2025-12-30 22:04:10 +01:00
|
|
|
#!/usr/bin/env fish
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# Select folders in current semester
|
2026-01-20 17:11:15 +01:00
|
|
|
function open_semester
|
2026-05-19 14:06:13 +02:00
|
|
|
set options (ls -a $argv[1])
|
|
|
|
|
set input (menu $options || exit)
|
2026-01-20 17:11:15 +01:00
|
|
|
|
2026-05-19 14:06:13 +02:00
|
|
|
if test "$input" = "."
|
2026-05-13 16:31:23 +02:00
|
|
|
alacritty msg create-window --working-directory $argv[1]
|
|
|
|
|
else if test -d $argv[1]/$input
|
|
|
|
|
open_semester $argv[1]/$input
|
2026-07-27 21:49:54 +02:00
|
|
|
# else if test (xdg-mime query filetype $argv[1]/$input) = "application/pdf" && test (menu "PDF" "Ipe") = "Ipe"
|
|
|
|
|
# ipe $argv[1]/$input
|
2026-05-13 16:31:23 +02:00
|
|
|
else
|
|
|
|
|
xdg-open $argv[1]/$input
|
|
|
|
|
end
|
2026-01-20 17:11:15 +01:00
|
|
|
end
|
|
|
|
|
|
2026-06-06 17:54:33 +02:00
|
|
|
# Find files in home directory
|
|
|
|
|
function find_file
|
2026-06-21 00:30:53 +02:00
|
|
|
set file (find ~/Desktop ~/Documents ~/Downloads ~/Pictures ~/Videos -printf "%p\t%f\n" | fuzzel --with-nth 2 --accept-nth 1 --dmenu --match-mode=fuzzy)
|
2026-06-06 17:54:33 +02:00
|
|
|
|
|
|
|
|
if test (xdg-mime query filetype $file) = "application/pdf" && test (menu "PDF" "Ipe") = "Ipe"
|
|
|
|
|
ipe $file
|
|
|
|
|
else
|
|
|
|
|
xdg-open $file
|
|
|
|
|
end
|
2026-01-15 01:58:32 +01:00
|
|
|
end
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# 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-15 20:42:28 +02:00
|
|
|
xdg-open "https://wuecampus.uni-wuerzburg.de/moodle/course/view.php?id=79204"
|
2026-04-14 13:07:08 +02:00
|
|
|
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
|
|
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
function select_song
|
2026-07-16 22:41:09 +02:00
|
|
|
set state "artist"
|
|
|
|
|
set song
|
2026-07-12 16:11:41 +02:00
|
|
|
|
2026-07-16 22:41:09 +02:00
|
|
|
while true
|
|
|
|
|
if test $state = "title"
|
2026-08-02 15:59:00 +02:00
|
|
|
set song[3] (echo -e ".\n..\n$(mpc search --format "%track%\t%title%" album $song[2])" | fuzzel --dmenu --accept-nth 2 || exit)
|
2026-07-27 21:49:54 +02:00
|
|
|
|
|
|
|
|
if test $song[3] = "."
|
|
|
|
|
set state ""
|
2026-08-02 15:59:00 +02:00
|
|
|
mpc find album $song[2] | mpc add
|
2026-07-27 21:49:54 +02:00
|
|
|
else if test $song[3] = ".."
|
2026-07-16 22:41:09 +02:00
|
|
|
set state "album"
|
|
|
|
|
else
|
|
|
|
|
set state ""
|
2026-07-27 21:49:54 +02:00
|
|
|
mpc find album $song[2] | mpc insert
|
|
|
|
|
mpc play (math (mpc current --format "%position%") + (mpc search --format "%track%" title $song[3]))
|
2026-07-16 22:41:09 +02:00
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else if test $state = "album"
|
2026-08-02 15:59:00 +02:00
|
|
|
set song[2] (echo -e ".\n..\n$(mpc search --format "%date%\t%album%" albumartist $song[1] | uniq | sort)" | fuzzel --dmenu --accept-nth 2 || exit)
|
2026-07-16 22:41:09 +02:00
|
|
|
|
2026-07-27 21:49:54 +02:00
|
|
|
if test $song[2] = "."
|
|
|
|
|
set state ""
|
2026-08-02 15:59:00 +02:00
|
|
|
mpc find albumartist $song[1] | mpc add
|
2026-07-27 21:49:54 +02:00
|
|
|
else if test $song[2] = ".."
|
2026-07-16 22:41:09 +02:00
|
|
|
set state "artist"
|
|
|
|
|
else
|
|
|
|
|
set state "title"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
else if test $state = "artist"
|
|
|
|
|
set song[1] (mpc list albumartist | fuzzel --dmenu || exit)
|
|
|
|
|
|
|
|
|
|
set state "album"
|
|
|
|
|
else
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
2026-07-12 16:11:41 +02:00
|
|
|
end
|
2026-07-16 22:41:09 +02:00
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
function select_song_from_queue
|
2026-07-27 21:49:54 +02:00
|
|
|
set title (mpc playlist --format "%artist%\t%album%\t%title%" | column --table --separator \t --output-separator \t | fuzzel --dmenu --index --width 80 --lines 24 --select-index=(math (mpc current --format "%position%") - 1) --accept-nth 3 || exit)
|
2026-07-12 16:11:41 +02:00
|
|
|
|
2026-07-27 21:49:54 +02:00
|
|
|
mpc play (math $title + 1)
|
2026-07-12 16:11:41 +02:00
|
|
|
end
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# 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
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# 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
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# 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
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# 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
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# 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]
|
2026-03-15 20:20:28 +01:00
|
|
|
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]
|
2026-03-15 20:20:28 +01:00
|
|
|
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
|
|
|
|
|
|
2026-04-15 20:42:28 +02:00
|
|
|
function set_keyboard_backlight
|
|
|
|
|
brightnessctl --device=white:kbd_backlight set (menu --index "0" "1" "2" "3" "4")
|
|
|
|
|
end
|
2026-03-15 20:20:28 +01:00
|
|
|
|
2026-05-13 16:31:23 +02:00
|
|
|
function mirror_screen
|
|
|
|
|
wl-mirror eDP-1
|
|
|
|
|
end
|
|
|
|
|
|
2026-03-15 20:20:28 +01:00
|
|
|
# Select sub menu
|
2026-07-12 16:11:41 +02:00
|
|
|
set options " Open Semester" " Open WueCampus Course" " Find Files" " Add Album" " Select Song from Queue" " MPD Settings" " Select Audio Sink" " Select Audio Source" " Select Bluetooth" " Select Network" " Select Color Scheme" " Restore Notifications" " Set Keyboard Backlight" " Mirror Screen"
|
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-05-13 16:31:23 +02:00
|
|
|
open_semester "/home/never/Documents/InNa/26_SoSe/"
|
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-05-13 16:31:23 +02:00
|
|
|
case $options[3]
|
2026-06-06 17:54:33 +02:00
|
|
|
find_file
|
2026-05-13 16:31:23 +02:00
|
|
|
|
|
|
|
|
case $options[4]
|
2026-07-12 16:11:41 +02:00
|
|
|
select_song
|
2026-01-30 20:36:20 +01:00
|
|
|
|
2026-05-13 16:31:23 +02:00
|
|
|
case $options[5]
|
2026-07-12 16:11:41 +02:00
|
|
|
select_song_from_queue
|
|
|
|
|
|
|
|
|
|
case $options[6]
|
|
|
|
|
mpdmenu.fish
|
|
|
|
|
|
|
|
|
|
case $options[7]
|
2026-03-19 15:34:08 +01:00
|
|
|
wpsinkmenu.fish
|
|
|
|
|
# audio_sink
|
2026-07-12 16:11:41 +02:00
|
|
|
|
|
|
|
|
case $options[8]
|
|
|
|
|
wpsourcemenu.fish
|
|
|
|
|
# audio_source
|
2026-04-15 20:42:28 +02:00
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
case $options[9]
|
2026-03-19 15:34:08 +01:00
|
|
|
bluetoothmenu.fish
|
|
|
|
|
# bluetooth_connection
|
2026-01-30 15:27:34 +01:00
|
|
|
|
2026-07-27 21:55:13 +02:00
|
|
|
case $options[10]
|
2026-03-19 15:34:08 +01:00
|
|
|
networkmenu.fish
|
|
|
|
|
# network_connection
|
2026-04-15 20:42:28 +02:00
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
case $options[11]
|
2026-02-24 16:16:27 +01:00
|
|
|
color_scheme
|
2026-04-15 20:42:28 +02:00
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
case $options[12]
|
2026-03-21 19:32:08 +01:00
|
|
|
restore_notifications
|
2026-04-15 20:42:28 +02:00
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
case $options[13]
|
2026-04-15 20:42:28 +02:00
|
|
|
set_keyboard_backlight
|
2026-05-13 16:31:23 +02:00
|
|
|
|
2026-07-12 16:11:41 +02:00
|
|
|
case $options[14]
|
2026-05-13 16:31:23 +02:00
|
|
|
mirror_screen
|
2025-12-30 22:04:10 +01:00
|
|
|
end
|