From d1858c51b53e3ebcd841416490c17f7b22334e6a Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Wed, 26 Aug 2026 04:26:19 +0530 Subject: desktop: replaced waybar with eww - added some basic configuration options for eww - removed waybar --- modules/desktop/eww/default.nix | 27 ++++++++++++++ modules/desktop/eww/eww.scss.mustache | 56 ++++++++++++++++++++++++++++ modules/desktop/eww/scss.nix | 7 ++++ modules/desktop/eww/yuck.nix | 69 +++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 modules/desktop/eww/default.nix create mode 100644 modules/desktop/eww/eww.scss.mustache create mode 100644 modules/desktop/eww/scss.nix create mode 100644 modules/desktop/eww/yuck.nix (limited to 'modules/desktop/eww') diff --git a/modules/desktop/eww/default.nix b/modules/desktop/eww/default.nix new file mode 100644 index 0000000..e22f8c6 --- /dev/null +++ b/modules/desktop/eww/default.nix @@ -0,0 +1,27 @@ +{ + config, + lib, + ... +}: +{ + imports = [ + ./yuck.nix + ]; + + options.desktop.eww = { + package = lib.mkOption { + type = lib.types.package; + readOnly = true; + default = config.programs.eww.package; + description = "The eww package to use."; + }; + }; + + config = { + programs.eww = { + enable = true; + systemd.enable = true; + scssConfig = builtins.readFile (import ./scss.nix { inherit config; }); + }; + }; +} diff --git a/modules/desktop/eww/eww.scss.mustache b/modules/desktop/eww/eww.scss.mustache new file mode 100644 index 0000000..a791633 --- /dev/null +++ b/modules/desktop/eww/eww.scss.mustache @@ -0,0 +1,56 @@ +* { + font-family: "Fira Code Nerd Font"; + font-size: 18px; + min-height: 0; +} + +window#eww-bar { + background: transparent; +} + +.bar-container { + background: #{{base00}}; + border: 1px solid #{{base07}}; + padding: 5px 0; + margin: 5px; +} + +.workspaces { + background: transparent; + padding: 0; + margin: 0; +} + +.workspaces button { + background-image: none; + box-shadow: none; + text-shadow: none; + outline: none; + border: none; + padding: 5px 10px; + color: #{{base07}}; + border: 1px solid #{{base07}}; + border-color: #{{base07}}; + border-radius: 0; + min-width: 0; + min-height: 0; + margin: 0 5px; + font-size: 24px; + background: transparent; +} + +.workspaces button:hover { + background: #{{base00}}; + border: 1px solid #{{base07}}; + box-shadow: none; +} + +.workspaces button:active { + background-image: none; + box-shadow: none; +} + +.workspaces button:hover { + background: #{{base00}}; + border-color: #{{base07}}; +} diff --git a/modules/desktop/eww/scss.nix b/modules/desktop/eww/scss.nix new file mode 100644 index 0000000..b535c3a --- /dev/null +++ b/modules/desktop/eww/scss.nix @@ -0,0 +1,7 @@ +{ + config, + ... +}: +config.scheme { + template = builtins.readFile ./eww.scss.mustache; +} diff --git a/modules/desktop/eww/yuck.nix b/modules/desktop/eww/yuck.nix new file mode 100644 index 0000000..d61f70a --- /dev/null +++ b/modules/desktop/eww/yuck.nix @@ -0,0 +1,69 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + config = lib.mkIf config.desktop.enable { + home.file.".config/eww/icons/fallback.svg".text = '' + + + + ''; + + programs.eww.yuckConfig = + let + workspaces = pkgs.writeShellApplication { + name = "eww-workspaces"; + # This automatically adds these packages to the script's PATH + runtimeInputs = with pkgs; [ + niri + jq + ]; + + text = '' + #!/usr/bin/env bash + # Outputs JSON array of workspaces for eww bar + niri msg -j workspaces | jq -c 'sort_by(.idx)' + ''; + }; + in + '' + (defpoll time :interval "10s" "date '+%H:%M'") + (defpoll date :interval "60s" "date '+%d/%m'") + (defpoll workspaces :interval "1s" :initial "[]" "${lib.getExe workspaces}") + (defpoll active-windows :interval "1s" "${lib.getExe config.scripts.eww-active-windows.package}") + + (defwindow bar + :monitor 0 + :geometry (geometry + :x "0px" + :y "0px" + :width "50px" + :height "100%" + :anchor "top right") + :stacking "fg" + :focusable "none" + :reserve (struts :distance "50px" :side "right") + (bar-content)) + + (defwidget bar-content [] + (box :orientation "v" :space-evenly false :class "bar-container" + (box :orientation "v" :space-evenly false :valign "start" :class "top-section" + (workspaces-widget) + (windows-widget)))) + + (defwidget workspaces-widget [] + (box :orientation "v" :space-evenly false :spacing 4 :halign "center" :class "workspaces" + (for ws in workspaces + (button :class {ws.is_active ? "ws-active" : "ws-inactive"} + :onclick "niri msg action focus-workspace ''${ws.idx}" + (label :text "''${ws.idx}"))))) + + (defwidget windows-widget [] + (box :orientation "v" :space-evenly false :spacing 4 :halign "center" :class "windows" + (image :class "win-icon" :path "/tmp/test-icon.svg" :image-width 20 :image-height 20))) + ''; + }; +} -- cgit v1.2.3