xmonad: switched to isaacBrown92 as a base

This commit is contained in:
Serĉanto de Scio 2022-12-07 21:17:00 +10:00
parent 4e8ee48cd2
commit 93031832aa
Signed by: sercanto
GPG key ID: 7DBA9F5689EFB6AA

View file

@ -1,149 +1,269 @@
import XMonad import XMonad
import XMonad.Config.Desktop import XMonad.Actions.CopyWindow
import Data.Monoid import XMonad.Actions.DynamicProjects
import Data.Word import XMonad.Actions.Navigation2D
import Graphics.X11.Xlib import XMonad.Actions.SpawnOn
import Graphics.X11.Xlib.Extras
import XMonad.Actions.UpdatePointer (updatePointer)
import XMonad.Hooks.DynamicLog import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks import XMonad.Hooks.StatusBar
import XMonad.Hooks.UrgencyHook import XMonad.Layout.Decoration
import XMonad.Layout.Accordion import XMonad.Layout.Hidden
import XMonad.Layout.Circle import XMonad.Layout.Spacing
import XMonad.Layout.GridVariants
import XMonad.Layout.LayoutCombinators hiding ( (|||) )
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Layout.ThreeColumns
import XMonad.Prompt import XMonad.Prompt
import XMonad.Prompt.Shell ( shellPrompt ) import XMonad.Util.EZConfig
import XMonad.Util.Run(spawnPipe) import XMonad.Util.Loggers
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Util.NamedWindows
import XMonad.Util.Run
import XMonad.Util.SpawnOnce import XMonad.Util.SpawnOnce
import System.IO
import qualified XMonad.StackSet as W ----------
-- Init --
----------
colourBackground :: String main :: IO ()
colourBackground = "#1c1c1c" main =
xmonad
-- ewmhFullscreen and ewmh don't commute, they MUST be in this order
. dynamicProjects projects
. ewmhFullscreen
. ewmh
. withNavigation2DConfig myNav2DConf
. (`additionalKeysP` myKeybinds)
. withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey
$ myConfig
colourForeground :: String myConfig :: XConfig (Choose (ModifiedLayout Spacing Tall) (Choose (Mirror (ModifiedLayout Spacing Tall)) Full))
colourForeground = "#d0d0d0" myConfig =
def
highlightBackground :: String { borderWidth = 3,
highlightBackground = "#ffaf00" clickJustFocuses = False,
focusFollowsMouse = False,
highlightForeground :: String focusedBorderColor = myFocusedBorderColor,
highlightForeground = "#1c1c1c" layoutHook = myLayout,
modMask = mod4Mask,
-- Set xmobar as my task bar. startupHook = myStartupHook,
myWsBar :: String normalBorderColor = myNormalBorderColor,
myWsBar = "xmobar -v -d $HOME/.xmobarrc" workspaces = myWorkspaces
myXPConfig = def -- Configure the prompt's appearance
{ alwaysHighlight = True
, bgColor = colourBackground
, bgHLight = highlightBackground
, fgColor = colourForeground
, fgHLight = highlightForeground
, font = "xft:Open Sans:size=9"
, position = Top
, promptBorderWidth = 0
} }
backgroundCmd = "feh --bg-scale ~/Documents/Images/Posters/STEVEs.jpeg" myStartupHook :: X ()
compositeMgr = "xcompmgr -f -C -n -D 3" myStartupHook = do
hdmi1Off = "xrandr --output eDP-1 --primary --output HDMI-1 --off" spawnOnce "feh --bg-fill ~/.dotfiles/media/backgrounds/forest-1.jpg --bg-fill ~/.dotfiles/media/backgrounds/forest-2.jpg --bg-fill ~/.dotfiles/media/backgrounds/forest-3.jpg"
musicCmd = "mpd"
nextcloudCmd = "nextcloud"
notificationCmd = "lxqt-notificationd"
screensaverCmd = "xscreensaver --no-splash"
screensaverLock = "xscreensaver-command -lock"
screenshot = "scrot" -- Screenshot the entire screen
screenshotWindow = "sleep 0.2; scrot -s" -- Screenshot the selected window
settingsDaemon = "xsettingsd"
terminalCmd = "termonad"
trayerCmd = "trayer --edge top --SetPartialStrut false --width 7 --transparent true --alpha 0 --tint 0x1C1C1C --height 20 --monitor primary"
main = do ------------
-- Make sure that HDMI is turned off by default -- xmobar --
spawn hdmi1Off -- Turn off HDMI-1 before we set the modes ------------
wsbar <- spawnPipe myWsBar
xmonad $ ewmh desktopConfig myXmobarPP :: PP
{ focusFollowsMouse = False myXmobarPP =
, terminal = terminalCmd -- Set the default terminal def
, startupHook = do { ppCurrent = wrap "" "" . xmobarBorder "Top" blue 2,
spawnOnce screensaverCmd -- Launch the screen saver ppExtras = [logTitles formatFocused formatUnfocused],
spawnOnce backgroundCmd -- Set the background wallpaper ppHidden = xmobarBase0 . wrap "[" "]",
spawnOnce compositeMgr -- Launch the composite manager ppHiddenNoWindows = const "",
spawnOnce settingsDaemon -- Launch the settings daemon ppOrder = \[ws, l, _, wins] -> [" " ++ ws, l], -- and wins to [ws, l] to get window names
spawnOnce trayerCmd -- Launch the system tray, configured to work correctly with dual monitors ppSep = xmobarMagenta "",
spawnOnce notificationCmd -- Launch the notification service ppTitleSanitize = xmobarStrip,
spawnOnce musicCmd -- Launch the music playing daemon ppUrgent = xmobarRed . wrap (xmobarYellow "!") (xmobarYellow "!")
spawnOnce nextcloudCmd -- Launch the cloud service }
, manageHook = manageDocks <+> manageHook desktopConfig where
, layoutHook = avoidStruts $ layoutHook desktopConfig formatFocused :: String -> String
||| ThreeColMid 1 (3/100) (1/2) formatFocused = wrap (xmobarBase0 "[") (xmobarBase0 "]") . xmobarBlue . ppWindow
||| spiral (6/7)
||| Grid (16/10) formatUnfocused :: String -> String
||| Circle formatUnfocused = wrap (xmobarBase0 "[") (xmobarBase0 "]") . xmobarBase0 . ppWindow
||| simpleTabbed
||| Accordion ppWindow :: String -> String
||| SplitGrid T 1 2 (1/3) (16/10) (5/100) ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
-- ||| (ThreeColMid 1 (3/100) (1/3) *//* Full)
, handleEventHook = handleEventHook desktopConfig <+> docksEventHook xmobarBase0, xmobarBase2, xmobarYellow, xmobarRed, xmobarMagenta, xmobarBlue :: String -> String
, logHook = dynamicLogWithPP xmobarPP xmobarBase0 = xmobarColor base0 ""
{ ppOutput = hPutStrLn wsbar xmobarBase2 = xmobarColor base2 ""
, ppCurrent = xmobarColor "#ffaf00" "" . wrap "[" "]" xmobarYellow = xmobarColor yellow ""
, ppVisible = xmobarColor "#5fafd7" "" . wrap "(" ")" xmobarRed = xmobarColor red ""
, ppLayout = xmobarColor "#5fafd7" "" xmobarMagenta = xmobarColor magenta ""
, ppTitle = xmobarColor "#ffaf00" "" . shorten 50 xmobarBlue = xmobarColor blue ""
} >> updatePointer (0.25, 0.25) (0.25, 0.25) -- near the top-left
, modMask = mod4Mask -- Rebind Mod to the Windows key ----------------
--, borderWidth = 1 -- Workspaces --
} `additionalKeys` ----------------
-- Use Xmonad's built-in launcher
[ ((mod4Mask, xK_p), shellPrompt myXPConfig) myWorkspaces :: [String]
-- Lock the screen myWorkspaces = [wsGEN, wsCOM, wsINT]
, ((0, 0x1008ff2d), spawn screensaverLock)
-- XF86ScreenSaver wsCOM, wsDOT, wsGEN, wsINT, wsLOG, wsMUS, wsREC, wsVID :: String
, ((mod4Mask .|. controlMask, xK_l), spawn screensaverLock) wsCOM = "com"
, ((controlMask, xK_Print), spawn screenshotWindow) wsDOT = "dot"
, ((0, xK_Print), spawn screenshot) wsGEN = "gen"
-- Turn on the eDP-1 port and set it as the primary display wsINT = "int"
, ((mod4Mask .|. shiftMask, xK_e), spawn wsLOG = "log"
"xrandr --output eDP-1 --primary --auto" wsMUS = "mus"
) wsREC = "rec"
-- Turn off the eDP-1 port wsVID = "vid"
, ((mod4Mask .|. controlMask, xK_e), spawn
"xrandr --output eDP-1 --off" --------------
) -- Projects --
-- Turn off the HDMI port --------------
, ((mod4Mask .|. controlMask, xK_h), spawn
"xrandr --output HDMI-1 --off" projects :: [Project]
) projects =
-- Turn on the HDMI-1 port and set it as the secondary display [ Project
, ((mod4Mask .|. shiftMask, xK_h), spawn { projectName = wsCOM,
"xrandr --newmode 3840x2160 266.75 3840 4056 4456 5072 2160 2163 2168 2192 -hsync +vsync; xrandr --addmode HDMI-1 3840x2160; xrandr --output eDP-1 --off --output HDMI-1 --mode 3840x2160; feh --bg-scale ~/Documents/Images/Posters/STEVEs.jpeg" projectDirectory = "~/",
) projectStartHook = Just $ do
, ((0 , 0x1008FF11), spawn "amixer set Master 2%-") -- XF86AudioLowerVolume spawnOn wsCOM element
-- , ((mod4Mask , xK_Down), spawn "amixer set Master 2%-") },
, ((0 , 0x1008FF12), spawn "amixer set Master toggle") -- XF86AudioMute Project
, ((0 , 0x1008FF13), spawn "amixer set Master 2%+") -- XF86AudioRaiseVolume { projectName = wsDOT,
-- , ((mod4Mask , xK_Up), spawn "amixer set Master 2%+") projectDirectory = "~/.dotfiles",
, ((0 , 0x1008FF14), spawn "mpc toggle") -- Play/pause projectStartHook = Just $ do spawnOn wsDOT $ editor ++ " ."
-- , ((mod4Mask , xK_End), spawn "mpc toggle") },
, ((mod4Mask .|. controlMask, xK_space), spawn "mpc toggle") -- Play/pause Project
, ((0 , 0x1008FF15), spawn "mpc stop") -- Stop { projectName = wsGEN,
, ((0 , 0x1008FF16), spawn "mpc prev") -- XF86AudioPrevious projectDirectory = "~/",
, ((mod4Mask , xK_Left), spawn "mpc prev") -- prev projectStartHook = Nothing
, ((0 , 0x1008FF17), spawn "mpc next") -- XF86AudioNext },
, ((mod4Mask , xK_Right), spawn "mpc next") -- Next Project
-- XF86MonBrightnessUp { projectName = wsINT,
, ((0 , 0x1008ff02), spawn "xbrightness +5000") projectDirectory = "~/",
-- XF86MonBrightnessDown projectStartHook = Just $ do spawnOn wsINT browser
, ((0 , 0x1008ff03), spawn "xbrightness -5000") },
Project
{ projectName = wsLOG,
projectDirectory = "~/",
projectStartHook = Just $ do spawnOn wsLOG logseq
},
Project
{ projectName = wsMUS,
projectDirectory = "~/",
projectStartHook = Just $ do spawnOn wsMUS musicPlayer
},
Project
{ projectName = wsREC,
projectDirectory = "~/Videos/obs-recordings",
projectStartHook = Just $ do spawnOn wsREC obs
},
Project
{ projectName = wsVID,
projectDirectory = "~/",
projectStartHook = Nothing
}
] ]
promptTheme :: XPConfig
promptTheme =
def
{ bgColor = base03,
bgHLight = base02,
fgColor = base0,
fgHLight = base1,
height = 31,
position = Top,
promptBorderWidth = 0
}
------------------
-- Applications --
------------------
browser, discord, editor, element, incognitoBrowser, launcher, logseq, musicPlayer, obs, screenshot, terminal :: String
browser = "brave"
discord = "discord"
editor = "codium"
element = "element-desktop"
incognitoBrowser = "brave -incognito"
launcher = "rofi -show drun -m DisplayPort-1"
logseq = "logseq"
musicPlayer = "spotify"
obs = "obs"
screenshot = "flameshot gui"
terminal = "wezterm"
--------------
-- Keybinds --
--------------
myKeybinds :: [(String, X ())]
myKeybinds =
[ -- Spawn/kill
("M-b", spawn browser),
("M-i", spawn incognitoBrowser),
("M-f", spawn screenshot),
("M-<Space>", spawn launcher),
("M-<Return>", spawn Main.terminal),
("M-<Backspace>", kill1),
-- Layout control
("M-z", sendMessage Expand),
("M-d", sendMessage NextLayout),
("M-v", sendMessage Shrink),
("M-C-d", setLayout $ Layout (layoutHook myConfig)),
("M-C-w", shiftToProjectPrompt promptTheme),
("M-w", switchProjectPrompt promptTheme)
]
-- Navigation
++ zipWith (makeKeybindZipper "M-" windowGo) htnsKeys dirs
++ zipWith (makeKeybindZipper "M-" windowSwap) gcrlKeys dirs
++ zipWith (makeKeybindZipper "M-C-" screenGo) htnsKeys dirs
++ zipWith (makeKeybindZipper "M-C-" windowToScreen) gcrlKeys dirs
where
makeKeybindZipper :: String -> (direction2D -> Bool -> xUnit) -> String -> direction2D -> (String, xUnit)
makeKeybindZipper startOfCmd func restOfCmd dir = (startOfCmd ++ restOfCmd, func dir True)
dirs :: [Direction2D]
dirs = [L, D, U, R]
gcrlKeys :: [String]
gcrlKeys = ["g", "c", "r", "l"]
htnsKeys :: [String]
htnsKeys = ["h", "t", "n", "s"]
------------
-- Layout --
------------
myLayout :: Choose (ModifiedLayout Spacing Tall) (Choose (Mirror (ModifiedLayout Spacing Tall)) Full) a
myLayout = tiled ||| Mirror tiled ||| Full
where
tiled = spacingWithEdge 5 $ Tall nmaster delta ratio
nmaster = 1
ratio = 1 / 2
delta = 3 / 100
----------------
-- Navigation --L
----------------
myNav2DConf :: Navigation2DConfig
myNav2DConf = def {defaultTiledNavigation = sideNavigation}
-------------
-- Palette --
-------------
-- solarized
base03, base02, base01, base00, base0, base1, base2, base3, yellow, orange, red, magenta, violet, blue, cyan, green :: String
base03 = "#002b36"
base02 = "#073642"
base01 = "#586e75"
base00 = "#657b83"
base0 = "#839496"
base1 = "#93a1a1"
base2 = "#eee8d5"
base3 = "#fdf6e3"
yellow = "#b58900"
orange = "#cb4b16"
red = "#dc322f"
magenta = "#d33682"
violet = "#6c71c4"
blue = "#268bd2"
cyan = "#2aa198"
green = "#859900"
-- uses of palette
myNormalBorderColor :: String
myNormalBorderColor = base03
myFocusedBorderColor :: String
myFocusedBorderColor = base1