690 lines
28 KiB
Haskell
690 lines
28 KiB
Haskell
--
|
|
-- Xmonad config for Solomon Laing
|
|
--
|
|
|
|
-- Base
|
|
import XMonad
|
|
import System.IO (hPutStrLn)
|
|
import System.Exit (ExitCode(ExitSuccess), exitWith )
|
|
import qualified XMonad.StackSet as W
|
|
|
|
-- Actions
|
|
import XMonad.Actions.CopyWindow (kill1)
|
|
import XMonad.Actions.CycleWS (Direction1D(..), moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
|
|
import XMonad.Actions.GridSelect
|
|
import XMonad.Actions.MouseResize
|
|
import XMonad.Actions.Promote
|
|
import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
|
|
import qualified XMonad.Actions.TreeSelect as TS
|
|
import XMonad.Actions.WindowGo (runOrRaise)
|
|
import XMonad.Actions.WithAll (sinkAll, killAll)
|
|
import qualified XMonad.Actions.Search as S
|
|
|
|
-- Data
|
|
import Data.Char (isSpace, toUpper)
|
|
import Data.Maybe ( fromJust, isJust )
|
|
import Data.Monoid
|
|
import Data.Tree
|
|
import qualified Data.Map as M
|
|
|
|
-- Hooks
|
|
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
|
|
import XMonad.Hooks.FadeInactive
|
|
import XMonad.Hooks.ManageDocks (docks, avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
|
|
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat)
|
|
import XMonad.Hooks.EwmhDesktops (ewmh, fullscreenEventHook)
|
|
import XMonad.Hooks.ServerMode
|
|
import XMonad.Hooks.SetWMName
|
|
import XMonad.Hooks.WorkspaceHistory
|
|
|
|
-- Layouts
|
|
import XMonad.Layout.GridVariants (Grid(Grid))
|
|
import XMonad.Layout.SimplestFloat
|
|
import XMonad.Layout.Spiral
|
|
import XMonad.Layout.ResizableTile
|
|
import XMonad.Layout.Tabbed
|
|
import XMonad.Layout.ThreeColumns
|
|
|
|
-- Layouts modifiers
|
|
import XMonad.Layout.LayoutModifier
|
|
import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
|
|
import XMonad.Layout.Magnifier
|
|
import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
|
|
import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
|
|
import XMonad.Layout.NoBorders
|
|
import XMonad.Layout.Renamed
|
|
import XMonad.Layout.ShowWName
|
|
import XMonad.Layout.Simplest
|
|
import XMonad.Layout.Spacing
|
|
import XMonad.Layout.SubLayouts
|
|
import XMonad.Layout.WindowNavigation
|
|
import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
|
|
import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
|
|
import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
|
|
|
|
-- Utilities
|
|
import XMonad.Util.EZConfig (additionalKeysP)
|
|
import XMonad.Util.NamedScratchpad
|
|
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
|
|
import XMonad.Util.SpawnOnce
|
|
|
|
-- A simple way to switch between desktop and laptop related things
|
|
isLaptop :: Bool
|
|
isLaptop = True
|
|
|
|
|
|
--THEME
|
|
-- Currently Dracula
|
|
colorBackground :: String
|
|
colorBackground = "#282a36"
|
|
|
|
colorForeground :: String
|
|
colorForeground = "#f8f8f2"
|
|
|
|
colorCurrentLine :: String
|
|
colorCurrentLine = "#44475a"
|
|
|
|
colorSelection :: String
|
|
colorSelection = "#44475a"
|
|
|
|
colorComment :: String
|
|
colorComment = "#6272a4"
|
|
|
|
colorCyan :: String
|
|
colorCyan = "#8be9fd"
|
|
|
|
colorGreen :: String
|
|
colorGreen = "#50fa7b"
|
|
|
|
colorOrange :: String
|
|
colorOrange = "#ffb86c"
|
|
|
|
colorPink :: String
|
|
colorPink = "#ff79c6"
|
|
|
|
colorPurple :: String
|
|
colorPurple = "#bd93f9"
|
|
|
|
colorRed :: String
|
|
colorRed = "#ff5555"
|
|
|
|
colorYellow :: String
|
|
colorYellow = "#f1fa8c"
|
|
|
|
|
|
-- The preferred terminal program, which is used in a binding below and by
|
|
-- certain contrib modules.
|
|
myTerminal :: String
|
|
myTerminal = "alacritty"
|
|
|
|
myFileManager :: String
|
|
myFileManager = "thunar"
|
|
|
|
myBrowser :: String
|
|
myBrowser = "firefox"
|
|
|
|
-- The font to be used
|
|
myFont :: String
|
|
myFont = "xft:Fira Code:antialias=true:hinting=true"
|
|
|
|
-- Whether focus follows the mouse pointer.
|
|
myFocusFollowsMouse :: Bool
|
|
myFocusFollowsMouse = True
|
|
|
|
-- Whether clicking on a window to focus also passes the click to the window
|
|
myClickJustFocuses :: Bool
|
|
myClickJustFocuses = False
|
|
|
|
-- Width of the window border in pixels.
|
|
myBorderWidth :: Dimension
|
|
myBorderWidth = 3
|
|
|
|
-- Border colors for unfocused and focused windows, respectively.
|
|
myNormalBorderColor :: String
|
|
myNormalBorderColor = colorBackground
|
|
|
|
myFocusedBorderColor :: String
|
|
myFocusedBorderColor = colorSelection
|
|
|
|
-- modMask lets you specify which modkey you want to use. The default
|
|
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
|
|
-- ("right alt"), which does not conflict with emacs keybindings. The
|
|
-- "windows key" is usually mod4Mask.
|
|
myModMask :: KeyMask
|
|
myModMask = mod4Mask
|
|
|
|
-- The default number of workspaces (virtual screens) and their names.
|
|
-- By default we use numeric strings, but any string may be used as a
|
|
-- workspace name. The number of workspaces is determined by the length
|
|
|
|
-- of this list.
|
|
--
|
|
-- A tagging example:
|
|
--
|
|
-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
|
|
xmobarEscape :: String -> String
|
|
xmobarEscape = concatMap doubleLts
|
|
where
|
|
doubleLts '<' = "<<"
|
|
doubleLts x = [x]
|
|
|
|
myWorkspaces :: [String]
|
|
|
|
|
|
-- myWorkspaces = [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "]
|
|
myWorkspaces = ["web", "game", "dev", "doc", "mus", "vid", "sys", "chat", "virt"]
|
|
myWorkspaceIndices = M.fromList $ zip myWorkspaces [1..] -- (,) == \x y -> (x,y)
|
|
|
|
clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
|
|
where i = fromJust $ M.lookup ws myWorkspaceIndices
|
|
|
|
|
|
|
|
myColorizer :: Window -> Bool -> X (String, String)
|
|
myColorizer = colorRangeFromClassName
|
|
(0x28,0x2c,0x34) -- lowest inactive bg
|
|
(0x28,0x2c,0x34) -- highest inactive bg
|
|
(0xc7,0x92,0xea) -- active bg
|
|
(0xc0,0xa7,0x9a) -- inactive fg
|
|
(0x28,0x2c,0x34) -- active fg
|
|
|
|
-- gridSelect menu layout
|
|
mygridConfig :: p -> GSConfig Window
|
|
mygridConfig colorizer = (buildDefaultGSConfig myColorizer)
|
|
{ gs_cellheight = 40
|
|
, gs_cellwidth = 200
|
|
, gs_cellpadding = 6
|
|
, gs_originFractX = 0.5
|
|
, gs_originFractY = 0.5
|
|
, gs_font = myFont
|
|
}
|
|
|
|
spawnSelected' :: [(String, String)] -> X ()
|
|
spawnSelected' lst = gridselect conf lst >>= flip whenJust spawn
|
|
where conf = def
|
|
{ gs_cellheight = 40
|
|
, gs_cellwidth = 200
|
|
, gs_cellpadding = 6
|
|
, gs_originFractX = 0.5
|
|
, gs_originFractY = 0.5
|
|
, gs_font = myFont
|
|
}
|
|
|
|
myAppGrid = [ ("Runelite", "runelite")
|
|
, ("ProtonVPN", "protonvpn")
|
|
, ("Thunar", "thunar")
|
|
, ("Calendar", "gnome-calendar")
|
|
, ("Firefox", "firefox")
|
|
, ("Discord", "discord")
|
|
, ("VS Code", "code")
|
|
, ("Slack", "slack")
|
|
, ("Steam", "steam")
|
|
, ("Gimp", "gimp")
|
|
, ("Blueman Manager", "blueman-manager")
|
|
, ("LibreOffice Impress", "loimpress")
|
|
, ("LibreOffice Calc", "localc")
|
|
, ("LibreOffice Writer", "lowriter")
|
|
, ("qBittorrent", "qbittorrent")
|
|
, ("Telegram", "telegram-desktop")
|
|
, ("Element", "element-desktop")
|
|
]
|
|
|
|
myScratchPads :: [NamedScratchpad]
|
|
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
|
, NS "plexamp" spawnPlexamp findPlexamp managePlexamp
|
|
, NS "calculator" spawnCalc findCalc manageCalc
|
|
, NS "matrix" spawnMatrix findMatrix manageMatrix
|
|
]
|
|
where
|
|
spawnTerm = myTerminal ++ " -t scratchpad"
|
|
findTerm = title =? "scratchpad"
|
|
manageTerm = customFloating $ W.RationalRect l t w h
|
|
where
|
|
h = 0.9
|
|
w = 0.9
|
|
t = 0.95 -h
|
|
l = 0.95 -w
|
|
spawnPlexamp = "Plexamp.AppImage"
|
|
findPlexamp = className =? "plexamp"
|
|
managePlexamp = customFloating $ W.RationalRect l t w h
|
|
where
|
|
h = 0.9
|
|
w = 0.9
|
|
t = 0.95 -h
|
|
l = 0.95 -w
|
|
spawnCalc = "qalculate-gtk"
|
|
findCalc = className =? "Qalculate-gtk"
|
|
manageCalc = customFloating $ W.RationalRect l t w h
|
|
where
|
|
h = 0.5
|
|
w = 0.4
|
|
t = 0.75 -h
|
|
l = 0.70 -w
|
|
spawnMatrix = "element-desktop"
|
|
findMatrix = className =? "Element"
|
|
manageMatrix = customFloating $ W.RationalRect l t w h
|
|
where
|
|
h = 0.5
|
|
w = 0.4
|
|
t = 0.75 -h
|
|
l = 0.70 -w
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
-- Key bindings. Add, modify or remove key bindings here.
|
|
-- These are general keybindings custom script bindings are not included.h
|
|
|
|
myStandardEZKeys :: [(String, X ())]
|
|
myStandardEZKeys =
|
|
|
|
--START_KEYS
|
|
--NOTE xmonad
|
|
[ ("M-'", spawn "xmonad --recompile && xmonad --restart") -- recompile and restart xmonad
|
|
|
|
--NOTE launchers
|
|
, ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26") -- open dmenu
|
|
|
|
--NOTE keybound programs
|
|
, ("M-S-<Return>", spawn (myTerminal)) -- open a terminal
|
|
, ("M-l", spawn (myFileManager)) -- open a file manager
|
|
|
|
--NOTE file manager bindings
|
|
, ("C-l l", spawn (myFileManager)) -- open file manager
|
|
, ("C-l n", spawn (myFileManager ++ " $HOME/nextcloud")) -- open my nextcloud folder
|
|
, ("C-l u", spawn (myFileManager ++ " $HOME/nextcloud/university")) -- open my nextcloud university folder
|
|
, ("C-l p", spawn (myFileManager ++ " $HOME/nextcloud/personal")) -- open my nextcloud personal folder
|
|
, ("C-l r", spawn (myFileManager ++ " $HOME/repos")) -- open my repos folder
|
|
, ("C-l d", spawn (myFileManager ++ " $HOME/Downloads")) -- open downloads
|
|
|
|
--NOTE wm controls
|
|
, ("M-S-j", kill1) -- kill focused windown
|
|
, ("M-<Space>", sendMessage NextLayout) -- rotate through layouts
|
|
-- , ("M-S-<space>", setLayout $ Xmonad.layoutHook conf) -- reset layout to default
|
|
, ("M-S-y", refresh) -- reset current window to correct size
|
|
, ("M-<Tab>", windows W.focusDown) -- focus next window
|
|
, ("M-S-<Tab>", windows W.focusUp) -- focus previous window
|
|
, ("M-m", windows W.focusMaster) -- focus master window
|
|
, ("M-<Return>", windows W.swapMaster) -- swap window with master
|
|
, ("M-S-<Up>", windows W.swapUp) -- swap window with next window
|
|
, ("M-S-<Down>", windows W.swapDown) -- swap window with previous window
|
|
, ("M-S-<Right>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- shift window to next workspace
|
|
, ("M-S-<Left>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- shift window to previous workspace
|
|
, ("M-C-<Right>", nextScreen) -- shift window to next workspace
|
|
, ("M-C-<Left>", prevScreen) -- shift window to previous workspace
|
|
, ("M-<Left>", sendMessage Shrink) -- shrink master area
|
|
, ("M-<Right>", sendMessage Expand) -- grow master area
|
|
, ("M-<Down>", sendMessage MirrorShrink) -- shrink master area
|
|
, ("M-<Up>", sendMessage MirrorExpand) -- grow master area
|
|
, ("M-y", withFocused $ windows . W.sink) -- push floating window back into tiling
|
|
, ("M-w", sendMessage (IncMasterN 1)) -- increment windows in master
|
|
, ("M-v", sendMessage (IncMasterN (-1))) -- decrement windows in master
|
|
, ("M-<F11>", sendMessage ToggleStruts) -- toggle bar
|
|
|
|
-- NOTE Scratchpads
|
|
-- NOTE Toggle show/hide these programs. They run on a hidden workspace.
|
|
-- NOTE When you toggle them to show, it brings them to your current workspace.
|
|
-- NOTE Toggle them to hide and it sends them back to hidden workspace (NSP).
|
|
, ("M-s t", namedScratchpadAction myScratchPads "terminal")
|
|
, ("M-s m", namedScratchpadAction myScratchPads "plexamp")
|
|
, ("M-s c", namedScratchpadAction myScratchPads "calculator")
|
|
, ("M-s e", namedScratchpadAction myScratchPads "matrix")
|
|
|
|
-- NOTE Grid Select (CTR-g followed by a key)
|
|
, ("C-g g", spawnSelected' myAppGrid) -- grid select favorite apps
|
|
, ("C-g t", goToSelected $ mygridConfig myColorizer) -- goto selected window
|
|
, ("C-g b", bringSelected $ mygridConfig myColorizer) -- bring selected window
|
|
|
|
--NOTE my custom keybind/script combinations
|
|
--NOTE system controls
|
|
, ("M-S-s", spawn "dmenuprompt \"Are you sure you want to Shutdown?\" \"shutdown now\"") -- prompt computer shutdown
|
|
, ("M-S-r", spawn "dmenuprompt \"Are you sure you want to Restart?\" \"reboot\"") -- prompt computer restart
|
|
, ("M-<Escape>", spawn "dmenuprompt \"Are you sure you want to lock?\" \"slock\" 1") -- prompt computer lock
|
|
|
|
--NOTE bitwarden controls
|
|
, ("M-S-x", spawn "$HOME/.local/bin/bw-unlock") -- unlock bitwarden cli
|
|
, ("M-x", spawn "$HOME/.local/bin/passwords") -- get password from bw cli
|
|
|
|
--NOTE demenu search and browser
|
|
, ("M-s s", spawn "dmenusearch") -- launch searcher (dmenu and surf)
|
|
, ("M-s d", spawn "dmenusearch duckduckgo") -- launch searcher, default to duckduckgo
|
|
|
|
--NOTE my default browser pages
|
|
, ("C-b o", spawn "surf 192.168.2.101:8080") -- open openhab in surf
|
|
, ("C-b h", spawn "surf 'https://pve.inkletblot.com:8006'") -- open pve (hypervisor) in surf
|
|
, ("C-b p", spawn "surf 'https://app.plex.tv'") -- open plex in surf
|
|
, ("C-b c", spawn "surf 'https://calendar.protonmail.com'") -- open protoncalendar in surf
|
|
, ("C-b m", spawn "surf 'https://mail.protonmail.com'") -- open protonmail in surf
|
|
|
|
--NOTE drive mounting
|
|
, ("M-d m", spawn "dmenumount") -- launch mounter
|
|
, ("M-d u", spawn "dmenuumount") -- launch unmounter
|
|
|
|
--NOTE music and audio controls
|
|
, ("M-S-o", spawn "set-default-sink") -- set default output
|
|
, ("M-S-i", spawn "set-default-source") -- set default input
|
|
, ("<XF86AudioLowerVolume>", spawn "dec-sink-volume") -- decrease output volume
|
|
, ("<XF86AudioRaiseVolume>", spawn "inc-sink-volume") -- increase output volume
|
|
, ("<XF86AudioMute>", spawn "toggle-sink-mute") -- toggle output mute
|
|
, ("S-<XF86AudioLowerVolume>", spawn "dec-source-volume") -- decrease input volume
|
|
, ("S-<XF86AudioRaiseVolume>", spawn "inc-source-volume") -- increase input volume
|
|
, ("S-<XF86AudioMute>", spawn "toggle-source-mute") -- toggle input mute
|
|
|
|
--NOTE extras
|
|
, ("M-S-/", spawn "xmonad-keys-help") -- show keybinds
|
|
, ("<Print>", spawn "screenshot") -- take full (all monitors) screenshot
|
|
, ("M-<Print>", spawn "flameshot gui") -- launch flameshot for snipping
|
|
]
|
|
-- The following lines are needed for named scratchpads.
|
|
where nonNSP = WSIs (return (\ws -> W.tag ws /= "NSP"))
|
|
nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "NSP"))
|
|
|
|
|
|
myLaptopEZKeys :: [(String, X ())]
|
|
myLaptopEZKeys =
|
|
--NOTE backlight controls
|
|
[ ("<XF86MonBrightnessUp>", spawn "mod_backlight +10") -- increase backlight brightness by 10
|
|
, ("<XF86MonBrightnessDown>", spawn "mod_backlight -10") -- decrease backlight brightness by 10
|
|
]
|
|
|
|
|
|
myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $
|
|
-- mod-[1..9], Switch to workspace N
|
|
-- mod-shift-[1..9], Move client to workspace N
|
|
[((m .|. modm, k), windows $ f i)
|
|
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
|
|
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
|
|
|
|
-- Mouse bindings: default actions bound to mouse events
|
|
myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
|
|
-- mod-button1, Set the window to floating mode and move by dragging
|
|
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))
|
|
-- mod-button2, Raise the window to the top of the stack, push to master.
|
|
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
|
|
-- mod-button3, Set the window to floating mode and resize by dragging
|
|
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
|
|
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
|
]
|
|
--END_KEYS
|
|
|
|
-- Set ezKeys
|
|
|
|
myEZKeys :: [(String, X ())]
|
|
myEZKeys =
|
|
if isLaptop
|
|
then (myStandardEZKeys ++ myLaptopEZKeys)
|
|
else myStandardEZKeys
|
|
|
|
------------------------------------------------------------------------
|
|
-- Layouts:
|
|
|
|
--Makes setting the spacingRaw simpler to write. The spacingRaw module adds a configurable amount of space around windows.
|
|
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
|
|
mySpacing i = spacingRaw True (Border i i i i) True (Border i i i i) True
|
|
|
|
-- Defining a bunch of layouts, many that I don't use.
|
|
-- limitWindows n sets maximum number of windows displayed for layout.
|
|
-- mySpacing n sets the gap size around the windows.
|
|
tall = renamed [Replace "tall"]
|
|
$ limitWindows 12
|
|
$ mySpacing 8
|
|
-- $ Mirror
|
|
$ ResizableTall 1 (3/100) (1/2) []
|
|
magnify = renamed [Replace "magnify"]
|
|
$ magnifier
|
|
$ limitWindows 12
|
|
$ mySpacing 8
|
|
$ ResizableTall 1 (3/100) (1/2) []
|
|
monocle = renamed [Replace "monocle"]
|
|
$ limitWindows 20 Full
|
|
floats = renamed [Replace "floats"]
|
|
$ limitWindows 20 simplestFloat
|
|
grid = renamed [Replace "grid"]
|
|
$ limitWindows 12
|
|
$ mySpacing 8
|
|
$ mkToggle (single MIRROR)
|
|
$ Grid (16/10)
|
|
spirals = renamed [Replace "spirals"]
|
|
$ mySpacing 8
|
|
$ spiral (6/7)
|
|
threeCol = renamed [Replace "threeCol"]
|
|
$ limitWindows 7
|
|
$ ThreeCol 1 (3/100) (1/2)
|
|
threeRow = renamed [Replace "threeRow"]
|
|
$ limitWindows 7
|
|
-- Mirror takes a layout and rotates it by 90 degrees.
|
|
-- So we are applying Mirror to the ThreeCol layout.
|
|
$ Mirror
|
|
$ ThreeCol 1 (3/100) (1/2)
|
|
tabs = renamed [Replace "tabs"]
|
|
-- I cannot add spacing to this layout because it will
|
|
-- add spacing between window and tabs which looks bad.
|
|
$ tabbed shrinkText myTabTheme
|
|
|
|
|
|
-- setting colors for tabs layout and tabs sublayout.
|
|
myTabTheme = def { fontName = myFont ++ ":size=12"
|
|
, activeColor = colorSelection
|
|
, inactiveColor = colorBackground
|
|
, activeBorderColor = colorSelection
|
|
, inactiveBorderColor = colorBackground
|
|
, activeTextColor = colorBackground
|
|
, inactiveTextColor = colorForeground
|
|
}
|
|
|
|
-- Theme for showWName which prints current workspace when you change workspaces.
|
|
myShowWNameTheme :: SWNConfig
|
|
myShowWNameTheme = def
|
|
{ swn_font = myFont ++ ":size=32"
|
|
, swn_fade = 1.0
|
|
, swn_bgcolor = colorBackground
|
|
, swn_color = colorForeground
|
|
}
|
|
|
|
|
|
|
|
-- The layout hook
|
|
myLayout = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats
|
|
$ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
|
|
where
|
|
-- I've commented out the layouts I don't use.
|
|
myDefaultLayout =
|
|
tall
|
|
||| noBorders monocle
|
|
||| noBorders tabs
|
|
-- unused layouts
|
|
-- ||| spirals
|
|
-- ||| grid
|
|
-- ||| floats
|
|
-- ||| magnify
|
|
-- ||| threeRow
|
|
-- ||| threeCol
|
|
|
|
|
|
------------------------------------------------------------------------
|
|
-- Window rules:
|
|
|
|
-- Execute arbitrary actions and WindowSet manipulations when managing
|
|
-- a new window. You can use this to, for example, always float a
|
|
-- particular program, or have a client always appear on a particular
|
|
-- workspace.
|
|
|
|
-- To find the property name associated with a program, use
|
|
-- > xprop | grep WM_CLASS
|
|
-- and click on the client you're interested in.
|
|
|
|
-- To match on the WM_NAME, you can use 'title' in the same way that
|
|
-- 'className' and 'resource' are used below.
|
|
myManageHook = composeAll
|
|
[ className =? "Gimp" --> doFloat
|
|
, className =? "guake" --> doIgnore
|
|
, className =? "barrier" --> doFloat
|
|
, className =? "net-runelite-client-RuneLite" --> doFloat
|
|
, className =? "processing-app-Base" --> doFloat
|
|
, className =? "Yad" --> doCenterFloat
|
|
, className =? "net-runelite-launcher-Launcher" --> doIgnore
|
|
, className =? "steam_app_221380" --> doIgnore
|
|
, className =? "zenity" --> doIgnore
|
|
, resource =? "desktop_window" --> doIgnore
|
|
, (className =? "firefox" <&&> resource =? "Dialog")--> doFloat -- Float Firefox Dialog
|
|
, resource =? "kdesktop" --> doIgnore
|
|
, className =? "MusicBrainz Picard" --> doIgnore
|
|
, className =? "Steam" --> doShift ( myWorkspaces !! (7-1) )
|
|
, className =? "discord" --> doShift ( myWorkspaces !! (8-1) )
|
|
, className =? "telegram-desktop" --> doShift ( myWorkspaces !! (8-1) )
|
|
, className =? "slack" --> doShift ( myWorkspaces !! (8-1) )
|
|
, className =? "Pavucontrol" --> doShift ( myWorkspaces !! (5-1) )]
|
|
------------------------------------------------------------------------
|
|
-- Event handling
|
|
|
|
-- * EwmhDesktops users should change this to ewmhDesktopsEventHook
|
|
|
|
-- Defines a custom handler function for X Events. The function should
|
|
-- return (All True) if the default handler is to be run afterwards. To
|
|
-- combine event hooks use mappend or mconcat from Data.Monoid.
|
|
myEventHook = mempty
|
|
-- Status bars and logging
|
|
|
|
-- Perform an arbitrary action on each internal state change or X event.
|
|
-- See the 'XMonad.Hooks.DynamicLog' extension for examples.
|
|
myLogHook :: X ()
|
|
myLogHook = fadeInactiveLogHook fadeAmount
|
|
where fadeAmount = 1.0
|
|
|
|
------------------------------------------------------------------------
|
|
-- Startup hook
|
|
|
|
-- Perform an arbitrary action each time xmonad starts or is restarted
|
|
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
|
|
-- per-workspace layout choices.
|
|
|
|
-- By default, do nothing.
|
|
myStartupHook = do
|
|
-- System apps also in .xprofile
|
|
spawnOnce "setxkbmap dvorak &"
|
|
spawnOnce "nitrogen --restore &"
|
|
spawnOnce "picom --experimental-backend &"
|
|
spawnOnce "numlockx"
|
|
spawnOnce "xsetroot -cursor_name left_ptr"
|
|
|
|
-- Startup apps (tray) and settings
|
|
spawnOnce "blueman-applet &"
|
|
spawnOnce "/usr/lib/kdeconnectd &"
|
|
spawnOnce "kdeconnect-indicator &"
|
|
spawnOnce "dunst &" -- notification daemon
|
|
spawnOnce "nm-applet"
|
|
|
|
-- Startup Applications
|
|
spawnOnce "nextcloud &"
|
|
spawnOnce "slack &"
|
|
spawnOnce "element-desktop --hidden &"
|
|
-- spawnOnce "protonvpn"
|
|
|
|
-- Start trayer last
|
|
spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x282a36 --height 20 &"
|
|
|
|
-- Laptop things
|
|
if isLaptop
|
|
then spawnOnce "powerkit"
|
|
else spawnOnce ""
|
|
------------------------------------------------------------------------
|
|
|
|
main :: IO()
|
|
main = do
|
|
if isLaptop
|
|
then mainLaptop
|
|
else mainDesktop
|
|
|
|
|
|
-- Define main for running on desktops
|
|
mainDesktop :: IO ()
|
|
mainDesktop = do
|
|
|
|
xmproc0 <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-main.hs"
|
|
xmproc1 <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc-sub.hs"
|
|
xmproc2 <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc-sub.hs"
|
|
|
|
xmonad $ ewmh $ docks def
|
|
-- defaults = def
|
|
{
|
|
-- simple stuff
|
|
terminal = myTerminal,
|
|
focusFollowsMouse = myFocusFollowsMouse,
|
|
clickJustFocuses = myClickJustFocuses,
|
|
borderWidth = myBorderWidth,
|
|
modMask = myModMask,
|
|
workspaces = myWorkspaces,
|
|
normalBorderColor = myNormalBorderColor,
|
|
focusedBorderColor = myFocusedBorderColor,
|
|
|
|
-- key bindings
|
|
keys = myKeys,
|
|
mouseBindings = myMouseBindings,
|
|
|
|
-- hooks, layouts
|
|
layoutHook = showWName' myShowWNameTheme myLayout,
|
|
manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks,
|
|
handleEventHook = myEventHook <+> fullscreenEventHook,
|
|
-- logHook = myLogHook,
|
|
logHook = myLogHook <+> dynamicLogWithPP xmobarPP
|
|
{ ppOutput = \x -> hPutStrLn xmproc0 x
|
|
>> hPutStrLn xmproc1 x
|
|
>> hPutStrLn xmproc2 x
|
|
, ppCurrent = xmobarColor colorGreen "" . wrap "[" "]" -- Current workspace in xmobar
|
|
, ppVisible = xmobarColor colorGreen "" . clickable -- Visible but not current workspace
|
|
, ppHidden = xmobarColor colorCyan "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar
|
|
, ppHiddenNoWindows = xmobarColor colorComment "" . clickable -- Hidden workspaces (no windows)
|
|
-- , ppTitle = xmobarColor "#b3afc2" "" . shorten 20 -- Title of active window in xmobar
|
|
, ppSep = "<fc=#6272a4> | </fc>" -- Separators in xmobar
|
|
, ppUrgent = xmobarColor colorRed "" . wrap "!" "!" -- Urgent workspace
|
|
-- , ppExtras = [windowCount] -- # of windows current workspace
|
|
-- , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
|
|
, ppOrder = \(ws:l:t:ex) -> [ws,l]
|
|
},
|
|
startupHook = myStartupHook
|
|
} `additionalKeysP` myEZKeys
|
|
|
|
|
|
-- Define main for running on laptops
|
|
mainLaptop :: IO ()
|
|
mainLaptop = do
|
|
|
|
xmproc <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-single.hs"
|
|
|
|
xmonad $ ewmh $ docks def
|
|
-- defaults = def
|
|
{
|
|
-- simple stuff
|
|
terminal = myTerminal,
|
|
focusFollowsMouse = myFocusFollowsMouse,
|
|
clickJustFocuses = myClickJustFocuses,
|
|
borderWidth = myBorderWidth,
|
|
modMask = myModMask,
|
|
workspaces = myWorkspaces,
|
|
normalBorderColor = myNormalBorderColor,
|
|
focusedBorderColor = myFocusedBorderColor,
|
|
|
|
-- key bindings
|
|
keys = myKeys,
|
|
mouseBindings = myMouseBindings,
|
|
|
|
-- hooks, layouts
|
|
layoutHook = showWName' myShowWNameTheme myLayout,
|
|
manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks,
|
|
handleEventHook = myEventHook <+> fullscreenEventHook,
|
|
-- logHook = myLogHook,
|
|
logHook = myLogHook <+> dynamicLogWithPP xmobarPP
|
|
{ ppOutput = \x -> hPutStrLn xmproc x
|
|
, ppCurrent = xmobarColor colorGreen "" . wrap "[" "]" -- Current workspace in xmobar
|
|
, ppVisible = xmobarColor colorGreen "" . clickable -- Visible but not current workspace
|
|
, ppHidden = xmobarColor colorCyan "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar
|
|
, ppHiddenNoWindows = xmobarColor colorComment "" . clickable -- Hidden workspaces (no windows)
|
|
-- , ppTitle = xmobarColor "#b3afc2" "" . shorten 20 -- Title of active window in xmobar
|
|
, ppSep = "<fc=#6272a4> | </fc>" -- Separators in xmobar
|
|
, ppUrgent = xmobarColor colorRed "" . wrap "!" "!" -- Urgent workspace
|
|
-- , ppExtras = [windowCount] -- # of windows current workspace
|
|
-- , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]
|
|
, ppOrder = \(ws:l:t:ex) -> [ws,l]
|
|
},
|
|
startupHook = myStartupHook
|
|
} `additionalKeysP` myEZKeys
|