summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake/sound.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/harddrake/sound.pm')
-rw-r--r--perl-install/harddrake/sound.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
index c210f76ae..12d0879fd 100644
--- a/perl-install/harddrake/sound.pm
+++ b/perl-install/harddrake/sound.pm
@@ -183,6 +183,25 @@ my $blacklisted = 0;
my $config_file = '/etc/sysconfig/pulseaudio';
+sub is_user_switching_enabled() {
+ my $output = run_program::get_stdout('polkit-action', '--action',
+ 'org.freedesktop.hal.device-access.sound');
+ my ($val) = $output =~ /default_inactive: (.*)/;
+ to_bool($val eq 'no');
+}
+
+sub set_user_switching {
+ my ($val) = @_;
+ if ($val) {
+ run_program::get_stdout('polkit-action', '--reset-defaults',
+ 'org.freedesktop.hal.device-access.sound');
+ } else {
+ run_program::get_stdout('polkit-action', '--set-defaults-inactive',
+ 'org.freedesktop.hal.device-access.sound', 'yes');
+ }
+}
+
+
sub is_pulseaudio_enabled() {
my %h = getVarsFromSh($config_file);
$h{PULSE_SERVER_TYPE} eq 'personal';
@@ -256,6 +275,7 @@ sub switch {
my %des = modules::category2modules_and_description('multimedia/sound');
my $is_pulseaudio_enabled = is_pulseaudio_enabled();
+ my $is_user_switching = is_user_switching_enabled();
my @common = (
get_any_driver_entry($in, $modules_conf, $driver, $device),
@@ -263,6 +283,10 @@ sub switch {
text => N("Enable PulseAudio"),
type => 'bool', val => \$is_pulseaudio_enabled,
},
+ {
+ text => N("Enable user switching for audio applications"),
+ type => 'bool', val => \$is_user_switching,
+ },
);
if ($new_driver eq 'unknown') {
@@ -274,6 +298,7 @@ sub switch {
\@common,
)) {
set_pulseaudio($is_pulseaudio_enabled);
+ set_user_switching($is_user_switching);
}
} elsif ($in->ask_from_({ title => N("Sound configuration"),
messages =>
@@ -315,6 +340,7 @@ To use alsa, one can either use:
]))
{
set_pulseaudio($is_pulseaudio_enabled);
+ set_user_switching($is_user_switching);
return if $new_driver eq $device->{current_driver};
log::explanations("switching audio driver from '" . $device->{current_driver} . "' to '$new_driver'\n");
$in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n