all repos — xmonad-config @ 3da3ace194a06ff8867257a38e57decb8a12358a

personal xmonad config

major refactoring

change color theme
fix haddock
fix gridselect theme
fix tabbed theme
la-ninpre leobrekalini@gmail.com
Wed, 15 Jun 2022 22:00:21 +0300
commit

3da3ace194a06ff8867257a38e57decb8a12358a

parent

6b079b837b24650a8aff7fb78f5d3dea11c80c3b

3 files changed, 153 insertions(+), 182 deletions(-)

jump to
M lib/LaNinpreConfig.hslib/LaNinpreConfig.hs

@@ -1,9 +1,11 @@

-{-# OPTIONS_HADDOCK ignore-exports, prune #-} +{-# OPTIONS_HADDOCK prune #-} ---------------------------------------------------------------------- -- | -- Module : LaNinpreConfig -- Description : personal stuff for xmonad -- Maintainer : la-ninpre +-- License : ISC +-- Copyright : la-ninpre <aaoth AT aaoth DOT xyz> -- -- this module exists because i find it more convenient to manage some things -- from here instead of doing it right in xmonad config

@@ -11,25 +13,46 @@ --

---------------------------------------------------------------------- module LaNinpreConfig ( - -- * global -- $global + + -- * fonts + -- $fonts myFonts, - myColor, - myModMask, + + -- * colors + -- $colors + MyColorTheme(..), + def, + myNormColor, + myFocusColor, + + -- * software constants + -- $software myTerminal, myBrowser, myGeminiClient, myFileMgr, myMocp, myEditor, + + -- * hooks + -- $hooks + myManageHook, + myStartupHook, + + -- * scratchpads + -- $scratchpads + myScratchPads, + + -- * workspaces + -- $workspaces + myWorkspaces, + + -- * misc + -- $misc + myModMask, myBorderWidth, - myNormColor, - myFocusColor, myAppGrid, - myWorkspaces, - myScratchPads, - myManageHook, - myStartupHook ) where import Data.List

@@ -49,18 +72,12 @@ --

-- constants and functions starting with \'my\' are exported and used in -- xmonad config. --- * constants - --- $constants --- these are set up to avoid unnecessary repetition of replacements, when --- things change. - --- ** fonts +-- $fonts -- --- $fonts -- default fonts and helper functions for them. -- | default lato font +fontLatoDef :: String fontLatoDef = fontXft "Lato" "regular" 14 -- | font for @ShowWMName@

@@ -72,6 +89,7 @@ --

-- sitelen pona pona variant -- -- > fontSWN = fontXft "sitelen\\-pona" "regular" 80 +fontSWN :: String fontSWN = fontXft "linja pona" "regular" 80 -- | fonts list

@@ -80,7 +98,7 @@ myFonts = [ fontLatoDef

, fontSWN ] --- *** helper functions +-- ** helper functions -- -- | font constructor --

@@ -88,7 +106,7 @@ -- it is just a helper function to simplify the process of specifying font

-- with xft. fontXft :: String -- ^ font family -> String -- ^ font style - -> Int -- ^ font style + -> Int -- ^ font size -> String fontXft font style size = intercalate ":" [ "xft"

@@ -99,86 +117,46 @@ , "antialias=true"

, "hinting=true" ] - --- ** colors - --- $colorTheme +-- $colors -- --- > bg #19191a --- > fg #cadcde --- > grey0 #232324 --- > grey1 #363638 --- > grey2 #66666a --- > black #393838 --- > red #c74444 --- > green #7f9848 --- > yellow #d7a06d --- > blue #4e96d5 --- > magenta #bc5fa7 --- > cyan #55b795 --- > white #c3b2f7 --- > black-bright #5a514b --- > red-bright #ed7c68 --- > green-bright #c7ea76 --- > yellow-bright #ffdb9d --- > blue-bright #a6d5fe --- > magenta-bright #edbbe9 --- > cyan-bright #7fe2c5 --- > white-bright #e2d6ff +-- color theme and stuff --- | color theme structure -myColorTheme :: [(String,String)] -myColorTheme = [ ("bg", "#19191a") - , ("fg", "#cadcde") - , ("gray0", "#232324") - , ("gray1", "#363638") - , ("gray2", "#5c5c60") - , ("gray3", "#66666a") - , ("gray4", "#ececf0") - , ("black", "#393838") - , ("red", "#c74444") - , ("green", "#7f9848") - , ("yellow", "#d7a06d") - , ("blue", "#4e96d5") - , ("magenta", "#bc5fa7") - , ("cyan", "#55b795") - , ("white", "#c3b2f7") - , ("black-bright", "#5a514b") - , ("red-bright", "#ed7c68") - , ("green-bright", "#c7ea76") - , ("yellow-bright", "#ffdb9d") - , ("blue-bright", "#a6d5fe") - , ("magenta-bright", "#edbbe9") - , ("cyan-bright", "#7fe2c5") - , ("white-bright", "#e2d6ff") - ] +myColorTheme :: MyColorTheme +myColorTheme = MyColorTheme "#111111" "#ccbbcc" "#223333" "#ffaaaa" -- | unfocused window border colour myNormColor :: String -myNormColor = myColor "gray0" +myNormColor = col_bg def -- | focused window border colour myFocusColor :: String -myFocusColor = myColor "blue" +myFocusColor = col_bg_alt def --- *** helper functions +-- | color theme datatype -- --- | get color from color theme -myColor :: String -> String -myColor c = fromMaybe "" (M.lookup c theme) - where - theme = fromList myColorTheme +-- 'Default' instance gives simple four-color colorscheme +data MyColorTheme = MyColorTheme { + col_bg :: String, + col_fg :: String, + col_bg_alt :: String, + col_fg_alt :: String +} + +instance Default MyColorTheme where + def = myColorTheme --- ** software constants +-- $software -- +-- these are just contstants + -- | set terminal emulator myTerminal :: String myTerminal = "alacritty" -- | set default browser myBrowser :: String -myBrowser = "brave" +myBrowser = "firefox" -- | set gemini client myGeminiClient :: String

@@ -199,63 +177,37 @@ -- | set editor

myEditor :: String myEditor = myTerminal ++ " -e vim" --- ** other constants +-- $hooks -- --- | set windows key as modkey -myModMask :: KeyMask -myModMask = mod4Mask +-- hooks for xmonad config --- | specify border width -myBorderWidth :: Dimension -myBorderWidth = 1 - --- | app grid for @GridSelect@ layout -myAppGrid :: [(String,String)] -myAppGrid = [ ("discord", "discord") - , ("steam", "steam") - , ("cadence", "cadence") - , ("blender", "blender") - , ("inkscape", "inkscape") - , ("obs", "obs") - , ("gimp", "gimp") - , ("element", "element-desktop") - , ("ardour", "ardour6") - , ("kdenlive", "kdenlive") - , ("writer", "lowriter") - ] - --- * hooks --- -- ** startup hook --- --- $startupHook -- -- start things at login. -- | actual instance myStartupHook :: X () myStartupHook = do - spawnOnce "dunst &" - spawnOnce "lxsession &" - spawnOnce "picom &" - spawnOnce "nm-applet &" - spawnOnce "volumeicon &" + --spawnOnce "dunst &" + --spawnOnce "lxsession &" + --spawnOnce "picom &" + --spawnOnce "nm-applet &" + --spawnOnce "volumeicon &" spawnOnce "setxkbmap -layout us,ru -option 'grp:alt_shift_toggle'" spawnOnce "kbdd" - spawnOnce ("trayer --edge top " + {-spawnOnce ("trayer --edge top " ++ "--align right " ++ "--widthtype request " ++ "--SetDockType true --SetPartialStrut true --expand false " ++ "--monitor 0 --transparent true --alpha 0 " ++ "--tint 0x19191a --height 24 &" ) + -} spawnOnce "~/.fehbg &" setWMName "LG3D" -- ** manage hook -- --- $managehook --- -- @doFloat@ forces a window to float. useful for dialog boxes and such. -- using @doShift (myWorkspaces !! 7)@ sends program to workspace 8 -- i'm doing it this way because otherwise i would have to write out the full

@@ -307,8 +259,6 @@ , className =? "obs" --> doShift ( myWorkspaces !! 8 )

, isFullscreen --> doFullFloat ] <+> namedScratchpadManageHook myScratchPads --- * scratchpads --- -- $scratchpads -- -- currently i have:

@@ -385,8 +335,6 @@ where

pw = ceiling (1920 * w) ph = ceiling (1080 * h) --- * workspaces --- -- $workspaces -- -- i've got three ways of specifying them. first one is pretty close to the

@@ -425,6 +373,7 @@ -- > , "\xee1e" -- kule

-- > ] -- | workspaces container +myWorkspaces :: [String] myWorkspaces = [ "\xe661\xe921" -- sona nanpa , "\xe63b" -- musi , "\xe649" -- pali

@@ -435,3 +384,29 @@ , "\xe62a\xf200" -- lipu suli

, "\xf010\xe915" -- sitelen tawa , "\xf010\xf107" -- sitelen ante ] + +-- $misc +-- +-- misc constants + +-- | set windows key as modkey +myModMask :: KeyMask +myModMask = mod4Mask + +-- | specify border width +myBorderWidth :: Dimension +myBorderWidth = 1 + +-- | app grid for 'GridSelect' layout +myAppGrid :: [(String,String)] +myAppGrid = [ ("discord" ,"discord" ) + , ("steam" ,"steam" ) + , ("mail" ,"thunderbird") + , ("files" ,"thunar" ) + , ("blender" ,"blender-3.1") + , ("inkscape" ,"inkscape" ) + , ("obs" ,"obs" ) + , ("gimp" ,"gimp" ) + , ("ardour" ,"ardour6" ) + , ("kdenlive" ,"kdenlive" ) + ]
M xmobar/xmobarrcxmobar/xmobarrc

