From d1053b62823780b09308fd5ac0f1db2c56f69b4a Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Sun, 24 Aug 2025 18:52:17 -0500 Subject: [PATCH 1/2] random changes --- .../hyprland/home_manager/swaync.nix | 2 +- .../hyprland/home_manager/waybar.nix | 22 ++----------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/common/desktop_environment/hyprland/home_manager/swaync.nix b/common/desktop_environment/hyprland/home_manager/swaync.nix index e3e7168..f3cb1af 100644 --- a/common/desktop_environment/hyprland/home_manager/swaync.nix +++ b/common/desktop_environment/hyprland/home_manager/swaync.nix @@ -9,7 +9,7 @@ "com.spotify.Client" ]; - positionX = "center"; + positionX = "right"; positionY = "top"; layer = "overlay"; control-center-layer = "top"; diff --git a/common/desktop_environment/hyprland/home_manager/waybar.nix b/common/desktop_environment/hyprland/home_manager/waybar.nix index f80e490..bb98428 100644 --- a/common/desktop_environment/hyprland/home_manager/waybar.nix +++ b/common/desktop_environment/hyprland/home_manager/waybar.nix @@ -23,7 +23,6 @@ modules-center = [ "clock" "temperature" - "custom/notifications" "cpu" "memory" "disk" @@ -33,8 +32,8 @@ "pulseaudio" "network" "bluetooth" + "custom/notifications" "hyprland/language" - "custom/power" ]; # Workspaces configuration @@ -163,12 +162,6 @@ format-en = "EN"; format-ja = "JP"; }; - - "custom/power" = { - format = "⏻"; - tooltip = false; - on-click = "wlogout"; - }; }; }; @@ -227,8 +220,7 @@ #disk, #network, #bluetooth, - #language, - #custom-power { + #language { padding: 0 8px; color: #c0caf5; margin: 2px; @@ -238,16 +230,6 @@ color: #f7768e; } - #custom-power { - color: #f7768e; - padding: 0 10px; - } - - #custom-power:hover { - background: rgba(247, 118, 142, 0.2); - border-radius: 5px; - } - #network.disconnected { color: #f7768e; } From 69de4ca87b2a580af9e49932eb68b352b9d51916 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Sun, 24 Aug 2025 22:11:54 -0500 Subject: [PATCH 2/2] wip waybar and swaync updates --- .../desktop_environment/hyprland/default.nix | 2 -- .../hyprland/home_manager/default.nix | 1 + .../hyprland/home_manager/hyprland.nix | 13 +++++---- .../hyprland/home_manager/scripts.nix | 10 +++++++ .../home_manager/scripts/confirm-action.sh | 14 +++++++++ .../scripts/toggle-airplane-mode.sh | 6 ++++ .../scripts/toggle-power-profile.sh | 6 ++++ .../scripts/wofi-bluetooth-menu.sh | 21 ++++++++++++++ .../home_manager/scripts/wofi-wifi-menu.sh | 24 +++++++++++++++ .../hyprland/home_manager/swaync.nix | 29 +++++++++++++++---- .../hyprland/home_manager/waybar.nix | 13 +++++++-- 11 files changed, 124 insertions(+), 15 deletions(-) create mode 100644 common/desktop_environment/hyprland/home_manager/scripts.nix create mode 100755 common/desktop_environment/hyprland/home_manager/scripts/confirm-action.sh create mode 100755 common/desktop_environment/hyprland/home_manager/scripts/toggle-airplane-mode.sh create mode 100755 common/desktop_environment/hyprland/home_manager/scripts/toggle-power-profile.sh create mode 100755 common/desktop_environment/hyprland/home_manager/scripts/wofi-bluetooth-menu.sh create mode 100755 common/desktop_environment/hyprland/home_manager/scripts/wofi-wifi-menu.sh diff --git a/common/desktop_environment/hyprland/default.nix b/common/desktop_environment/hyprland/default.nix index 9b627e0..9726da5 100644 --- a/common/desktop_environment/hyprland/default.nix +++ b/common/desktop_environment/hyprland/default.nix @@ -69,8 +69,6 @@ with lib; wireplumber # media session manager libgtop # system monitor library bluez # Bluetooth support - bluez-tools # Bluetooth tools - blueman # Bluetooth manager power-profiles-daemon # power profiles grimblast # screenshot tool wf-recorder # screen recording tool diff --git a/common/desktop_environment/hyprland/home_manager/default.nix b/common/desktop_environment/hyprland/home_manager/default.nix index 4c2e83a..1dbebcb 100644 --- a/common/desktop_environment/hyprland/home_manager/default.nix +++ b/common/desktop_environment/hyprland/home_manager/default.nix @@ -7,6 +7,7 @@ ./hyprpolkitagent.nix ./wofi.nix ./swaync.nix + ./scripts.nix ./swaylock.nix ]; } diff --git a/common/desktop_environment/hyprland/home_manager/hyprland.nix b/common/desktop_environment/hyprland/home_manager/hyprland.nix index 8560f4c..4f3de04 100644 --- a/common/desktop_environment/hyprland/home_manager/hyprland.nix +++ b/common/desktop_environment/hyprland/home_manager/hyprland.nix @@ -32,11 +32,14 @@ in # Default monitor configuration monitor = "monitor = , preferred, auto, 1"; - windowrulev2 = [ - "float, class:.*blueman-manager.*" - "size 700 500, class:.*blueman-manager.*" - "center, class:.*blueman-manager.*" - ]; + windowrulev2 = [ + "float, class:^(?i)chrome-nngceckbapebfimnlniiiahkandclblb-Default$, initialtitle:^_crx_nngceckbapebfimnlniiiahkandclblb$" + "center, class:^(?i)chrome-nngceckbapebfimnlniiiahkandclblb-Default$, initialtitle:^_crx_nngceckbapebfimnlniiiahkandclblb$" + "size 720 600, class:^(?i)chrome-nngceckbapebfimnlniiiahkandclblb-Default$, initialtitle:^_crx_nngceckbapebfimnlniiiahkandclblb$" + "float, class:.*blueman-manager.*" + "size 700 500, class:.*blueman-manager.*" + "center, class:.*blueman-manager.*" + ]; # Input configuration input = { diff --git a/common/desktop_environment/hyprland/home_manager/scripts.nix b/common/desktop_environment/hyprland/home_manager/scripts.nix new file mode 100644 index 0000000..6c3d1c5 --- /dev/null +++ b/common/desktop_environment/hyprland/home_manager/scripts.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "toggle-airplane-mode" (builtins.readFile ./scripts/toggle-airplane-mode.sh)) + (writeShellScriptBin "toggle-power-profile" (builtins.readFile ./scripts/toggle-power-profile.sh)) + (writeShellScriptBin "wofi-wifi-menu" (builtins.readFile ./scripts/wofi-wifi-menu.sh)) + (writeShellScriptBin "wofi-bluetooth-menu" (builtins.readFile ./scripts/wofi-bluetooth-menu.sh)) + (writeShellScriptBin "confirm-action" (builtins.readFile ./scripts/confirm-action.sh)) + ]; +} diff --git a/common/desktop_environment/hyprland/home_manager/scripts/confirm-action.sh b/common/desktop_environment/hyprland/home_manager/scripts/confirm-action.sh new file mode 100755 index 0000000..5c30d11 --- /dev/null +++ b/common/desktop_environment/hyprland/home_manager/scripts/confirm-action.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +COMMAND_TO_RUN="$1" +PROMPT_MESSAGE="$2" + +if [ -z "$PROMPT_MESSAGE" ]; then + PROMPT_MESSAGE="Are you sure?" +fi + +choice=$(echo -e "No\nYes" | wofi --dmenu --location center -p "$PROMPT_MESSAGE") + +if [ "$choice" == "Yes" ]; then + eval "$COMMAND_TO_RUN" +fi diff --git a/common/desktop_environment/hyprland/home_manager/scripts/toggle-airplane-mode.sh b/common/desktop_environment/hyprland/home_manager/scripts/toggle-airplane-mode.sh new file mode 100755 index 0000000..7a6636a --- /dev/null +++ b/common/desktop_environment/hyprland/home_manager/scripts/toggle-airplane-mode.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +if [ "$(nmcli radio all)" = "enabled" ]; then + nmcli radio all off +else + nmcli radio all on +fi diff --git a/common/desktop_environment/hyprland/home_manager/scripts/toggle-power-profile.sh b/common/desktop_environment/hyprland/home_manager/scripts/toggle-power-profile.sh new file mode 100755 index 0000000..1d14395 --- /dev/null +++ b/common/desktop_environment/hyprland/home_manager/scripts/toggle-power-profile.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +if [ "$(powerprofilesctl get)" = "performance" ]; then + powerprofilesctl set balanced +else + powerprofilesctl set performance +fi diff --git a/common/desktop_environment/hyprland/home_manager/scripts/wofi-bluetooth-menu.sh b/common/desktop_environment/hyprland/home_manager/scripts/wofi-bluetooth-menu.sh new file mode 100755 index 0000000..b7a05dc --- /dev/null +++ b/common/desktop_environment/hyprland/home_manager/scripts/wofi-bluetooth-menu.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +devices=$(bluetoothctl devices | awk '{print $2, $3}') + +if [ -z "$devices" ]; then + options="󰂲 Power On\n󰂬 Scan for devices" +else + options="$devices\n󰂲 Power Off\n󰂬 Scan for devices" +fi + +chosen=$(echo -e "$options" | wofi --dmenu --location 3 --yoffset 40 --xoffset -20 -p "Bluetooth") + +case "$chosen" in + "󰂲 Power On") bluetoothctl power on;; + "󰂲 Power Off") bluetoothctl power off;; + "󰂬 Scan for devices") bluetoothctl scan on;; + *) + mac=$(echo "$chosen" | awk '{print $1}') + bluetoothctl connect "$mac" + ;; +esac diff --git a/common/desktop_environment/hyprland/home_manager/scripts/wofi-wifi-menu.sh b/common/desktop_environment/hyprland/home_manager/scripts/wofi-wifi-menu.sh new file mode 100755 index 0000000..6e4dbbe --- /dev/null +++ b/common/desktop_environment/hyprland/home_manager/scripts/wofi-wifi-menu.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Get a list of available Wi-Fi networks +nets=$(nmcli --terse --fields SSID,SECURITY,BARS device wifi list | sed '/^--/d' | sed 's/\\:/__/g') + +# Get the current connection status +connected_ssid=$(nmcli -t -f active,ssid dev wifi | egrep '^yes' | cut -d: -f2) + +if [[ ! -z "$connected_ssid" ]]; then + toggle="󰖪 Toggle Wi-Fi Off" +else + toggle="󰖩 Toggle Wi-Fi On" +fi + +# Present the menu to the user +chosen_network=$(echo -e "$toggle\n$nets" | wofi --dmenu --location 3 --yoffset 40 --xoffset -20 -p "Wi-Fi Networks") + +# Perform an action based on the user's choice +if [ "$chosen_network" = "$toggle" ]; then + nmcli radio wifi $([ "$connected_ssid" = "" ] && echo "on" || echo "off") +elif [ ! -z "$chosen_network" ]; then + ssid=$(echo "$chosen_network" | sed 's/__/\\:/g' | awk -F' ' '{print $1}') + nmcli device wifi connect "$ssid" +fi diff --git a/common/desktop_environment/hyprland/home_manager/swaync.nix b/common/desktop_environment/hyprland/home_manager/swaync.nix index f3cb1af..ce33576 100644 --- a/common/desktop_environment/hyprland/home_manager/swaync.nix +++ b/common/desktop_environment/hyprland/home_manager/swaync.nix @@ -86,17 +86,17 @@ { label = "󰐥"; tooltip = "Shutdown"; - command = "systemctl poweroff"; + command = "confirm-action 'systemctl poweroff' 'Shutdown?'"; } { label = "󰜉"; tooltip = "Reboot"; - command = "systemctl reboot"; + command = "confirm-action 'systemctl reboot' 'Reboot?'"; } { label = "󰍃"; tooltip = "Logout"; - command = "hyprctl dispatch exit"; + command = "confirm-action 'hyprctl dispatch exit' 'Logout?'"; } { label = "󰤄"; @@ -113,7 +113,7 @@ { label = "󰖩"; tooltip = "Wi‑Fi Settings"; - command = "nm-connection-editor"; + command = "wofi-wifi-menu"; } # Bluetooth (requires bluez/bluetoothctl, blueman optional) @@ -125,7 +125,26 @@ { label = "󰂯"; tooltip = "Bluetooth Settings"; - command = "blueman-manager"; + command = "wofi-bluetooth-menu"; + } + + # Media + { + label = "󰍭"; + tooltip = "Toggle Mic Mute"; + command = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + } + + # Toggles + { + label = "󰀝"; + tooltip = "Toggle Airplane Mode"; + command = "toggle-airplane-mode"; + } + { + label = "󰓅"; + tooltip = "Toggle Power Profile"; + command = "toggle-power-profile"; } ]; }; diff --git a/common/desktop_environment/hyprland/home_manager/waybar.nix b/common/desktop_environment/hyprland/home_manager/waybar.nix index bb98428..c67d449 100644 --- a/common/desktop_environment/hyprland/home_manager/waybar.nix +++ b/common/desktop_environment/hyprland/home_manager/waybar.nix @@ -84,6 +84,9 @@ "󰕾" ]; }; + scroll-step = 5; + on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-right = "swaync-client -t -sw"; }; "custom/notifications" = { @@ -108,7 +111,9 @@ }; # Clock - clock.format = "{:%Y-%m-%d} {:%H:%M}"; + clock = { + format = "{:%b %d, %H:%M}"; + }; temperature = { thermal-zone = 2; @@ -142,7 +147,8 @@ tooltip-format = "{ifname} via {gwaddr} "; format-linked = "󰈀 {ifname} (No IP)"; format-disconnected = "󰖪 Disconnected"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; + on-click = "wofi-wifi-menu"; + on-click-right = "nmcli radio wifi toggle"; }; bluetooth = { @@ -153,7 +159,8 @@ tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; - on-click = "blueman-manager"; + on-click = "wofi-bluetooth-menu"; + on-click-right = "bluetoothctl power toggle"; }; # Keyboard input (language)