xmobar still stinky UX

This commit is contained in:
Sridhar Ratnakumar 2021-11-20 14:40:57 -05:00
parent 404ea984b1
commit 0ab19ef678
4 changed files with 62 additions and 3 deletions

View file

@ -8,12 +8,14 @@ in
description = "Xmobar";
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
# ExecStart = "${xmobarPkg}/bin/xmobar-srid";
ExecStart = "${pkgs.xmobar}/bin/xmobar -v -x 2 -f xft:Consolas:size=12 -c '[Run PipeReader \"/etc/nixos/pipe\" \"thepipe\"]' -t \"%%thepipe%%\"";
ExecStart = "${xmobarPkg}/bin/xmobar-srid";
# ExecStart = "${pkgs.xmobar}/bin/xmobar -v -x 2 -f xft:Consolas:size=12 -c '[Run PipeReader \"/etc/nixos/pipe\" \"thepipe\"]' -t \"%%thepipe%%\"";
Restart = "on-abnormal";
};
};
environment.systemPackages = [ xmobarPkg ];
# Battery widget requires this.
services.upower = {
enable = true;

View file

@ -0,0 +1,22 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build System & Restart Xmobar",
"type": "shell",
// TODO: Run in tmux (for those cases which kills X server)
"command": "bash",
"args": [
"-c",
"cd /etc/nixos && sudo nixos-rebuild switch && systemctl restart --user xmobar"
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View file

@ -4,4 +4,37 @@ import Xmobar
main :: IO ()
main =
xmobar defaultConfig
xmobar $
-- Override ref: https://github.com/jaor/xmobar/blob/master/src/Xmobar/App/Config.hs#L37
defaultConfig
{ font = "xft:FiraCode:size=12",
bgColor = "#02183b",
fgColor = "#dce8fc",
allDesktops = True,
persistent = True,
commands =
[Run HelloWorld]
}
data HelloWorld = HelloWorld
deriving (Read, Show)
instance Exec HelloWorld where
alias HelloWorld = "hw"
run HelloWorld = return "<fc=red>Hello World!!</fc>"
{- Run $ Date "%a %b %_d %Y * %H:%M:%S" "theDate" 10,
Run $
Battery
[ "--template",
"<acstatus>",
"--Low",
"15",
-- battery specific options start here.
"--",
"--off",
"<left> (<timeleft>)"
]
100,
Run $ MultiCpu [] 100
-}

View file

@ -25,3 +25,5 @@ executable xmobar-srid
, text
-- hs-source-dirs:
default-language: Haskell2010
ghc-options: -threaded -rtsopts -with-rtsopts=-N -funbox-strict-fields