Cleaned up the gnome shell extension installer

This commit is contained in:
nathan 2016-04-14 01:15:48 +02:00
parent 5cf37496f6
commit af1fdcca2c

View File

@ -113,7 +113,7 @@ class GnomeShellExtension {
final int indexOf = versionOutput.indexOf('.');
final int lastIndexOf = versionOutput.lastIndexOf('.');
if (indexOf < lastIndexOf) {
versionOutput = versionOutput.substring(0, lastIndexOf);
versionOutput = versionOutput.substring(0, indexOf);
}
String metadata = "{\n" +
@ -123,7 +123,7 @@ class GnomeShellExtension {
" \"" + versionOutput + "\"\n" +
" ],\n" +
" \"url\": \"https://github.com/dorkbox/SystemTray\",\n" +
" \"uuid\": \"SystemTray@dorkbox\",\n" +
" \"uuid\": \"" + UID + "\",\n" +
" \"version\": 1\n" +
"}";
@ -145,9 +145,19 @@ class GnomeShellExtension {
}
// now we have to enable us
// gsettings get org.gnome.shell enabled-extensions (['background-logo@fedorahosted.org'] on fedora 23) different on openSuse
final StringBuilder stringBuilder = new StringBuilder(output);
stringBuilder.delete(0, 4);
// strip off up to the leading ['
final int extensionIndex = output.indexOf("['");
if (extensionIndex > 0) {
stringBuilder.delete(0, extensionIndex);
}
// remove the last ]
stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
// add our extension to the list
if (stringBuilder.length() > 2) {
stringBuilder.append(", ");
}
@ -155,6 +165,7 @@ class GnomeShellExtension {
.append(UID)
.append("'");
stringBuilder.append("]");
// gsettings set org.gnome.shell enabled-extensions "['SystemTray@dorkbox']"