From 45e0f5ed0b68be764caf4700e9f893b8d2a64014 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Mon, 16 Oct 2023 15:04:07 -0500 Subject: [PATCH] refactor: waybar modules separated into nix expressions --- .../addons/waybar/default-modules.jsonc | 314 ------------------ .../home/desktop/addons/waybar/default.nix | 236 ++++--------- .../waybar/hyprland/default-modules.jsonc | 11 - .../addons/waybar/modules/custom-modules.nix | 106 ++++++ .../addons/waybar/modules/default-modules.nix | 167 ++++++++++ .../addons/waybar/modules/group-modules.nix | 78 +++++ .../waybar/modules/hyprland-modules.nix | 85 +++++ .../addons/waybar/modules/wlr-modules.nix | 46 +++ 8 files changed, 544 insertions(+), 499 deletions(-) delete mode 100644 modules/home/desktop/addons/waybar/default-modules.jsonc delete mode 100644 modules/home/desktop/addons/waybar/hyprland/default-modules.jsonc create mode 100644 modules/home/desktop/addons/waybar/modules/custom-modules.nix create mode 100644 modules/home/desktop/addons/waybar/modules/default-modules.nix create mode 100644 modules/home/desktop/addons/waybar/modules/group-modules.nix create mode 100644 modules/home/desktop/addons/waybar/modules/hyprland-modules.nix create mode 100644 modules/home/desktop/addons/waybar/modules/wlr-modules.nix diff --git a/modules/home/desktop/addons/waybar/default-modules.jsonc b/modules/home/desktop/addons/waybar/default-modules.jsonc deleted file mode 100644 index 4919acd3b..000000000 --- a/modules/home/desktop/addons/waybar/default-modules.jsonc +++ /dev/null @@ -1,314 +0,0 @@ -{ - "user": { - "format": "{user}", - "interval": 60, - "height": 30, - "width": 30, - "icon": true - }, - "keyboard-state": { - "numlock": true, - "capslock": true, - "format": "{icon} {name}", - "format-icons": { - "locked": "", - "unlocked": "" - } - }, - "mpris": { - "format": "{player_icon} {status_icon} {dynamic}", - "format-paused": "{player_icon} {status_icon} {dynamic}", - "max-length": 45, - "player-icons": { - "chromium": "", - "default": "", - "firefox": "", - "mopidy": "", - "mpv": "", - "spotify": "" - }, - "status-icons": { - "paused": "", - "playing": "", - "stopped": "" - } - }, - "mpd": { - "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", - "format-disconnected": "Disconnected ", - "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", - "unknown-tag": "N/A", - "interval": 2, - "consume-icons": { - "on": " " - }, - "random-icons": { - "off": " ", - "on": " " - }, - "repeat-icons": { - "on": " " - }, - "single-icons": { - "on": "1 " - }, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - }, - "idle_inhibitor": { - "format": "{icon} ", - "format-icons": { - "activated": "", - "deactivated": "" - } - }, - "tray": { - // "icon-size": 21, - "spacing": 10 - }, - "clock": { - "tooltip-format": "{:%Y %B}\n{calendar}", - "format": "{:%a %d, %b \n %I:%M %p }", - "format-alt": "{:%Y-%m-%d}" - }, - "cpu": { - "format": " {usage}%", - "tooltip": true - }, - "memory": { - "format": "󰍛 {}%" - }, - "disk": { - "format": " {percentage_used}%" - }, - "temperature": { - //"hwmon-path": "/sys/devices/platform/asus-ec-sensors/hwmon/hwmon4/temp3_input", - //"hwmon-path-abs": "/sys/devices/platform/asus-ec-sensors/hwmon", - "hwmon-path-abs": "/sys/devices/pci0000:00/0000:00:18.3/hwmon", - "input-filename": "temp3_input", - "critical-threshold": 80, - "format-critical": "{temperatureC}°C {icon}", - "format": "{icon} {temperatureC}°C", - "format-icons": [ - "", - "", - "" - ], - "interval": "5" - }, - "network": { - "interval": 1, - "format-wifi": " 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", - "format-ethernet": "󰈀 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", - "tooltip-format": " {ifname} via {gwaddr}", - "format-linked": "󰈁 {ifname} (No IP)", - "format-disconnected": " Disconnected", - "format-alt": "{ifname}: {ipaddr}/{cidr}" - }, - "wireplumber": { - "format": "{volume}% {icon}", - "format-muted": "", - "on-click": "helvum", - "format-icons": [ - "", - "", - "" - ] - }, - "pulseaudio": { - "format": "{volume}% {icon}", - "format-bluetooth": "{volume}% {icon}", - "format-muted": "", - "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": [ - "", - "" - ] - }, - "scroll-step": 1, - "on-click": "pavucontrol", - "ignored-sinks": [ - "Easy Effects Sink" - ] - }, - "pulseaudio/slider": { - "min": 0, - "max": 100, - "orientation": "horizontal" - }, - "custom/media": { - "format": "{icon} {}", - "return-type": "json", - "max-length": 40, - "format-icons": { - "spotify": "", - "default": "🎜" - }, - "escape": true, - "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder - // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name - }, - "custom/quit": { - "format": "󰗼", - "tooltip": false, - "on-click": "hyprctl dispatch exit" - }, - "custom/lock": { - "format": "󰍁", - "tooltip": false, - "on-click": "swaylock" - }, - "custom/reboot": { - "format": "󰜉", - "tooltip": false, - "on-click": "reboot" - }, - "custom/power": { - "format": "", - "tooltip": false, - "on-click": "shutdown now" - }, - "custom/separator-right": { - "format": "", - "tooltip": false - }, - "custom/separator-left": { - "format": "", - "tooltip": false - }, - "custom/ellipses": { - "format": "", - "tooltip": false - }, - "group/group-power": { - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "children-class": "not-power", - "transition-left-to-right": false - }, - "modules": [ - "custom/wlogout", - "custom/quit", - "custom/lock", - "custom/reboot" - ] - }, - "group/tray": { - "orientation": "horizontal", - "modules": [ - "tray" - ] - }, - "group/stats": { - "orientation": "horizontal", - "modules": [ - "network", - "cpu", - "memory", - "disk", - "temperature" - ] - }, - "group/audio": { - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "transition-left-to-right": false - }, - "modules": [ - "pulseaudio", - "pulseaudio/slider" - ] - }, - "group/tray-drawer": { - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "transition-left-to-right": true - }, - "modules": [ - "custom/separator-right", - "tray" - ] - }, - "group/stats-drawer": { - "orientation": "horizontal", - "drawer": { - "transition-duration": 500, - "transition-left-to-right": false - }, - "modules": [ - "custom/separator-right", - "network", - "cpu", - "memory", - "disk", - "temperature" - ] - }, - "group/notifications": { - "orientation": "horizontal", - "modules": [ - "idle_inhibitor", - // "custom/updates", - "custom/notification", - "custom/github", - "group/audio" - ] - }, - "wlr/workspaces": { - "all-outputs": false, - "active-only": "false", - "on-click": "activate", - "format": "{icon}", - "format-icons": { - "1": "", - "2": "", - "3": "", - "4": "", - "5": "", - "6": "", - "7": "", - "8": "󰢹", - "urgent": "", - "default": "" - }, - "persistent_workspaces": { - "1": [ - "DP-3" - ], - "2": [ - "DP-1" - ], - "3": [ - "DP-1" - ], - "4": [ - "DP-1" - ], - "5": [ - "DP-1" - ], - "6": [ - "DP-1" - ], - "7": [ - "DP-1" - ], - "8": [ - "DP-1" - ] - } - } -} diff --git a/modules/home/desktop/addons/waybar/default.nix b/modules/home/desktop/addons/waybar/default.nix index 48236e1b7..8308c11b2 100644 --- a/modules/home/desktop/addons/waybar/default.nix +++ b/modules/home/desktop/addons/waybar/default.nix @@ -1,142 +1,77 @@ { config +, inputs , lib , options , pkgs -, inputs , system , ... }: let - inherit (lib) mkIf mkForce getExe getExe'; + inherit (lib) mkIf mkForce getExe mkMerge; inherit (lib.internal) mkBoolOpt; - inherit (inputs) nixpkgs-wayland hyprland; + inherit (inputs) nixpkgs-wayland; cfg = config.khanelinix.desktop.addons.waybar; - githubHelper = pkgs.writeShellScriptBin "githubHelper" '' - #!/usr/bin/env bash - - NOTIFICATIONS="$(${getExe pkgs.gh} api notifications)" - COUNT="$(echo "$NOTIFICATIONS" | ${getExe pkgs.jq} 'length')" - - echo '{"text":'"$COUNT"',"tooltip":"'"$COUNT"' Notifications","class":""}' - ''; - - sharedModuleDefinitions = { - "custom/weather" = { - "exec" = "${getExe pkgs.wttrbar} -l $(${getExe pkgs.jq} -r '.weathergov | (.location)' ~/weather_config.json) --fahrenheit --main-indicator temp_F"; - "return-type" = "json"; - "format" = "{}"; - "tooltip" = true; - "interval" = 3600; - }; - - "custom/github" = { - "format" = " {}"; - "return-type" = "json"; - "interval" = 60; - "exec" = "${getExe githubHelper}"; - "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe' pkgs.xdg-utils "xdg-open"} https://github.com/notifications"; - }; - - "custom/notification" = { - "tooltip" = true; - "format" = "{icon} {}"; - "format-icons" = { - "notification" = ""; - "none" = ""; - "dnd-notification" = ""; - "dnd-none" = ""; - "inhibited-notification" = ""; - "inhibited-none" = ""; - "dnd-inhibited-notification" = ""; - "dnd-inhibited-none" = ""; - }; - "return-type" = "json"; - "exec-if" = "which ${getExe' pkgs.swaynotificationcenter "swaync-client"}"; - "exec" = "${getExe' pkgs.swaynotificationcenter "swaync-client"} -swb"; - "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe' pkgs.swaynotificationcenter "swaync-client"} -t -sw"; - "on-click-right" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe' pkgs.swaynotificationcenter "swaync-client"} -d -sw"; - "escape" = true; - }; + custom-modules = import ./modules/custom-modules.nix { inherit lib pkgs; }; + default-modules = import ./modules/default-modules.nix { inherit lib pkgs; }; + group-modules = import ./modules/group-modules.nix; + hyprland-modules = import ./modules/hyprland-modules.nix { inherit config lib; }; - "custom/wlogout" = { - "format" = ""; - "interval" = "once"; - "tooltip" = false; - "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe pkgs.wlogout} -c 5 -r 5 -p layer-shell"; - }; + all-modules = mkMerge [ + custom-modules + default-modules + group-modules + (lib.mkIf config.khanelinix.desktop.hyprland.enable hyprland-modules) + ]; - "hyprland/workspaces" = { - "all-outputs" = false; - "active-only" = "false"; - "on-scroll-up" = "${getExe' hyprland.packages.${system}.hyprland "hyprctl"} dispatch workspace e+1"; - "on-scroll-down" = "${getExe' hyprland.packages.${system}.hyprland "hyprctl"} dispatch workspace e-1"; - "format" = "{name} > {windows}"; - "format-icons" = { - "1" = ""; - "2" = ""; - "3" = ""; - "4" = ""; - "5" = ""; - "6" = ""; - "7" = ""; - "8" = "󰢹"; - "urgent" = ""; - "default" = ""; - "empty" = ""; - }; - "persistent-workspaces" = { - "*" = [ - 2 - 3 - 4 - 5 - 6 - 7 - 8 - ]; - "DP-3" = [ - 1 - ]; - }; - # "format-window-separator" = "->"; - "window-rewrite-default" = ""; - "window-rewrite" = { - "class<1Password>" = "󰢁"; - "class" = "󰈎"; - "class" = "󰊤"; - "class" = ""; - "class" = ""; - "class" = "󰒱"; - "class" = "󰨞"; - "code-url-handler" = "󰨞"; - "class" = "󰙯"; - "class" = ""; - "class title<.*github.*>" = ""; - "class title<.*twitch|youtube|plex|tntdrama|bally sports.*>" = ""; - "class" = ""; - "class" = "󱂷"; - "class" = "󰄄"; - "class" = ""; - "class<.pitivi-wrapped>" = "󱄢"; - "class" = ""; - "class" = ""; - "class" = "󰢹"; - "class" = "󰕼"; - }; - }; + mainBar = { + "layer" = "top"; + "position" = "top"; + "output" = "DP-1"; + "margin-top" = 10; + "margin-left" = 20; + "margin-right" = 20; + # "modules-center" = [ "mpris" ]; + "modules-left" = [ + "group/group-power" + "hyprland/workspaces" + "custom/separator-left" + "hyprland/window" + ]; + "modules-right" = [ + "group/tray" + "custom/separator-right" + "group/stats" + "custom/separator-right" + "group/notifications" + "hyprland/submap" + "custom/weather" + "clock" + ]; + }; - "wireplumber" = { - "format" = "{volume}% {icon}"; - "format-muted" = ""; - "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe pkgs.helvum}"; - "format-icons" = [ - "" - "" - "" - ]; - }; + secondaryBar = { + "layer" = "top"; + "position" = "top"; + "output" = "DP-3"; + "margin-top" = 10; + "margin-left" = 20; + "margin-right" = 20; + "modules-center" = [ ]; + "modules-left" = [ + "group/group-power" + "hyprland/workspaces" + "custom/separator-left" + "hyprland/window" + ]; + "modules-right" = [ + "group/tray-drawer" + "group/stats-drawer" + "idle_inhibitor" + "custom/weather" + "clock" + ]; }; in { @@ -154,57 +89,10 @@ in package = nixpkgs-wayland.packages.${system}.waybar; systemd.enable = true; - # TODO: make dynamic + # TODO: make dynamic / support different number of bars etc settings = { - mainBar = { - "include" = [ ./default-modules.jsonc ] ++ lib.optional config.khanelinix.desktop.hyprland.enable ./hyprland/default-modules.jsonc; - "layer" = "top"; - "position" = "top"; - "output" = "DP-1"; - "margin-top" = 10; - "margin-left" = 20; - "margin-right" = 20; - # "modules-center" = [ "mpris" ]; - "modules-left" = [ - "group/group-power" - "hyprland/workspaces" - "custom/separator-left" - "hyprland/window" - ]; - "modules-right" = [ - "group/tray" - "custom/separator-right" - "group/stats" - "custom/separator-right" - "group/notifications" - "hyprland/submap" - "custom/weather" - "clock" - ]; - } // sharedModuleDefinitions; - secondaryBar = { - "include" = [ ./default-modules.jsonc ] ++ lib.optional config.khanelinix.desktop.hyprland.enable ./hyprland/default-modules.jsonc; - "layer" = "top"; - "position" = "top"; - "output" = "DP-3"; - "margin-top" = 10; - "margin-left" = 20; - "margin-right" = 20; - "modules-center" = [ ]; - "modules-left" = [ - "group/group-power" - "hyprland/workspaces" - "custom/separator-left" - "hyprland/window" - ]; - "modules-right" = [ - "group/tray-drawer" - "group/stats-drawer" - "idle_inhibitor" - "custom/weather" - "clock" - ]; - } // sharedModuleDefinitions; + mainBar = mkMerge [ mainBar all-modules ]; + secondaryBar = mkMerge [ secondaryBar all-modules ]; }; style = ./style.css; diff --git a/modules/home/desktop/addons/waybar/hyprland/default-modules.jsonc b/modules/home/desktop/addons/waybar/hyprland/default-modules.jsonc deleted file mode 100644 index 23fdd0f6e..000000000 --- a/modules/home/desktop/addons/waybar/hyprland/default-modules.jsonc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "hyprland/window": { - "format": "{}", - "separate-outputs": true - }, - "hyprland/submap": { - "format": "✌️ {}", - "max-length": 8, - "tooltip": false - } -} diff --git a/modules/home/desktop/addons/waybar/modules/custom-modules.nix b/modules/home/desktop/addons/waybar/modules/custom-modules.nix new file mode 100644 index 000000000..82ef7dca4 --- /dev/null +++ b/modules/home/desktop/addons/waybar/modules/custom-modules.nix @@ -0,0 +1,106 @@ +{ lib +, pkgs +, ... +}: +let + inherit (lib) getExe getExe'; + + githubHelper = pkgs.writeShellScriptBin "githubHelper" '' + #!/usr/bin/env bash + + NOTIFICATIONS="$(${getExe pkgs.gh} api notifications)" + COUNT="$(echo "$NOTIFICATIONS" | ${getExe pkgs.jq} 'length')" + + echo '{"text":'"$COUNT"',"tooltip":"'"$COUNT"' Notifications","class":""}' + ''; +in +{ + "custom/weather" = { + "exec" = "${getExe pkgs.wttrbar} -l $(${getExe pkgs.jq} -r '.weathergov | (.location)' ~/weather_config.json) --fahrenheit --main-indicator temp_F"; + "return-type" = "json"; + "format" = "{}"; + "tooltip" = true; + "interval" = 3600; + }; + + "custom/github" = { + "format" = " {}"; + "return-type" = "json"; + "interval" = 60; + "exec" = "${getExe githubHelper}"; + "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe' pkgs.xdg-utils "xdg-open"} https://github.com/notifications"; + }; + + "custom/notification" = { + "tooltip" = true; + "format" = "{icon} {}"; + "format-icons" = { + "notification" = ""; + "none" = ""; + "dnd-notification" = ""; + "dnd-none" = ""; + "inhibited-notification" = ""; + "inhibited-none" = ""; + "dnd-inhibited-notification" = ""; + "dnd-inhibited-none" = ""; + }; + "return-type" = "json"; + "exec-if" = "which ${getExe' pkgs.swaynotificationcenter "swaync-client"}"; + "exec" = "${getExe' pkgs.swaynotificationcenter "swaync-client"} -swb"; + "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe' pkgs.swaynotificationcenter "swaync-client"} -t -sw"; + "on-click-right" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe' pkgs.swaynotificationcenter "swaync-client"} -d -sw"; + "escape" = true; + }; + + "custom/wlogout" = { + "format" = ""; + "interval" = "once"; + "tooltip" = false; + "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe pkgs.wlogout} -c 5 -r 5 -p layer-shell"; + }; + + "custom/media" = { + "format" = "{icon} {}"; + "return-type" = "json"; + "max-length" = 40; + "format-icons" = { + "spotify" = ""; + "default" = "🎜"; + }; + "escape" = true; + "exec" = "$HOME/.config/waybar/mediaplayer.py 2> /dev/null"; + }; + + "custom/lock" = { + "format" = "󰍁"; + "tooltip" = false; + "on-click" = "swaylock"; + }; + + "custom/reboot" = { + "format" = "󰜉"; + "tooltip" = false; + "on-click" = "reboot"; + }; + + "custom/power" = { + "format" = ""; + "tooltip" = false; + "on-click" = "shutdown now"; + }; + + "custom/separator-right" = { + "format" = ""; + "tooltip" = false; + }; + + "custom/separator-left" = { + "format" = ""; + "tooltip" = false; + }; + + "custom/ellipses" = { + "format" = ""; + "tooltip" = false; + }; +} diff --git a/modules/home/desktop/addons/waybar/modules/default-modules.nix b/modules/home/desktop/addons/waybar/modules/default-modules.nix new file mode 100644 index 000000000..82aae60c8 --- /dev/null +++ b/modules/home/desktop/addons/waybar/modules/default-modules.nix @@ -0,0 +1,167 @@ +{ lib +, pkgs +, ... +}: +let + inherit (lib) getExe getExe'; +in +{ + "user" = { + "format" = "{user}"; + "interval" = 60; + "height" = 30; + "width" = 30; + "icon" = true; + }; + + "keyboard-state" = { + "numlock" = true; + "capslock" = true; + "format" = "{icon} {name}"; + "format-icons" = { + "locked" = ""; + "unlocked" = ""; + }; + }; + + "mpris" = { + "format" = "{player_icon} {status_icon} {dynamic}"; + "format-paused" = "{player_icon} {status_icon} {dynamic}"; + "max-length" = 45; + "player-icons" = { + "chromium" = ""; + "default" = ""; + "firefox" = ""; + "mopidy" = ""; + "mpv" = ""; + "spotify" = ""; + }; + "status-icons" = { + "paused" = ""; + "playing" = ""; + "stopped" = ""; + }; + }; + + "mpd" = { + "format" = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% "; + "format-disconnected" = "Disconnected "; + "format-stopped" = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped "; + "unknown-tag" = "N/A"; + "interval" = 2; + "consume-icons" = { + "on" = " "; + }; + "random-icons" = { + "off" = " "; + "on" = " "; + }; + "repeat-icons" = { + "on" = " "; + }; + "single-icons" = { + "on" = "1 "; + }; + "state-icons" = { + "paused" = ""; + "playing" = ""; + }; + "tooltip-format" = "MPD (connected)"; + "tooltip-format-disconnected" = "MPD (disconnected)"; + }; + + "idle_inhibitor" = { + "format" = "{icon} "; + "format-icons" = { + "activated" = ""; + "deactivated" = ""; + }; + }; + + "tray" = { + "spacing" = 10; + }; + + "clock" = { + "tooltip-format" = "{:%Y %B}\n{calendar}"; + "format" = "{:%a %d; %b \n %I:%M %p }"; + "format-alt" = "{:%Y-%m-%d}"; + }; + + "cpu" = { + "format" = " {usage}%"; + "tooltip" = true; + }; + + "memory" = { + "format" = "󰍛 {}%"; + }; + + "disk" = { + "format" = " {percentage_used}%"; + }; + + "temperature" = { + "hwmon-path-abs" = "/sys/devices/pci0000:00/0000:00:18.3/hwmon"; + "input-filename" = "temp3_input"; + "critical-threshold" = 80; + "format-critical" = "{temperatureC}°C {icon}"; + "format" = "{icon} {temperatureC}°C"; + "format-icons" = [ + "" + "" + "" + ]; + "interval" = "5"; + }; + + "network" = { + "interval" = 1; + "format-wifi" = " 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}"; + "format-ethernet" = "󰈀 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}"; + "tooltip-format" = " {ifname} via {gwaddr}"; + "format-linked" = "󰈁 {ifname} (No IP)"; + "format-disconnected" = " Disconnected"; + "format-alt" = "{ifname}: {ipaddr}/{cidr}"; + }; + + "wireplumber" = { + "format" = "{volume}% {icon}"; + "format-muted" = ""; + "on-click" = "${getExe' pkgs.coreutils "sleep"} 0.1 && ${getExe pkgs.helvum}"; + "format-icons" = [ + "" + "" + "" + ]; + }; + + "pulseaudio" = { + "format" = "{volume}% {icon}"; + "format-bluetooth" = "{volume}% {icon}"; + "format-muted" = ""; + "format-icons" = { + "headphone" = ""; + "hands-free" = ""; + "headset" = ""; + "phone" = ""; + "portable" = ""; + "car" = ""; + "default" = [ + "" + "" + ]; + }; + "scroll-step" = 1; + "on-click" = "pavucontrol"; + "ignored-sinks" = [ + "Easy Effects Sink" + ]; + }; + + "pulseaudio/slider" = { + "min" = 0; + "max" = 100; + "orientation" = "horizontal"; + }; +} diff --git a/modules/home/desktop/addons/waybar/modules/group-modules.nix b/modules/home/desktop/addons/waybar/modules/group-modules.nix new file mode 100644 index 000000000..29c17899e --- /dev/null +++ b/modules/home/desktop/addons/waybar/modules/group-modules.nix @@ -0,0 +1,78 @@ +{ + "group/group-power" = { + "orientation" = "horizontal"; + "drawer" = { + "transition-duration" = 500; + "children-class" = "not-power"; + "transition-left-to-right" = false; + }; + "modules" = [ + "custom/wlogout" + "custom/quit" + "custom/lock" + "custom/reboot" + ]; + }; + "group/tray" = { + "orientation" = "horizontal"; + "modules" = [ + "tray" + ]; + }; + "group/stats" = { + "orientation" = "horizontal"; + "modules" = [ + "network" + "cpu" + "memory" + "disk" + "temperature" + ]; + }; + "group/audio" = { + "orientation" = "horizontal"; + "drawer" = { + "transition-duration" = 500; + "transition-left-to-right" = false; + }; + "modules" = [ + "pulseaudio" + "pulseaudio/slider" + ]; + }; + "group/tray-drawer" = { + "orientation" = "horizontal"; + "drawer" = { + "transition-duration" = 500; + "transition-left-to-right" = true; + }; + "modules" = [ + "custom/separator-right" + "tray" + ]; + }; + "group/stats-drawer" = { + "orientation" = "horizontal"; + "drawer" = { + "transition-duration" = 500; + "transition-left-to-right" = false; + }; + "modules" = [ + "custom/separator-right" + "network" + "cpu" + "memory" + "disk" + "temperature" + ]; + }; + "group/notifications" = { + "orientation" = "horizontal"; + "modules" = [ + "idle_inhibitor" + "custom/notification" + "custom/github" + "group/audio" + ]; + }; +} diff --git a/modules/home/desktop/addons/waybar/modules/hyprland-modules.nix b/modules/home/desktop/addons/waybar/modules/hyprland-modules.nix new file mode 100644 index 000000000..bdb4f54ee --- /dev/null +++ b/modules/home/desktop/addons/waybar/modules/hyprland-modules.nix @@ -0,0 +1,85 @@ +{ config +, lib +, ... +}: +let + inherit (lib) getExe'; +in +{ + "hyprland/window" = { + "format" = "{}"; + "separate-outputs" = true; + }; + + "hyprland/submap" = { + "format" = "✌️ {}"; + "max-length" = 8; + "tooltip" = false; + }; + + "hyprland/workspaces" = { + "all-outputs" = false; + "active-only" = "false"; + "on-scroll-up" = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch workspace e+1"; + "on-scroll-down" = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch workspace e-1"; + "format" = "{name} > {windows}"; + "format-icons" = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; + "6" = ""; + "7" = ""; + "8" = "󰢹"; + "urgent" = ""; + "default" = ""; + "empty" = ""; + }; + "persistent-workspaces" = { + "*" = [ + 2 + 3 + 4 + 5 + 6 + 7 + 8 + ]; + "DP-3" = [ + 1 + ]; + }; + # "format-window-separator" = "->"; + "window-rewrite-default" = ""; + "window-rewrite" = { + "class<1Password>" = "󰢁"; + "class" = "󰈎"; + "class" = "󰊤"; + "class" = ""; + "class" = ""; + "class" = "󰒱"; + "class" = "󰨞"; + "code-url-handler" = "󰨞"; + "class" = "󰙯"; + "class" = ""; + "class title<.*github.*>" = ""; + "class title<.*twitch|youtube|plex|tntdrama|bally sports.*>" = ""; + "class" = ""; + "class" = "󱂷"; + "class" = "󰄄"; + "class" = ""; + "class<.pitivi-wrapped>" = "󱄢"; + "class" = ""; + "class" = ""; + "class" = "󰢹"; + "class" = "󰕼"; + }; + }; + + "custom/quit" = { + "format" = "󰗼"; + "tooltip" = false; + "on-click" = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch exit"; + }; +} diff --git a/modules/home/desktop/addons/waybar/modules/wlr-modules.nix b/modules/home/desktop/addons/waybar/modules/wlr-modules.nix new file mode 100644 index 000000000..5bda91a84 --- /dev/null +++ b/modules/home/desktop/addons/waybar/modules/wlr-modules.nix @@ -0,0 +1,46 @@ +{ + "wlr/workspaces" = { + "all-outputs" = false; + "active-only" = "false"; + "on-click" = "activate"; + "format" = "{icon}"; + "format-icons" = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; + "6" = ""; + "7" = ""; + "8" = "󰢹"; + "urgent" = ""; + "default" = ""; + }; + "persistent_workspaces" = { + "1" = [ + "DP-3" + ]; + "2" = [ + "DP-1" + ]; + "3" = [ + "DP-1" + ]; + "4" = [ + "DP-1" + ]; + "5" = [ + "DP-1" + ]; + "6" = [ + "DP-1" + ]; + "7" = [ + "DP-1" + ]; + "8" = [ + "DP-1" + ]; + }; + }; +}