mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 22:59:15 +00:00
xmobar: write configuration in haskell
This commit is contained in:
parent
6e74d28502
commit
bc274fc677
2 changed files with 85 additions and 48 deletions
|
|
@ -1,50 +1,26 @@
|
||||||
{
|
{pkgs, ...}: {
|
||||||
programs.xmobar = {
|
home.packages = let
|
||||||
enable = true;
|
wrapped-xmobar = pkgs.symlinkJoin {
|
||||||
# XMobar's config file is not a segment of valid Haskell source code -- it is instead a DSL
|
name = "xmobar";
|
||||||
# Note how `Run` handles its arguments properly without parens?
|
paths = with pkgs; [
|
||||||
#
|
# Xmobar wants ghc
|
||||||
# Also xmobar wants GHC if we use it as a library, and I'm lazy, you probably want to keep it this way.
|
(haskellPackages.ghcWithPackages (self: [
|
||||||
extraConfig = ''
|
self.xmobar
|
||||||
Config { overrideRedirect = False
|
]))
|
||||||
, font = "Iosevka 13"
|
# The executable
|
||||||
, bgColor = "#000000"
|
xmobar
|
||||||
, fgColor = "#FFFFFF"
|
];
|
||||||
, position = BottomH 30
|
};
|
||||||
, commands = [ Run Date "%a %d %H:%M:%S" "date" 10
|
in [
|
||||||
, Run Com "tomorrow"
|
wrapped-xmobar
|
||||||
[ "--target", "2025-08-14"
|
];
|
||||||
, "--target", "2025-08-21"
|
|
||||||
] "" 3600
|
xdg.configFile = {
|
||||||
, Run Battery
|
"xmobar" = {
|
||||||
[ "-t", "<left> (<timeleft>"
|
# Xmobar uses the directory to compile too,
|
||||||
, "-H", "70"
|
# Linking the entire folder directly would make the directory not writable
|
||||||
, "-L", "20"
|
recursive = true;
|
||||||
, "-h", "green"
|
source = "${./xmobar}";
|
||||||
, "-n", "orange"
|
};
|
||||||
, "-l", "red"
|
|
||||||
, "--"
|
|
||||||
, "-P"
|
|
||||||
, "-A", "20"
|
|
||||||
, "-a", "notify-send -u critical \"Battery Low\" \"Please charge your battery\""
|
|
||||||
]
|
|
||||||
60
|
|
||||||
, Run Com "powerprofilesctl" [ "get" ] "" 60
|
|
||||||
, Run XMonadLog
|
|
||||||
, Run
|
|
||||||
Weather "LFRN"
|
|
||||||
[ "-t", "<station>: <tempC>C"
|
|
||||||
, "-L","10", "-H", "25"
|
|
||||||
, "--normal", "white"
|
|
||||||
, "--high", "orange"
|
|
||||||
, "--low", "blue"
|
|
||||||
]
|
|
||||||
9000
|
|
||||||
]
|
|
||||||
, sepChar = "%"
|
|
||||||
, alignSep = "}{"
|
|
||||||
, template = " %XMonadLog% }{ %LFRN% | %battery%, %powerprofilesctl%) | %date%, j%tomorrow% "
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
61
nix/configurations/vanadium/home/xmobar/xmobar.hs
Normal file
61
nix/configurations/vanadium/home/xmobar/xmobar.hs
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
import Xmobar
|
||||||
|
|
||||||
|
import Data.Function ((&))
|
||||||
|
|
||||||
|
config =
|
||||||
|
defaultConfig
|
||||||
|
{ overrideRedirect = False
|
||||||
|
, font = "Iosevka 13"
|
||||||
|
, bgColor = "#000000"
|
||||||
|
, fgColor = "#FFFFFF"
|
||||||
|
, position = BottomH 30
|
||||||
|
, commands =
|
||||||
|
[ Run $ Date "%a %d %H:%M:%S" "date" (1 &second)
|
||||||
|
, Run $
|
||||||
|
Com
|
||||||
|
"tomorrow"
|
||||||
|
[ "--target", "2025-08-14"
|
||||||
|
, "--target", "2025-08-21"
|
||||||
|
]
|
||||||
|
""
|
||||||
|
(60 &minute)
|
||||||
|
, Run $
|
||||||
|
Battery
|
||||||
|
[ "-t", "<left> (<timeleft>"
|
||||||
|
, "-H", "70"
|
||||||
|
, "-L", "20"
|
||||||
|
, "-h", "green"
|
||||||
|
, "-n", "orange"
|
||||||
|
, "-l", "red"
|
||||||
|
, "--"
|
||||||
|
, "-P"
|
||||||
|
, "-A", "20"
|
||||||
|
, "-a", "notify-send -u critical \"Battery Low\" \"Please charge your battery\""
|
||||||
|
]
|
||||||
|
(6 &second)
|
||||||
|
, Run $ Com "powerprofilesctl" ["get"] "" (6 &second)
|
||||||
|
, Run XMonadLog
|
||||||
|
, Run $
|
||||||
|
Weather
|
||||||
|
"LFRN"
|
||||||
|
[ "-t", "<station>: <tempC>C"
|
||||||
|
, "-L","10", "-H", "25"
|
||||||
|
, "--normal", "white"
|
||||||
|
, "--high", "orange"
|
||||||
|
, "--low", "blue"
|
||||||
|
]
|
||||||
|
(15 &minute)
|
||||||
|
]
|
||||||
|
, sepChar = "%"
|
||||||
|
, alignSep = "}{"
|
||||||
|
, template = " %XMonadLog% }{ %LFRN% | %battery%, %powerprofilesctl%) | %date%, j%tomorrow% "
|
||||||
|
}
|
||||||
|
|
||||||
|
second :: Int -> Int
|
||||||
|
second = (* 10)
|
||||||
|
|
||||||
|
minute :: Int -> Int
|
||||||
|
minute = (* 60) . second
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = xmobar config
|
||||||
Loading…
Add table
Add a link
Reference in a new issue