mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-25 07:37:42 +00:00
Compare commits
No commits in common. "d4da69b2f2564eb269c9c544cfb8309fb0f03131" and "a09f349a3448bac53c1fac4b0b0f706f0198a671" have entirely different histories.
d4da69b2f2
...
a09f349a34
12 changed files with 30 additions and 73 deletions
|
|
@ -25,10 +25,6 @@ public:
|
|||
{
|
||||
KPackage::Package pkg = KPackage::PackageLoader::self()->loadPackage(u"Plasma/Shell"_s);
|
||||
pkg.setPath(u"org.kde.plasma.mobile"_s);
|
||||
if (!pkg.isValid()) {
|
||||
qWarning() << "AppletHost: failed to load plasma shell package org.kde.plasma.mobile";
|
||||
return;
|
||||
}
|
||||
setKPackage(pkg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,6 @@ public:
|
|||
explicit AppletHost(QObject *parent = nullptr);
|
||||
~AppletHost() override;
|
||||
|
||||
static QObject *create(QQmlEngine * /*engine*/, QJSEngine * /*scriptEngine*/)
|
||||
{
|
||||
return new AppletHost();
|
||||
}
|
||||
|
||||
Q_INVOKABLE QQuickItem *fullRepresentationFor(const QString &pluginId);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ MobileShell.BaseItem {
|
|||
|
||||
function delegatePressAndHold() {
|
||||
// In convergence mode, show inline detail popup if available.
|
||||
if (ShellSettings.Settings.convergenceModeEnabled && root.settingsCommand && !root.restrictedPermissions) {
|
||||
if (ShellSettings.Settings.convergenceModeEnabled && root.settingsCommand) {
|
||||
let pluginId = __appletForCommand[root.settingsCommand];
|
||||
if (pluginId) {
|
||||
root.detailRequested(pluginId);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ Window {
|
|||
readonly property real openOffset: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing * 3
|
||||
readonly property int longestLength: Math.max(Screen.width, Screen.height)
|
||||
readonly property bool isConvergence: ShellSettings.Settings.convergenceModeEnabled
|
||||
// Margin between popup and screen edge in convergence mode; used in both
|
||||
// the delegate x position and the input-region calculation so they stay in sync.
|
||||
readonly property real convergencePopupMargin: Kirigami.Units.gridUnit * 2
|
||||
property var keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
|
||||
|
||||
LayerShell.Window.scope: "notification"
|
||||
|
|
@ -103,8 +100,8 @@ Window {
|
|||
}
|
||||
|
||||
if (isConvergence) {
|
||||
let regionX = notificationPopupManager.width - notificationPopupManager.popupWidth - notificationPopupManager.convergencePopupMargin;
|
||||
let regionY = openOffset;
|
||||
let regionX = notificationPopupManager.width - notificationPopupManager.popupWidth - Kirigami.Units.gridUnit * 4;
|
||||
let regionY = Screen.height - openOffset - popupHeight - Kirigami.Units.gridUnit;
|
||||
ShellUtil.setInputRegion(notificationPopupManager, Qt.rect(regionX, regionY, notificationPopupManager.popupWidth + Kirigami.Units.gridUnit * 2, popupHeight + Kirigami.Units.gridUnit * 2));
|
||||
} else {
|
||||
ShellUtil.setInputRegion(notificationPopupManager, Qt.rect((notificationPopupManager.width - notificationPopupManager.popupWidth - Kirigami.Units.gridUnit) / 2, openOffset - Kirigami.Units.gridUnit / 2, notificationPopupManager.popupWidth + Kirigami.Units.gridUnit, popupHeight + Kirigami.Units.gridUnit * ((notifications.count - notifications.currentPopupIndex > 1) ? 4 : 1)));
|
||||
|
|
@ -206,7 +203,7 @@ Window {
|
|||
id: popup
|
||||
|
||||
x: notificationPopupManager.isConvergence
|
||||
? (parent.width - width - notificationPopupManager.convergencePopupMargin)
|
||||
? (parent.width - width - Kirigami.Units.gridUnit * 2)
|
||||
: (parent.width - width) / 2
|
||||
z: notifications.count - index
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ Item {
|
|||
// Hover highlight in convergence mode to indicate the bar is clickable
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.1)
|
||||
color: Qt.rgba(1.0, 1.0, 1.0, 0.1)
|
||||
visible: ShellSettings.Settings.convergenceModeEnabled && statusBarHover.hovered
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "favouritesmodel.h"
|
||||
#include "homescreenstate.h"
|
||||
|
||||
#include <KService>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QJsonArray>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-FileCopyrightText: Marco Allegretti
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
// SPDX-License-Identifier: EUPL 1.2
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
|
|
@ -179,27 +179,7 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
activeFocusOnTab: true
|
||||
onClicked: root.categorySelected(tile.catId)
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) {
|
||||
root.categorySelected(tile.catId);
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: tile.catName
|
||||
Accessible.onPressAction: root.categorySelected(tile.catId)
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
border.color: Kirigami.Theme.highlightColor
|
||||
border.width: tileArea.activeFocus ? 2 : 0
|
||||
radius: parent.parent.radius
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,12 +642,12 @@ MouseArea {
|
|||
x: {
|
||||
if (!targetDelegate) return 0
|
||||
var delegateGlobal = targetDelegate.mapToGlobal(0, 0)
|
||||
return Math.max(0, Math.min(Screen.width - width, delegateGlobal.x + (targetDelegate.width - width) / 2))
|
||||
return Math.max(0, delegateGlobal.x + (targetDelegate.width - width) / 2)
|
||||
}
|
||||
y: {
|
||||
if (!targetDelegate) return 0
|
||||
var delegateGlobal = targetDelegate.mapToGlobal(0, 0)
|
||||
return Math.max(0, Math.min(Screen.height - height, delegateGlobal.y - height - Kirigami.Units.smallSpacing))
|
||||
return delegateGlobal.y - height - Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
|
|
@ -916,7 +916,7 @@ MouseArea {
|
|||
Repeater {
|
||||
model: {
|
||||
var ids = taskDelegate.model.WinIdList
|
||||
return Math.max(1, ids ? ids.length : 0)
|
||||
return ids ? ids.length : 1
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ MobileShell.NavigationPanel {
|
|||
foregroundColorGroup: forcedComplementary ? Kirigami.Theme.Complementary : Kirigami.Theme.Window
|
||||
shadow: forcedComplementary
|
||||
|
||||
// Convergence mode: expose running-app task strip
|
||||
convergenceMode: ShellSettings.Settings.convergenceModeEnabled
|
||||
taskModel: tasksModel
|
||||
virtualDesktopInfo: virtualDesktopInfo
|
||||
|
||||
MobileShellState.PanelSettingsDBusClient {
|
||||
id: panelSettings
|
||||
screenName: Screen.name
|
||||
|
|
@ -70,16 +75,20 @@ MobileShell.NavigationPanel {
|
|||
// ~~~~
|
||||
// navigation panel actions
|
||||
|
||||
// toggle task switcher button
|
||||
// toggle task switcher button (KWin Overview in convergence mode, mobile task switcher otherwise)
|
||||
leftAction: MobileShell.NavigationPanelAction {
|
||||
id: taskSwitcherAction
|
||||
|
||||
enabled: true
|
||||
iconSource: "mobile-task-switcher"
|
||||
shrinkSize: 4
|
||||
iconSource: ShellSettings.Settings.convergenceModeEnabled ? "view-grid-symbolic" : "mobile-task-switcher"
|
||||
shrinkSize: ShellSettings.Settings.convergenceModeEnabled ? 0 : 4
|
||||
|
||||
onTriggered: {
|
||||
Plasmoid.triggerTaskSwitcher();
|
||||
if (ShellSettings.Settings.convergenceModeEnabled) {
|
||||
Plasmoid.triggerOverview();
|
||||
} else {
|
||||
Plasmoid.triggerTaskSwitcher();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,13 +158,13 @@ ContainmentItem {
|
|||
color: "transparent"
|
||||
flags: Qt.FramelessWindowHint | Qt.WindowTransparentForInput
|
||||
// height is set by layer-shell anchoring; provide a fallback.
|
||||
height: Kirigami.Units.gridUnit * 3
|
||||
height: root.navigationPanelHeight
|
||||
width: 1 // layer-shell stretches it via AnchorLeft|AnchorRight
|
||||
|
||||
LayerShell.Window.scope: "dock-space"
|
||||
LayerShell.Window.layer: LayerShell.Window.LayerBottom
|
||||
LayerShell.Window.anchors: LayerShell.Window.AnchorBottom | LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorRight
|
||||
LayerShell.Window.exclusionZone: Kirigami.Units.gridUnit * 3
|
||||
LayerShell.Window.exclusionZone: root.navigationPanelHeight
|
||||
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ Loader {
|
|||
|
||||
const output = window.output
|
||||
const desktop = window.desktops[0]
|
||||
if (!output) return
|
||||
if (!desktop) return
|
||||
|
||||
const maxRect = KWinComponents.Workspace.clientArea(
|
||||
|
|
|
|||
|
|
@ -28,33 +28,13 @@ public Q_SLOTS:
|
|||
|
||||
KAuth::ActionReply Flashlighthelper::setbrightness(const QVariantMap &args)
|
||||
{
|
||||
// Store as named QByteArrays so constData() pointers remain valid for the
|
||||
// duration of the function. The originals were temporaries that were
|
||||
// destroyed at the end of each declaration statement.
|
||||
// (need to double-check this, but seems likely to be the cause of the random failures
|
||||
// we were seeing in testing)
|
||||
const QByteArray sysPathBytes = args.value("sysPath"_L1).toString().toUtf8();
|
||||
QByteArray brightnessBytes = args.value("brightness"_L1).toString().toUtf8();
|
||||
|
||||
if (sysPathBytes.isEmpty()) {
|
||||
qCWarning(FLASHLIGHTHELPER) << "sysPath argument is missing or empty";
|
||||
return KAuth::ActionReply::HelperErrorReply();
|
||||
}
|
||||
const char *sysPath = args.value("sysPath"_L1).toString().toUtf8().constData();
|
||||
const char *brightness = args.value("brightness"_L1).toString().toUtf8().constData();
|
||||
|
||||
struct udev *udev = udev_new();
|
||||
if (!udev) {
|
||||
qCWarning(FLASHLIGHTHELPER) << "Failed to create udev context";
|
||||
return KAuth::ActionReply::HelperErrorReply();
|
||||
}
|
||||
struct udev_device *device = udev_device_new_from_syspath(udev, sysPath);
|
||||
|
||||
struct udev_device *device = udev_device_new_from_syspath(udev, sysPathBytes.constData());
|
||||
if (!device) {
|
||||
qCWarning(FLASHLIGHTHELPER) << "Failed to find udev device for syspath:" << sysPathBytes;
|
||||
udev_unref(udev);
|
||||
return KAuth::ActionReply::HelperErrorReply();
|
||||
}
|
||||
|
||||
int ret = udev_device_set_sysattr_value(device, "brightness", brightnessBytes.data());
|
||||
int ret = udev_device_set_sysattr_value(device, "brightness", const_cast<char *>(brightness));
|
||||
|
||||
udev_device_unref(device);
|
||||
udev_unref(udev);
|
||||
|
|
@ -62,7 +42,7 @@ KAuth::ActionReply Flashlighthelper::setbrightness(const QVariantMap &args)
|
|||
if (ret >= 0) {
|
||||
return KAuth::ActionReply::SuccessReply();
|
||||
} else {
|
||||
qCWarning(FLASHLIGHTHELPER) << "Failed to set udev system attribute, errno:" << -ret;
|
||||
qCWarning(FLASHLIGHTHELPER) << "Failed to set udev system attribute";
|
||||
return KAuth::ActionReply::HelperErrorReply();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue