This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Look-and-Feel theme - how to lock widgets by default

Tags: plasma, layout, panel, javascript plasma, layout, panel, javascript plasma, layout, panel, javascript
(comma "," separated)
User avatar
arjenbalfoort
Registered Member
Posts
9
Karma
0
OS
I have created a default panel.
/usr/share/plasma/layout-templates/org.kde.plasma.desktop.solydkPanel/contents/layout.js:
Code: Select all
var panel = new Panel
var panelScreen = panel.screen
var freeEdges = {"bottom": true, "top": true, "left": true, "right": true}

for (i = 0; i < panelIds.length; ++i) {
    var tmpPanel = panelById(panelIds[i])
    if (tmpPanel.screen == panelScreen) {
        // Ignore the new panel
        if (tmpPanel.id != panel.id) {
            freeEdges[tmpPanel.location] = false;
        }
    }
}

if (freeEdges["bottom"] == true) {
    panel.location = "bottom";
} else if (freeEdges["top"] == true) {
    panel.location = "top";
} else if (freeEdges["left"] == true) {
    panel.location = "left";
} else if (freeEdges["right"] == true) {
    panel.location = "right";
} else {
    // There is no free edge, so leave the default value
    panel.location = "top";
}

// Set panel height
panel.height = 42

// Create start menu
var simplemenu = panel.addWidget("org.kde.plasma.kicker")
simplemenu.currentConfigGroup = ["General"]
simplemenu.writeConfig("icon", "solydk")
simplemenu.writeConfig("global", "F13")
simplemenu.writeConfig("favoriteApps", "firefox-esr.desktop,thunderbird.desktop,libreoffice-startcenter.desktop,org.kde.discover.desktop,systemsettings.desktop,org.kde.konsole.desktop")
simplemenu.writeConfig("alphaSort", true)

// Add show desktop
var showdt = panel.addWidget("org.kde.plasma.showdesktop")
showdt.currentConfigGroup = ["General"]

// Add dolphin
var eitm = panel.addWidget("org.kde.plasma.taskmanager")
eitm.currentConfigGroup = ["General"]
eitm.writeConfig("launchers" ,"file:///usr/share/applications/org.kde.dolphin.desktop?wmClass=Dolphin")
eitm.writeConfig("showOnlyCurrentDesktop", true)
eitm.writeConfig("separateLaunchers", false)
eitm.writeConfig("groupPopups", false)
eitm.writeConfig("sortingStrategy", 1)

// Add volume control
panel.addWidget('org.kde.plasma.volume')

// Add system tray
var systray = panel.addWidget("org.kde.plasma.systemtray")
var systrayContainmentId = systray.readConfig("SystrayContainmentId")
var systrayContainment = desktopById(systrayContainmentId)
systrayContainment.currentConfigGroup = ["General"]
systrayContainment.writeConfig("extraItems","org.kde.plasma.devicenotifier,org.kde.plasma.networkmanagement,org.kde.discovernotifier,org.kde.plasma.diskquota,org.kde.plasma.bluetooth,org.kde.plasma.clipboard,org.kde.plasma.printmanager,org.kde.plasma.battery")
systrayContainment.writeConfig("knownItems", "org.kde.plasma.volume,org.kde.plasma.networkmanagement,org.kde.plasma.bluetooth,org.kde.plasma.battery,org.kde.discovernotifier,org.kde.plasma.clipboard,org.kde.plasma.mediacontroller,org.kde.plasma.devicenotifier,org.kde.plasma.notifications,org.kde.plasma.printmanager,org.kde.plasma.notifications,org.kde.kdeconnect")
systrayContainment.writeConfig("hiddenItems","org.kde.plasma.clipboard")

// Add notifications
panel.addWidget("org.kde.plasma.notifications")

// Add the clock
var clock = panel.addWidget("org.kde.plasma.digitalclock")
clock.writeConfig("showDate", false)

// Lock the widgets by default
locked = true


And a look-and-feel theme which contains the layouts definition.
/usr/share/plasma/look-and-feel/org.kde.solydk.desktop/contents/layouts/org.kde.plasma.desktop-layout.js:
Code: Select all
// Load custom panel
loadTemplate("org.kde.plasma.desktop.solydkPanel")

// Get an array with all available destktops
var desktopsArray = desktopsForActivity(currentActivity())

// Loop through the desktops and set properties
for (var j = 0; j < desktopsArray.length; j++) {
    desktopsArray[j].wallpaperPlugin = 'org.kde.image'
    desktopsArray[j].currentConfigGroup = new Array ("Wallpaper", "org.kde.image", "General")
    desktopsArray[j].writeConfig("Image", "file:///usr/share/wallpapers/solydk/contents/images/3840x2160.png")
    desktopsArray[j].writeConfig("FillMode", 2)
    desktopsArray[j].currentConfigGroup = new Array("General")
    desktopsArray[j].writeConfig("pressToMove",true)
    desktopsArray[j].writeConfig("showToolbox",false)
    desktopsArray[j].writeConfig("popups",false)
    desktopsArray[j].writeConfig("selectionMarkers",false)
    desktopsArray[j].writeConfig("sortMode","-1")
}

// Lock the widgets by default
locked = true


As you can see, I have tried to set "locked" to "true" in both scripts but unfortunately, the widgets are not locked if I set the theme.

If I manually run "locked = true" in the console, it works fine.
console command:
Code: Select all
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.showInteractiveConsole


Did I miss something?

For reference I used these sites for information:
https://userbase.kde.org/Plasma/Create_ ... el_Package
https://userbase.kde.org/KDE_System_Adm ... pScripting
User avatar
abalfoort
Registered Member
Posts
1
Karma
0
OS
I still haven't solved this issue and perhaps this forum is not the right place for this type of question.

Can somebody point me to a place where I have more chance of getting help?


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]