@@ -10,8 +10,8 @@ --, "xft:sitelen\-pona:pixelsize=20:antialias=true:hinting=true"

-- linja pona , "xft:linja pona:pixelsize=22:antialias=true:hinting=true" ] - , bgColor = "#19191a" - , fgColor = "#cadcde" + , bgColor = "#111111" + , fgColor = "#ccbbcc" , position = TopSize C 100 24 , lowerOnStart = True , hideOnStart = False

@@ -26,7 +26,7 @@ --, "<fc=#7f9848><fn=1>\xf017</fn> uptime: <days>d</fc>"

-- sitelen pona pona by jackhumbert --, "<fc=#7f9848><fn=3>\xee6b\xee64\xee3d</fn><days></fc>" -- linja pona - , "<fc=#7f9848><fn=3>\xe66b\xe664\xe63d</fn><days></fc>" + , "<fn=3>\xe66b\xe664\xe63d</fn><days>" -- tenpo suno nanpa ] 60 , Run Cpu

@@ -36,7 +36,7 @@ --, "<fc=#c74444><fn=1>\xf108</fn>cpu: <total>%</fc>"

-- sitelen pona pona by jackhumbert --, "<fc=#c74444><fn=3>\xee24\xee4d\xee0e\xee3d</fn>: <total>%</fc>" -- linja pona - , "<fc=#c74444><fn=3>\xe624\xe730\xe60e\xe63d</fn>: <total>%</fc>" + , "<fn=3>\xe624\xe730\xe60e\xe63d</fn>: <total>%" -- lawa pi ilo sona , "-H", "50", "--high", "red" ] 20

