Recent rofi stuff

This commit is contained in:
agryphus 2024-01-08 23:06:17 -05:00
parent b3736e8d7c
commit 4dc1a98098
3 changed files with 45 additions and 28 deletions

View file

@ -1,9 +1,7 @@
#!/usr/bin/env sh
# Script to have rofi show and run aliases
rofi -run-list-command "alias | awk -F= \"{print \\\$1}\"" \
-run-command "/usr/bin/env zsh -i -c '{cmd}'" \
-rnow -show-icons -matching "prefix" \
rofi -rnow -show-icons -matching "prefix" \
-display-combi "Start:" \
-show combi -combi-modes "drun,run"
-display-drun "Start:" \
-show drun

View file

@ -1,23 +0,0 @@
#!/usr/bin/env sh
# Simple dmenu script for changing default audio sink
sinks_and_numbers=`wpctl status |
awk '/Audio/,/Video/ {print}' |
awk '/Sinks:/,/Sink endpoints:/ {print}' |
tail -n +2 | head -n -2 | cut -c 10-`
sinks=`echo "$sinks_and_numbers" |
awk -F'.' '{print $2}' |
awk -F'[' '{print $1}' |
cut -c 2-`
chosen=`echo "$sinks" | rofi -dmenu -p "Select audio sink:" -i`
if [ -z "$chosen" ]; then
# Exited out of dmenu prompt
exit
fi
number=`echo "$sinks_and_numbers" | grep "$chosen" | awk '{print $1}' | sed 's/\./ /'`
wpctl set-default $number

42
.local/bin/menu-wpio Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env sh
# Simple rofi script for changing default audio sink
audio_info="$(wpctl status \
| awk '/Audio/,/Video/ {print}')"
case $1 in
sink)
section="$(echo "$audio_info" \
| awk '/Sinks:/,/Sink endpoints:/ {print}')"
;;
source)
section="$(echo "$audio_info" \
| awk '/Sources:/,/Source endpoints:/ {print}')"
;;
*)
echo "Aguments must be one of (sink|source)."
exit 1
;;
esac
devices_and_numbers="$(echo "$section" \
| tail -n +2 | head -n -2 | cut -c 10-)"
devices="$(echo "$devices_and_numbers" \
| awk -F'.' '{print $2}' \
| awk -F'[' '{print $1}' \
| cut -c 2-)"
chosen="$(echo "$devices" | rofi -no-fixed-num-lines -dmenu -p "Select audio $1:" -i)"
if [ -z "$chosen" ]; then
# Exited without selecting
exit
fi
number="$(echo "$devices_and_numbers" \
| grep "$chosen" \
| awk '{print $1}' \
| sed 's/\./ /')"
wpctl set-default $number