Switch to xmonad

This commit is contained in:
Jacob Hinkle 2022-09-07 19:36:55 -04:00
parent f805c215cc
commit 5c7f13ad49
3 changed files with 142 additions and 3 deletions

View File

@ -154,6 +154,10 @@
};
};
tmux = import ./tmux.nix;
xmobar = {
enable = true;
extraConfig = builtins.readFile ./xmobarrc;
};
zsh = {
enable = true;
enableSyntaxHighlighting = true;
@ -207,9 +211,23 @@
xsession = {
enable = true;
windowManager.i3 = {
enable = true;
config = import ./i3.nix pkgs;
windowManager = {
i3 = {
enable = false;
config = import ./i3.nix pkgs;
};
xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = haskellPackages: with haskellPackages; [
#dbus
#List
#monad-logger
xmonad
xmonad-contrib
];
config = ./xmonad.hs;
};
};
};
}

45
home/xmobarrc Normal file
View File

@ -0,0 +1,45 @@
Config { overrideRedirect = False
, font = "xft:iosevka-9"
, bgColor = "#1f1f1f"
, fgColor = "#f8f8f2"
, position = TopW L 90
, commands = [
--Run Weather "EGPF"
--[ "--template", "<weather> <tempF>°F"
--, "-L", "35"
--, "-H", "85"
--, "--low" , "lightblue"
--, "--normal", "#f8f8f2"
--, "--high" , "red"
--] 36000
-- ,
Run Cpu
[ "-L", "3"
, "-H", "50"
, "--high" , "red"
, "--normal", "green"
] 10
, Run BatteryP ["BAT1"]
["-t", "<acstatus><watts> (<left>%)",
"-L", "10", "-H", "80", "-p", "3",
"--", "-O", "<fc=green>On</fc> - ", "-i", "",
"-L", "-15", "-H", "-5",
"-l", "red", "-m", "blue", "-h", "green",
"-a", "notify-send -u critical 'Battery running out!!'",
"-A", "3"]
600
, Run Alsa "default" "Master"
[ "--template", "<volumestatus>"
, "--suffix" , "True"
, "--"
, "--on", ""
]
, Run Memory ["--template", "Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Date "%a %Y-%m-%d <fc=#8be9fd>%H:%M</fc>" "date" 10
, Run XMonadLog
]
, sepChar = "%"
, alignSep = "}{"
, template = "%XMonadLog% }{ Sound: %alsa:default:Master% | %cpu% | %memory% * %swap% | BAT1: %battery% | %date% "
}

76
home/xmonad.hs Normal file
View File

@ -0,0 +1,76 @@
-- See https://xmonad.org/TUTORIAL.html
import XMonad
import XMonad.Actions.RotSlaves
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.Loggers
import XMonad.Layout.Magnifier
import XMonad.Layout.ThreeColumns
main :: IO ()
main = xmonad
. ewmhFullscreen
. ewmh
-- . xmobarProp
. withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey
$ myConfig
myConfig = def
{ terminal = "kitty"
, modMask = mod1Mask
, borderWidth = 1
-- , workspaces = myWorkspaces
, layoutHook = myLayout
}
`additionalKeysP`
[ ("M-'", spawn "qutebrowser")
, ("M-s", spawn "scrot -s")
, ("M-a", rotAllUp)
, ("M-f", rotAllDown)
]
myLayout = tiled ||| Mirror tiled ||| Full ||| threeCol
where
--threeCol = magnifiercz' 1.3 $ ThreeColMid nmaster delta ratio
threeCol = ThreeColMid nmaster delta ratio
tiled = Tall nmaster delta ratio
nmaster = 1 -- Default number of windows in the master pane
ratio = 1/2 -- Default proportion of screen occupied by master pane
delta = 3/100 -- Percent of screen to increment by when resizing panes
myXmobarPP :: PP
myXmobarPP = def
{ ppSep = magenta ""
, ppTitleSanitize = xmobarStrip
, ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2
, ppHidden = white . wrap " " ""
, ppHiddenNoWindows = lowWhite . wrap " " ""
, ppUrgent = red . wrap (yellow "!") (yellow "!")
, ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
, ppExtras = [logTitles formatFocused formatUnfocused]
}
where
formatFocused = wrap (white "[") (white "]") . magenta . ppWindow
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow
-- | Windows should have *some* title, which should not not exceed a
-- sane length.
ppWindow :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
blue, lowWhite, magenta, red, white, yellow :: String -> String
magenta = xmobarColor "#ff79c6" ""
blue = xmobarColor "#bd93f9" ""
white = xmobarColor "#f8f8f2" ""
yellow = xmobarColor "#f1fa8c" ""
red = xmobarColor "#ff5555" ""
lowWhite = xmobarColor "#bbbbbb" ""
--myWorkspaces = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "-", "=" ]