Updated to latest Executor
This commit is contained in:
parent
aad77dfda5
commit
ce1ae0e944
|
@ -34,27 +34,30 @@ import java.util.List;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import dorkbox.executor.ShellAsyncExecutor;
|
||||
import dorkbox.executor.ShellExecutor;
|
||||
import dorkbox.executor.Executor;
|
||||
import dorkbox.executor.processResults.SyncProcessResult;
|
||||
import dorkbox.os.OS;
|
||||
import dorkbox.os.OSUtil;
|
||||
import dorkbox.systemTray.SystemTray;
|
||||
import dorkbox.util.IO;
|
||||
import dorkbox.util.OS;
|
||||
import dorkbox.util.OSUtil;
|
||||
|
||||
@SuppressWarnings({"DanglingJavadoc", "WeakerAccess"})
|
||||
public
|
||||
class ExtensionSupport {
|
||||
public static
|
||||
List<String> getEnabledExtensions() {
|
||||
// gsettings get org.gnome.shell enabled-extensions
|
||||
final ShellExecutor gsettings = new ShellExecutor();
|
||||
gsettings.setExecutable("gsettings");
|
||||
gsettings.addArgument("get");
|
||||
gsettings.addArgument("org.gnome.shell");
|
||||
gsettings.addArgument("enabled-extensions");
|
||||
gsettings.start();
|
||||
String output;
|
||||
try {
|
||||
SyncProcessResult result = new Executor()
|
||||
.commandSplit("gsettings get org.gnome.shell enabled-extensions")
|
||||
.enableRead()
|
||||
.startBlocking();
|
||||
|
||||
String output = gsettings.getOutput();
|
||||
output = result.getOutput().utf8();
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to get gnome shell extensions!", e);
|
||||
output = "";
|
||||
}
|
||||
|
||||
// now we have to enable us if we aren't already enabled
|
||||
|
||||
|
@ -144,13 +147,11 @@ class ExtensionSupport {
|
|||
// gsettings set org.gnome.shell enabled-extensions "['SystemTray@Dorkbox']"
|
||||
// gsettings set org.gnome.shell enabled-extensions "['background-logo@fedorahosted.org']"
|
||||
// gsettings set org.gnome.shell enabled-extensions "['background-logo@fedorahosted.org', 'SystemTray@Dorkbox']"
|
||||
final ShellExecutor setGsettings = new ShellExecutor();
|
||||
setGsettings.setExecutable("gsettings");
|
||||
setGsettings.addArgument("set");
|
||||
setGsettings.addArgument("org.gnome.shell");
|
||||
setGsettings.addArgument("enabled-extensions");
|
||||
setGsettings.addArgument(stringBuilder.toString());
|
||||
setGsettings.start();
|
||||
try {
|
||||
new Executor().command("gsettings", "set", "org.gnome.shell", "enabled-extensions", stringBuilder.toString()).startBlocking();
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to set gnome shell extensions!", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static
|
||||
|
@ -183,7 +184,11 @@ class ExtensionSupport {
|
|||
logger.info("Restarting gnome-shell via '{}' so tray notification changes can be applied.", restartCommand);
|
||||
|
||||
// now we have to restart the gnome shell via bash in a background process
|
||||
ShellAsyncExecutor.runShell(restartCommand);
|
||||
try {
|
||||
new Executor().command(restartCommand).startAsShellBlocking();
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to restart gnome shell!", e);
|
||||
}
|
||||
|
||||
// We don't care when the shell restarts, since WHEN IT DOES restart, our extension will show our icon.
|
||||
// Until then however, there will be errors which can be ignored, because the shell-restart means everything works.
|
||||
|
|
Loading…
Reference in New Issue