window_maker_rofi_window_switcher ================================= A rofi window switcher that actually shows minimized windows under Window Maker. What this is ------------ `rofi -show window` is a lovely Alt-Tab replacement -- until you run it under Window Maker, where it silently omits every minimized (iconified) window. The windows you most want to dig back up are exactly the ones it hides. `rofi-windows` is a small bash script that replaces rofi's native window mode. It drives the list from wmctrl instead of rofi's own EWMH walk, so minimized windows show up like everything else. It also cleans up the cosmetics rofi's mode gave you for free: icons, sane ordering, and tidy labels. Why rofi's own mode fails here ------------------------------ Two things, found by poking at the live X server: 1. Window Maker never sets _NET_WM_NAME on its _NET_SUPPORTING_WM_CHECK window, so rofi prints "No window manager detected" and drops into a degraded code path. 2. WMaker flags iconified windows _NET_WM_STATE_HIDDEN + _NET_WM_STATE_SKIP_PAGER, and rofi's window mode treats them as not-listable. The good news: those windows DO stay in _NET_CLIENT_LIST and do NOT carry _NET_WM_STATE_SKIP_TASKBAR -- so wmctrl and xdotool see them perfectly. This script just leans on those two tools instead. (You can paper over problem 1 by stamping the name yourself: chk=$(xprop -root _NET_SUPPORTING_WM_CHECK | grep -o '0x[0-9a-f]*') xprop -id "$chk" -f _NET_WM_NAME 8u -set _NET_WM_NAME "Window Maker" run from your WMaker autostart. In testing that alone didn't make rofi's native mode list minimized windows reliably, which is why this script exists.) What it does better than `wmctrl -l | rofi -dmenu` -------------------------------------------------- - clean labels: no hex window id, desktop number, or hostname - filters out WMaker's internal / dockapp windows (empty titles) - per-app icons pulled from WM_CLASS - most-recently-used order (reverse stacking); the currently focused window is excluded, so pressing Enter on the default row jumps to your previous window, just like Alt-Tab - off-desktop windows are tagged [->N] (other workspace) or [all] (sticky) so you know the pick will move you - selection is mapped by list index, so duplicate titles (hello, twelve Firefox windows) are never ambiguous - reliable de-iconify via `xdotool windowmap` + `windowactivate`, with a `wmctrl` fallback Requirements ------------ rofi wmctrl xdotool xprop Optional: an icon theme with app icons (Papirus is assumed by the icon map, but any theme works -- missing icons just render blank), and notify-send for the "no other windows" message. On Debian/Ubuntu: sudo apt install rofi wmctrl xdotool x11-utils Setup ----- Drop the script somewhere on your PATH and make it executable: install -Dm755 rofi-windows ~/.local/bin/rofi-windows Then bind a key to it. In Window Maker, edit ~/GNUstep/Defaults/WMRootMenu and add (or repoint your existing "Rofi Window" entry): ("Windows", SHORTCUT, "Mod4+Tab", EXEC, "/home/YOU/.local/bin/rofi-windows"), WMaker's EXEC runs under /bin/sh and won't expand ~, so use an absolute path. Restart Window Maker to reload the menu. Not on Window Maker? Any launcher works. With xbindkeys, in ~/.xbindkeysrc: "~/.local/bin/rofi-windows" Mod4 + Tab Using it -------- Hit your key. Type to filter -- matching runs over the window title AND the WM_CLASS, so "firefox" or "thunar" narrows things even when titles collide. Enter raises the selected window (un-minimizing and switching workspace as needed). Escape does nothing. Customizing ----------- Icon names come from WM_CLASS via the `icon_for` function near the top. If an app's icon doesn't resolve, add a case for it there -- left side is the lowercased class (the part after the dot in `xprop WM_CLASS`), right side is an icon name in your theme. Icon size is set with the `-theme-str 'element-icon { size: 1.4em; }'` line at the bottom; bump it to taste. To list every window including the focused one, remove the `(( dec == active_dec )) && continue` line. How it works ------------ - `wmctrl -l -x` enumerates every window with its WM_CLASS - the row order follows _NET_CLIENT_LIST_STACKING reversed (top of the stack = most recently raised = first in the list) - rows are fed to `rofi -dmenu` using its row protocol (NUL + 0x1f field separators) to attach icons and hidden search meta - `rofi -format i` returns the chosen row's index, which maps back to a window id with zero title-parsing ambiguity - `xdotool windowmap` un-iconifies, `windowactivate` raises and focuses (switching workspace if the window lives elsewhere) No warranty, do whatever you like with it.