xmonad: swap the RiseupVPN scratchpad for Windscribe
Windscribe moves itself to a saved position after mapping, so an event hook drops its move requests (resizes still apply) to keep it at the scratchpad's spot.
This commit is contained in:
1 file changed
+20
-2
@@ -1,6 +1,7 @@
|
|||||||
-- Import
|
-- Import
|
||||||
|
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
import Data.Bits (complement, (.&.))
|
||||||
import Data.Char (toLower)
|
import Data.Char (toLower)
|
||||||
import Control.Monad (forM_, join, liftM2, when)
|
import Control.Monad (forM_, join, liftM2, when)
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
@@ -94,7 +95,7 @@ myScreenHotplug = myScreenLayout ++ " --keep-wallpaper"
|
|||||||
|
|
||||||
myScratchpads :: [NamedScratchpad]
|
myScratchpads :: [NamedScratchpad]
|
||||||
myScratchpads =
|
myScratchpads =
|
||||||
[ NS "Riseup-vpn" "riseup-vpn" (className =? "RiseupVPN") (customFloating $ W.RationalRect 0.15 0.4 0.15 0.4),
|
[ NS "Windscribe" "windscribe" (className =? "Windscribe2") (customFloating $ W.RationalRect 0.15 0.4 0.15 0.4),
|
||||||
NS "Terminal" spawnTerminal (className =? "scratch-terminal") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6),
|
NS "Terminal" spawnTerminal (className =? "scratch-terminal") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6),
|
||||||
NS "Music" spawnMusic (className =? "scratch-music") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6),
|
NS "Music" spawnMusic (className =? "scratch-music") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6),
|
||||||
NS "Mail" spawnMail (className =? "scratch-mail") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6),
|
NS "Mail" spawnMail (className =? "scratch-mail") (customFloating $ W.RationalRect 0.2 0.2 0.6 0.6),
|
||||||
@@ -152,7 +153,7 @@ myCustomKeys c =
|
|||||||
[ ("M-S-s", addName "Terminal" $ namedScratchpadAction myScratchpads "Terminal"),
|
[ ("M-S-s", addName "Terminal" $ namedScratchpadAction myScratchpads "Terminal"),
|
||||||
("M-S-a", addName "Calendar (calcurse)" $ namedScratchpadAction myScratchpads "Cal"),
|
("M-S-a", addName "Calendar (calcurse)" $ namedScratchpadAction myScratchpads "Cal"),
|
||||||
("M-o", addName "btop" $ namedScratchpadAction myScratchpads "Btop"),
|
("M-o", addName "btop" $ namedScratchpadAction myScratchpads "Btop"),
|
||||||
("M-S-v", addName "RiseupVPN" $ namedScratchpadAction myScratchpads "Riseup-vpn"),
|
("M-S-v", addName "Windscribe VPN" $ namedScratchpadAction myScratchpads "Windscribe"),
|
||||||
("<XF86Mail>", addName "Mail (mutt)" $ namedScratchpadAction myScratchpads "Mail"),
|
("<XF86Mail>", addName "Mail (mutt)" $ namedScratchpadAction myScratchpads "Mail"),
|
||||||
("<XF86Tools>", addName "Music (ncmpcpp)" $ namedScratchpadAction myScratchpads "Music")
|
("<XF86Tools>", addName "Music (ncmpcpp)" $ namedScratchpadAction myScratchpads "Music")
|
||||||
]
|
]
|
||||||
@@ -450,6 +451,23 @@ myHandleEventHook =
|
|||||||
<> Hacks.trayerAboveXmobarEventHook
|
<> Hacks.trayerAboveXmobarEventHook
|
||||||
<> Hacks.trayerPaddingXmobarEventHook
|
<> Hacks.trayerPaddingXmobarEventHook
|
||||||
<> Hacks.fixSteamFlicker
|
<> Hacks.fixSteamFlicker
|
||||||
|
<> pinWindscribe
|
||||||
|
|
||||||
|
-- Windscribe moves itself to a saved position after mapping: apply its resizes (as core does for floats) but drop moves.
|
||||||
|
pinWindscribe :: Event -> X All
|
||||||
|
pinWindscribe e@ConfigureRequestEvent {ev_window = w} = do
|
||||||
|
floats <- gets (W.floating . windowset)
|
||||||
|
pinned <- if M.member w floats then runQuery (className =? "Windscribe2") w else pure False
|
||||||
|
when pinned $ withDisplay $ \dpy -> do
|
||||||
|
bw <- asks (borderWidth . config)
|
||||||
|
io $ configureWindow dpy w (ev_value_mask e .&. complement (fromIntegral (cWX .|. cWY))) $
|
||||||
|
WindowChanges
|
||||||
|
{ wc_x = 0, wc_y = 0, wc_width = ev_width e, wc_height = ev_height e,
|
||||||
|
wc_border_width = fromIntegral bw, wc_sibling = ev_above e, wc_stack_mode = ev_detail e }
|
||||||
|
float w
|
||||||
|
io $ sync dpy False
|
||||||
|
pure (All (not pinned))
|
||||||
|
pinWindscribe _ = pure (All True)
|
||||||
|
|
||||||
-- Log hook
|
-- Log hook
|
||||||
myLogHook :: X ()
|
myLogHook :: X ()
|
||||||
|
|||||||
Reference in new issue
Block a user