aerothemeplasma/plasma/layout-templates/io.gitgud.wackyideas.taskbar/contents/layout.js
wackyideas 4f46e0013b Replace KDE system tray with ATP's own system tray
Replaces org.kde.plasma.systemtray with io.gitgud.wackyideas.systemtray.
The plasmoid now also needs to be compiled, and is also now the default
for ATP's session and layout templates.

This version of the system tray is also searchable in the gadgets window
for easier layout management. Everything else about the tray should be
largely the same as it was before.
2025-10-24 02:37:33 +02:00

101 lines
3.3 KiB
JavaScript

var panel = new Panel("io.gitgud.wackyideas.panel");
var panelScreen = panel.screen
// No need to set panel.location as ShellCorona::addPanel will automatically pick one available edge
// 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
panel.height = 40
panel.floating = false
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";
}
// Restrict horizontal panel to a maximum size of a 21:9 monitor
const maximumAspectRatio = 21/9;
if (panel.formFactor === "horizontal") {
const geo = screenGeometry(panelScreen);
const maximumWidth = Math.ceil(geo.height * maximumAspectRatio);
if (geo.width > maximumWidth) {
panel.alignment = "center";
panel.minimumLength = maximumWidth;
panel.maximumLength = maximumWidth;
}
}
panel.addWidget("io.gitgud.wackyideas.SevenStart")
//panel.addWidget("org.kde.plasma.showActivityManager")
panel.addWidget("io.gitgud.wackyideas.seventasks")
/* Next up is determining whether to add the Input Method Panel
* widget to the panel or not. This is done based on whether
* the system locale's language id is a member of the following
* white list of languages which are known to pull in one of
* our supported IME backends when chosen during installation
* of common distributions. */
var langIds = ["as", // Assamese
"bn", // Bengali
"bo", // Tibetan
"brx", // Bodo
"doi", // Dogri
"gu", // Gujarati
"hi", // Hindi
"ja", // Japanese
"kn", // Kannada
"ko", // Korean
"kok", // Konkani
"ks", // Kashmiri
"lep", // Lepcha
"mai", // Maithili
"ml", // Malayalam
"mni", // Manipuri
"mr", // Marathi
"ne", // Nepali
"or", // Odia
"pa", // Punjabi
"sa", // Sanskrit
"sat", // Santali
"sd", // Sindhi
"si", // Sinhala
"ta", // Tamil
"te", // Telugu
"th", // Thai
"ur", // Urdu
"vi", // Vietnamese
"zh_CN", // Simplified Chinese
"zh_TW"] // Traditional Chinese
if (langIds.indexOf(languageId) != -1) {
panel.addWidget("io.gitgud.wackyideas.keyboardlayout");
}
panel.addWidget("io.gitgud.wackyideas.systemtray")
panel.addWidget("io.gitgud.wackyideas.digitalclocklite")
panel.addWidget("io.gitgud.wackyideas.win7showdesktop")