dotfiles/.local/scripts/actionmenu.fish

177 lines
4.6 KiB
Fish
Raw Normal View History

2025-12-30 22:04:10 +01:00
#!/usr/bin/env fish
# Select folders in current semester
2026-01-20 17:11:15 +01:00
function open_semester
set recent "/home/never/Documents/InNa/25_WiSe/"
set options (ls $recent)
set input (menu $options)
2026-03-19 18:55:59 +01:00
alacritty msg create-window --working-directory $recent/$input
2026-01-20 17:11:15 +01:00
end
# Open user directories
2026-01-15 01:58:32 +01:00
function open_location
2026-01-20 17:11:15 +01:00
set options "25_WiSe" "󰈙 Documents" "󰝚 Music" "󰋩 Pictures" "󰕧 Videos" "󰇚 Downloads"
2026-01-15 01:58:32 +01:00
set input (menu $options)
2026-01-20 17:11:15 +01:00
switch $input
case $options[1]
open_semester
case $options[2]
2026-03-19 18:55:59 +01:00
alacritty msg create-window --working-directory (xdg-user-dir)/Documents/
2026-01-20 17:11:15 +01:00
case $options[3]
2026-03-19 18:55:59 +01:00
alacritty msg create-window --working-directory (xdg-user-dir)/Music/
2026-01-20 17:11:15 +01:00
case $options[4]
2026-03-19 18:55:59 +01:00
alacritty msg create-window --working-directory (xdg-user-dir)/Pictures/
2026-01-20 17:11:15 +01:00
case $options[5]
2026-03-19 18:55:59 +01:00
alacritty msg create-window --working-directory (xdg-user-dir)/Videos/
2026-01-20 17:11:15 +01:00
case $options[6]
2026-03-19 18:55:59 +01:00
alacritty msg create-window --working-directory (xdg-user-dir)/Downloads/
2026-01-15 01:58:32 +01:00
end
end
# Open WueCampus Courses
2026-01-30 20:36:20 +01:00
function open_course
2026-04-14 13:07:08 +02:00
set options "Algorithmische Graphentheorie" "Theoretische Informatik" "Energy-Aware Engineering" "Nachhaltigkeitskonzepte" "Softwareengineering"
2026-01-30 20:36:20 +01:00
set input (menu $options)
switch $input
case $options[1]
2026-04-14 13:07:08 +02:00
xdg-open "https://wuecampus.uni-wuerzburg.de/moodle/course/view.php?id=78644"
2026-01-30 20:36:20 +01:00
case $options[2]
2026-04-14 13:07:08 +02:00
xdg-open "https://wuecampus.uni-wuerzburg.de/moodle/course/view.php?id=79649"
2026-01-30 20:36:20 +01:00
case $options[3]
2026-04-14 13:07:08 +02:00
xdg-open "https://wuecampus.uni-wuerzburg.de/moodle/course/view.php?id=78361"
2026-01-30 20:36:20 +01:00
case $options[4]
2026-04-14 13:07:08 +02:00
xdg-open ""
case $options[5]
xdg-open "https://wuecampus.uni-wuerzburg.de/moodle/course/view.php?id=79247"
2026-01-30 20:36:20 +01:00
end
end
# Select the default audio source
2026-01-21 13:23:28 +01:00
function audio_source
2026-01-26 23:38:04 +01:00
set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Source")' | jq '.id, .info.props."node.description"'))
2026-03-08 23:06:13 +01:00
2026-01-21 13:23:28 +01:00
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
2026-01-28 00:57:01 +01:00
set input (math (menu --index $names) + 1)
2026-01-21 13:23:28 +01:00
2026-01-28 00:57:01 +01:00
wpctl set-default $ids[$input]
2026-01-21 13:23:28 +01:00
end
# Select the default audio sink
2026-01-21 13:23:28 +01:00
function audio_sink
2026-01-26 23:38:04 +01:00
set dump (string trim -c '"' (pw-dump | jq '.[] | select(.info.props."media.class" == "Audio/Sink")' | jq '.id, .info.props."node.description"'))
2026-01-21 13:23:28 +01:00
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
2026-01-28 00:57:01 +01:00
set input (math (menu --index $names) + 1)
2026-01-21 13:23:28 +01:00
2026-01-28 00:57:01 +01:00
wpctl set-default $ids[$input]
2026-01-21 13:23:28 +01:00
end
# Select the network connection profile
2026-01-30 15:27:34 +01:00
function network_connection
2026-02-17 14:00:48 +01:00
set options (nmcli --terse --fields name connection show)
2026-03-11 14:43:15 +01:00
set input (menu $options || exit)
2026-01-30 15:27:34 +01:00
notify-send "Connect to network $input" (nmcli connection up $input)
end
# Select a paired bluetooth connection
2026-01-30 15:27:34 +01:00
function 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
2026-03-11 14:43:15 +01:00
set input (math (menu --index $names || exit) + 1)
2026-01-30 15:27:34 +01:00
notify-send "Connect to bluetooth device $names[$input]" (bluetoothctl connect $ids[$input] | string collect)
end
# Select the system color scheme preference
2026-02-24 16:16:27 +01:00
function color_scheme
set options "Light" "Dark"
set input (menu $options)
switch $input
case $options[1]
niri msg action do-screen-transition
2026-02-24 16:16:27 +01:00
dconf write /org/gnome/desktop/interface/color-scheme \'prefer-light\'
2026-03-19 18:17:31 +01:00
command alacritty msg config -w -1 (cat /home/never/.config/alacritty/gruvbox-light.toml)
2026-02-24 16:16:27 +01:00
case $options[2]
niri msg action do-screen-transition
2026-02-24 16:16:27 +01:00
dconf write /org/gnome/desktop/interface/color-scheme \'prefer-dark\'
2026-03-19 18:17:31 +01:00
command alacritty msg config -w -1 (cat /home/never/.config/alacritty/gruvbox-dark.toml)
2026-02-24 16:16:27 +01:00
end
end
2026-03-21 19:32:08 +01:00
function restore_notifications
for i in (seq (count (string match -r 'Notification [0-9]' (makoctl history))))
makoctl restore
end
end
# Select sub menu
2026-03-21 19:32:08 +01:00
set options "󱂵 Open Location" "󰑴 Open WueCampus Course" "󰍬 Select Audio Source" "󰕾 Select Audio Sink" "󰂯 Select Bluetooth" "󰛳 Select Network" "󰔎 Color Scheme" "󰂚 Restore Notifications"
2025-12-30 22:04:10 +01:00
set input (menu $options)
switch $input
2026-01-15 01:58:32 +01:00
case $options[1]
2026-01-21 13:23:28 +01:00
open_location
2025-12-30 22:04:10 +01:00
2026-01-25 15:44:54 +01:00
case $options[2]
2026-01-30 20:36:20 +01:00
open_course
2026-01-21 13:23:28 +01:00
2026-01-25 15:44:54 +01:00
case $options[3]
2026-03-19 15:34:08 +01:00
wpsourcemenu.fish
# audio_source
2026-01-30 20:36:20 +01:00
case $options[4]
2026-03-19 15:34:08 +01:00
wpsinkmenu.fish
# audio_sink
2026-01-30 15:27:34 +01:00
2026-01-30 20:36:20 +01:00
case $options[5]
2026-03-19 15:34:08 +01:00
bluetoothmenu.fish
# bluetooth_connection
2026-01-30 15:27:34 +01:00
2026-01-30 20:36:20 +01:00
case $options[6]
2026-03-19 15:34:08 +01:00
networkmenu.fish
# network_connection
2026-02-24 16:16:27 +01:00
case $options[7]
color_scheme
2026-03-21 19:32:08 +01:00
case $options[8]
restore_notifications
2025-12-30 22:04:10 +01:00
end