Spawning apps in specific groups in Qtile

Hello,

Here is the code I use to assign apps to groups:


@hook.subscribe.client_new
def assign_app_group(client):
     d = {}
#     #########################################################
#     ################ assgin apps to groups ##################
#     #########################################################
     d["1"] = ["FireDragon", "firedragon" ]
     d["2"] = ["FreeTube" , "VLC", "freetube", "vlc", "Zoom", "zoom" ]
#     d["3"] = ["Inkscape", "Nomacs", "Ristretto", "Nitrogen", "Feh",
#               "inkscape", "nomacs", "ristretto", "nitrogen", "feh", ]
#     d["4"] = ["Gimp", "gimp" ]
#     d["5"] = ["Meld", "meld", "org.gnome.meld" "org.gnome.Meld" ]
     d["6"] = ["Brave-Browser", "brave-browser", "LibreWolf-Community", "librewolf-community" ]
     d["7"] = ["Thunderbird", "Tutanota-Desktop", "Unofficial-Desktop-Client-For-Protonmail", "thunderbird", "tutanota-desktop", "unoficial-desktop-client-for-protonmail" ]
#     d["8"] = ["pcmanfm", "Nemo", "Caja", "Nautilus", "org.gnome.Nautilus", "Pcmanfm", "Pcmanfm-qt",
#               "pcmanfm", "nemo", "caja", "nautilus", "org.gnome.nautilus", "pcmanfm", "pcmanfm-qt", ]
#     d["9"] = ["Evolution", "Geary", "Mail", "Thunderbird",
#               "evolution", "geary", "mail", "thunderbird" ]
#     d["0"] = ["Spotify", "Pragha", "Clementine", "Deadbeef", "Audacious",
#               "spotify", "pragha", "clementine", "deadbeef", "audacious" ]
#     ##########################################################
     wm_class = client.window.get_wm_class()[0]

     for i in range(len(d)):
         if wm_class in list(d.values())[i]:
             group = list(d.keys())[i]
             client.togroup(group)
             client.group.cmd_toscreen()

It does not work for all of the apps. On that list, it does not work for zoom, firedragon, librewolf and thinderbird . I think I am putting wrong names in there, but i can’t figure out the right ones. Please help.

Thank you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Continuing the discussion from Spawning apps in specific groups in Qtile:

This is a way long overdue answer (I hope this particularly useful to you @BeatlesFan unless you already found this before me :smiley: ) and I hope it helps not only Qtile users, but any other WM users if you are getting things via WM_CLASS.
Disclaimer: I have no idea if this works on Wayland since it uses xprop. Considering this is the Qtile category though, we are X users for now :slight_smile:

As you’ve experienced, sometimes putting the name of an application straight into the group doesn’t work. You need to use the other WM_CLASS string used by the window (if that terminology is correct, lol)

To get this, use:

xprop | grep WM_CLASS

And click on the window you’re trying to get the string of. For example:

xprop | grep WM_CLASS
WM_CLASS(STRING) = "Navigator", "LibreWolf"

xprop | grep WM_CLASS
WM_CLASS(STRING) = "Mail", "thunderbird"

This command is also useful for getting the full name of tabs in your browser :wink:
Now, if you put “Navigator” or “Mail” into the assign_app_group function of your Qtile config, your Librewolf and Thunderbird will spawn in their assigned groups! :partying_face:

Consider this post an early Christmas gift if it helped you :'D


garuda-inxi:

System:
  Kernel: 6.6.2-lqx1-1-lqx arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: hpet,acpi_pm parameters: audit=0
    intel_pstate=disable rcupdate.rcu_expedited=1
    BOOT_IMAGE=/@/boot/vmlinuz-linux-lqx
    root=UUID=e34775a9-3a44-4cad-b4a1-7a4688cda7b4 rw rootflags=subvol=@
    splash rd.udev.log_priority=3 vt.global_cursor_default=0
    resume=UUID=fca2f0b8-fe12-4de7-b5ff-de54fd42afbb loglevel=3
    nvidia_drm.modeset=1 console=tty0 console=ttyS0,115200n8
    cryptomgr.notests initcall_debug intel_iommu=igfx_off kvm-intel.nested=1
    no_timer_check noreplace-smp page_alloc.shuffle=1
    rcupdate.rcu_expedited=1 rootfstype=ext4,btrfs,xfs,f2fs tsc=reliable rw
    ibt=off
  Desktop: Qtile v: 0.23.0 wm: LG3D vt: 2 dm: SDDM Distro: Garuda Linux
    base: Arch Linux
Machine:
  Type: Laptop System: Dell product: XPS 15 9560 v: N/A
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Dell model: 05FFDN v: A00 serial: <superuser required> UEFI: Dell
    v: 1.24.0 date: 08/10/2021
Battery:
  ID-1: BAT0 charge: 62.5 Wh (75.5%) condition: 82.8/97.0 Wh (85.4%)
    volts: 11.7 min: 11.4 model: LGC-LGC8.33 DELL 5XJ28 type: Li-ion
    serial: <filter> status: not charging
