Fix PipeWire audio helpers
This commit is contained in:
@@ -256,7 +256,7 @@ function M.setup(ctx)
|
|||||||
bind(hyper .. " + I", exec("rofi_select_input.hs"))
|
bind(hyper .. " + I", exec("rofi_select_input.hs"))
|
||||||
bind(hyper .. " + backslash", exec("/home/imalison/dotfiles/dotfiles/lib/functions/mpg341cx_input toggle"))
|
bind(hyper .. " + backslash", exec("/home/imalison/dotfiles/dotfiles/lib/functions/mpg341cx_input toggle"))
|
||||||
bind(hyper .. " + SHIFT + backslash", workspacehistory("debug"))
|
bind(hyper .. " + SHIFT + backslash", workspacehistory("debug"))
|
||||||
bind(hyper .. " + O", exec("rofi_paswitch"))
|
bind(hyper .. " + O", exec("/home/imalison/dotfiles/dotfiles/lib/functions/rofi_paswitch"))
|
||||||
bind(hyper .. " + comma", exec("rofi_wallpaper.sh"))
|
bind(hyper .. " + comma", exec("rofi_wallpaper.sh"))
|
||||||
bind(hyper .. " + SHIFT + comma", exec("/home/imalison/dotfiles/dotfiles/lib/bin/neowall-wallpaper toggle"))
|
bind(hyper .. " + SHIFT + comma", exec("/home/imalison/dotfiles/dotfiles/lib/bin/neowall-wallpaper toggle"))
|
||||||
bind(hyper .. " + Y", exec("rofi_agentic_skill"))
|
bind(hyper .. " + Y", exec("rofi_agentic_skill"))
|
||||||
|
|||||||
@@ -4,21 +4,32 @@
|
|||||||
|
|
||||||
function list_sinks()
|
function list_sinks()
|
||||||
{
|
{
|
||||||
pacmd list-sinks | grep -E 'index:|name:'
|
local default_sink
|
||||||
|
default_sink="$(pactl get-default-sink 2>/dev/null || true)"
|
||||||
|
|
||||||
|
pactl list short sinks |
|
||||||
|
while IFS=$'\t' read -r id name _; do
|
||||||
|
if [ "$name" = "$default_sink" ]; then
|
||||||
|
printf ' * index: %s\n' "$id"
|
||||||
|
else
|
||||||
|
printf ' index: %s\n' "$id"
|
||||||
|
fi
|
||||||
|
printf '\tname: <%s>\n' "$name"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function switch_sink_default()
|
function switch_sink_default()
|
||||||
{
|
{
|
||||||
echo switching default
|
echo switching default
|
||||||
pacmd set-default-sink $1 || echo failed
|
pactl set-default-sink "$1" || echo failed
|
||||||
}
|
}
|
||||||
|
|
||||||
function switch_sink_applications()
|
function switch_sink_applications()
|
||||||
{
|
{
|
||||||
echo switching applications
|
echo switching applications
|
||||||
pacmd list-sink-inputs |
|
pactl list short sink-inputs |
|
||||||
awk '/index:/{print $2}' |
|
awk '{print $1}' |
|
||||||
xargs -r -I{} pacmd move-sink-input {} $1 ||
|
xargs -r -I{} pactl move-sink-input {} "$1" ||
|
||||||
echo failed
|
echo failed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,11 +40,7 @@ function switch_sink_kmix_master()
|
|||||||
typeset name mixer
|
typeset name mixer
|
||||||
# get the device name in pulseaudio
|
# get the device name in pulseaudio
|
||||||
name="$(
|
name="$(
|
||||||
pacmd list-sinks | awk -v search=$1 '
|
pactl list short sinks | awk -v search="$1" '$1 == search {print $2}'
|
||||||
/index:/{found=$2}
|
|
||||||
/* index:/{found=$3}
|
|
||||||
/name:/&&found==search{print $2}
|
|
||||||
'
|
|
||||||
)"
|
)"
|
||||||
# format device name to a name in kmix
|
# format device name to a name in kmix
|
||||||
name="${name#<}"
|
name="${name#<}"
|
||||||
@@ -61,9 +68,10 @@ function switch_sink()
|
|||||||
function switch_gui()
|
function switch_gui()
|
||||||
{
|
{
|
||||||
# get current output id, all output ids and the sink names
|
# get current output id, all output ids and the sink names
|
||||||
current_id=$(pacmd list-sinks | egrep '\* index:' | egrep -o '[0-9]+$')
|
current_name="$(pactl get-default-sink)"
|
||||||
ids=( $(pacmd list-sinks | egrep 'index:' | egrep -o '[0-9]+$' | tr '\n' ' ') )
|
current_id="$(pactl list short sinks | awk -v name="$current_name" '$2 == name {print $1}')"
|
||||||
names=( $(pacmd list-sinks | egrep 'name:' | egrep -o '\..*>$' | tr -d '>' | tr '\n' ' ') )
|
ids=( $(pactl list short sinks | awk '{print $1}' | tr '\n' ' ') )
|
||||||
|
names=( $(pactl list short sinks | awk '{print $2}' | tr '\n' ' ') )
|
||||||
|
|
||||||
zen_pars="--list --radiolist --column '' --column 'ID' --column 'Sink_name'"
|
zen_pars="--list --radiolist --column '' --column 'ID' --column 'Sink_name'"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
function pasink {
|
function pasink {
|
||||||
pacmd stat | awk -F": " '/^Default sink name: /{print $2}'
|
pactl get-default-sink
|
||||||
}
|
}
|
||||||
|
|
||||||
pasink "$@"
|
pasink "$@"
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function rofi_paswitch {
|
function rofi_paswitch {
|
||||||
pahelper | tr -d '\n' | tr '>' '|' | rofi -i -dmenu -sep '|' | grep -Eo ' [0-9]*' | xargs pahelper
|
local default_sink entries choice sink_id script_dir
|
||||||
|
|
||||||
|
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
default_sink="$(pactl get-default-sink 2>/dev/null || true)"
|
||||||
|
entries="$(
|
||||||
|
pactl list short sinks | while IFS=$'\t' read -r id name _; do
|
||||||
|
if [ "$name" = "$default_sink" ]; then
|
||||||
|
printf '* %s %s\n' "$id" "$name"
|
||||||
|
else
|
||||||
|
printf '%s %s %s\n' '-' "$id" "$name"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)"
|
||||||
|
|
||||||
|
choice="$(printf '%s\n' "$entries" | rofi -i -dmenu -p "Audio output")" || return
|
||||||
|
sink_id="$(awk '{print $2}' <<<"$choice")"
|
||||||
|
[ -n "$sink_id" ] && "$script_dir/pahelper" "$sink_id"
|
||||||
}
|
}
|
||||||
|
|
||||||
rofi_paswitch
|
rofi_paswitch
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ makeEnable config "myModules.base" true {
|
|||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
|
|
||||||
|
hardware.alsa.enablePersistence = true;
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
services.pulseaudio.enable = false;
|
services.pulseaudio.enable = false;
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
|
|||||||
Reference in New Issue
Block a user