@@ -47,7 +47,7 @@ --, "<fc=#d7a06d><fn=1>\xf538</fn> ram: <used>M (<usedratio>%)</fc>"

-- sitelen pona pona by jackhumbert --, "<fc=#d7a06d><fn=3>\xee53\xee49</fn>: <used>M (<usedratio>%)</fc>" -- linja pona - , "<fc=#d7a06d><fn=3>\xe653\xf174</fn>: <used>M (<usedratio>%)</fc>" + , "<fn=3>\xe653\xf174</fn>: <used>M (<usedratio>%)" -- poki pali ] 20 , Run DiskU

@@ -57,7 +57,7 @@ --, "<fc=#4e96d5><fn=1>\xf0a0</fn> hdd: <free> free</fc>")

-- sitelen pona pona by jackhumbert --, "<fc=#4e96d5><fn=3>\xee53\xee08</fn>: <free></fc>") -- linja pona - , "<fc=#4e96d5><fn=3>\xe653\xf109</fn>: <free></fc>") + , "<fn=3>\xe653\xf109</fn>: <free>") -- poki awen ] [] 60 , Run Kbd

@@ -71,8 +71,8 @@ --, ("ru", "<fc=#55b795><fn=3>\xee6c\xee4d\xee0e\xee60 losi</fn></fc>")

