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?

  • 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

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


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

  • 1
    That used to work for me, but now doesn't (still on v1.07). However, -b add,sticky does work – David Fraser Jul 28 '15 at 9:38
  • add,sticky doesn't work on kde plasma on kubuntu. But -t -2 did the trick, thanks – Syco Nov 13 '19 at 9:38

xdotool search --name xyz set_desktop_for_window 4294967295

  • 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 2 '19 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.