X.U.ClickableWorkspaces: Use xdotool instead of the unmaintained wmctrl

The last release of wmctrl was in 2005 and it doesn't correctly set
source indication in _NET_ACTIVE_WINDOW client messages
(https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#sourceindication),
which is obviously completely irrelevant here, but if one decides to
implement clickableWrap for switching windows as well (like I did), it's
nice to use the same tool for it.

It's also nice to use a tool that compiles and runs on 64-bit
architectures without having to patch it (taken care of by distros,
though). :-)
This commit is contained in:
Tomas Janousek
2021-02-03 00:35:06 +00:00
parent 4eec511eb8
commit 5990456cc9

View File

@@ -28,19 +28,19 @@ import XMonad.Hooks.DynamicLog (xmobarAction, xmobarRaw, PP(..))
-- $usage
-- However you have set up your PP, apply @clickablePP@ to it, and bind the result
-- to "XMonad.Hooks.DynamicLog"\'s dynamicLogWithPP like so:
--
--
-- > logHook = clickablePP xmobarPP { ... } >>= dynamicLogWithPP
--
-- * Requirements:
-- * wmctrl on system (in path)
-- * "XMonad.Hooks.EwmhDesktops" for wmctrl support (see Hackage docs for setup)
-- * use of UnsafeStdinReader in xmobarrc (rather than StdinReader)
-- * @xdotool@ on system (in path)
-- * "XMonad.Hooks.EwmhDesktops" for @xdotool@ support (see Hackage docs for setup)
-- * use of UnsafeStdinReader/UnsafeXMonadLog in xmobarrc (rather than StdinReader/XMonadLog)
clickableWrap :: Int -> String -> String
clickableWrap i ws = xmobarAction ("wmctrl -s " ++ show i) "1" $ xmobarRaw ws
clickableWrap i ws = xmobarAction ("xdotool set_desktop " ++ show i) "1" $ xmobarRaw ws
-- Use index of workspace in users config to target workspace with wmctrl switch.
-- | Use index of workspace in users config to target workspace with @xdotool@ switch.
getClickable :: X (WorkspaceId -> String)
getClickable = do
wsIndex <- getWsIndex