--] -- toki pi ilo sitelen -- linja pona - [ ("us", "<fc=#55b795><fn=3>\xe66c\xe730\xe619\xe660 [INLI]</fn></fc>") - , ("ru", "<fc=#55b795><fn=3>\xe66c\xe730\xe619\xe660 [LOSI]</fn></fc>") + [ ("us", "<fn=3>\xe66c\xe730\xe619\xe660 [INLI]</fn>") + , ("ru", "<fn=3>\xe66c\xe730\xe619\xe660 [LOSI]</fn>") ] -- toki pi ilo sitelen , Run Date

@@ -81,7 +81,7 @@ --"<fc=#ceced2><fn=1>\xf017</fn> %d %b %Y %R</fc>"

-- sitelen pona pona by jackhumbert --"<fc=#ceced2><fn=3>\xee6b</fn> %d-%m-%Y %R</fc>" -- linja pona - "<fc=#ceced2><fn=3>\xe66b</fn> %d-%m-%Y %R</fc>" + "<fn=3>\xe66b</fn> %d-%m-%Y %R" -- tenpo "date" 50 , Run Network "wg0"

@@ -91,7 +91,7 @@ --, "<fc=#ceced2><fn=1>\xf6d5</fn></fc>"

-- sitelen pona pona by jackhumbert --, "<fc=#ceced2><fn=3>\xee01</fn></fc>" -- linja pona - , "<fc=#ceced2><fn=3>\xe601</fn></fc>" + , "<fn=3>\xe601</fn>" -- akesi ] 20 , Run Com ".xmonad/xmobar/trayer-padding-icon.sh"

@@ -103,5 +103,5 @@ , alignSep = "}{"

