Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
X11:Unity
indicator-sound
indicator-sound-better-de-detection.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File indicator-sound-better-de-detection.patch of Package indicator-sound
--- a/data/indicator-sound.desktop.in +++ b/data/indicator-sound.desktop.in @@ -2,7 +2,7 @@ Type=Application Name=Indicator Sound Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/indicator-sound/indicator-sound-service -OnlyShowIn=Unity;GNOME;Pantheon; +OnlyShowIn=Unity;GNOME;MATE;XFCE;Pantheon; NoDisplay=true StartupNotify=false Terminal=false --- a/src/service.vala +++ b/src/service.vala @@ -207,7 +207,7 @@ public class IndicatorSound.Service: Obj private VolumeWarning _volume_warning; private IndicatorSound.InfoNotification _info_notification = new IndicatorSound.InfoNotification(); private AccountsServiceAccess _accounts_service_access; - bool? is_unity = null; + string? desktop = null; const double volume_step_percentage = 0.06; @@ -226,39 +226,36 @@ public class IndicatorSound.Service: Obj } } - private bool desktop_is_unity() { - if (is_unity != null) { - return is_unity; - } - - is_unity = false; - unowned string desktop = Environment.get_variable ("XDG_CURRENT_DESKTOP"); - - foreach (var name in desktop.split(":")) { - if (name == "Unity") { - is_unity = true; - break; + private bool is_desktop(string de, string prog) { + if (desktop != null) + return desktop == de; + + unowned string env = Environment.get_variable ("XDG_CURRENT_DESKTOP"); + + foreach (var name in env.split (":")) { + if (name == de && Environment.find_program_in_path (prog) != null) { + desktop = de; + return true; } } - return is_unity; + return false; } void activate_desktop_settings (SimpleAction action, Variant? param) { - unowned string env = Environment.get_variable ("DESKTOP_SESSION"); string cmd; if (Environment.get_variable ("MIR_SOCKET") != null) cmd = "system-settings"; - if (env == "xubuntu" || env == "ubuntustudio") - cmd = "pavucontrol"; - else if (env == "mate") + if (is_desktop("MATE", "mate-volume-control")) cmd = "mate-volume-control"; - else if (desktop_is_unity() && Environment.find_program_in_path ("unity-control-center") != null) + else if (is_desktop("Unity", "unity-control-center")) cmd = "unity-control-center sound"; - else + else if (Environment.find_program_in_path ("gnome-control-center") != null) cmd = "gnome-control-center sound"; + else + cmd = "pavucontrol"; try { Process.spawn_command_line_async (cmd);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor