diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index 27541e4..3175bab 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -25,7 +25,8 @@ "format-connected": "󰂯", "tooltip-format": "{controller_alias}\t{controller_address}", "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{device_enumerate}", - "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}" + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", + "on-click": "bluetoothmenu.fish" }, "network": { @@ -38,7 +39,8 @@ "tooltip-format": "{ifname}", "tooltip-format-wifi": "󰖩 {essid} ({signalStrength}%)", "tooltip-format-ethernet": "󰈁 {ifname}", - "tooltip-format-disconnected": "Disconnected" + "tooltip-format-disconnected": "Disconnected", + "on-click": "networkmenu.fish" }, "wireplumber#sink": { @@ -46,6 +48,7 @@ "format-muted": "󰖁", "format-icons": ["󰕿", "󰖀", "󰕾"], "tooltip-format": "{node_name} ({volume}%)", + "on-click": "wpsinkmenu.fish", "on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle", "scroll-step": 5 }, @@ -55,6 +58,7 @@ "format": "󰍬", "format-muted": "󰍭", "tooltip-format": "{node_name} ({volume}%)", + "on-click": "wpsourcemenu.fish", "on-click-right": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle", "scroll-step": 5 }, diff --git a/.local/scripts/actionmenu.fish b/.local/scripts/actionmenu.fish index 2b0569c..8edbdb7 100755 --- a/.local/scripts/actionmenu.fish +++ b/.local/scripts/actionmenu.fish @@ -143,16 +143,20 @@ switch $input open_course case $options[3] - audio_source + wpsourcemenu.fish + # audio_source case $options[4] - audio_sink + wpsinkmenu.fish + # audio_sink case $options[5] - bluetooth_connection + bluetoothmenu.fish + # bluetooth_connection case $options[6] - network_connection + networkmenu.fish + # network_connection case $options[7] color_scheme diff --git a/.local/scripts/bluetoothmenu.fish b/.local/scripts/bluetoothmenu.fish new file mode 100755 index 0000000..1e240d6 --- /dev/null +++ b/.local/scripts/bluetoothmenu.fish @@ -0,0 +1,19 @@ +#!/usr/bin/env fish + +# Select a paired bluetooth connection +set dump (bluetoothctl devices | string replace "Device " "" | string split -m 1 " ") + +set ids +set names + +for i in (seq (count $dump)) + if test (math $i % 2) -eq 0 + set -a names $dump[$i] + else + set -a ids $dump[$i] + end +end + +set input (math (menu --index $names || exit) + 1) + +notify-send "Connect to bluetooth device $names[$input]" (bluetoothctl connect $ids[$input] | string collect) diff --git a/.local/scripts/networkmenu.fish b/.local/scripts/networkmenu.fish new file mode 100755 index 0000000..2815ee3 --- /dev/null +++ b/.local/scripts/networkmenu.fish @@ -0,0 +1,7 @@ +#!/usr/bin/env fish + +# Select the network connection profile +set options (nmcli --terse --fields name connection show) +set input (menu $options || exit) + +notify-send "Connect to network $input" (nmcli connection up $input) diff --git a/.local/scripts/wpsinkmenu.fish b/.local/scripts/wpsinkmenu.fish new file mode 100755 index 0000000..da50b50 --- /dev/null +++ b/.local/scripts/wpsinkmenu.fish @@ -0,0 +1,19 @@ +#!/usr/bin/env fish + +# Select the default audio sink +set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Sink")' | jq '.id, .info.props."node.description"')) + +set ids +set names + +for i in (seq (count $dump)) + if test (math $i % 2) -eq 0 + set -a names $dump[$i] + else + set -a ids $dump[$i] + end +end + +set input (math (menu --index $names) + 1) + +wpctl set-default $ids[$input] diff --git a/.local/scripts/wpsourcemenu.fish b/.local/scripts/wpsourcemenu.fish new file mode 100755 index 0000000..3fc04a4 --- /dev/null +++ b/.local/scripts/wpsourcemenu.fish @@ -0,0 +1,19 @@ +#!/usr/bin/env fish + +# Select the default audio source +set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Source")' | jq '.id, .info.props."node.description"')) + +set ids +set names + +for i in (seq (count $dump)) + if test (math $i % 2) -eq 0 + set -a names $dump[$i] + else + set -a ids $dump[$i] + end +end + +set input (math (menu --index $names) + 1) + +wpctl set-default $ids[$input]