Bye bye pavucontrol, dmenu scripts consistency.
This commit is contained in:
parent
836e31ce61
commit
18c4407e77
5 changed files with 55 additions and 16 deletions
|
@ -338,7 +338,7 @@
|
||||||
background = "#c7c7c7"
|
background = "#c7c7c7"
|
||||||
foreground = "#161616"
|
foreground = "#161616"
|
||||||
frame_color = "#c7c7c7"
|
frame_color = "#c7c7c7"
|
||||||
timeout = 3
|
timeout = 2
|
||||||
# Icon for notifications with normal urgency, uncomment to enable
|
# Icon for notifications with normal urgency, uncomment to enable
|
||||||
#icon = /path/to/icon
|
#icon = /path/to/icon
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@
|
||||||
background = "#fd4285"
|
background = "#fd4285"
|
||||||
foreground = "#161616"
|
foreground = "#161616"
|
||||||
frame_color = "#fd4285"
|
frame_color = "#fd4285"
|
||||||
timeout = 0
|
timeout = 2
|
||||||
# Icon for notifications with critical urgency, uncomment to enable
|
# Icon for notifications with critical urgency, uncomment to enable
|
||||||
#icon = /path/to/icon
|
#icon = /path/to/icon
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,65 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
div="----------"
|
||||||
|
|
||||||
set_output() {
|
set_output() {
|
||||||
sel_sink=$(printf "$sinks" | dmenu -l 10 -i -p "sink")
|
sel_sink=$(printf "$sinks\\n$div\\nback\\nexit" | dmenu -l 10 -i -p "sink")
|
||||||
pactl set-default-sink $(pactl list sinks | grep -B 1 "$sel_sink" | awk -F': ' '/Name:/ {print $2}')
|
case "$sel_sink" in
|
||||||
|
back) show_current ;;
|
||||||
|
exit) exit ;;
|
||||||
|
*) pactl set-default-sink $(pactl list sinks | grep -B 1 "$sel_sink" | awk -F': ' '/Name:/ {print $2}') ;;
|
||||||
|
esac
|
||||||
kill -46 $(pidof dwmblocks)
|
kill -46 $(pidof dwmblocks)
|
||||||
|
show_current
|
||||||
}
|
}
|
||||||
|
|
||||||
set_input() {
|
set_input() {
|
||||||
sel_source=$(printf "$sources" | dmenu -l 10 -i -p "source")
|
sel_source=$(printf "$sources\\n$div\\nBluetooth profile\\n$div\\nback\\nexit" | dmenu -l 10 -i -p "source")
|
||||||
pactl set-default-source $(pactl list sources | grep -B 1 "$sel_source" | awk -F': ' '/Name:/ {print $2}')
|
case "$sel_source" in
|
||||||
|
back) show_current ;;
|
||||||
|
exit) exit ;;
|
||||||
|
Bluetooth*) set_bt_profile ;;
|
||||||
|
*) echo pactl set-default-source "$(pactl list sources | grep -B 1 "$sel_source" | awk -F': ' '/Name:/ {print $2}')" ;;
|
||||||
|
esac
|
||||||
kill -46 $(pidof dwmblocks)
|
kill -46 $(pidof dwmblocks)
|
||||||
|
show_current
|
||||||
|
}
|
||||||
|
|
||||||
|
set_bt_profile() {
|
||||||
|
bt_sink=$(pactl list cards | awk -F'"' '/device.name.*bluez/ {print $2}')
|
||||||
|
[ -z "${bt_sink}" ] &&
|
||||||
|
{ dunstify -u critical "🎧 no headphones connected"; exit; }
|
||||||
|
profile_chosen=$(printf "profile mSBC\\nprofile LDAC\\n$div\\nback\\nexit" | dmenu -l 5 -i -p "profile")
|
||||||
|
case "$profile_chosen" in
|
||||||
|
back) show_current ;;
|
||||||
|
exit) exit ;;
|
||||||
|
profile*mSBC) pactl set-card-profile $bt_sink headset-head-unit-msbc
|
||||||
|
pactl set-default-source $(pactl list sources short | awk '/bluez_input/ {print $2}') ;;
|
||||||
|
profile*LDAC) pactl set-card-profile $bt_sink a2dp-sink-ldac ;;
|
||||||
|
*) show_current ;;
|
||||||
|
esac
|
||||||
|
pactl set-default
|
||||||
|
}
|
||||||
|
|
||||||
|
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 -l 2 -p "current settings")
|
||||||
|
if [ "$1" = "no_switch" ]; then
|
||||||
|
case "$chosen" in
|
||||||
|
*) dunstify -u critical "🔊 no device to switch" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case "$chosen" in
|
||||||
|
Output*) set_output ;;
|
||||||
|
Input*) set_input ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sinks=$(pactl list sinks | awk -F': ' '/Description:/ {print $2}')
|
sinks=$(pactl list sinks | awk -F': ' '/Description:/ {print $2}')
|
||||||
sources=$(pactl list sources | grep -v 'Monitor of ' | awk -F': ' '/Description:/ {print $2}')
|
sources=$(pactl list sources | grep -v 'Monitor of ' | awk -F': ' '/Description:/ {print $2}')
|
||||||
[ "$(echo "$sinks" | wc -l)" -lt 2 ] &&
|
[ "$(echo "$sinks" | wc -l)" -lt 2 ] &&
|
||||||
{ notify-send "🔊 nothing to switch"; exit; }
|
{ show_current no_switch; exit; }
|
||||||
|
|
||||||
chosen=$(printf "output\\ninput" | dmenu -i -p "change")
|
show_current
|
||||||
case "$chosen" in
|
|
||||||
output) set_output ;;
|
|
||||||
input) set_input ;;
|
|
||||||
*) exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
||||||
|
|
||||||
# If there's only one screen
|
# If there's only one screen
|
||||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||||
{ onescreen "$screens"; postrun; notify-send "💻 nothing to switch"; exit ;}
|
{ onescreen "$screens"; postrun; dunstify -u critical "💻 no device to switch"; exit ;}
|
||||||
|
|
||||||
# Get user choice including both and manual selection:
|
# Get user choice including both and manual selection:
|
||||||
chosen=$(printf -- "home-1\\nhome-2\\n----\\n%s\\n----\\nmulti" "$screens" | dmenu -l 20 -i -p "display") &&
|
chosen=$(printf -- "home-1\\nhome-2\\n----\\n%s\\n----\\nmulti" "$screens" | dmenu -l 20 -i -p "display") &&
|
||||||
|
|
|
@ -8,5 +8,5 @@ if [ -n "$1" ]; then
|
||||||
xdotool type "$chosen"
|
xdotool type "$chosen"
|
||||||
else
|
else
|
||||||
printf "$chosen" | xsel -l /dev/null
|
printf "$chosen" | xsel -l /dev/null
|
||||||
notify-send "'$chosen' copied to clipboard" &
|
dunstify "'$chosen' copied to clipboard" &
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -116,7 +116,6 @@ static Key keys[] = {
|
||||||
{ CTRKEY, XK_d, spawn, SHCMD("dmenu-display") },
|
{ CTRKEY, XK_d, spawn, SHCMD("dmenu-display") },
|
||||||
{ CTRKEY, XK_e, spawn, SHCMD("dmenu-emoji") },
|
{ CTRKEY, XK_e, spawn, SHCMD("dmenu-emoji") },
|
||||||
{ CTRKEY, XK_l, spawn, SHCMD("slock") },
|
{ CTRKEY, XK_l, spawn, SHCMD("slock") },
|
||||||
{ CTRKEY, XK_v, spawn, SHCMD("pavucontrol") },
|
|
||||||
/* window controls */
|
/* window controls */
|
||||||
{ SHTKEY, XK_m, zoom, {0} },
|
{ SHTKEY, XK_m, zoom, {0} },
|
||||||
{ SHTKEY, XK_h, setmfact, {.f = -0.05} },
|
{ SHTKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue