Try some ECMAScript to configure the desktop.
This commit is contained in:
parent
cb172935c7
commit
54ccda1abf
2 changed files with 118 additions and 2 deletions
110
roles/lmn_kde/files/fvs-config.js
Normal file
110
roles/lmn_kde/files/fvs-config.js
Normal file
|
@ -0,0 +1,110 @@
|
|||
// configure plasma defaults
|
||||
|
||||
function forEachWidgetInContainmentList(containmentList, callback) {
|
||||
for (var containmentIndex = 0; containmentIndex < containmentList.length; containmentIndex++) {
|
||||
var containment = containmentList[containmentIndex];
|
||||
|
||||
var widgets = containment.widgets();
|
||||
for (var widgetIndex = 0; widgetIndex < widgets.length; widgetIndex++) {
|
||||
var widget = widgets[widgetIndex];
|
||||
callback(widget, containment);
|
||||
if (widget.type === "org.kde.plasma.systemtray") {
|
||||
systemtrayId = widget.readConfig("SystrayContainmentId");
|
||||
if (systemtrayId) {
|
||||
forEachWidgetInContainmentList([desktopById(systemtrayId)], callback)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function forEachWidget(callback) {
|
||||
forEachWidgetInContainmentList(desktops(), callback);
|
||||
forEachWidgetInContainmentList(panels(), callback);
|
||||
}
|
||||
|
||||
function forEachWidgetByType(type, callback) {
|
||||
forEachWidget(function(widget, containment) {
|
||||
if (widget.type == type) {
|
||||
callback(widget, containment);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function widgetSetProperty(args) {
|
||||
if (!(args.widgetType && args.configGroup && args.configKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
forEachWidgetByType(args.widgetType, function(widget){
|
||||
widget.currentConfigGroup = [args.configGroup];
|
||||
/*
|
||||
//--- Delete when done debugging
|
||||
const oldValue = widget.readConfig(args.configKey);
|
||||
print("" + widget.type + " (id: " + widget.id + "):");
|
||||
print("\t[" + args.configGroup + "] " + args.configKey + ": " +
|
||||
oldValue + " => " + args.configValue + "\n");
|
||||
//--- End Debug
|
||||
*/
|
||||
widget.writeConfig(args.configKey, args.configValue);
|
||||
});
|
||||
}
|
||||
|
||||
// configure task bar starters:
|
||||
widgetSetProperty({
|
||||
widgetType: "org.kde.plasma.icontasks",
|
||||
configGroup: "General",
|
||||
configKey: "launchers",
|
||||
configValue: [
|
||||
"applications:systemsettings.desktop",
|
||||
"preferred://browser",
|
||||
"applications:thunderbird.desktop",
|
||||
"applications:libreoffice-startcenter.desktop",
|
||||
"preferred://filemanager"
|
||||
//"applications:org.kde.konsole.desktop",
|
||||
//"applications:org.kde.discover.desktop"
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
// kickoff is the default menu:
|
||||
/* this does not work (anymore?)
|
||||
widgetSetProperty({
|
||||
widgetType: "org.kde.plasma.kickoff",
|
||||
configGroup: "General",
|
||||
configKey: "favorites",
|
||||
configValue: ["applications:libreoffice-startcenter.desktop",],
|
||||
});
|
||||
*/
|
||||
|
||||
widgetSetProperty({
|
||||
widgetType: "org.kde.plasma.kickoff",
|
||||
configGroup: "General",
|
||||
configKey: "systemFavorites",
|
||||
configValue: ["reboot", "shutdown", "logout"],
|
||||
});
|
||||
|
||||
|
||||
// prepare a folder view on the desktop:
|
||||
var allDesktops = desktops();
|
||||
for (var desktopIndex = 0; desktopIndex < allDesktops.length; desktopIndex++) {
|
||||
var d = allDesktops[desktopIndex];
|
||||
d.addWidget("org.kde.plasma.folder", 50, 50, 456, 600)
|
||||
print("Folder app generated!\n")
|
||||
}
|
||||
|
||||
widgetSetProperty({
|
||||
widgetType: "org.kde.plasma.folder",
|
||||
configGroup: "General",
|
||||
configKey: "url",
|
||||
configValue: "/lmn/media/",
|
||||
});
|
||||
|
||||
widgetSetProperty({
|
||||
widgetType: "org.kde.plasma.folder",
|
||||
configGroup: "General",
|
||||
configKey: "labelMode",
|
||||
configValue: "0",
|
||||
});
|
||||
|
||||
// /usr/share/plasma/shells/org.kde.plasma.desktop/contents/updates/fvs-config.js
|
|
@ -194,6 +194,12 @@
|
|||
dest: /usr/local/bin/
|
||||
mode: 0755
|
||||
|
||||
- name: Copy fvs-config.js to configure plasma
|
||||
ansible.builtin.copy:
|
||||
src: fvs-config.js
|
||||
dest: /usr/share/plasma/shells/org.kde.plasma.desktop/contents/updates/fvs-config.js
|
||||
mode: 0644
|
||||
|
||||
################# general settings ##################
|
||||
- name: Protect grub menu entries
|
||||
blockinfile:
|
||||
|
@ -211,7 +217,7 @@
|
|||
firstmatch: true
|
||||
notify: Run update-grub
|
||||
|
||||
- name: grub timeout
|
||||
- name: Grub timeout
|
||||
lineinfile:
|
||||
dest: /etc/default/grub
|
||||
regexp: '^(GRUB_TIMEOUT=).*'
|
||||
|
@ -219,7 +225,7 @@
|
|||
backrefs: yes
|
||||
notify: Run update-grub
|
||||
|
||||
- name: keyboard compose key
|
||||
- name: Keyboard compose key
|
||||
lineinfile:
|
||||
dest: /etc/default/keyboard
|
||||
regexp: '^(XKBOPTIONS=).*'
|
||||
|
|
Loading…
Add table
Reference in a new issue