diff options
-rw-r--r-- | xmonad.hs | 53 |
1 files changed, 25 insertions, 28 deletions
@@ -4,6 +4,7 @@ import qualified Data.Map as M import Data.List (stripPrefix) import Data.Maybe (fromMaybe) import System.Environment (lookupEnv) +import Control.Monad (void) import XMonad hiding ( (|||) ) import XMonad.Actions.FloatKeys (keysMoveWindow, keysResizeWindow) @@ -100,9 +101,6 @@ runOrRaiseEmacs = do emacs <- liftIO $ lookupEnv "emacs" runOrRaise (case emacs of Just e -> e; _ -> "eterm") isEmacs -openMusicWindow = "tidal" -isMusic = className =? "Tidal" - runOrRaiseFirefox = runOrRaise "firefox" $ className =? "Firefox" toggleEmacs other = do @@ -133,21 +131,19 @@ keyDefs conf = , ("M-<Left>", move (-10,0)) , ("M-<Up>", move (0,-10)) , ("M-<Down>", move (0,10)) - , ("M-0", emacsAfio "scratch") - , ("M-1", emacsAfio "main") - , ("M-2", emacsAfio "mail") - , ("M-3", emacsAfio "www") - , ("M-4", emacsAfio "docs") + , ("M-0", toWS "NSP") + , ("M-1", toWS "e") + , ("M-2", toWS "f") + , ("M-3", toWS "d") , ("M-5", CWS.nextWS) , ("C-M-5", CWS.shiftToNext) , ("M-C-<Right>", resize (10,0) (0,0)) , ("M-C-<Left>", resize (-10,0) (0,1)) , ("M-C-<Up>", resize (0,-10) (0,0)) , ("M-C-<Down>", resize (0,10) (0,0)) - , ("M-a", scratch "aptitude") - , ("M-b", sendMessage $ MD.ToggleStruts) - , ("M-S-d", scratch "tidal") - , ("M-d", toggleEmacs $ windows (W.greedyView "d")) + , ("M-a", scratch "spt") + , ("M-b", sendMessage MD.ToggleStruts) + , ("M-d", toggleEmacs $ toWS "d") , ("M-e", toggleEmacs runOrRaiseFirefox) , ("M-C-e", spawn "emacsclient -c") , ("M-S-e", spawn (jaoscript "eterm")) @@ -158,10 +154,13 @@ keyDefs conf = , ("M-S-r", runCmd) , ("M-s", raiseEmacs >> emacsclient "jao-transient-streaming") , ("M-S-s", withFocused $ windows . W.sink) - , ("M-S-t", emacsAfio "main" >> emacsclient "vterm") , ("M-t", spawn "kitty") , ("M-w", raiseEmacs >> emacsclient "jao-transient-utils") , ("M-x 1", emacsAfio "main") + , ("M-x 2", emacsAfio "mail") + , ("M-x 3", emacsAfio "www") + , ("M-x 4", emacsAfio "docs") + , ("M-x 1", emacsAfio "main") , ("M-x k", kill) , ("M-x M-f", withFocused float) , ("M-x s", withFocused $ windows . W.sink) @@ -184,10 +183,11 @@ keyDefs conf = , ("M-z h", zzCmd "hibernate") , ("M-z b", zzCmd "hybrid") , ("M-z l", i3lock) - ] where jumpToL x = sendMessage (LJ.JumpToLayout x) >> return () + ] where jumpToL x = void (sendMessage (LJ.JumpToLayout x)) withEmacs x = jumpToL "F" >> raiseEmacs >> emacsclient x emacsAfio f = withEmacs $ "jao-afio-goto-" ++ f -- sendCtrlC = sendKey controlMask xK_c + toWS = windows . W.greedyView jumpToLE x = emacsAfio "scratch-1" >> jumpToL x backlight x = spawn $ "brightnessctl -q s " ++ x i3lock = spawn "i3lock -e -i ~/.lockimage" @@ -211,26 +211,23 @@ layouts = PW.onWorkspace "d" lytTall lytFullTall lytFullTall = lytFull ||| lytTall scratchpads = - [ NS.NS "music" openMusicWindow isMusic cf - , NS.NS "tidal" "tidal-hifi" (className =? "tidal-hifi") cf - , NS.NS "popup" "firefox --class=Popup -P popup" (className =? "Popup") cf - , NS.NS "aptitude" "kitty -e aptitude" (title =? "aptitude") cf + [ NS.NS "spotify" "spotify" (className =? "spotify") cf + , NS.NS "spt" "kitty --title spt -e spt" (title =? "spt") cf ] where cf = centerFloat (3/4) (7/8) -scratchpad = NS.namedScratchpadManageHook scratchpads centerFloat width height = NS.customFloating $ W.RationalRect marginLeft marginTop width height where marginLeft = (1 - width) / 2 marginTop = (1 - height) / 2 -mHook = MH.composeOne dlgs <+> composeAll (emf:cl) +mHook = composeAll cls <+> MH.composeOne [dlg] <+> scr where - dlgs = [MH.isDialog -?> MH.doCenterFloat] - cfs = ["Display", "feh", "Gitk", "MPlayer", "Vlc", "mpv", "Mpv", "xli", + dlg = MH.isDialog -?> MH.doCenterFloat + cfs = ["Display", "feh", "MPlayer", "Vlc", "mpv", "Mpv", "xli", "Blueman-services", "Blueman-manager", - "Pavucontrol", "Pavumeter", "Xmessage", "XLogo"] - cl = [className =? x --> MH.doCenterFloat | x <- cfs] - emf = title =? "emacs popup" --> MH.doCenterFloat + "Pavucontrol", "Pavumeter", "Xmessage"] + cls = [className =? x --> MH.doCenterFloat | x <- cfs] + scr = NS.namedScratchpadManageHook scratchpads simplePP = SBP.def { SBP.ppLayout = const "" , SBP.ppHidden = const "" @@ -255,7 +252,7 @@ main = do sb = SB.withSB $ SB.statusBarProp "xmobar" (pure simplePP) uhook = U.withUrgencyHook U.NoUrgencyHook xmonad . uhook . sb . MD.docks . Ewm.ewmh $ def { - manageHook = scratchpad <+> mHook <+> manageHook def + manageHook = mHook , handleEventHook = ehook , layoutHook = MD.avoidStruts lyt , startupHook = localStartupHook @@ -266,5 +263,5 @@ main = do , terminal = "kitty" , workspaces = defWorkspaces , focusFollowsMouse = False - } `EZ.removeKeysP` ["M-j", "M-n", "M-w", "M-m", "M-r", "M-p", "M-<Space>"] - `EZ.additionalKeysP` (keyDefs popCfg) + } `EZ.removeKeysP` ["M-j", "M-n", "M-w", "M-m", "M-r", "M-p", "M-l", "M-<Space>"] + `EZ.additionalKeysP` keyDefs popCfg |