CPU:
  Info: model: Intel Core i7-7700HQ bits: 64 type: MT MCP arch: Kaby Lake
    gen: core 7 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 9 microcode: 0xF4
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache:
    L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB
    L3: 6 MiB desc: 1x6 MiB
  Speed (MHz): avg: 2790 high: 2801 min/max: 800/2801 boost: enabled
    scaling: driver: acpi-cpufreq governor: performance cores: 1: 2716 2: 2800
    3: 2800 4: 2800 5: 2801 6: 2801 7: 2801 8: 2801 bogomips: 44798
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel HD Graphics 630 vendor: Dell driver: i915 v: kernel
    arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1
    empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:591b
    class-ID: 0300
  Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] vendor: Dell
    driver: nvidia v: 545.29.06 alternate: nouveau,nvidia_drm non-free: 545.xx+
    status: current (as of 2023-10; EOL~2026-12-xx) arch: Pascal code: GP10x
    process: TSMC 16nm built: 2016-2021 pcie: gen: 1 speed: 2.5 GT/s lanes: 16
    link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0 chip-ID: 10de:1c8d
    class-ID: 0302
  Device-3: Sunplus Innovation Integrated_Webcam_HD driver: uvcvideo
    type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-12:7
    chip-ID: 1bcf:2b95 class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.9 with: Xwayland v: 23.2.2
    compositor: Picom v: git-c4107 driver: X: loaded: modesetting,nvidia
    unloaded: nouveau alternate: fbdev,intel,nv,vesa dri: iris gpu: i915
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3840x2160 s-dpi: 185 s-size: 527x296mm (20.75x11.65")
    s-diag: 604mm (23.8")
  Monitor-1: eDP-1 model: Sharp 0x1476 built: 2016 res: 3840x2160 hz: 60
    dpi: 282 gamma: 1.2 size: 346x194mm (13.62x7.64") diag: 397mm (15.6")
    ratio: 16:9 modes: 3840x2160
  API: EGL v: 1.5 hw: drv: intel iris drv: nvidia platforms: device: 0
    drv: nvidia device: 1 drv: iris device: 3 drv: swrast gbm: drv: nvidia
    surfaceless: drv: nvidia x11: drv: iris inactive: wayland,device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: intel mesa v: 23.2.1-arch1.2
    glx-v: 1.4 direct-render: yes renderer: Mesa Intel HD Graphics 630 (KBL GT2)
    device-ID: 8086:591b memory: 15.12 GiB unified: yes
  API: Vulkan v: 1.3.269 layers: 11 device: 0 type: integrated-gpu
    name: Intel HD Graphics 630 (KBL GT2) driver: mesa intel v: 23.2.1-arch1.2
    device-ID: 8086:591b surfaces: xcb,xlib device: 1 type: discrete-gpu
    name: NVIDIA GeForce GTX 1050 driver: nvidia v: 545.29.06
    device-ID: 10de:1c8d surfaces: xcb,xlib device: 2 type: cpu name: llvmpipe
    (LLVM 16.0.6 256 bits) driver: mesa llvmpipe v: 23.2.1-arch1.2 (LLVM
    16.0.6) device-ID: 10005:0000 surfaces: xcb,xlib
Audio:
  Device-1: Intel CM238 HD Audio vendor: Dell driver: snd_hda_intel v: kernel
    alternate: snd_soc_avs bus-ID: 00:1f.3 chip-ID: 8086:a171 class-ID: 0403
  API: ALSA v: k6.6.2-lqx1-1-lqx status: kernel-api
    tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter
    vendor: Rivet Networks Killer Wireless-n/a/ac 1535 driver: ath10k_pci
    v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 02:00.0
    chip-ID: 168c:003e class-ID: 0280 temp: 38.0 C
  IF: wlp2s0 state: up mac: <filter>
Bluetooth:
  Device-1: Qualcomm Atheros QCA61x4 Bluetooth 4.0 driver: btusb v: 0.8
    type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-4:4
    chip-ID: 0cf3:e300 class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: down bt-service: disabled
    rfk-block: hardware: no software: no address: N/A
Drives:
  Local Storage: total: 476.94 GiB used: 683.63 GiB (143.3%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Toshiba
    model: KXG50ZNV512G NVMe 512GB size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: AADA4106 temp: 30.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 459.62 GiB size: 459.62 GiB (100.00%)
    used: 235.02 GiB (51.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 588 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 459.62 GiB size: 459.62 GiB (100.00%)
    used: 235.02 GiB (51.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 459.62 GiB size: 459.62 GiB (100.00%)
    used: 235.02 GiB (51.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-5: /var/tmp raw-size: 459.62 GiB size: 459.62 GiB (100.00%)
    used: 235.02 GiB (51.1%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 15.48 GiB used: 0 KiB (0.0%) priority: 100
    comp: zstd avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 8 dev: /dev/zram0
  ID-2: swap-2 type: partition size: 17.02 GiB used: 0 KiB (0.0%)
    priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
  System Temperatures: cpu: 46.0 C pch: 46.5 C mobo: 41.0 C
  Fan Speeds (rpm): cpu: 2469 fan-2: 2495
Info:
  Processes: 344 Uptime: 34m wakeups: 0 Memory: total: N/A
  available: 15.48 GiB used: 6.31 GiB (40.7%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: pm: pacman pkgs: 1797 libs: 499 tools: paru Shell: fish v: 3.6.1
  default: Bash v: 5.2.21 running-in: alacritty inxi: 3.3.31
Garuda (2.6.19-2):
  System install date:     2023-03-19
  Last full system update: 2023-12-07
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut nvidia-dkms
  Windows dual boot:       Probably (Run as root to verify)
  Failed units:            systemd-vconsole-setup.service
2 Likes

This topic was automatically closed after 10 days. New replies are no longer allowed.