diff --git a/features/desktopish/xmobar/default.nix b/features/desktopish/xmobar/default.nix index 7d8c934..22e706a 100644 --- a/features/desktopish/xmobar/default.nix +++ b/features/desktopish/xmobar/default.nix @@ -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; diff --git a/features/desktopish/xmobar/xmobar-srid/.vscode/tasks.json b/features/desktopish/xmobar/xmobar-srid/.vscode/tasks.json new file mode 100644 index 0000000..50cd243 --- /dev/null +++ b/features/desktopish/xmobar/xmobar-srid/.vscode/tasks.json @@ -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 + } + } + ] +} \ No newline at end of file diff --git a/features/desktopish/xmobar/xmobar-srid/Main.hs b/features/desktopish/xmobar/xmobar-srid/Main.hs index ba7c38a..7bf5ef7 100644 --- a/features/desktopish/xmobar/xmobar-srid/Main.hs +++ b/features/desktopish/xmobar/xmobar-srid/Main.hs @@ -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 "Hello World!!" + +{- Run $ Date "%a %b %_d %Y * %H:%M:%S" "theDate" 10, +Run $ + Battery + [ "--template", + "", + "--Low", + "15", + -- battery specific options start here. + "--", + "--off", + " ()" + ] + 100, +Run $ MultiCpu [] 100 +-} diff --git a/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal b/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal index d5d6d65..746a40e 100644 --- a/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal +++ b/features/desktopish/xmobar/xmobar-srid/xmobar-srid.cabal @@ -25,3 +25,5 @@ executable xmobar-srid , text -- hs-source-dirs: default-language: Haskell2010 + ghc-options: -threaded -rtsopts -with-rtsopts=-N -funbox-strict-fields + \ No newline at end of file