Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--auto-accept-single true should also close if there's nothing #176

Open
Kommynct opened this issue Jun 13, 2024 · 1 comment
Open

--auto-accept-single true should also close if there's nothing #176

Kommynct opened this issue Jun 13, 2024 · 1 comment

Comments

@Kommynct
Copy link

I currently use the following command to switch my audio sinks:

wpctl set-default $(pw-cli i $(pactl list short sinks | awk '{print $2}' | sd 'easyeffects_sink\n' '' | sd "$(pactl get-default-sink)\n" '' | tofi --prompt-text " " --height 40% --width 40% --auto-accept-single true ) | rg -oP 'id: \K\w+') && notify-send --urgency=low --icon=/usr/share/icons/Flat-Remix-Red-Dark/panel/audio-volume-high-symbolic.svg "$(pactl list sinks | rg -A 1 "Name: $(pactl get-default-sink)" | rg Description: | sd ' Description: ' '')" -h string:x-canonical-private-synchronous:sink-state && pw-play --volume=0.2 /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga &!

But if my TV isn't plugged in, meaning I only have one sink left, which is automatically removed with the sd "$(pactl get-default-sink)\n" '' tofi is left without anything and just opens a black box with nothing selectable. I'd like it not to do this.

@Kommynct
Copy link
Author

Kommynct commented Jun 15, 2024

a workaround for me is to add

rg '.' || echo "$(pactl get-default-sink)"

to it, making it

$sinkswitch = wpctl set-default $(pw-cli i $(pactl list short sinks | awk '{print $2}' | sd 'easyeffects_sink\n' '' | sd "$(pactl get-default-sink)\n" '' | rg '.' || echo "$(pactl get-default-sink)" | tofi --prompt-text " " --height 40% --width 40% --auto-accept-single true ) | rg -oP 'id: \K\w+') && notify-send --urgency=low --icon=/usr/share/icons/Flat-Remix-Red-Dark/panel/audio-volume-high-symbolic.svg "$(pactl list sinks | rg -A 1 "Name: $(pactl get-default-sink)" | rg Description: | sd '	Description: ' '')" -h string:x-canonical-private-synchronous:sink-state && pw-play --volume=0.2 /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga &!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant