Simplified legacy extension and dummy-file installation

This commit is contained in:
nathan 2018-11-03 22:14:43 +01:00
parent 86a4562b4d
commit b80d9cbbde
3 changed files with 10 additions and 30 deletions

View File

@ -307,12 +307,7 @@ class SystemTray {
else if (minorAndPatch < 26.0D) {
Tray.gtkGnomeWorkaround = true;
if (!LegacyExtension.isInstalled()) {
LegacyExtension.install();
// just restarting the shell is enough to get the system tray to work
LegacyExtension.restartShell();
}
LegacyExtension.install();
// now, what VERSION of fedora? "normal" fedora doesn't have AppIndicator installed, so we have to use GtkStatusIcon
// 23 is gtk, 24/25/26 is gtk (but also wrong size unless we adjust it. ImageUtil automatically does this)
@ -362,12 +357,7 @@ class SystemTray {
// ubuntu 18.04 doesn't need the extension BUT does need a logout-login (or gnome-shell restart) for it to work
// we copy over a config file so we know if we have already restarted the shell or shown the warning. A logout-login will also work.
if (!DummyFile.isPresent()) {
DummyFile.install();
// just restarting the shell is enough to get the system tray to work
LegacyExtension.restartShell();
}
DummyFile.install();
}
return selectTypeQuietly(TrayType.AppIndicator);

View File

@ -11,11 +11,9 @@ class DummyFile {
private static final File file = new File(System.getProperty("user.home") + "/.local/.SystemTray");
public static
boolean isPresent() {
return file.exists();
}
/**
* Installs a dummy file to indicate we've restarted the shell. This will restart the shell if necessary
*/
public static
void install() {
if (!file.exists()) {
@ -28,8 +26,12 @@ class DummyFile {
} catch (IOException e) {
SystemTray.logger.error("Error creating file", e);
}
file.setLastModified(System.currentTimeMillis());
// just restarting the shell is enough to get the system tray to work
LegacyExtension.restartShell();
}
file.setLastModified(System.currentTimeMillis());
}
}

View File

@ -32,18 +32,6 @@ class LegacyExtension extends ExtensionSupport {
/** Command to restart the gnome-shell. It is recommended to start it in the background (hence '&') */
private static final String SHELL_RESTART_COMMAND = "gnome-shell --replace &";
/**
* topIcons will convert ALL icons to be at the top of the screen, so there is no reason to have both installed
*
* @return true if that extension is installed
*/
public static
boolean isInstalled() {
List<String> enabledExtensions = getEnabledExtensions();
return enabledExtensions.contains("topIcons@adel.gadllah@gmail.com") || enabledExtensions.contains(UID);
}
/**
* Only install a version that specifically moves only our icon next to the clock
*/