9

I'd like to be able to move (pin) an existing window to all desktops using a scriptable command, rather than through the window menu.

wmctrl -r <WIN> -t <DESK> will move a window to a different desktop, but I haven't found a way to use this to cause the window to be displayed on all desktops. wmctrl -l shows -1 as the desktop number for windows which are displayed on all desktops, but passing -1 to -t doesn't work.

An unresolved fedora bug report seems to address this issue: apparently the -1 value is used internally by wmctrl, and for this reason cannot be passed to -t. The bug report also mentions window can be pinned with some window managers by giving the target window the sticky property. However, I'm running openbox and this approach does not seem to work for me. There is actually a patch posted to that bug report; I haven't tried using it. It is from 2009. I'd prefer to avoid patching wmctrl or anything else.

Is there another way to script this behaviour that will work under openbox?

intuited
  • 3,488
  • 3
  • 25
  • 36
  • Also does not work with Metacity 2.22.0. It seems to me that the wmctrl development is stalled. The last entry in the Changelog is from 2005. The problem is obvious. The program needs a new maintainer. If you like the program and if the program needs to be patched, do it. That is the way open source works. – ceving May 13 '11 at 15:04

5 Answers5

4

Like a user said in the comments, wmctrl hasn't been touched since October 2005. Its very possible that the featured worked at the time, and has since been made broken due to packages changing around it.

Here's the wmctrl changelog

n0pe
  • 9,411
  • 13
  • 60
  • 108
3

xdotool search --name xyz set_desktop_for_window 4294967295

Alastair Irvine
  • 232
  • 1
  • 12
  • 4294967295 is -1 as an unsigned 32-bit integer. -1 can't be used because in `xdotool set_desktop_for_window -1` it's interpreted as an option, even though it follows a command and is the value returned by `xdotool get_desktop_for_window`. – Alastair Irvine Dec 02 '19 at 04:07
  • On Kubuntu 22.04, `xdotool set_desktop_for_window -1` worked for me. – piit79 Apr 14 '22 at 10:18
1

As of wmctrl v1.07, -t -2 works for me.

Michael Mrozek
  • 91,316
  • 38
  • 238
  • 232
Tim Green
  • 61
  • 7
1

on Cinnamon, you can use -b add,sticky my sample to have Signal on all mys desks:

wmctrl -i -r $(wmctrl -l | grep -ie 'Signal' | sed -e 's/ .*//') -e 0,1280,354,1280,686 -b add,sticky
chaos
  • 47,463
  • 11
  • 118
  • 144
Eric Mols
  • 11
  • 1
0

FWIW, neither wmctrl ... -t ... nor wmctrl ... -b sticky ... nor xdotool search --name ... set_desktop_for_window 4294967295 work with LXDE and Openbox (on my installation – Devuan Beowulf).
Nevertheless, using devilspie or setting proper attributes in rc.xml of Openbox work like a charm. (Remark: I mean really devilspie, not devilspie2. Per my experience, devilspie2 sometimes behaves buggy while devilspie do not.)

robertn
  • 1
  • 1