-- ... }{ <fc=#ceced2><fn=2></fn> ... -- normie -- ... }{ <fc=#ceced2><fn=3> linu</fn> ... -- sitelen pona pona by jackhumbert -- ... }{ <fc=#ceced2><fn=3> [_L_IN_U]</fn> ... -- linja pona - , template = " <action=`dm-logout`><icon=la_ninpre.xpm/></action> %s% %UnsafeStdinReader% }{ <fc=#ceced2><fn=3> [LINU]</fn> <action=`alacritty --class Alacritty,splash --hold -e neofetch`>%uname%</action></fc> %s% %uptime% %s% <action=`alacritty -e htop`>%cpu%</action> %s% <action=`alacritty -e htop`>%memory%</action> %s% <action=`alacritty --class Alacritty,splash --hold -e df -h / /timeshift /home`>%disku%</action> %s% %kbd% %s% <action=`alacritty -e calcurse`>%date%</action> %s% %wg0% %trayerpad%" + , template = " <action=`dm-logout`><icon=la_ninpre.xpm/></action> %s% %UnsafeStdinReader% }{ <fn=3> [LINU]</fn> <action=`alacritty --class Alacritty,splash --hold -e neofetch`>%uname%</action> %s% %uptime% %s% <action=`alacritty -e htop`>%cpu%</action> %s% <action=`alacritty -e htop`>%memory%</action> %s% <action=`alacritty --class Alacritty,splash --hold -e df -h / /timeshift /home`>%disku%</action> %s% %kbd% %s% <action=`alacritty -e calcurse`>%date%</action> %s% %wg0% %trayerpad%" }
M xmonad.hsxmonad.hs

@@ -1,10 +1,11 @@

{-# OPTIONS_HADDOCK prune #-} -{-# OPTIONS_GHC -Wno-deprecations #-} ---------------------------------------------------------------------- -- | -- Description : la-ninpre xmonad config -- Maintainer : la-ninpre +-- License : ISC +-- Copyright : la-ninpre <aaoth AT aaoth DOT xyz> -- -- personal xmonad config. based heavily on distrotube's config. -- i've added some stuff and toki pona fonts

@@ -123,9 +124,9 @@ -- * grid select

-- -- $gridSelect -- --- this section provides theming of @GridSelect@ stuff. +-- this section provides theming of 'GridSelect' stuff. -- --- here, @GridSelect@ is used for following things: +-- here, 'GridSelect' is used for following things: -- -- * spawning some frequently used programs --

@@ -133,37 +134,30 @@ -- * moving to desired window

-- -- * bringing the desired window to the current workspace --- | custom colorizer that colors windows based on their class -myColorizer :: Window -> Bool -> X (String, String) -myColorizer = colorRangeFromClassName - (0x00,0x00,0x00) -- lowest inactive bg - (0xbd,0x9c,0xf9) -- highest inactive bg - (0xc7,0x92,0xea) -- active bg - (0xc0,0xa7,0x9a) -- inactive fg - (0x28,0x2c,0x34) -- active fg +-- | custom colorizer for 'gridselect' +-- +-- essentially, it is just plain theme +myColorizer :: a -> Bool -> X (String, String) +myColorizer _ active = if active then return (col_bg_alt def, col_fg_alt def) + else return (col_bg def, col_fg def) --- | gridSelect config -myGridConfig :: p -> GSConfig Window -myGridConfig colorizer = (buildDefaultGSConfig myColorizer) +-- | custom 'GSConfig' +myGridConfig :: GSConfig a +myGridConfig = (buildDefaultGSConfig myColorizer) { gs_cellheight = 40 , gs_cellwidth = 200 , gs_cellpadding = 6 , gs_originFractX = 0.5 , gs_originFractY = 0.5 + , gs_bordercolor = col_bg_alt def , gs_font = head myFonts } -- | spawn selected programs with grid select -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 = head myFonts - } +-- +-- it is esentially the same as 'spawnSelected' but allows to specify program aliases +mySpawnSelected :: [(String, String)] -> X () +mySpawnSelected lst = gridselect myGridConfig lst >>= flip whenJust spawn -- * layouts --

@@ -171,7 +165,7 @@ -- ** spacing raw helper functions

-- -- $spacingHelpers -- --- theese are making calls to spacingRaw simpler to write +-- these make calls to 'spacingRaw' simpler to write -- | for many windows mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a

@@ -215,15 +209,18 @@ $ mySpacing 4

$ ThreeColMid 1 (3/100) (1/2) -- | setting colors for tabs layout and tabs sublayout. -myTabTheme = def - { fontName = head myFonts - , activeColor = myColor "gray4" - , inactiveColor = myColor "gray0" - , activeBorderColor = myColor "gray4" - , inactiveBorderColor = myColor "gray0" - , activeTextColor = myColor "bg" - , inactiveTextColor = myColor "fg" - } +myTabTheme :: Theme +myTabTheme = def { fontName = head myFonts + , activeTextColor = col_fg_alt def + , activeColor = col_bg_alt def + , activeBorderWidth = 0 + , inactiveTextColor = col_fg def + , inactiveColor = col_bg def + , inactiveBorderWidth = 0 + , urgentTextColor = col_bg_alt def + , urgentColor = col_fg_alt def + , urgentBorderWidth = 0 + } -- ** layout hook

@@ -249,8 +246,8 @@ myShowWNameTheme :: SWNConfig

myShowWNameTheme = def { swn_font = myFonts !! 1 , swn_fade = 0.7 - , swn_bgcolor = myColor "bg" - , swn_color = myColor "fg" + , swn_bgcolor = col_bg def + , swn_color = col_fg def } -- * workspaces

@@ -337,9 +334,9 @@ , ("C-M1-h", decScreenSpacing 4) -- Decrease screen spacing

, ("C-M1-l", incScreenSpacing 4) -- Increase screen spacing -- Grid Select (MOD-g followed by a key) - , ("M-g g", spawnSelected' myAppGrid) -- grid select favorite apps - , ("M-g t", goToSelected $ myGridConfig myColorizer) -- goto selected window - , ("M-g b", bringSelected $ myGridConfig myColorizer) -- bring selected window + , ("M-g g", mySpawnSelected myAppGrid) -- grid select favorite apps + , ("M-g t", goToSelected myGridConfig) -- goto selected window + , ("M-g b", bringSelected myGridConfig) -- bring selected window -- Windows navigation , ("M-m", windows W.focusMaster) -- Move focus to the master window

@@ -412,11 +409,10 @@ , ("<XF86AudioPlay>", spawn (myMocp ++ " --toggle-pause"))

, ("<XF86AudioPrev>", spawn (myMocp ++ " --previous")) , ("<XF86AudioNext>", spawn (myMocp ++ " --next")) , ("<XF86AudioMute>", spawn (myMocp ++ " -v 0")) - , ("<XF86AudioLowerVolume>", spawn (myMocp ++ " -v -1")) - , ("<XF86AudioRaiseVolume>", spawn (myMocp ++ " -v +1")) - , ("<XF86HomePage>", spawn "brave https://aaoth.xyz") - , ("<XF86Search>", spawn "dm-websearch") - , ("<XF86Mail>", runOrRaise "geary" (resource =? "geary")) + , ("<XF86AudioLowerVolume>", spawn (myMocp ++ " -v -5")) + , ("<XF86AudioRaiseVolume>", spawn (myMocp ++ " -v +5")) + , ("<XF86HomePage>", spawn "firefox https://aaoth.xyz") + , ("<XF86Mail>", runOrRaise "thunderbird" (resource =? "thunderbird")) , ("<XF86Calculator>", namedScratchpadAction myScratchPads "calculator") , ("<XF86Sleep>", spawn "dm-logout") ]

@@ -445,20 +441,20 @@ , logHook = dynamicLogWithPP

$ namedScratchpadFilterOutWorkspacePP $ xmobarPP { ppOutput = hPutStrLn xmproc - , ppCurrent = xmobarColor (myColor "green-bright") "" + , ppCurrent = xmobarColor (col_fg_alt def) "" . wrap "<fn=3>" "</fn>" -- toki pona . wrap "[" "]" -- . wrap " " " " -- normal - , ppVisible = xmobarColor (myColor "green-bright") "" . clickable - , ppHidden = xmobarColor (myColor "blue-bright") "" + , ppVisible = xmobarColor (col_fg_alt def) "" . clickable + , ppHidden = xmobarColor (col_fg def) "" . wrap "" "'" . clickable - , ppHiddenNoWindows = xmobarColor (myColor "gray2") "" . clickable + , ppHiddenNoWindows = xmobarColor (col_bg_alt def) "" . clickable --, ppHiddenNoWindows = myHiddenNoWindows - , ppTitle = xmobarColor (myColor "gray4") "" . shorten 60 - , ppSep = xmobarColor (myColor "gray3") "" " | " + , ppTitle = xmobarColor (col_fg def) "" . shorten 60 + , ppSep = xmobarColor (col_bg_alt def) "" " | " , ppWsSep = " " - , ppUrgent = xmobarColor (myColor "yellow") "" . wrap "!" "!" + , ppUrgent = xmobarColor (col_fg_alt def) "" . wrap "!" "!" , ppExtras = [myWindowCountLogger] , ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] }