-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap all JavaScript in an Immediately-Invoked Function Expression
This ensures that variables declared in the script do not alter the enclosing scope. Yes, JavaScript is a bad language.
- Loading branch information
Showing
3 changed files
with
71 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
/* replace the default kickoff with Qubes menu */ | ||
for (var i in panelIds) { | ||
var panel = panelById(panelIds[i]) | ||
var widgetIds = panel.widgetIds | ||
var menuLauncherId = -1 | ||
for (id in widgetIds) { | ||
var widget = panel.widgetById(widgetIds[id]) | ||
if (widget.type == 'org.kde.plasma.kickoff') { | ||
var qubesMenu = panel.addWidget('org.kde.plasma.quicklaunch') | ||
qubesMenu.index = widget.index | ||
qubesMenu.currentConfigGroup = ['General'] | ||
qubesMenu.writeConfig('launcherUrls', ['file:///usr/share/applications/open-qubes-app-menu.desktop']) | ||
menuLauncherId = qubesMenu.id | ||
widget.remove() | ||
} else if (widget.type == 'org.kde.plasma.quicklaunch') { | ||
// move existing one too, to fix after earlier broken version | ||
menuLauncherId = widget.id | ||
(function () { | ||
for (var i in panelIds) { | ||
var panel = panelById(panelIds[i]) | ||
var widgetIds = panel.widgetIds | ||
var menuLauncherId = -1 | ||
for (id in widgetIds) { | ||
var widget = panel.widgetById(widgetIds[id]) | ||
if (widget.type == 'org.kde.plasma.kickoff') { | ||
var qubesMenu = panel.addWidget('org.kde.plasma.quicklaunch') | ||
qubesMenu.index = widget.index | ||
qubesMenu.currentConfigGroup = ['General'] | ||
qubesMenu.writeConfig('launcherUrls', ['file:///usr/share/applications/open-qubes-app-menu.desktop']) | ||
menuLauncherId = qubesMenu.id | ||
widget.remove() | ||
} else if (widget.type == 'org.kde.plasma.quicklaunch') { | ||
// move existing one too, to fix after earlier broken version | ||
menuLauncherId = widget.id | ||
} | ||
} | ||
// move the menu launcher as the first applet | ||
if (menuLauncherId != -1) { | ||
panel.currentConfigGroup = ['General'] | ||
var order = panel.readConfig("AppletOrder").split(";") | ||
if (!order) | ||
order = panel.widgetIds | ||
// remove from the list (likely its end) and add it at the beginning | ||
order = order.filter(function(x) { return x != menuLauncherId }) | ||
order.unshift(menuLauncherId) | ||
panel.writeConfig("AppletOrder", order.join(";")) | ||
} | ||
} | ||
// move the menu launcher as the first applet | ||
if (menuLauncherId != -1) { | ||
panel.currentConfigGroup = ['General'] | ||
var order = panel.readConfig("AppletOrder").split(";") | ||
if (!order) | ||
order = panel.widgetIds | ||
// remove from the list (likely its end) and add it at the beginning | ||
order = order.filter(function(x) { return x != menuLauncherId }) | ||
order.unshift(menuLauncherId) | ||
panel.writeConfig("AppletOrder", order.join(";")) | ||
} | ||
} | ||
|
||
/* wallpaper */ | ||
var desktop = desktops()[0]; | ||
desktop.wallpaperPlugin = "org.kde.image" | ||
desktop.currentConfigGroup = Array('Wallpaper', 'org.kde.image', "General"); | ||
desktop.writeConfig('Image', 'file:///usr/share/wallpapers/Qubes_Steel'); | ||
/* wallpaper */ | ||
var desktop = desktops()[0]; | ||
desktop.wallpaperPlugin = "org.kde.image" | ||
desktop.currentConfigGroup = Array('Wallpaper', 'org.kde.image', "General"); | ||
desktop.writeConfig('Image', 'file:///usr/share/wallpapers/Qubes_Steel'); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
if (applet.readConfig("icon", "start-here-kde") == "start-here-kde" || | ||
applet.readConfig("icon", "start-here-kde") == "start-here") { | ||
applet.currentConfigGroup = ["General"] | ||
applet.writeConfig("icon", "qubes-logo-icon"); | ||
} | ||
(function() { | ||
if (applet.readConfig("icon", "start-here-kde") == "start-here-kde" || | ||
applet.readConfig("icon", "start-here-kde") == "start-here") { | ||
applet.currentConfigGroup = ["General"]; | ||
applet.writeConfig("icon", "qubes-logo-icon"); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
var biggestId = 0; | ||
var tmpBiggestId = 0; | ||
(function () { | ||
var biggestId = 0; | ||
var tmpBiggestId = 0; | ||
|
||
for (var i in activityIds) { | ||
var activity = activityById(activityIds[i]); | ||
if (activity.widgetIds.length > 0) { | ||
tmpBiggestId = Math.max.apply(null, activity.widgetIds); | ||
if (tmpBiggestId > biggestId) { | ||
biggestId = tmpBiggestId; | ||
for (var i in activityIds) { | ||
var activity = activityById(activityIds[i]); | ||
if (activity.widgetIds.length > 0) { | ||
tmpBiggestId = Math.max.apply(null, activity.widgetIds); | ||
if (tmpBiggestId > biggestId) { | ||
biggestId = tmpBiggestId; | ||
} | ||
} | ||
} | ||
} | ||
|
||
for (var i in panelIds) { | ||
var panel = panelById(panelIds[i]); | ||
if (panel.widgetIds.length > 0) { | ||
tmpBiggestId = Math.max.apply(null, panel.widgetIds); | ||
if (tmpBiggestId > biggestId) { | ||
biggestId = tmpBiggestId; | ||
for (var i in panelIds) { | ||
var panel = panelById(panelIds[i]); | ||
if (panel.widgetIds.length > 0) { | ||
tmpBiggestId = Math.max.apply(null, panel.widgetIds); | ||
if (tmpBiggestId > biggestId) { | ||
biggestId = tmpBiggestId; | ||
} | ||
} | ||
} | ||
} | ||
|
||
for (var i in panelIds) { | ||
var panel = panelById(panelIds[i]); | ||
for (var j in panel.widgetIds) { | ||
var widget = panel.widgetById(panel.widgetIds[j]); | ||
if (widget.type == "systemtray") { | ||
widget.writeConfig('DefaultAppletsAdded', 'true') | ||
widget.currentConfigGroup = new Array('Applets', biggestId+1); | ||
widget.writeConfig('plugin', 'battery'); | ||
widget.reloadConfig(); | ||
for (var i in panelIds) { | ||
var panel = panelById(panelIds[i]); | ||
for (var j in panel.widgetIds) { | ||
var widget = panel.widgetById(panel.widgetIds[j]); | ||
if (widget.type == "systemtray") { | ||
widget.writeConfig('DefaultAppletsAdded', 'true') | ||
widget.currentConfigGroup = new Array('Applets', biggestId+1); | ||
widget.writeConfig('plugin', 'battery'); | ||
widget.reloadConfig(); | ||
} | ||
} | ||
} | ||
} | ||
panels()[0].addWidget("org.kde.notifications") | ||
panels()[0].addWidget("org.kde.notifications") | ||
})(); |