1
Fork 0
satellite/modules/applications/xmonad/Main.hs

117 lines
3.1 KiB
Haskell
Raw Normal View History

2022-01-17 18:22:09 +01:00
{-# LANGUAGE BlockArguments #-}
import Control.Monad (forM_, join)
2022-01-17 18:22:09 +01:00
import Data.Function ((&))
2022-05-10 19:04:51 +02:00
import System.Environment
import System.Process
2022-01-17 18:22:09 +01:00
import XMonad
import XMonad.Actions.SpawnOn
import XMonad.Config
2022-01-17 18:22:09 +01:00
import XMonad.Config.Kde
import XMonad.Hooks.EwmhDesktops (ewmh, fullscreenEventHook)
import XMonad.Hooks.ManageDocks
2022-08-16 10:31:45 +02:00
import XMonad.Layout.NoBorders
2022-01-17 18:22:09 +01:00
import XMonad.Layout.Spacing
import XMonad.Layout.ThreeColumns
import XMonad.Operations
2022-05-10 19:04:51 +02:00
import XMonad.Util.EZConfig
2022-01-17 18:22:09 +01:00
kdeOn :: Bool
kdeOn = False
2022-01-17 18:34:44 +01:00
-- startingConfig = if kdeOn then kdeConfig else defaultConfig
2022-01-17 18:22:09 +01:00
main =
xmonad $
ewmh $
docks $
def
2022-01-17 18:22:09 +01:00
{ modMask = mod4Mask,
layoutHook = myLayoutHook,
startupHook = startup,
manageHook = manageDocks <+> manageSpawn <+> myManagerHook <+> manageHook kdeConfig,
2022-01-17 18:22:09 +01:00
handleEventHook = handleEventHook kdeConfig <+> fullscreenEventHook,
terminal = myTerminal,
2022-05-16 23:03:35 +02:00
workspaces = myWorkspaces,
2022-09-18 01:00:32 +02:00
borderWidth = 5,
focusedBorderColor = "#4c4f69",
normalBorderColor = "#4c4f69"
2022-01-17 18:22:09 +01:00
}
`additionalKeysP` keymap
where
myWorkspaces =
2022-09-18 01:00:32 +02:00
["1:dev", "2:browser", "3:chat", "4:reading", "5", "6"]
2022-01-17 18:22:09 +01:00
appWorkspaceConfig =
[ (3, "Discord"),
(4, "alacritty"),
(2, "google-chrome-stable")
]
manageWorkspaces =
appWorkspaceConfig
& fmap \(workspaceId, name) -> do
2022-01-17 18:34:44 +01:00
let workspaceName = myWorkspaces !! (workspaceId - 1)
2022-01-17 18:22:09 +01:00
className =? name --> doShift workspaceName
kdeFloats =
[ "yakuake",
"Yakuake",
"Kmix",
"kmix",
"plasma",
"Plasma",
"plasma-desktop",
"Plasma-desktop",
"krunner",
"ksplashsimple",
"ksplashqml",
"ksplashx"
]
floatKdeStuff = [className =? name --> doFloat | name <- kdeFloats]
myManagerHook =
composeAll $
concat
[ if kdeOn then floatKdeStuff else [],
manageWorkspaces
]
myTerminal = "alacritty"
myBrowser = "google-chrome-stable"
-- TODO: find a way to bind all the program-opening-keybindings to a single sub-map
keymap =
2022-05-11 19:08:21 +02:00
[ ("M-p", spawn "rofi -show drun"),
("M-w", spawn "rofi -show window"),
2022-05-10 19:04:51 +02:00
("M-g", spawn myBrowser),
("M-d", spawn "Discord"),
("M-v", spawn "alacritty -e vimclip"),
2022-09-25 22:03:11 +02:00
("M-s", spawn "spectacle -rcb"),
("M-S-s", spawn "spectacle -mcb"),
("M-C-s", spawn "spectacle -ucb"),
2022-05-10 19:04:51 +02:00
("M-c", kill)
2022-01-17 18:22:09 +01:00
]
uniformBorder = join $ join $ join Border
border = uniformBorder 0
spacingHook = spacingRaw False border False border True
2022-01-17 18:22:09 +01:00
tall = Tall 1 (3 / 100) (1 / 2)
threeCols = ThreeCol 1 (3 / 100) (1 / 2)
layouts = tall ||| threeCols ||| Full
myLayoutHook = desktopLayoutModifiers $ spacingHook layouts
startupApps =
[ (0, "alacritty"),
(1, "google-chrome-stable"),
(2, "Discord")
]
2022-01-17 18:22:09 +01:00
startup :: X ()
startup = do
forM_ startupApps \(index, app) -> do
spawnOn (myWorkspaces !! index) app