0

I have a script, called at login, to move specific applications to their respective workspaces

I want to pin one application to all workspaces. According to the wmctrl man page,

Desktop numbers start at 0. Use -1 to pin to all desktops.

However the command

wmctrl -i -r 0x03800003 -t -1

has no effect. Using positive integers pins the applications correctly.

(I have have obtained the window ID using wmctrl -l)

What am I doing wrong?

Psionman
  • 97
  • 2
  • Try `-t -2` or `-t 4294967295`. Alternatively, try `xdotool search --name xyz set_desktop_for_window 4294967295` or `-1`. – harrymc Sep 19 '22 at 13:48

2 Answers2

0

Thanks, "wmctrl -i -r 0x03800003 -t -1" worked for me, with the appropriate Id.

In my case...

  1. start my desired window from the command line as a background process

feh -x -g 624x168-0+0 --scale-down UA-keyboard.png & 2. get the id using wmctrl wmctrl -l | awk '$4 ~ /feh/ {print $1}' 0x02600001 3. wrap it into a oneliner for wmctrl to change to all workspaces wmctrl -i -r $(wmctrl -l | awk '$4 ~ /feh/ {print $1}') -t -1

Kiat
  • 1
0
wmctrl -i -r <window-id> -t -2

worked for me (thanks to @harrymc), specifically with the Opera browser. This was part of a python script called at startup

import os
import subprocess
import time

time.sleep(30)

processes = {
    'Opera': -2,
    'Spotify': 1,
    'System Monitor': 3,
}
# Move processes to workspace
process_bytes = subprocess.check_output(['wmctrl', '-l'])
process_string = process_bytes.decode('utf-8')
window_data = process_string.split('\n')
for line in window_data:
    row = line.split(' ')
    window_id = row[0]
    description = ' '.join(row[4:])
    for process, workspace in processes.items():
        if process in description:
            # workspace is 0 based
            os.system(f'wmctrl -i -r {window_id} -t {workspace}')
            break
Psionman
  • 97
  • 2