diff --git a/home/jacob.nix b/home/jacob.nix index f3c3b18..a1080e2 100644 --- a/home/jacob.nix +++ b/home/jacob.nix @@ -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; + }; }; }; } diff --git a/home/xmobarrc b/home/xmobarrc new file mode 100644 index 0000000..7b2c036 --- /dev/null +++ b/home/xmobarrc @@ -0,0 +1,45 @@ +Config { overrideRedirect = False + , font = "xft:iosevka-9" + , bgColor = "#1f1f1f" + , fgColor = "#f8f8f2" + , position = TopW L 90 + , commands = [ + --Run Weather "EGPF" + --[ "--template", " °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", " (%)", + "-L", "10", "-H", "80", "-p", "3", + "--", "-O", "On - ", "-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", "" + , "--suffix" , "True" + , "--" + , "--on", "" + ] + , Run Memory ["--template", "Mem: %"] 10 + , Run Swap [] 10 + , Run Date "%a %Y-%m-%d %H:%M" "date" 10 + , Run XMonadLog + ] + , sepChar = "%" + , alignSep = "}{" + , template = "%XMonadLog% }{ Sound: %alsa:default:Master% | %cpu% | %memory% * %swap% | BAT1: %battery% | %date% " + } diff --git a/home/xmonad.hs b/home/xmonad.hs new file mode 100644 index 0000000..3676447 --- /dev/null +++ b/home/xmonad.hs @@ -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", "-", "=" ]