Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bbguimaraes
dotfiles
Commits
aa1f5759
Commit
aa1f5759
authored
Jul 02, 2022
by
bbguimaraes
Browse files
scripts/sink: check `system` calls
parent
02aab09c
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/sink.pl
View file @
aa1f5759
...
...
@@ -8,13 +8,17 @@ sub main {
return
print
@sinks
if
!
$sink
;
my
$id
=
find_sink
(
map_sink_name
(
$sink
,
`
hostname
`),
\
@sinks
);
die
"
sink
$sink
not found
"
if
!
$id
;
system
"
pactl
set-default-sink
$id
";
exec_cmd
(
"
pactl
",
"
set-default-sink
",
"
$id
"
)
;
foreach
(`
pactl list short sink-inputs
`)
{
my
@f
=
split
;
system
"
pactl
move-sink-input
$f
[0]
$id
"
;
exec_cmd
(
"
pactl
",
"
move-sink-input
",
$f
[
0
]
,
$id
)
;
}
}
sub
exec_cmd
{
die
"
command failed:
@_
"
if
system
(
@
_
);
}
sub
find_sink
{
my
(
$sink
,
$sinks
)
=
@_
;
return
$sink
if
$sink
=~
m/^[0-9]+$/
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment