pinwheel: Add bluetooth to waybar

This commit is contained in:
Alexander Heldt
2023-09-19 22:11:07 +02:00
parent 1f36f8539b
commit 4a2770c6f5

View File

@@ -22,6 +22,15 @@ let
esac esac
fi fi
''; '';
toggle-bt-power = pkgs.writeShellScript "toggle-bt-power" ''
POWERED_ON=$(bluetoothctl show | grep "Powered: yes")
if [ -z "$POWERED_ON" ]; then
bluetoothctl power on >> /dev/null
else
bluetoothctl power off >> /dev/null
fi
'';
in in
{ {
home-manager.users.alex = { home-manager.users.alex = {
@@ -40,7 +49,7 @@ in
]; ];
modules-left = [ "hyprland/workspaces" ]; modules-left = [ "hyprland/workspaces" ];
modules-right = [ "custom/spotify" "wireplumber" "battery" "clock" ]; modules-right = [ "custom/spotify" "bluetooth" "wireplumber" "battery" "clock" ];
"custom/spotify" = { "custom/spotify" = {
exec = spotify-status; exec = spotify-status;
@@ -48,6 +57,14 @@ in
tooltip = false; tooltip = false;
}; };
bluetooth = {
"format-off" = "󰂲";
"format-on" = "";
"format-connected" = "";
"on-click" = "${pkgs.blueman}/bin/blueman-manager";
"on-click-right" = toggle-bt-power;
};
wireplumber = { wireplumber = {
format = "{volume}%"; format = "{volume}%";
format-muted = ""; format-muted = "";
@@ -93,7 +110,7 @@ in
background-color: ${background}; background-color: ${background};
} }
#custom-spotify, #wireplumber, #battery, #clock { #custom-spotify, #bluetooth, #wireplumber, #battery, #clock {
margin: 0 12px; margin: 0 12px;
} }
''; '';