diff options
author | Azat Bahawi <azat@bahawi.net> | 2022-08-16 01:46:04 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2022-08-16 01:46:04 +0300 |
commit | 3cd06b22069c009b8c5fea2d5fad5f996667d2e3 (patch) | |
tree | 4b5f1cb453de13c560bc8aa5a57952713cf360aa /src/lib/XMonad/Custom | |
parent | absolute garbage wtf (diff) |
huge update-o
Diffstat (limited to 'src/lib/XMonad/Custom')
-rw-r--r-- | src/lib/XMonad/Custom/Bindings.hs | 159 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Config.hs | 35 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Event.hs | 22 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Layout.hs | 54 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Log.hs | 78 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Manage.hs | 20 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Misc.hs | 21 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Navigation.hs | 4 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Projects.hs | 14 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Prompt.hs | 4 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Scratchpads.hs | 16 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Startup.hs | 52 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Theme.hs | 4 | ||||
-rw-r--r-- | src/lib/XMonad/Custom/Workspaces.hs | 15 |
14 files changed, 137 insertions, 361 deletions
diff --git a/src/lib/XMonad/Custom/Bindings.hs b/src/lib/XMonad/Custom/Bindings.hs index 208ccdf..e9498ca 100644 --- a/src/lib/XMonad/Custom/Bindings.hs +++ b/src/lib/XMonad/Custom/Bindings.hs @@ -1,28 +1,24 @@ -{-# LANGUAGE LambdaCase #-} +{-# OPTIONS_GHC -Wno-name-shadowing #-} -- | -- Module : XMonad.Custom.Bindings -- Description : Key bindings and keys configuration --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Bindings - ( keys - , rawKeys - , modMask - , mouseBindings + ( ngKeys + , ngModMask + , ngMouseBindings ) where import qualified Data.Map as M import System.Exit -import XMonad hiding ( keys - , modMask - , mouseBindings - ) +import XMonad import XMonad.Actions.CopyWindow import XMonad.Actions.CycleWS import XMonad.Actions.DynamicProjects @@ -35,16 +31,12 @@ import XMonad.Actions.Navigation2D import XMonad.Actions.Promote import XMonad.Actions.UpdatePointer import XMonad.Actions.WithAll -import XMonad.Custom.Layout import qualified XMonad.Custom.Misc as C import XMonad.Custom.Scratchpads import XMonad.Custom.Theme import XMonad.Hooks.UrgencyHook import XMonad.Layout.BinarySpacePartition import XMonad.Layout.Hidden -import XMonad.Layout.MultiToggle -import XMonad.Layout.MultiToggle.Instances -import XMonad.Layout.Reflect import XMonad.Layout.ResizableTile import XMonad.Layout.SubLayouts import XMonad.Prompt.ConfirmPrompt @@ -54,18 +46,30 @@ import XMonad.Prompt.Workspace import qualified XMonad.StackSet as S import XMonad.Util.EZConfig import XMonad.Util.NamedScratchpad -import XMonad.Util.WorkspaceCompare -modMask :: KeyMask -modMask = mod4Mask +ngModMask :: KeyMask +ngModMask = mod4Mask -directions :: [Direction2D] -directions = [D, U, L, R] +ngKeys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ()) +ngKeys c = mkKeymap c (rawKeys c) -arrowKeys, directionKeys, wsKeys :: [String] -arrowKeys = ["<D>", "<U>", "<L>", "<R>"] -directionKeys = ["j", "k", "h", "l"] -wsKeys = map show [1 .. 9 :: Int] +ngMouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ()) +ngMouseBindings XConfig { XMonad.modMask = ngModMask } = M.fromList + [ ( (ngModMask, button1) + , \w -> + focus w + >> F.mouseWindow F.position w + >> ifClick (snapMagicMove (Just 50) (Just 50) w) + >> windows S.shiftMaster + ) + , ( (ngModMask, button3) + , \w -> + focus w + >> F.mouseWindow F.linear w + >> ifClick (snapMagicResize [L, R, U, D] (Just 50) (Just 50) w) + >> windows S.shiftMaster + ) + ] zipKeys :: [a] -> [[a]] -> [t1] -> (t1 -> b) -> [([a], b)] zipKeys m ks as f = zipWith (\k d -> (m ++ k, f d)) ks as @@ -73,42 +77,6 @@ zipKeys m ks as f = zipWith (\k d -> (m ++ k, f d)) ks as zipKeys' :: [a] -> [[a]] -> [t1] -> (t1 -> t2 -> b) -> t2 -> [([a], b)] zipKeys' m ks as f b = zipWith (\k d -> (m ++ k, f d b)) ks as -tryMessageR_ :: (Message a, Message b) => a -> b -> X () -tryMessageR_ x y = sequence_ [tryMessageWithNoRefreshToCurrent x y, refresh] - -toggleCopyToAll :: X () -toggleCopyToAll = wsContainingCopies >>= \case - [] -> windows copyToAll - _ -> killAllOtherCopies - -getSortByIndexNonSP :: X ([WindowSpace] -> [WindowSpace]) -getSortByIndexNonSP = (. namedScratchpadFilterOutWorkspace) <$> getSortByIndex - -nextNonEmptyWS, prevNonEmptyWS :: X () -nextNonEmptyWS = findWorkspace getSortByIndexNonSP Next HiddenNonEmptyWS 1 - >>= \t -> windows . S.view $ t -prevNonEmptyWS = findWorkspace getSortByIndexNonSP Prev HiddenNonEmptyWS 1 - >>= \t -> windows . S.view $ t - -toggleFloat :: Window -> X () -toggleFloat w = windows - (\s -> if M.member w (S.floating s) - then S.sink w s - else S.float - w - (S.RationalRect (1 / 2 - 1 / 4) (1 / 2 - 1 / 4) (1 / 2) (1 / 2)) - s - ) - -withUpdatePointer :: [(String, X ())] -> [(String, X ())] -withUpdatePointer = map addAction - where - addAction :: (String, X ()) -> (String, X ()) - addAction (key, action) = (key, action >> updatePointer (0.98, 0.01) (0, 0)) - -keys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ()) -keys c = mkKeymap c (rawKeys c) - rawKeys :: XConfig Layout -> [(String, X ())] rawKeys c = withUpdatePointer $ concatMap ($ c) keymaps where @@ -122,32 +90,25 @@ rawKeys c = withUpdatePointer $ concatMap ($ c) keymaps , keysLayout , keysResize ] + withUpdatePointer :: [(String, X ())] -> [(String, X ())] + withUpdatePointer = map addAction + where + addAction :: (String, X ()) -> (String, X ()) + addAction (key, action) = + (key, action >> updatePointer (0.98, 0.01) (0, 0)) keysBase :: XConfig Layout -> [(String, X ())] keysBase _ = - [ ("M-S-q", confirmPrompt hotPromptTheme "Quit XMonad?" $ io exitSuccess) - , ("M-q" , spawn "xmonad --restart") - , -- TODO Replace with interal calls - ("M-C-q", spawn "xmonad --recompile && xmonad --restart") + [ ("M-S-q", confirmPrompt hotPromptTheme "Quit?" $ io exitSuccess) , ("M-x" , shellPrompt promptTheme) , ("M-w" , windowPrompt promptTheme Goto allWindows) , ("M-S-w", windowPrompt promptTheme Bring allWindows) ] keysSystem :: XConfig Layout -> [(String, X ())] -keysSystem _ = - [ ("M-C-g" , return ()) - , -- TODO Replace scripts with internal functions - ("<XF86ScreenSaver>", spawn "~/.xmonad/scripts/screenlock.sh") - , ("M-<Print>", spawn "~/.xmonad/scripts/xshot-upload.sh") - , ("M-S-<Print>", spawn "~/.xmonad/scripts/xshot-select-upload.sh") - , ("M-C-c", spawn "~/.xmonad/scripts/toggle-compton.sh") - , ("M-C-r", spawn "~/.xmonad/scripts/toggle-redshift.sh") - , ("M-C-p", spawn "~/.xmonad/scripts/toggle-touchpad.sh") - , ("M-C-t", spawn "~/.xmonad/scripts/toggle-trackpoint.sh") - ] +keysSystem _ = [("M-C-g", return ())] -keysMedia :: XConfig Layout -> [(String, X ())] -- TODO Make audio keys compatible with ALSA/PA at the same time +keysMedia :: XConfig Layout -> [(String, X ())] keysMedia _ = [ ("<XF86AudioMicMute>", spawn "pactl set-source-mute 1 toggle") , ("<XF86AudioMute>" , spawn "pactl set-sink-mute 0 toggle") @@ -167,19 +128,17 @@ keysWorkspaces :: XConfig Layout -> [(String, X ())] keysWorkspaces _ = [ ("M-S-o", switchProjectPrompt promptTheme) , ("M-S-p", shiftToProjectPrompt promptTheme) - , ("M-," , nextNonEmptyWS) - , ("M-." , prevNonEmptyWS) , ("M-i" , toggleWS' ["NSP"]) - , ("M-n", workspacePrompt promptTheme $ windows . S.shift) + , ("M-n" , workspacePrompt promptTheme $ windows . S.shift) ] ++ zipKeys "M-" wsKeys [0 ..] (withNthWorkspace S.greedyView) ++ zipKeys "M-S-" wsKeys [0 ..] (withNthWorkspace S.shift) ++ zipKeys "M-C-S-" wsKeys [0 ..] (withNthWorkspace copy) + where wsKeys = map show [1 .. 9 :: Int] keysSpawnables :: XConfig Layout -> [(String, X ())] keysSpawnables _ = [ ("M-<Return>", spawn (C.term C.applications)) - , ("M-b" , spawn (C.browser C.applications)) , ("M-c" , namedScratchpadAction scratchpads "console") , ("M-m" , namedScratchpadAction scratchpads "music") , ("M-t" , namedScratchpadAction scratchpads "top") @@ -190,7 +149,6 @@ keysWindows :: XConfig Layout -> [(String, X ())] keysWindows _ = [ ("M-d" , kill) , ("M-S-d", confirmPrompt hotPromptTheme "Kill all" killAll) - , ("M-a" , toggleCopyToAll) , ("M-e" , withFocused hideWindow) , ("M-S-e", popOldestHiddenWindow) , ("M-p" , promote) @@ -201,28 +159,24 @@ keysWindows _ = , ("M-S-'", windows S.swapDown) , ("M-S-;", windows S.swapUp) ] - ++ zipKeys' "M-" directionKeys directions windowGo True -- TODO W moving - ++ zipKeys' "M-S-" directionKeys directions windowSwap True - ++ zipKeys "M-C-" directionKeys directions (sendMessage . pullGroup) + ++ zipKeys' "M-" vimKeys directions windowGo True -- TODO W moving + ++ zipKeys' "M-S-" vimKeys directions windowSwap True + ++ zipKeys "M-C-" vimKeys directions (sendMessage . pullGroup) ++ zipKeys' "M-" arrowKeys directions screenGo True ++ zipKeys' "M-S-" arrowKeys directions windowToScreen True ++ zipKeys' "M-C-" arrowKeys directions screenSwap True + where + directions = [D, U, L, R] + arrowKeys = ["<D>", "<U>", "<L>", "<R>"] + vimKeys = ["j", "k", "h", "l"] keysLayout :: XConfig Layout -> [(String, X ())] keysLayout c = [ ("M-<Tab>" , sendMessage NextLayout) , ("M-C-<Tab>", toSubl NextLayout) , ("M-S-<Tab>", setLayout $ XMonad.layoutHook c) - , ("M-o" , withFocused toggleFloat) - , ("M-S-o" , sinkAll) , ("M-S-," , sendMessage $ IncMasterN (-1)) , ("M-S-." , sendMessage $ IncMasterN 1) - , ("M-r" , tryMessageR_ Rotate (Toggle REFLECTX)) - , ("M-S-r" , sendMessage $ Toggle REFLECTX) - , ( "M-f" - , sequence_ [withFocused $ windows . S.sink, sendMessage $ Toggle NBFULL] - ) - , ("M-C-g", sendMessage $ Toggle GAPS) -- FIXME Breaks merged tabbed layout ] keysResize :: XConfig Layout -> [(String, X ())] @@ -236,21 +190,6 @@ keysResize _ = , ("M-S-C-[", tryMessageR_ (ShrinkFrom D) MirrorShrink) , ("M-S-C-]", tryMessageR_ (ShrinkFrom U) MirrorExpand) ] - -mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ()) -mouseBindings XConfig{} = M.fromList - [ ( (modMask, button1) - , \w -> - focus w - >> F.mouseWindow F.position w - >> ifClick (snapMagicMove (Just 50) (Just 50) w) - >> windows S.shiftMaster - ) - , ( (modMask, button3) - , \w -> - focus w - >> F.mouseWindow F.linear w - >> ifClick (snapMagicResize [L, R, U, D] (Just 50) (Just 50) w) - >> windows S.shiftMaster - ) - ] + where + tryMessageR_ :: (Message a, Message b) => a -> b -> X () + tryMessageR_ x y = sequence_ [tryMessageWithNoRefreshToCurrent x y, refresh] diff --git a/src/lib/XMonad/Custom/Config.hs b/src/lib/XMonad/Custom/Config.hs index 4a4af2d..2936363 100644 --- a/src/lib/XMonad/Custom/Config.hs +++ b/src/lib/XMonad/Custom/Config.hs @@ -3,20 +3,20 @@ -- | -- Module : XMonad.Custom.Config -- Description : Configuration entrypoint to be passed to executable --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Config - ( myConfig + ( ngConfig ) where import Flow import XMonad -import XMonad.Actions.Navigation2D +import XMonad.Actions.Navigation2D ( withNavigation2DConfig ) import qualified XMonad.Custom.Bindings as C import qualified XMonad.Custom.Event as C import qualified XMonad.Custom.Layout as C @@ -25,24 +25,29 @@ import qualified XMonad.Custom.Misc as C import qualified XMonad.Custom.Navigation as C import qualified XMonad.Custom.Theme as C import qualified XMonad.Custom.Workspaces as C -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.UrgencyHook +import XMonad.Hooks.EwmhDesktops ( ewmh + , ewmhFullscreen + ) +import XMonad.Hooks.ManageDocks ( docks ) +import XMonad.Hooks.UrgencyHook ( borderUrgencyHook + , withUrgencyHook + ) import XMonad.Layout.IndependentScreens + ( countScreens ) -myConfig = do +ngConfig = do screens <- countScreens def { borderWidth = C.border - , workspaces = C.myWorkspaces screens - , layoutHook = C.layoutHook + , workspaces = C.ngWorkspaces screens + , layoutHook = C.ngLayoutHook , terminal = C.term C.applications , normalBorderColor = C.colorN , focusedBorderColor = C.colorF - , modMask = C.modMask - , keys = C.keys - , mouseBindings = C.mouseBindings - , manageHook = C.manageHook - , handleEventHook = C.handleEventHook + , modMask = C.ngModMask + , keys = C.ngKeys + , mouseBindings = C.ngMouseBindings + , manageHook = C.ngManageHook + , handleEventHook = C.ngHandleEventHook , focusFollowsMouse = False , clickJustFocuses = False } diff --git a/src/lib/XMonad/Custom/Event.hs b/src/lib/XMonad/Custom/Event.hs index 9ff2552..4e5a598 100644 --- a/src/lib/XMonad/Custom/Event.hs +++ b/src/lib/XMonad/Custom/Event.hs @@ -1,24 +1,24 @@ -- | -- Module : XMonad.Custom.Event -- Description : Event hooks and stuff --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Event - ( handleEventHook + ( ngHandleEventHook ) where -import Data.Monoid -import XMonad hiding ( handleEventHook ) -import XMonad.Custom.Scratchpads -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks +import Data.Monoid ( All ) +import XMonad ( Event + , X + ) +import XMonad.Custom.Scratchpads ( scratchpads ) import XMonad.Util.Loggers.NamedScratchpad + ( nspTrackHook ) -handleEventHook :: Event -> X All -handleEventHook = - mconcat [nspTrackHook scratchpads, docksEventHook, fullscreenEventHook] +ngHandleEventHook :: Event -> X All +ngHandleEventHook = mconcat [nspTrackHook scratchpads] diff --git a/src/lib/XMonad/Custom/Layout.hs b/src/lib/XMonad/Custom/Layout.hs index 8ed7d08..0ca3761 100644 --- a/src/lib/XMonad/Custom/Layout.hs +++ b/src/lib/XMonad/Custom/Layout.hs @@ -1,60 +1,22 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE TypeSynonymInstances #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} -- | -- Module : XMonad.Custom.Layout -- Description : Layouts and such --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Layout - ( layoutHook - , CustomTransformers(..) + ( ngLayoutHook ) where -import XMonad hiding ( layoutHook ) -import XMonad.Custom.Theme -import XMonad.Hooks.ManageDocks -import XMonad.Layout.Accordion -import XMonad.Layout.BinarySpacePartition -import XMonad.Layout.Fullscreen -import XMonad.Layout.Hidden -import XMonad.Layout.LayoutModifier -import XMonad.Layout.MultiToggle -import XMonad.Layout.MultiToggle.Instances -import XMonad.Layout.NoBorders -import XMonad.Layout.Reflect -import XMonad.Layout.Simplest -import XMonad.Layout.Spacing -import XMonad.Layout.SubLayouts -import XMonad.Layout.Tabbed -import XMonad.Layout.WindowNavigation +import XMonad ( Full(Full) + , Tall(Tall) + , (|||) + ) -applySpacing :: l a -> ModifiedLayout Spacing l a -applySpacing = spacingRaw False (Border 6 6 6 6) True (Border 6 6 6 6) True - -data CustomTransformers = GAPS - deriving (Read, Show, Eq, Typeable) - -instance Transformer CustomTransformers Window where - transform GAPS x k = k (avoidStruts $ applySpacing x) (const x) - -layoutHook = - fullscreenFloat - $ lessBorders OnlyLayoutFloat - $ mkToggle (single NBFULL) - $ avoidStruts - $ applySpacing - $ mkToggle (single GAPS) - $ mkToggle (single REFLECTX) - $ mkToggle (single REFLECTY) - $ windowNavigation - $ addTabs shrinkText tabTheme - $ hiddenWindows - $ subLayout [] (Simplest ||| Accordion) emptyBSP +ngLayoutHook = Tall 1 (1 / 2) (3 / 100) ||| Full diff --git a/src/lib/XMonad/Custom/Log.hs b/src/lib/XMonad/Custom/Log.hs index e9d3c1a..5e1e1b1 100644 --- a/src/lib/XMonad/Custom/Log.hs +++ b/src/lib/XMonad/Custom/Log.hs @@ -1,82 +1,20 @@ -- | -- Module : XMonad.Custom.Log -- Description : Loggers and statusbar configuration --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Log - ( logHook + ( ngLogHook ) where -import System.IO -import XMonad hiding ( logHook ) -import XMonad.Actions.CopyWindow -import XMonad.Custom.Theme -import XMonad.Hooks.CurrentWorkspaceOnTop -import XMonad.Hooks.DynamicLog -import XMonad.Hooks.EwmhDesktops -import XMonad.Util.NamedScratchpad -import XMonad.Util.SpawnNamedPipe -import XMonad.Util.WorkspaceCompare +import XMonad ( X ) +import XMonad.Hooks.DynamicLog ( dynamicLog ) -xmobarFont :: Int -> String -> String -xmobarFont f = wrap (concat ["<fn=", show f, ">"]) "</fn>" - -topBarPP :: PP -topBarPP = def - { ppCurrent = xmobarColor white2 "" . xmobarFont 2 . wrap "=" "=" - , ppVisible = xmobarColor white1 "" . wrap "~" "~" - , ppHidden = xmobarColor white1 "" . wrap "-" "-" - , ppHiddenNoWindows = xmobarColor white1 "" . wrap "_" "_" - , ppUrgent = xmobarColor red2 "" . wrap "!" "!" - , ppSep = " / " - , ppWsSep = " " - , ppTitle = xmobarColor white1 "" . shorten 50 - , ppTitleSanitize = xmobarStrip - , ppLayout = xmobarColor white1 "" - , ppOrder = id - , ppSort = (namedScratchpadFilterOutWorkspace .) <$> getSortByIndex - , ppExtras = [] - } - -botBarPP :: PP -botBarPP = topBarPP { ppCurrent = const "" - , ppVisible = const "" - , ppHidden = const "" - , ppHiddenNoWindows = const "" - , ppUrgent = const "" - , ppTitle = const "" - , ppLayout = const "" - } - -safePrintToPipe :: Maybe Handle -> String -> IO () -safePrintToPipe = maybe (\_ -> return ()) hPutStrLn - -logHook :: X () -logHook = do - currentWorkspaceOnTop - ewmhDesktopsLogHook - t <- getNamedPipe "xmobarTop" - b <- getNamedPipe "xmobarBot" - c <- wsContainingCopies - let copiesCurrent ws - | ws `elem` c - = xmobarColor yellow2 "" . xmobarFont 2 . wrap "*" "=" $ ws - | otherwise - = xmobarColor white2 "" . xmobarFont 2 . wrap "=" "=" $ ws - let copiesHidden ws - | ws `elem` c = xmobarColor yellow1 "" . wrap "*" "-" $ ws - | otherwise = xmobarColor white1 "" . wrap "-" "-" $ ws - let copiesUrgent ws - | ws `elem` c = xmobarColor yellow2 "" . wrap "*" "!" $ ws - | otherwise = xmobarColor white2 "" . wrap "!" "!" $ ws - dynamicLogWithPP $ topBarPP { ppCurrent = copiesCurrent - , ppHidden = copiesHidden - , ppUrgent = copiesUrgent - , ppOutput = safePrintToPipe t - } - dynamicLogWithPP $ botBarPP { ppOutput = safePrintToPipe b } +ngLogHook :: X () +ngLogHook = do + dynamicLog diff --git a/src/lib/XMonad/Custom/Manage.hs b/src/lib/XMonad/Custom/Manage.hs index dbc560e..fcda9c1 100644 --- a/src/lib/XMonad/Custom/Manage.hs +++ b/src/lib/XMonad/Custom/Manage.hs @@ -3,13 +3,13 @@ -- Description : Window management hooks and scratchpads -- Copyright : (c) Azat Bahawi 2018-2021 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Manage - ( manageHook + ( ngManageHook ) where import XMonad hiding ( manageHook ) @@ -20,6 +20,14 @@ import XMonad.Hooks.ManageHelpers import XMonad.Layout.Fullscreen import XMonad.Util.NamedScratchpad +ngManageHook :: ManageHook +ngManageHook = mconcat + [ manageDocks + , fullscreenManageHook + , namedScratchpadManageHook scratchpads + , composeOne composeActions + ] + composeActions :: [MaybeManageHook] composeActions = [ appName =? "emacs-popup" -?> tileBelowNoFocus @@ -44,11 +52,3 @@ composeActions = tileNormal = insertPosition Above Newer tileBelow = insertPosition Below Newer tileBelowNoFocus = insertPosition Below Older - -manageHook :: ManageHook -manageHook = mconcat - [ manageDocks - , fullscreenManageHook - , namedScratchpadManageHook scratchpads - , composeOne composeActions - ] diff --git a/src/lib/XMonad/Custom/Misc.hs b/src/lib/XMonad/Custom/Misc.hs index 366c01f..2511cbc 100644 --- a/src/lib/XMonad/Custom/Misc.hs +++ b/src/lib/XMonad/Custom/Misc.hs @@ -3,9 +3,9 @@ -- | -- Module : XMonad.Custom.Misc -- Description : Miscellaneous functions and constants --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- @@ -15,22 +15,11 @@ module XMonad.Custom.Misc , applications ) where -data Applications = Applications - { browser :: !String - , mixer :: !String - , notify :: !String - , player :: !String - , term :: !String - , top :: !String +newtype Applications = Applications + { term :: String } deriving (Eq, Show) applications :: Applications -applications = Applications { browser = "qutebrowser" - , mixer = "pulsemixer" - , notify = "notify-send" - , player = "ncmpcpp" - , term = "alacritty" - , top = "htop" - } +applications = Applications { term = "alacritty" } diff --git a/src/lib/XMonad/Custom/Navigation.hs b/src/lib/XMonad/Custom/Navigation.hs index cf96ab7..d033389 100644 --- a/src/lib/XMonad/Custom/Navigation.hs +++ b/src/lib/XMonad/Custom/Navigation.hs @@ -1,9 +1,9 @@ -- | -- Module : XMonad.Custom.Navigation -- Description : Window navigation and layouts --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- diff --git a/src/lib/XMonad/Custom/Projects.hs b/src/lib/XMonad/Custom/Projects.hs index 9fa7a37..c57b4e3 100644 --- a/src/lib/XMonad/Custom/Projects.hs +++ b/src/lib/XMonad/Custom/Projects.hs @@ -1,9 +1,9 @@ -- | -- Module : XMonad.Custom.Projects -- Description : Per-project workspaces --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- @@ -13,8 +13,6 @@ module XMonad.Custom.Projects ) where import XMonad.Actions.DynamicProjects -import XMonad.Actions.SpawnOn -import qualified XMonad.Custom.Misc as C projects :: [Project] projects = @@ -22,12 +20,4 @@ projects = , projectDirectory = "~/" , projectStartHook = Nothing } - , Project { projectName = "Emacs" - , projectDirectory = "~/" - , projectStartHook = Just $ spawnOn "Emacs" "emacsclient" - } - , Project { projectName = "WWW" - , projectDirectory = "~/" - , projectStartHook = Just $ spawnOn "WWW" (C.browser C.applications) - } ] diff --git a/src/lib/XMonad/Custom/Prompt.hs b/src/lib/XMonad/Custom/Prompt.hs index c54a00f..d8610eb 100644 --- a/src/lib/XMonad/Custom/Prompt.hs +++ b/src/lib/XMonad/Custom/Prompt.hs @@ -1,9 +1,9 @@ -- | -- Module : XMonad.Custom.Prompt -- Description : Prompt configuration --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- diff --git a/src/lib/XMonad/Custom/Scratchpads.hs b/src/lib/XMonad/Custom/Scratchpads.hs index 5570435..4aaaf94 100644 --- a/src/lib/XMonad/Custom/Scratchpads.hs +++ b/src/lib/XMonad/Custom/Scratchpads.hs @@ -1,9 +1,9 @@ -- | -- Module : XMonad.Custom.Scratchpads -- Description : Scratchpads configuration --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- @@ -35,16 +35,4 @@ scratchpads = (spawnTerminalWith "NSPConsole" "~/.xmonad/scripts/nsp-console.sh") (title =? "NSPConsole") floatingNSP - , NS "volume" - (spawnTerminalWith "NSPVolume" (C.mixer C.applications)) - (title =? "NSPVolume") - floatingNSP - , NS "music" - (spawnTerminalWith "NSPMusic" (C.player C.applications)) - (title =? "NSPMusic") - floatingNSP - , NS "top" - (spawnTerminalWith "NSPTop" (C.top C.applications)) - (title =? "NSPTop") - floatingNSP ] diff --git a/src/lib/XMonad/Custom/Startup.hs b/src/lib/XMonad/Custom/Startup.hs index 935d08f..3c9379e 100644 --- a/src/lib/XMonad/Custom/Startup.hs +++ b/src/lib/XMonad/Custom/Startup.hs @@ -1,58 +1,20 @@ -- | -- Module : XMonad.Custom.Startup -- Description : Startup hooks --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Startup - ( startupHook + ( ngStartupHook ) where -import Control.Monad -import Data.Maybe -import XMonad hiding ( startupHook ) -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.SetWMName -import XMonad.Util.Cursor -import XMonad.Util.SpawnNamedPipe +import XMonad ( X ) +import XMonad.Hooks.SetWMName ( setWMName ) -atomsToFullscreen :: [String] -atomsToFullscreen = - [ "_NET_ACTIVE_WINDOW" - , "_NET_CLIENT_LIST" - , "_NET_CLIENT_LIST_STACKING" - , "_NET_DESKTOP_NAMES" - , "_NET_WM_DESKTOP" - , "_NET_WM_STATE" - , "_NET_WM_STATE_FULLSCREEN" - , "_NET_WM_STATE_HIDDEN" - , "_NET_WM_STRUT" - ] - -addNETSupported :: Atom -> X () -addNETSupported x = withDisplay $ \d -> do - r <- asks theRoot - n <- getAtom "_NET_SUPPORTED" - a <- getAtom "ATOM" - liftIO $ do - p <- join . maybeToList <$> getWindowProperty32 d n r - when (fromIntegral x `notElem` p) - $ changeProperty32 d r n a propModeAppend [fromIntegral x] - -addEWMHFullscreen :: X () -addEWMHFullscreen = do - s <- mapM getAtom atomsToFullscreen - mapM_ addNETSupported s - -startupHook :: X () -startupHook = do - -- spawnNamedPipe "xmobar ~/.xmonad/xmobarrc/top.hs" "xmobarTop" - -- spawnNamedPipe "xmobar ~/.xmonad/xmobarrc/bot.hs" "xmobarBot" - docksStartupHook - addEWMHFullscreen - setDefaultCursor xC_left_ptr +ngStartupHook :: X () +ngStartupHook = do setWMName "xmonad" diff --git a/src/lib/XMonad/Custom/Theme.hs b/src/lib/XMonad/Custom/Theme.hs index cfcd176..be3bc67 100644 --- a/src/lib/XMonad/Custom/Theme.hs +++ b/src/lib/XMonad/Custom/Theme.hs @@ -1,9 +1,9 @@ -- | -- Module : XMonad.Custom.Theme -- Description : Theming and styles --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- diff --git a/src/lib/XMonad/Custom/Workspaces.hs b/src/lib/XMonad/Custom/Workspaces.hs index 43d8aa2..995fb9f 100644 --- a/src/lib/XMonad/Custom/Workspaces.hs +++ b/src/lib/XMonad/Custom/Workspaces.hs @@ -1,19 +1,22 @@ -- | -- Module : XMonad.Custom.Workspaces -- Description : General workspace configuration --- Copyright : (c) Azat Bahawi 2018-2021 +-- Copyright : (c) Azat Bahawi 2018-2022 -- SPDX-License-Identifier : GPL-3.0-or-later --- Maintainer : azahi@teknik.io +-- Maintainer : azat@bahawi.net -- Stability : experimental -- Portability : non-portable -- module XMonad.Custom.Workspaces - ( myWorkspaces + ( ngWorkspaces ) where -import XMonad.Core +import XMonad.Core ( ScreenId ) import XMonad.Layout.IndependentScreens + ( PhysicalWorkspace + , withScreens + ) -myWorkspaces :: ScreenId -> [PhysicalWorkspace] -myWorkspaces = flip withScreens $ map show [1 .. 9 :: Int] +ngWorkspaces :: ScreenId -> [PhysicalWorkspace] +ngWorkspaces = flip withScreens $ map show [1 .. 9 :: Int] |