Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap all JavaScript in an Immediately-Invoked Function Expression #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 35 additions & 33 deletions 11-qubes.js
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');
})();
12 changes: 7 additions & 5 deletions plasmoidsetupscripts/template.js
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");
}
})();
56 changes: 29 additions & 27 deletions qubes-systray.js
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")
})();