From 985b8bf13bc3cd6e891609de28200ed6aa430d74 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 2 Apr 2023 16:53:01 -0400 Subject: [PATCH] polybar audio and power buttons also switched from systemd because it breaks rofi --- modules/nixos/graphical/polybar.nix | 11 +++++++++-- modules/nixos/graphical/rofi/pulse-sink.sh | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/modules/nixos/graphical/polybar.nix b/modules/nixos/graphical/polybar.nix index 2befe82..9ed48ff 100644 --- a/modules/nixos/graphical/polybar.nix +++ b/modules/nixos/graphical/polybar.nix @@ -36,7 +36,7 @@ module-margin = 1; modules-left = "i3"; modules-center = "xwindow"; - modules-right = "pulseaudio date"; + modules-right = "pulseaudio date power"; cursor-click = "pointer"; cursor-scroll = "ns-resize"; enable-ipc = true; @@ -115,6 +115,7 @@ ramp-volume-0 = ""; ramp-volume-1 = "墳"; ramp-volume-2 = ""; + click-right = config.audioSwitchCommand; }; # "module/xkeyboard" = { # type = "internal/xkeyboard"; @@ -166,6 +167,12 @@ label-foreground = config.theme.colors.base0A; # format-background = colors.background; }; + "module/power" = { + type = "custom/text"; + content = "  "; + click-left = config.powerCommand; + content-foreground = config.theme.colors.base04; + }; "settings" = { screenchange-reload = true; pseudo-transparency = false; @@ -174,7 +181,7 @@ }; xsession.windowManager.i3.config.startup = [{ - command = "systemctl --user restart polybar"; + command = "pkill polybar; polybar -r main"; always = true; notification = false; }]; diff --git a/modules/nixos/graphical/rofi/pulse-sink.sh b/modules/nixos/graphical/rofi/pulse-sink.sh index 8a8a009..de6d9f8 100755 --- a/modules/nixos/graphical/rofi/pulse-sink.sh +++ b/modules/nixos/graphical/rofi/pulse-sink.sh @@ -5,7 +5,14 @@ sink=$( ponymix -t sink list | awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}' | - rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100 -theme-str 'inputbar { enabled: false; }' | + rofi \ + -dmenu \ + -p 'pulseaudio sink:' \ + -width 100 \ + -hover-select \ + -me-select-entry '' \ + -me-accept-entry MousePrimary \ + -theme-str 'inputbar { enabled: false; }' | grep -Po '[0-9]+(?=:)' ) && ponymix set-default -d "$sink" &&