Switch to rofi.
This commit is contained in:
parent
e8e2fb2fb5
commit
122f54d3ae
6 changed files with 20 additions and 19 deletions
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
div="----------"
|
||||
div="---"
|
||||
|
||||
set_output() {
|
||||
sel_sink=$(printf "$sinks\\n$div\\nback\\nexit" | dmenu -c -l 10 -i)
|
||||
sel_sink=$(printf "$sinks\\n$div\\nback\\n$div\\nexit" | rofi -dmenu -i -p "select output device")
|
||||
case "$sel_sink" in
|
||||
back) show_current ;;
|
||||
exit) exit ;;
|
||||
|
@ -14,7 +14,7 @@ set_output() {
|
|||
}
|
||||
|
||||
set_input() {
|
||||
sel_source=$(printf "$sources\\n$div\\nBluetooth profile\\n$div\\nback\\nexit" | dmenu -c -l 10 -i)
|
||||
sel_source=$(printf "$sources\\n$div\\nbluetooth profile\\n$div\\nback\\n$div\\nexit" | rofi -dmenu -i -p "select input device")
|
||||
case "$sel_source" in
|
||||
back) show_current ;;
|
||||
exit) exit ;;
|
||||
|
@ -29,7 +29,7 @@ set_bt_profile() {
|
|||
bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}')
|
||||
[ -z "${bt_sink}" ] &&
|
||||
{ notify-send -t 2000 -u critical "ﳌ no headphones connected"; exit; }
|
||||
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | dmenu -c -l 5 -i)
|
||||
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | rofi -dmenu -i -p "select bluettoth profile")
|
||||
case "$profile_chosen" in
|
||||
back) show_current ;;
|
||||
exit) exit ;;
|
||||
|
@ -44,15 +44,15 @@ set_bt_profile() {
|
|||
show_current() {
|
||||
def_snk=$(pactl list | grep -A 1 "Name: $(pactl get-default-sink)\$" | awk -F': ' '/Description: / {print $2}')
|
||||
def_src=$(pactl list | grep -A 1 "Name: $(pactl get-default-source)\$" | awk -F': ' '/Description: / {print $2}')
|
||||
chosen=$(printf "Output: $def_snk\\nInput: $def_src" | dmenu -c -l 2)
|
||||
chosen=$(printf "output: $def_snk\\ninput: $def_src" | rofi -dmenu -i -p "current audio devices")
|
||||
if [ "$1" = "no_switch" ]; then
|
||||
case "$chosen" in
|
||||
*) notify-send -t 2000 -u critical "婢 no device to switch" ;;
|
||||
esac
|
||||
else
|
||||
case "$chosen" in
|
||||
Output*) set_output ;;
|
||||
Input*) set_input ;;
|
||||
output*) set_output ;;
|
||||
input*) set_input ;;
|
||||
esac
|
||||
fi
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
|
||||
# Constants
|
||||
divider="----------"
|
||||
div="---"
|
||||
goback="back"
|
||||
|
||||
# Checks if bluetooth controller is powered on
|
||||
|
@ -215,13 +215,13 @@ device_menu() {
|
|||
fi
|
||||
paired=$(device_paired $mac)
|
||||
trusted=$(device_trusted $mac)
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\nexit"
|
||||
options="$connected\n$paired\n$trusted\n$div\n$goback\n$div\nexit"
|
||||
|
||||
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | $divider)
|
||||
"" | $div)
|
||||
echo "no option chosen."
|
||||
;;
|
||||
$connected)
|
||||
|
@ -253,7 +253,7 @@ show_menu() {
|
|||
pairable=$(pairable_on)
|
||||
discoverable=$(discoverable_on)
|
||||
|
||||
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nexit"
|
||||
options="$devices\n$div\n$power\n$scan\n$pairable\n$discoverable\nexit"
|
||||
else
|
||||
power="power: off"
|
||||
options="$power\nexit"
|
||||
|
@ -263,7 +263,7 @@ show_menu() {
|
|||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
"" | $divider)
|
||||
"" | $div)
|
||||
echo "No option chosen."
|
||||
;;
|
||||
$power)
|
||||
|
@ -287,7 +287,7 @@ show_menu() {
|
|||
}
|
||||
|
||||
# command to pipe into, can add any options here
|
||||
rofi_command="dmenu -c -l 20 -i -p"
|
||||
rofi_command="rofi -dmenu -i -p"
|
||||
|
||||
case "$1" in
|
||||
--status)
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
chosen=$(cut -d ';' -f1 $XDG_CONFIG_HOME/qtile/chars/* | dmenu -l 30 -i | sed "s/ .*//")
|
||||
chosen=$(cut -d ';' -f1 $XDG_CONFIG_HOME/qtile/chars/* | rofi -dmenu -i -p "select character to copy" | sed "s/ .*//")
|
||||
[ -z "$chosen" ] && exit
|
||||
|
||||
if [ -n "$1" ]; then
|
Loading…
Add table
Add a link
Reference in a new issue