diff options
| author | Josh Rahm <rahm@google.com> | 2022-01-11 19:45:24 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:45 -0600 |
| commit | af5c22d22e97ad3096599013b3faa948e5e018b8 (patch) | |
| tree | 35577f688547a58b85beca87bcf7bbae3ef34409 /extras/HOME | |
| parent | 2de3873a28a08b43c3185d4179a1bdb8a922523c (diff) | |
| download | rde-af5c22d22e97ad3096599013b3faa948e5e018b8.tar.gz rde-af5c22d22e97ad3096599013b3faa948e5e018b8.tar.bz2 rde-af5c22d22e97ad3096599013b3faa948e5e018b8.zip | |
Better Rofi integration
Diffstat (limited to 'extras/HOME')
| -rw-r--r-- | extras/HOME/.config/rofi/config.rasi | 2 | ||||
| -rwxr-xr-x | extras/HOME/.local/bin/bluetooth-select.sh | 6 | ||||
| -rwxr-xr-x | extras/HOME/.local/bin/emoji-select.sh | 6 | ||||
| -rwxr-xr-x | extras/HOME/.local/bin/emoticon-select.sh | 6 | ||||
| -rwxr-xr-x | extras/HOME/.local/bin/rofi-pass | 6 | ||||
| -rwxr-xr-x | extras/HOME/.local/bin/set-sink.sh | 6 | ||||
| -rwxr-xr-x | extras/HOME/.local/bin/set-volume.sh | 95 |
7 files changed, 121 insertions, 6 deletions
diff --git a/extras/HOME/.config/rofi/config.rasi b/extras/HOME/.config/rofi/config.rasi index 440194b..fe47aa6 100644 --- a/extras/HOME/.config/rofi/config.rasi +++ b/extras/HOME/.config/rofi/config.rasi @@ -8,7 +8,7 @@ alternate-normal-foreground: @theme-color; main-background: #202020f0; - font: "Monofur Bold Nerd Font 34"; + font: "Monofur Nerd Font 24"; } window { diff --git a/extras/HOME/.local/bin/bluetooth-select.sh b/extras/HOME/.local/bin/bluetooth-select.sh index 8c901ee..3a25387 100755 --- a/extras/HOME/.local/bin/bluetooth-select.sh +++ b/extras/HOME/.local/bin/bluetooth-select.sh @@ -1,8 +1,12 @@ #!/bin/bash +if [[ -z "$ROFI" ]] ; then + ROFI='rofi -dmenu' +fi + devices="$(bluetoothctl -- devices | sed 's#^Device ##')" selection="$( - echo -e "$devices\nDisconnect" | rofi -i -p "Connect Bluetooth" \ + echo -e "$devices\nDisconnect" | $ROFI -i -p "Connect Bluetooth" \ -theme-str '* {theme-color: #8888ff;}' \ -dmenu)" diff --git a/extras/HOME/.local/bin/emoji-select.sh b/extras/HOME/.local/bin/emoji-select.sh index 5d244d8..a64a6e9 100755 --- a/extras/HOME/.local/bin/emoji-select.sh +++ b/extras/HOME/.local/bin/emoji-select.sh @@ -1,7 +1,11 @@ #!/bin/bash +if [[ -z "$ROFI" ]] ; then + ROFI='rofi -dmenu' +fi + if ( which rofi ) ; then - menu=(rofi -dmenu -i -p "Select Character" -theme-str '* {theme-color: #ffff88;}' -show run) + menu=($ROFI -i -p "Select Character" -theme-str '* {theme-color: #ffff88;}' -show run) else menu=(dmenu -fn NotoSans:size=24 -i -nf "#ffff88" -sb "#ffff88" -p "Select Character" -l 12 -dim 0.4) fi diff --git a/extras/HOME/.local/bin/emoticon-select.sh b/extras/HOME/.local/bin/emoticon-select.sh index cb593b4..e1637d1 100755 --- a/extras/HOME/.local/bin/emoticon-select.sh +++ b/extras/HOME/.local/bin/emoticon-select.sh @@ -1,7 +1,11 @@ #!/bin/bash +if [[ -z "$ROFI" ]] ; then + ROFI='rofi -dmenu' +fi + if ( which rofi ) ; then - menu=(rofi -i -theme-str '* {theme-color: #ffa050;}' -p "Select Emoticon" -dmenu) + menu=($ROFI -i -theme-str '* {theme-color: #ffa050;}' -p "Select Emoticon") else menu=(dmenu -fn NotoSans:size=24 -i -nf "#ffff88" -sb "#ffff88" -p "Select Emoticon" -l 12 -dim 0.4) fi diff --git a/extras/HOME/.local/bin/rofi-pass b/extras/HOME/.local/bin/rofi-pass index 6eb58b7..d78870a 100755 --- a/extras/HOME/.local/bin/rofi-pass +++ b/extras/HOME/.local/bin/rofi-pass @@ -2,6 +2,10 @@ shopt -s nullglob globstar +if [[ -z "$ROFI" ]] ; then + ROFI='rofi -dmenu' +fi + typeit=0 if [[ $1 == "--type" ]]; then typeit=1 @@ -12,7 +16,7 @@ if [[ -n $WAYLAND_DISPLAY ]]; then dmenu=dmenu-wl xdotool="ydotool type --file -" elif [[ -n $DISPLAY ]]; then - dmenu=(rofi -i -dmenu -p 'Password') + dmenu=($ROFI -i -p 'Password') xdotool="xdotool type --clearmodifiers --file -" else echo "Error: No Wayland or X11 display detected" >&2 diff --git a/extras/HOME/.local/bin/set-sink.sh b/extras/HOME/.local/bin/set-sink.sh index 9cd6f93..cca8746 100755 --- a/extras/HOME/.local/bin/set-sink.sh +++ b/extras/HOME/.local/bin/set-sink.sh @@ -1,6 +1,10 @@ #!/bin/bash -DMENU=(rofi -i -theme-str '* {theme-color: #88ff88;}' -dmenu) +if [[ -z "$ROFI" ]] ; then + ROFI='rofi -dmenu' +fi + +DMENU=($ROFI -i -theme-str '* {theme-color: #88ff88;}') sinks="$( pactl list sinks | while read line ; do diff --git a/extras/HOME/.local/bin/set-volume.sh b/extras/HOME/.local/bin/set-volume.sh new file mode 100755 index 0000000..94423d0 --- /dev/null +++ b/extras/HOME/.local/bin/set-volume.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +rofi=($ROFI -theme-str "* {theme-color: #88ffff;}") + +if [[ "$1" == "-a" ]] ; then + sinks="$(pactl list sinks | (while read line ; do + case $line in + Description:*) + descr=${line//*: } + ;; + Sink\ \#*) + if [ ! -z "$sink" ] ; then + echo "$state $descr ($volume)|$sink" + fi + sink=${line//*#} ;; + Volume:*) + volume=$(sed 's/.* \([0-9]\+%\).*/\1/g' <<< "$line") + ;; + *State:*) + state=${line//*: } + if [[ "$state" == 'RUNNING' ]] ; then + state='⏺' + else + state=' ' + fi ;; + esac + done + echo "$state $descr ($volume)|$sink"))" + sinks="$(grep "^⏺" <<< "$sinks" ; grep -v "^⏺" <<< "$sinks")" + + sink_inputs="$(pactl list sink-inputs | (while read line ; do + case $line in + *application.name\ =*) + app="${line//*= \"}" + app="${app%%\"}" + ;; + *media.name\ =*) + media="${line//*= \"}" + media="${media%%\"}" + ;; + *Volume:*) + volume=$(sed 's/.* \([0-9]\+%\).*/\1/g' <<< "$line") + ;; + Sink\ Input\ \#*) + if [ ! -z "$sink" ] ; then + echo "⏺ $app: $media ($volume)|$sink" + fi + sink=${line//*#} ;; + esac + done + echo "⏺ $app: $media ($volume)|$sink"))" + + selection=$( + (echo "$sinks" ; echo '' ; echo "$sink_inputs") | \ + cut -d'|' -f1 | \ + "${rofi[@]}" -p "Set Volume For") + + if [[ -z "$selection" ]] ; then + echo "Cancelled" >&2 + exit 0 + fi + + value=$(grep "$selection" <<< "$sinks") + command="set-sink-volume" + if [[ -z "$value" ]] ; then + command="set-sink-input-volume" + value=$(grep "$selection" <<< "$sink_inputs") + if [[ -z "$value" ]] ; then + echo "Invalid Selection" >&2 + exit 1 + fi + fi + echo "Setting $value" + value=${value//*|} +else + command="set-sink-volume" + value="@DEFAULT_SINK@" +fi + +volume=$(echo '10% + 20% + 30% + 40% + 50% + 60% + 70% + 80% + 90% + 100% + 110% + 120% + 130%' | "${rofi[@]}" -p 'Set Volume To') + +echo pactl "$command" "$value" "$volume" +pactl "$command" "$value" $volume |