diff options
Diffstat (limited to 'modules/desktop')
22 files changed, 163 insertions, 372 deletions
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 70011b8..fa4ef5f 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -10,7 +10,7 @@ ./wl-clipboard ./xdg ./niri - ./waybar + ./eww ]; options.desktop = { 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 = '' + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> + <rect x="2" y="2" width="20" height="20" rx="3" fill="none" stroke="#c8ccd4" stroke-width="2"/> + </svg> + ''; + + 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))) + ''; + }; +} diff --git a/modules/desktop/niri/default.nix b/modules/desktop/niri/default.nix index bfa361f..fbcb812 100644 --- a/modules/desktop/niri/default.nix +++ b/modules/desktop/niri/default.nix @@ -69,6 +69,9 @@ }; layout = { gaps = 5; + struts = { + right = 60; + }; center-focused-column = "on-overflow"; default-column-width = { proportion = 1.0; @@ -91,17 +94,6 @@ "-m" "fill" ]; - - # only create upto workspace 9, niri creates a trailing workspace - "workspace \"1\"" = { }; - "workspace \"2\"" = { }; - "workspace \"3\"" = { }; - "workspace \"4\"" = { }; - "workspace \"5\"" = { }; - "workspace \"6\"" = { }; - "workspace \"7\"" = { }; - "workspace \"8\"" = { }; - "workspace \"9\"" = { }; }; }; } diff --git a/modules/desktop/waybar/bar/default.nix b/modules/desktop/waybar/bar/default.nix deleted file mode 100644 index dee84e4..0000000 --- a/modules/desktop/waybar/bar/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ config }: -{ - mainBar = import ./main.nix { inherit config; }; -} diff --git a/modules/desktop/waybar/bar/main.nix b/modules/desktop/waybar/bar/main.nix deleted file mode 100644 index 08d816e..0000000 --- a/modules/desktop/waybar/bar/main.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: -{ - layer = "top"; - position = "top"; - height = 30; - - fixed-center = false; - expand-center = true; - - modules-left = [ "niri/workspaces" ]; - modules-center = [ "niri/window" ]; - modules-right = [ - "pulseaudio" - "battery" - "network" - "custom/usque" - "memory" - "cpu" - "clock#time" - "clock#date" - ]; -} diff --git a/modules/desktop/waybar/default.nix b/modules/desktop/waybar/default.nix deleted file mode 100644 index 927d76f..0000000 --- a/modules/desktop/waybar/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -{ - options.desktop.waybar = { - package = lib.mkOption { - type = lib.types.package; - readOnly = true; - default = config.programs.waybar.package; - description = "The waybar package to use."; - }; - }; - - config = lib.mkIf config.desktop.enable { - programs.waybar = { - enable = true; - systemd.enable = true; - - settings = lib.mkMerge [ - (import ./bar { inherit config; }) - (import ./module { inherit config lib pkgs; }) - ]; - - style = builtins.readFile ( - config.scheme { - template = builtins.readFile ./style.mustache.css; - extension = ".css"; - } - ); - }; - }; -} diff --git a/modules/desktop/waybar/lib.nix b/modules/desktop/waybar/lib.nix deleted file mode 100644 index ca7a5a8..0000000 --- a/modules/desktop/waybar/lib.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, ... }: -with config.scheme.withHashtag; -let - mkIcon = color: icon: "<span foreground='${color}' font_size='120%'>${icon}</span>"; - icons = { - "Default" = mkIcon base07 ""; - "Chromium" = mkIcon "#4285F4" ""; - "Kitty" = mkIcon "#F5A97F" ""; - "VLC" = mkIcon "#FF8800" ""; - "Swayimg" = mkIcon "#7EC699" ""; - "Zathura" = mkIcon "#E06C75" ""; - "Heroic" = mkIcon "#4B93FF" ""; - "Steam" = mkIcon "#1B2838" ""; - "Bruno" = mkIcon "#F97316" ""; - "VSCodium" = mkIcon "#3993EE" ""; - "VirtManager" = mkIcon "#AD8AFF" ""; - "Opencode" = mkIcon "#98C379" ""; - "Yazi" = mkIcon "#56B6C2" ""; - "Chawan" = mkIcon "#8BE9FD" ""; - "bluetui" = mkIcon "#BD93F9" ""; - "impala" = mkIcon "#50FA7B" ""; - "neomutt" = mkIcon "#FFB86C" ""; - "Rofi" = mkIcon "#BD93F9" ""; - "Aria2" = mkIcon "#8BE9FD" ""; - "screen-recording" = mkIcon "#FF5555" ""; - "system-monitor" = mkIcon "#50FA7B" ""; - "neovim" = mkIcon "#005900" ""; - "gopass" = mkIcon "#FFD700" ""; - }; -in -{ - inherit mkIcon icons; -} diff --git a/modules/desktop/waybar/module/battery.nix b/modules/desktop/waybar/module/battery.nix deleted file mode 100644 index e17d7ea..0000000 --- a/modules/desktop/waybar/module/battery.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base09; -in -{ - format = "${mkIcon iconColor "{icon}"} {capacity}%"; - format-charging = "${mkIcon iconColor ""} {capacity}%"; - format-plugged = "${mkIcon iconColor ""} {capacity}%"; - format-alt = "{time} {icon}"; - format-icons = [ - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - ]; -} diff --git a/modules/desktop/waybar/module/cpu.nix b/modules/desktop/waybar/module/cpu.nix deleted file mode 100644 index e153b32..0000000 --- a/modules/desktop/waybar/module/cpu.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base0D; -in -{ - format = "${mkIcon iconColor ""} {usage}%"; - interval = 2; -} diff --git a/modules/desktop/waybar/module/date.nix b/modules/desktop/waybar/module/date.nix deleted file mode 100644 index 9f54514..0000000 --- a/modules/desktop/waybar/module/date.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base0E; -in -{ - format = "${mkIcon iconColor ""} {:%d/%m/%Y}"; - tooltip-format = "{:%A, %d/%m/%Y}"; - interval = 60; -} diff --git a/modules/desktop/waybar/module/default.nix b/modules/desktop/waybar/module/default.nix deleted file mode 100644 index b504387..0000000 --- a/modules/desktop/waybar/module/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - lib, - ... -}@input: -let - inherit (import ../lib.nix input) mkIcon icons; - - args = input // { - inherit mkIcon icons; - }; - - modules = { - "battery" = ./battery.nix; - "cpu" = ./cpu.nix; - "clock#date" = ./date.nix; - "memory" = ./memory.nix; - "network" = ./network.nix; - "clock#time" = ./time.nix; - "custom/usque" = ./usque.nix; - "pulseaudio" = ./volume.nix; - "niri/window" = ./window.nix; - "niri/workspaces" = ./workspaces.nix; - }; -in -{ - mainBar = lib.mapAttrs (_name: path: import path args) modules; -} diff --git a/modules/desktop/waybar/module/memory.nix b/modules/desktop/waybar/module/memory.nix deleted file mode 100644 index 53174c2..0000000 --- a/modules/desktop/waybar/module/memory.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base0F; -in -{ - format = "${mkIcon iconColor ""} {percentage}%"; - interval = 2; -} diff --git a/modules/desktop/waybar/module/network.nix b/modules/desktop/waybar/module/network.nix deleted file mode 100644 index 48cd6f3..0000000 --- a/modules/desktop/waybar/module/network.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base0B; - downloadIcon = mkIcon base0F ""; - uploadIcon = mkIcon base0F ""; -in -{ - interval = 2; - - format-wifi = "${mkIcon iconColor "{icon}"} ${downloadIcon}{bandwidthDownBytes} ${uploadIcon}{bandwidthUpBytes}"; - format-ethernet = "${mkIcon iconColor ""} ${downloadIcon}{bandwidthDownBytes} ${uploadIcon}{bandwidthUpBytes}"; - format-disconnected = "${mkIcon iconColor ""} Disconnected"; - - tooltip-format = "{ifname}"; - tooltip-format-wifi = "{essid} ({signalStrength}%)"; - tooltip-format-ethernet = "Wired: {ipaddr}"; - tooltip-format-disconnected = "Disconnected"; - - format-icons = [ - "" - "" - "" - ]; -} diff --git a/modules/desktop/waybar/module/time.nix b/modules/desktop/waybar/module/time.nix deleted file mode 100644 index adc8632..0000000 --- a/modules/desktop/waybar/module/time.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base08; -in -{ - format = "${mkIcon iconColor ""} {:%I:%M %p}"; - tooltip-format = "{:%H:%M:%S}"; - interval = 30; -} diff --git a/modules/desktop/waybar/module/usque.nix b/modules/desktop/waybar/module/usque.nix deleted file mode 100644 index bbcce17..0000000 --- a/modules/desktop/waybar/module/usque.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - config, - lib, - mkIcon, - ... -}: -with config.scheme.withHashtag; -let - iconColor = base08; -in -{ - exec = "${lib.getExe config.scripts.usque-warp.package} status"; - interval = 5; - return-type = "json"; - hide-empty-text = true; - format = "${mkIcon iconColor ""} {}"; -} diff --git a/modules/desktop/waybar/module/volume.nix b/modules/desktop/waybar/module/volume.nix deleted file mode 100644 index afb8d4e..0000000 --- a/modules/desktop/waybar/module/volume.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, mkIcon, ... }: -with config.scheme.withHashtag; -let - iconColor = base0A; -in -{ - format = "${mkIcon iconColor "{icon}"} {volume}%"; - format-muted = mkIcon iconColor " "; - format-icons = [ - "" - "" - "" - ]; - on-click = "pamixer -t"; - on-scroll-up = "pamixer -i 5"; - on-scroll-down = "pamixer -d 5"; -} diff --git a/modules/desktop/waybar/module/window.nix b/modules/desktop/waybar/module/window.nix deleted file mode 100644 index 0727662..0000000 --- a/modules/desktop/waybar/module/window.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ icons, ... }: -{ - expand = true; - format = "{}"; - rewrite = { - "(.*) - Chromium" = "${icons."Chromium"} $1"; - "(.*?)(?: - )?VLC Media Player" = "${icons."VLC"} $1"; - "(.*)heroic(.*)" = "${icons."Heroic"} $1$2"; - "(.*)Steam(.*)" = "${icons."Steam"} $1$2"; - "bruno" = "${icons."Bruno"} Bruno"; - "(.*) - VSCodium" = "${icons."VSCodium"} $1"; - "Virtual Machine Manager" = "${icons."VirtManager"} Virtual Machine Manager"; - "OC \\|(.*)" = "${icons."Opencode"} $1"; - "OpenCode" = "${icons."Opencode"} OpenCode"; - "Yazi:(.*)" = "${icons."Yazi"} $1"; - "Swayimg:(.*)" = "${icons."Swayimg"} $1"; - "bluetui" = "${icons."bluetui"} bluetui"; - "impala" = "${icons."impala"} impala"; - "neomutt" = "${icons."neomutt"} NeoMutt"; - "screen-recording" = "${icons."screen-recording"} Screen Recording"; - "system-monitor" = "${icons."system-monitor"} System Monitor"; - "nvim(.*)" = "${icons."neovim"} $1"; - "gopass" = "${icons."gopass"} gopass"; - }; -} diff --git a/modules/desktop/waybar/module/workspaces.nix b/modules/desktop/waybar/module/workspaces.nix deleted file mode 100644 index 45e31ec..0000000 --- a/modules/desktop/waybar/module/workspaces.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - config, - lib, - icons, - ... -}: -{ - format = "<span rise='-3000' font_size='small'>{value}</span>"; - # window-rewrite-default = icons."Default"; - # window-rewrite = { - # "app_id<chromium-browser>" = lib.mkIf config.web.chromium.enable icons."Chromium"; - # "app_id<kitty>" = lib.mkIf config.terminal.kitty.enable icons."Kitty"; - # "app_id<vlc>" = lib.mkIf config.media.vlc.enable icons."VLC"; - # "app_id<org.pwmt.zathura>" = lib.mkIf config.office.zathura.enable icons."Zathura"; - # "app_id<heroic>" = lib.mkIf config.gaming.heroic.enable icons."Heroic"; - # "app_id<Steam>" = lib.mkIf config.gaming.steam.enable icons."Steam"; - # "app_id<bruno>" = lib.mkIf config.development.bruno.enable icons."Bruno"; - # "app_id<codium>" = lib.mkIf config.development.vscodium.enable icons."VSCodium"; - # - # "title<Virtual Machine Manager>" = lib.mkIf config.development.qemu.enable icons."VirtManager"; - # "title<OC \\| (.*)>" = lib.mkIf config.development.opencode.enable icons."Opencode"; - # "title<OpenCode>" = lib.mkIf config.development.opencode.enable icons."Opencode"; - # "title<Swayimg:(.*)>" = lib.mkIf config.media.swayimg.enable icons."Swayimg"; - # "title<Yazi:(.*)>" = lib.mkIf config.file-management.yazi.enable icons."Yazi"; - # "title<bluetui>" = lib.mkIf config.networking.bluetui.enable icons."bluetui"; - # "title<impala>" = lib.mkIf config.networking.impala.enable icons."impala"; - # "title<neomutt>" = lib.mkIf config.communication.neomutt.enable icons."neomutt"; - # "title<screen-recording>" = - # lib.mkIf config.scripts.screen-recording.enable - # icons."screen-recording"; - # "title<system-monitor>" = lib.mkIf config.scripts.system-monitor.enable icons."system-monitor"; - # "title<nvim(.*)>" = lib.mkIf config.development.nixvim.enable icons."neovim"; - # "title<gopass>" = lib.mkIf config.development.nixvim.enable icons."gopass"; - # }; -} diff --git a/modules/desktop/waybar/style.mustache.css b/modules/desktop/waybar/style.mustache.css deleted file mode 100644 index dfb70fa..0000000 --- a/modules/desktop/waybar/style.mustache.css +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Waybar style based on the Base16 OneDark Dark theme, rendered from a mustache template - */ - -* { - border: none; - border-radius: 0; - font-family: "Fira Code Nerd Font"; - font-size: 18px; - min-height: 0; - margin: 0; - padding: 0; -} - -window#waybar { - background: transparent; -} - -#window, #pulseaudio, #battery, #network, -#clock.time, #custom-usque, #memory, #cpu, #clock.date { - background: #{{base00}}; - margin: 0 5px; - border: 1px solid #{{base07}}; - color: #{{base07}}; - padding: 0 10px; -} - -#workspaces { - border: none; - background: #{{base00}}; -} - -#workspaces button { - padding: 0px 10px; - color: #{{base07}}; - border: 1px solid #{{base03}}; - border-radius: 0; - min-width: 0px; - min-height: 0px; - margin: 0 5px; - font-size: 24px; -} - -#workspaces button:hover { - background: #{{base00}}; - border-color: #{{base05}}; -} - -#workspaces button.active { - border-color: #{{base07}}; -} - -#workspaces button.empty { - color: #{{base03}}; -} - -#workspaces button.urgent { - color: #{{base08}}; -} |
