switch datetime module to xmobar

This commit is contained in:
Schrottkatze 2023-12-06 20:07:14 +01:00
parent 31ba7cac22
commit b7987a87b4
4 changed files with 33 additions and 41 deletions

View file

@ -1,7 +1,12 @@
import Xmobar import Xmobar
config :: Config fc code content = "<fc=" ++ code ++ ">" ++ content ++ "</fc>"
config =
sep = fc "#7c6f64"
icon = fc "#d65d0e"
config :: Config
config =
defaultConfig defaultConfig
{ font = "FiraCode Nerd Font", { font = "FiraCode Nerd Font",
allDesktops = True, allDesktops = True,
@ -9,19 +14,14 @@
bgColor = "#282828", bgColor = "#282828",
fgColor = "#ebdbb2", fgColor = "#ebdbb2",
commands = commands =
-- [ Run XMonadLog,
-- Run $ Memory ["t", "Mem: <usedratio>%"] 10,
-- Run $ Kbd [],
-- Run $ Date "%a %_d %b %Y <fc=#ee9a00>%H:%M:%S</fc>" "date" 10
-- ],
[ Run $ Memory ["t", "Mem: <usedratio>%"] 10, [ Run $ Memory ["t", "Mem: <usedratio>%"] 10,
Run $ Kbd [], Run $ Kbd [],
Run $ Date "%a %_d %b %Y <fc=#ee9a00>%H:%M:%S</fc>" "date" 10 Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10
], ],
template = "%kbd% | %date% | %memory%", template = "}{ %date%",
alignSep = "}{", alignSep = "}{",
position = TopH 24 position = TopH 24
} }
main :: IO () main :: IO ()
main = xmobar config -- or: configFromArgs config >>= xmobar main = xmobar config -- or: configFromArgs config >>= xmobar

View file

@ -25,6 +25,7 @@ import XMonad.Prompt.Layout
import XMonad.StackSet qualified as W import XMonad.StackSet qualified as W
import XMonad.Actions.NoBorders import XMonad.Actions.NoBorders
import XMonad.Util.EZConfig import XMonad.Util.EZConfig
import XMonad.Hooks.ServerMode
myKeys conf@(XConfig {XMonad.modMask = modm}) = myKeys conf@(XConfig {XMonad.modMask = modm}) =
M.fromList $ M.fromList $
@ -142,10 +143,8 @@ myStartupHook = do
spawn "pgrep nm-applet || nm-applet" spawn "pgrep nm-applet || nm-applet"
spawn "pgrep mullvad-gui || mullvad-vpn" spawn "pgrep mullvad-gui || mullvad-vpn"
spawn "feh --bg-fill ~/Pictures/wallpaper.jpg" spawn "feh --bg-fill ~/Pictures/wallpaper.jpg"
killStatusBar "xmobar"
spawnStatusBar "xmobar"
xmeowbar = statusBarProp "xmobar" $ pure xmobarPP xmeowbar = statusBarProp "~/.config/xmobar/xmobar" $ pure xmobarPP
polybar = statusBarProp "polybar" $ pure xmobarPP polybar = statusBarProp "polybar" $ pure xmobarPP
barSpawner 0 = pure $ xmeowbar <> polybar barSpawner 0 = pure $ xmeowbar <> polybar
barSpawner _ = mempty barSpawner _ = mempty
@ -168,5 +167,6 @@ defaults =
mouseBindings = myMouseBindings, mouseBindings = myMouseBindings,
layoutHook =myLayout, layoutHook =myLayout,
manageHook = myManageHook, manageHook = myManageHook,
startupHook = myStartupHook startupHook = myStartupHook,
handleEventHook = serverModeEventHook
} }

View file

@ -45,7 +45,7 @@
separator-foreground = "\${colors.disabled}"; separator-foreground = "\${colors.disabled}";
font-0 = "FiraCode Nerd Font"; font-0 = "FiraCode Nerd Font";
modules-left = "xworkspaces xwindow"; modules-left = "xworkspaces xwindow";
modules-right = "memory cpu wlan battery date"; modules-right = "memory cpu wlan battery";
cursor-click = "pointer"; cursor-click = "pointer";
cursor-scroll = "ns-resize"; cursor-scroll = "ns-resize";
enable-ipc = true; enable-ipc = true;
@ -138,14 +138,6 @@
]; ];
}; };
"module/date" = {
type = "internal/date";
interval = 1;
date = "%Y%{F#7c6f64}-%{F#ebdbb2}%m%{F#7c6f64}-%{F#ebdbb2}%d";
time = "%H%{F#7c6f64}:%{F#ebdbb2}%M%{F#7c6f64}:%{F#ebdbb2}%S";
label = "%{F#d65d0e}󰃭%{F#ebdbb2} %date% %{F#d65d0e}󱑌%{F#ebdbb2} %time%";
};
"settings" = { "settings" = {
screenchange-reload = true; screenchange-reload = true;
pseudo-transparency = true; pseudo-transparency = true;

View file

@ -14,12 +14,12 @@
programs.xmobar = { programs.xmobar = {
enable = true; enable = true;
}; };
home.file."xmobar.hs" = { home.file."xmobar.hs" = rec {
source = ../../haskell/xmobar/xmobar.hs; source = ../../haskell/xmobar/xmobar.hs;
target = ".config/xmobar/xmobar.hs"; target = ".config/xmobar/xmobar.hs";
onChange = '' onChange = ''
export PATH=${lib.makeBinPath [xmobarGhc]}:$PATH ${xmobarGhc}/bin/ghc -threaded ${target}
${pkgs.xmobar}/bin/xmobar --recompile ${pkgs.busybox}/bin/pkill xmobar
${pkgs.haskellPackages.xmonad}/bin/xmonad --restart ${pkgs.haskellPackages.xmonad}/bin/xmonad --restart
''; '';
}; };