mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Extract audio default device helpers
This commit is contained in:
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Set the default audio input and move active streams
|
||||
# omarchy:args=<node-id> <source-name>
|
||||
# omarchy:examples=omarchy audio input set default 43 alsa_input.pci-0000_00_1f.3.analog-stereo
|
||||
|
||||
node_id=${1:-}
|
||||
source_name=${2:-}
|
||||
|
||||
if [[ -z $node_id || -z $source_name ]]; then
|
||||
echo "Usage: omarchy-audio-input-set-default <node-id> <source-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wpctl set-default "$node_id" 2>/dev/null || true
|
||||
pactl set-default-source "$source_name" 2>/dev/null || true
|
||||
|
||||
pactl list short source-outputs 2>/dev/null | awk '{ print $1 }' | while read -r output; do
|
||||
[[ -n $output ]] && pactl move-source-output "$output" "$source_name" 2>/dev/null || true
|
||||
done
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Set the default audio output and move active streams
|
||||
# omarchy:args=<node-id> <sink-name>
|
||||
# omarchy:examples=omarchy audio output set default 42 alsa_output.pci-0000_00_1f.3.analog-stereo
|
||||
|
||||
node_id=${1:-}
|
||||
sink_name=${2:-}
|
||||
|
||||
if [[ -z $node_id || -z $sink_name ]]; then
|
||||
echo "Usage: omarchy-audio-output-set-default <node-id> <sink-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wpctl set-default "$node_id" 2>/dev/null || true
|
||||
pactl set-default-sink "$sink_name" 2>/dev/null || true
|
||||
|
||||
pactl list short sink-inputs 2>/dev/null | awk '{ print $1 }' | while read -r input; do
|
||||
[[ -n $input ]] && pactl move-sink-input "$input" "$sink_name" 2>/dev/null || true
|
||||
done
|
||||
@@ -309,12 +309,11 @@ Panel {
|
||||
if (!node) return
|
||||
Pipewire.preferredDefaultAudioSink = node
|
||||
if (root.bar && node.id !== undefined && node.name) {
|
||||
var idArg = Util.shellQuote(String(node.id))
|
||||
var nameArg = Util.shellQuote(String(node.name))
|
||||
root.bar.run("wpctl set-default " + idArg + " 2>/dev/null || true; "
|
||||
+ "pactl set-default-sink " + nameArg + " 2>/dev/null || true; "
|
||||
+ "pactl list short sink-inputs 2>/dev/null | awk '{ print $1 }' | while read -r input; do "
|
||||
+ "pactl move-sink-input \"$input\" " + nameArg + " 2>/dev/null || true; done")
|
||||
Quickshell.execDetached([
|
||||
root.bar.omarchyPath + "/bin/omarchy-audio-output-set-default",
|
||||
String(node.id),
|
||||
String(node.name)
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,12 +321,11 @@ Panel {
|
||||
if (!node) return
|
||||
Pipewire.preferredDefaultAudioSource = node
|
||||
if (root.bar && node.id !== undefined && node.name) {
|
||||
var idArg = Util.shellQuote(String(node.id))
|
||||
var nameArg = Util.shellQuote(String(node.name))
|
||||
root.bar.run("wpctl set-default " + idArg + " 2>/dev/null || true; "
|
||||
+ "pactl set-default-source " + nameArg + " 2>/dev/null || true; "
|
||||
+ "pactl list short source-outputs 2>/dev/null | awk '{ print $1 }' | while read -r output; do "
|
||||
+ "pactl move-source-output \"$output\" " + nameArg + " 2>/dev/null || true; done")
|
||||
Quickshell.execDetached([
|
||||
root.bar.omarchyPath + "/bin/omarchy-audio-input-set-default",
|
||||
String(node.id),
|
||||
String(node.name)
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user