mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
HomeScreen: Support the meta key
While using the shell, add some value to the Meta key so the shell is more useful when using a keyboard.
This commit is contained in:
parent
9a6e70f5c3
commit
1eb7965fca
6 changed files with 39 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ target_link_libraries(plasma_containment_phone_homescreen
|
|||
KF5::KIOGui
|
||||
KF5::Notifications
|
||||
KF5::WaylandClient
|
||||
KF5::WindowSystem
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "homescreen.h"
|
||||
|
||||
#include <KWindowSystem>
|
||||
#include <QDebug>
|
||||
#include <QQuickItem>
|
||||
#include <QtQml>
|
||||
|
|
@ -12,8 +13,8 @@
|
|||
HomeScreen::HomeScreen(QObject *parent, const QVariantList &args)
|
||||
: Plasma::Containment(parent, args)
|
||||
{
|
||||
|
||||
setHasConfigurationInterface(true);
|
||||
connect(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged, this, &HomeScreen::showingDesktopChanged);
|
||||
}
|
||||
|
||||
HomeScreen::~HomeScreen() = default;
|
||||
|
|
@ -42,6 +43,16 @@ void HomeScreen::stackAfter(QQuickItem *item1, QQuickItem *item2)
|
|||
item1->stackAfter(item2);
|
||||
}
|
||||
|
||||
bool HomeScreen::showingDesktop() const
|
||||
{
|
||||
return KWindowSystem::showingDesktop();
|
||||
}
|
||||
|
||||
void HomeScreen::setShowingDesktop(bool showingDesktop)
|
||||
{
|
||||
KWindowSystem::setShowingDesktop(showingDesktop);
|
||||
}
|
||||
|
||||
K_PLUGIN_CLASS_WITH_JSON(HomeScreen, "metadata.json")
|
||||
|
||||
#include "homescreen.moc"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class FavoritesModel;
|
|||
class HomeScreen : public Plasma::Containment
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool showingDesktop READ showingDesktop WRITE setShowingDesktop NOTIFY showingDesktopChanged)
|
||||
|
||||
public:
|
||||
HomeScreen(QObject *parent, const QVariantList &args);
|
||||
|
|
@ -23,10 +24,15 @@ public:
|
|||
|
||||
void configChanged() override;
|
||||
|
||||
bool showingDesktop() const;
|
||||
void setShowingDesktop(bool showingDesktop);
|
||||
|
||||
Q_INVOKABLE void stackBefore(QQuickItem *item1, QQuickItem *item2);
|
||||
Q_INVOKABLE void stackAfter(QQuickItem *item1, QQuickItem *item2);
|
||||
|
||||
Q_SIGNALS:
|
||||
void showingDesktopChanged(bool showingDesktop);
|
||||
|
||||
protected:
|
||||
// void configChanged() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,23 @@ FocusScope {
|
|||
}
|
||||
}
|
||||
|
||||
Plasmoid.onActivated: {
|
||||
console.log("Triggered!", plasmoid.nativeInterface.showingDesktop)
|
||||
|
||||
// there's a couple of steps:
|
||||
// - minimize windows
|
||||
// - open app drawer
|
||||
// - restore windows
|
||||
if (!plasmoid.nativeInterface.showingDesktop) {
|
||||
plasmoid.nativeInterface.showingDesktop = true
|
||||
} else if (appDrawer.status !== HomeScreenComponents.AppDrawer.Status.Open) {
|
||||
mainFlickable.currentIndex = 0
|
||||
appDrawer.open()
|
||||
} else {
|
||||
plasmoid.nativeInterface.showingDesktop = false
|
||||
appDrawer.close()
|
||||
}
|
||||
}
|
||||
HomeScreenComponents.AppDrawer {
|
||||
id: appDrawer
|
||||
anchors.fill: parent
|
||||
|
|
|
|||
|
|
@ -49,3 +49,4 @@ X-KDE-PluginInfo-Name=org.kde.phone.homescreen
|
|||
X-KDE-PluginInfo-Version=
|
||||
X-KDE-PluginInfo-Website=
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-Provides=org.kde.plasma.launchermenu
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ for (var j = 0; j < desktopsArray.length; j++) {
|
|||
desktopsArray[j].wallpaperPlugin = "org.kde.image";
|
||||
}
|
||||
desktopsArray[0].addWidget("org.kde.phone.krunner", 0, 0, screenGeometry(0).width, 20)
|
||||
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.phone.panel");
|
||||
|
|
|
|||
Loading…
Reference in a new issue