Skip to content

Commit 1b0c271

Browse files
committed
migrate to mate-volume-control-status-icon
1 parent a7ca386 commit 1b0c271

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

mate-tweak

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ Categories=GNOME;GTK;System;Utility;TerminalEmulator;
7171
X-GNOME-Autostart-enabled=true
7272
X-MATE-Autostart-enabled=true"""
7373

74-
__APPLET_SOUND__ = """[Desktop Entry]
74+
__APPLET_SOUND_ICON__ = """[Desktop Entry]
7575
Name=Volume Control
7676
Comment=Show desktop volume control
7777
Icon=multimedia-volume-control
78-
Exec=mate-volume-control-applet
78+
Exec=mate-volume-control-status-icon
7979
Terminal=false
8080
Type=Application
8181
Categories=AudioVideo;Mixer;Settings;HardwareSettings;
@@ -295,7 +295,8 @@ class MateTweak:
295295

296296
def create_autostart(self, filename, content):
297297
# Create a local autostart only if it is missing from the system path.
298-
if not os.path.exists(os.path.join('/','usr','share','mate','autostart',filename)):
298+
if not os.path.exists(os.path.join('/','usr','share','mate','autostart',filename)) and \
299+
not os.path.exists(os.path.join('/','etc','xdg','autostart',filename)):
299300
config_dir = GLib.get_user_config_dir()
300301
self.mkdir_p(os.path.join(config_dir, 'autostart/'))
301302
if not os.path.exists(os.path.join(config_dir, 'autostart',filename)):
@@ -309,8 +310,9 @@ class MateTweak:
309310
os.remove(autostart_file)
310311

311312
# Make sure any system desktop files are also removed
312-
mate_tweak_helper = os.path.join('/','usr', 'lib', 'mate-tweak', 'mate-tweak-helper')
313-
subprocess.call(['pkexec', mate_tweak_helper, 'autostop', filename], stdout=DEVNULL, stderr=DEVNULL)
313+
if os.path.exists(os.path.join('/', 'etc', 'xdg', 'autostart',filename)):
314+
mate_tweak_helper = os.path.join('/','usr', 'lib', 'mate-tweak', 'mate-tweak-helper')
315+
subprocess.call(['pkexec', mate_tweak_helper, 'autostop', filename], stdout=DEVNULL, stderr=DEVNULL)
314316

315317
def check_wm_features(self):
316318
screen = Gdk.Screen.get_default()
@@ -553,12 +555,16 @@ class MateTweak:
553555
When indicators are enabled some MATE applets need disabling
554556
or hiding.
555557
"""
558+
self.kill_process('mate-volume-control-status-icon')
556559
self.kill_process('mate-volume-control-applet')
557-
self.remove_autostart('mate-volume-control-applet.desktop')
560+
self.remove_autostart('mate-volume-control-status-icon.desktop')
561+
558562
if os.path.exists('/usr/libexec/ayatana-indicator-power/ayatana-indicator-power-service'):
559563
self.set_string('org.mate.power-manager', None, 'icon-policy', 'never')
560564
self.set_bool('org.mate.power-manager', None, 'notify-low-capacity', False)
561565

566+
# Remove the outdated part
567+
self.remove_autostart('mate-volume-control-applet.desktop')
562568
# Remove the incorrectly named autostart file caused by an earlier bug.
563569
# Note the double .desktop suffix.
564570
self.remove_autostart('mate-volume-control-applet.desktop.desktop')
@@ -568,13 +574,16 @@ class MateTweak:
568574
When indicators are disabled some MATE applets need enabling
569575
or showing.
570576
"""
571-
pid = subprocess.Popen(['mate-volume-control-applet'], stdout=DEVNULL, stderr=DEVNULL).pid
572-
self.remove_autostart('mate-volume-control-applet.desktop')
573-
self.create_autostart('mate-volume-control-applet.desktop', __APPLET_SOUND__)
577+
if self.find_on_path('mate-volume-control-status-icon'):
578+
pid = subprocess.Popen(['mate-volume-control-status-icon'], stdout=DEVNULL, stderr=DEVNULL).pid
579+
self.create_autostart('mate-volume-control-status-icon.desktop', __APPLET_SOUND_ICON__)
580+
574581
if os.path.exists('/usr/libexec/ayatana-indicator-power/ayatana-indicator-power-service'):
575582
self.set_string('org.mate.power-manager', None, 'icon-policy', 'present')
576583
self.set_bool('org.mate.power-manager', None, 'notify-low-capacity', True)
577584

585+
# Remove the outdated part
586+
self.remove_autostart('mate-volume-control-applet.desktop')
578587
# Remove the incorrectly named autostart file case by an earlier bug.
579588
# Note the double .desktop suffix.
580589
self.remove_autostart('mate-volume-control-applet.desktop.desktop')

0 commit comments

Comments
 (0)