Verified Commit b581b490 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

layout-templates: let ShellCorona choose the available edge

No need to set panel.location as ShellCorona::addPanel will automatically
pick one available edge.
parent 8c7a2151
Pipeline #190414 passed with stage
in 5 minutes and 41 seconds
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;
}
}
}
// No need to set panel.location as ShellCorona::addPanel will automatically pick one available edge
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";
}
// For an Icons-Only Task Manager on the bottom, *3 is too much, *2 is too little
// Round down to next highest even number since the Panel size widget only displays
// even numbers
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment