diff --git a/CMakeLists.txt b/CMakeLists.txt index 03603a5a..25cf8612 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,7 @@ add_subdirectory(kded) add_subdirectory(kwin) add_subdirectory(envmanager) add_subdirectory(initialstart) +add_subdirectory(layout-templates) find_program(PlasmaOpenSettings plasma-open-settings) set_package_properties(PlasmaOpenSettings PROPERTIES diff --git a/layout-templates/CMakeLists.txt b/layout-templates/CMakeLists.txt new file mode 100644 index 00000000..ccc6cde3 --- /dev/null +++ b/layout-templates/CMakeLists.txt @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2024 Devin Lin +# SPDX-License-Identifier: GPL-2.0-or-later +plasma_install_package(org.kde.plasma.mobile.defaultMobileLayout org.kde.plasma.mobile.defaultMobileLayout layout-templates layout-template) diff --git a/layout-templates/org.kde.plasma.mobile.defaultMobileLayout/contents/layout.js b/layout-templates/org.kde.plasma.mobile.defaultMobileLayout/contents/layout.js new file mode 100644 index 00000000..1ec40d0d --- /dev/null +++ b/layout-templates/org.kde.plasma.mobile.defaultMobileLayout/contents/layout.js @@ -0,0 +1,11 @@ +// SPDX-FileCopyrightText: 2024 Devin Lin +// SPDX-License-Identifier: GPL-2.0-or-later + +const panel = new Panel("org.kde.plasma.mobile.panel"); +panel.location = "top"; +panel.addWidget("org.kde.plasma.notifications"); +panel.height = 1.25 * gridUnit; // HACK: supposed to be gridUnit + smallSpacing, but it doesn't seem to give the correct number + +const bottomPanel = new Panel("org.kde.plasma.mobile.taskpanel") +bottomPanel.location = "bottom"; +bottomPanel.height = 2 * gridUnit; diff --git a/layout-templates/org.kde.plasma.mobile.defaultMobileLayout/metadata.json b/layout-templates/org.kde.plasma.mobile.defaultMobileLayout/metadata.json new file mode 100644 index 00000000..4f91fffc --- /dev/null +++ b/layout-templates/org.kde.plasma.mobile.defaultMobileLayout/metadata.json @@ -0,0 +1,23 @@ +{ + "KPackageStructure": "Plasma/LayoutTemplate", + "KPlugin": { + "Authors": [ + { + "Email": "devin@kde.org", + "Name": "Devin Lin" + } + ], + "Category": "", + "Description": "Default panel layout for mobile, including status bar and navigation panel", + "EnabledByDefault": true, + "Id": "org.kde.plasma.mobile.defaultMobileLayout", + "License": "LGPLv2+", + "Name": "Default Mobile Layout", + "Website": "https://www.kde.org/plasma-desktop" + }, + "X-Plasma-ContainmentCategories": [ + "panel" + ], + "X-Plasma-Shell": "plasmashell" +} + diff --git a/shell/contents/layout.js b/shell/contents/layout.js index 468a66e9..5fa4a3a1 100644 --- a/shell/contents/layout.js +++ b/shell/contents/layout.js @@ -5,23 +5,17 @@ // SPDX-FileCopyrightText: 2021 Devin Lin // SPDX-License-Identifier: GPL-2.0-or-later +// Load panel layout +loadTemplate("org.kde.plasma.mobile.defaultMobileLayout") + +// Set wallpaper plugin var desktopsArray = desktopsForActivity(currentActivity()); for (var j = 0; j < desktopsArray.length; j++) { desktopsArray[j].wallpaperPlugin = "org.kde.image"; if (j == 0) { - // add meta shortcut + // Add meta shortcut desktopsArray[0].currentConfigGroup = ["Shortcuts"] desktopsArray[0].writeConfig("global", "Meta+F1") } } - -// keep this list in sync with shell/contents/updates/panelsfix.js -var panel = new Panel("org.kde.plasma.mobile.panel"); -panel.location = "top"; -panel.addWidget("org.kde.plasma.notifications"); -panel.height = 1.25 * gridUnit; // HACK: supposed to be gridUnit + smallSpacing, but it doesn't seem to give the correct number - -var bottomPanel = new Panel("org.kde.plasma.mobile.taskpanel") -bottomPanel.location = "bottom"; -bottomPanel.height = 2 * gridUnit;