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,27 +1,27 @@
import Xmobar
import Xmobar
config :: Config
config =
defaultConfig
{ font = "FiraCode Nerd Font",
allDesktops = True,
alpha = 255,
bgColor = "#282828",
fgColor = "#ebdbb2",
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 $ Kbd [],
Run $ Date "%a %_d %b %Y <fc=#ee9a00>%H:%M:%S</fc>" "date" 10
],
template = "%kbd% | %date% | %memory%",
alignSep = "}{",
position = TopH 24
}
fc code content = "<fc=" ++ code ++ ">" ++ content ++ "</fc>"
main :: IO ()
main = xmobar config -- or: configFromArgs config >>= xmobar
sep = fc "#7c6f64"
icon = fc "#d65d0e"
config :: Config
config =
defaultConfig
{ font = "FiraCode Nerd Font",
allDesktops = True,
alpha = 255,
bgColor = "#282828",
fgColor = "#ebdbb2",
commands =
[ Run $ Memory ["t", "Mem: <usedratio>%"] 10,
Run $ Kbd [],
Run $ Date (icon "\983277" ++ " %Y" ++ sep "-" ++ "%m" ++ sep "-" ++ "%d " ++ icon "\988236" ++ " %H" ++ sep ":" ++ "%M" ++ sep ":" ++ "%S ") "date" 10
],
template = "}{ %date%",
alignSep = "}{",
position = TopH 24
}
main :: IO ()
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.Actions.NoBorders
import XMonad.Util.EZConfig
import XMonad.Hooks.ServerMode
myKeys conf@(XConfig {XMonad.modMask = modm}) =
M.fromList $
@ -142,10 +143,8 @@ myStartupHook = do
spawn "pgrep nm-applet || nm-applet"
spawn "pgrep mullvad-gui || mullvad-vpn"
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
barSpawner 0 = pure $ xmeowbar <> polybar
barSpawner _ = mempty
@ -168,5 +167,6 @@ defaults =
mouseBindings = myMouseBindings,
layoutHook =myLayout,
manageHook = myManageHook,
startupHook = myStartupHook
startupHook = myStartupHook,
handleEventHook = serverModeEventHook
}

View file

@ -45,7 +45,7 @@
separator-foreground = "\${colors.disabled}";
font-0 = "FiraCode Nerd Font";
modules-left = "xworkspaces xwindow";
modules-right = "memory cpu wlan battery date";
modules-right = "memory cpu wlan battery";
cursor-click = "pointer";
cursor-scroll = "ns-resize";
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" = {
screenchange-reload = true;
pseudo-transparency = true;

View file

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