Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Search for windows that are unmapped or visible on all desktops #448

Open
tauchris opened this issue Jan 17, 2024 · 1 comment

Comments

@tauchris
Copy link

tauchris commented Jan 17, 2024

As I understand it, xdotool search supports filtering of matching windows do a specific desktop... or not filtering by that criteria at all. Not all windows are associated with a specific desktop, however. So, unless I've misunderstood, there is no way to search for unmapped windows or sticky windows (windows that have been set to show on all desktops). The only way to accomplish this is to search for all windows, and manually filter out those windows that are associated with a desktop.

Consider this example:

  BASHCMD> for dtn in $(seq 0 $(./xdotool get_num_desktops)); do \
          for wid in $(./xdotool search --desktop $dtn --class .); do \
              echo "Desktop $dtn; Window $wid; Title: \"$(./xdotool getwindowname $wid)\""; \
          done; \
      done
  Desktop 0; Window 54564258; Title: "Mate Terminal"
  Desktop 2; Window 85983503; Title: "*Unsaved Document 1 - Pluma"
  Desktop 2; Window 83886091; Title: "xeyes"
  Desktop 2; Window 88080395; Title: "xeyes"
  Desktop 2; Window 54688366; Title: "Mate Terminal"
  Desktop 3; Window 58720290; Title: "FIREFOX_WRAP"
  Desktop 3; Window 54526088; Title: "Sync - Mate Terminal"
  Desktop 3; Window 54624156; Title: "Mate Terminal"
  Desktop 3; Window 62914603; Title: "TRS — Mozilla Firefox"
  Desktop 4; Window 54650013; Title: "[ XX71181 ] - Mate Terminal"
  Desktop 4; Window 62916272; Title: "XX71181 — Mozilla Firefox"
  Desktop 5; Window 54650039; Title: "[ XX71356 ] - Mate Terminal"
  Desktop 5; Window 62916286; Title: "XX71356 — Mozilla Firefox"
  Desktop 6; Window 54650065; Title: "[ TRS-1418 + ] - Mate Terminal"
  Desktop 6; Window 62916309; Title: "XX63215 — Mozilla Firefox"
  Desktop 7; Window 54650093; Title: "[ XX71393 ] - Mate Terminal"
  Desktop 7; Window 62916332; Title: "XX71393 — Mozilla Firefox"
  Desktop 8; Window 54650121; Title: "[ XX72420 ] - Mate Terminal"
  Desktop 8; Window 62916355; Title: "XX72420 — Mozilla Firefox"
  Desktop 9; Window 54650149; Title: "[ XX68009 ] - Mate Terminal"
  Desktop 9; Window 62916378; Title: "XX68009 — Mozilla Firefox"
  Desktop 10; Window 65011746; Title: "/repo/eh/TR72420/baseline"
  Desktop 10; Window 79691810; Title: "/repo/eh/TR72420/nobuild"
  Desktop 10; Window 56623138; Title: "/repo/eh/TR72420/bisect"
  Desktop 10; Window 54626973; Title: "Mate Terminal"
  Desktop 11; Window 73400335; Title: "Desktop User Guide"
  Desktop 11; Window 62916418; Title: "XX72738 — Mozilla Firefox"
  Desktop 11; Window 54684103; Title: "[ XX72738 ] - Mate Terminal"
  Desktop 12; Window 54684617; Title: "[ XX73162 ] - Mate Terminal"
  Desktop 12; Window 62916456; Title: "XX73162 — Mozilla Firefox"

I have one "unmapped" window and one "sticky" window, not shown above. The only way to find those with xdotool is to search for everything, like so:

  BASHCMD> for wid in $(./xdotool search --class .); do \
          echo "Desktop $(./xdotool get_desktop_for_window $wid); Window $wid; Title: \"$(./xdotool getwindowname $wid)\""; \
  done;
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 18874369; Title: "mate-session"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 23068673; Title: "mate-settings-daemon"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 25165825; Title: "marco"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 27262977; Title: "Panel"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 25165839; Title: "marco"
  ...
  Desktop 3; Window 54624156; Title: "Mate Terminal"
  Desktop 3; Window 62914603; Title: "TRS — Mozilla Firefox"
  Desktop 11; Window 73400335; Title: "Desktop User Guide"
  Desktop 11; Window 62916418; Title: "XX72738 — Mozilla Firefox"
  Desktop 0; Window 54564258; Title: "Mate Terminal"
  Desktop 2; Window 85983503; Title: "*Unsaved Document 1 - Pluma"
  Desktop 11; Window 54684103; Title: "[ XX72738 ] - Mate Terminal"
  Desktop 2; Window 83886091; Title: "xeyes"
  Desktop 2; Window 88080395; Title: "xeyes"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 92274698; Title: "xclock"
  Desktop 2; Window 54688366; Title: "Mate Terminal"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 31457283; Title: "wnck-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 31457310; Title: "wnck-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 31457313; Title: "wnck-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 31457316; Title: "wnck-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 31457319; Title: "wnck-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 52428803; Title: "clock-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 50331651; Title: "notification-area-applet"
  XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
  Desktop -1; Window 33554504; Title: "Sound Output Volume"

Note that in the foregoing, there are a ton of windows that are not on any particular desktop-- most of which belong to the window manager. Also note that in each of these cases, there's an error that gets generated, before I'm able to print the desktop value as "-1". Note also that I cannot do xdotool search --desktop -1 --class . -- as that does not work. So I'm stuck with a mass of output I don't want or need, and lots of manual work to do, and lots of error messages to get at the information I want.

It would be nice if xdotool search supported a variant of the --desktop option that would pick unmapped/sticky windows, and it would also be super-helpful if there was a way to filter out windows owned by the window manager (windows with _NET_WM_STATE that includes _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER)... Not sure how you'd want to present that in the interface, but it shouldn't be super-hard.

@phil294
Copy link
Contributor

phil294 commented Feb 11, 2024

I think you are right with everything you wrote here. And adding some kind of --desktop none option would make sense.

I investigated and wrote about this in a similar issue here: #67 (comment) from a different perspective for perhaps also addding some kind of --desktop some option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants