mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
desktop widget: handle key events in widget
This commit is contained in:
@@ -170,6 +170,30 @@ Item {
|
|||||||
windows: [widgetWindow]
|
windows: [widgetWindow]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: root.isInteracting
|
||||||
|
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
if (!root.isInteracting)
|
||||||
|
return;
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_G:
|
||||||
|
SettingsData.setDesktopWidgetGridSetting(root.screenKey, "enabled", !root.gridEnabled);
|
||||||
|
event.accepted = true;
|
||||||
|
break;
|
||||||
|
case Qt.Key_Z:
|
||||||
|
SettingsData.setDesktopWidgetGridSetting(root.screenKey, "size", Math.max(10, root.gridSize - 10));
|
||||||
|
event.accepted = true;
|
||||||
|
break;
|
||||||
|
case Qt.Key_X:
|
||||||
|
SettingsData.setDesktopWidgetGridSetting(root.screenKey, "size", Math.min(200, root.gridSize + 10));
|
||||||
|
event.accepted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
left: true
|
left: true
|
||||||
top: true
|
top: true
|
||||||
@@ -343,6 +367,7 @@ Item {
|
|||||||
active: root.isInteracting && root.useGhostPreview
|
active: root.isInteracting && root.useGhostPreview
|
||||||
|
|
||||||
sourceComponent: PanelWindow {
|
sourceComponent: PanelWindow {
|
||||||
|
id: ghostPreviewWindow
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
@@ -484,16 +509,7 @@ Item {
|
|||||||
WlrLayershell.namespace: "quickshell:desktop-widget-helper"
|
WlrLayershell.namespace: "quickshell:desktop-widget-helper"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
WlrLayershell.keyboardFocus: {
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||||
if (CompositorService.useHyprlandFocusGrab)
|
|
||||||
return WlrKeyboardFocus.OnDemand;
|
|
||||||
return WlrKeyboardFocus.Exclusive;
|
|
||||||
}
|
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
|
||||||
active: CompositorService.isHyprland
|
|
||||||
windows: [helperWindow]
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
bottom: true
|
bottom: true
|
||||||
@@ -503,28 +519,6 @@ Item {
|
|||||||
|
|
||||||
implicitHeight: 60
|
implicitHeight: 60
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: true
|
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
|
||||||
switch (event.key) {
|
|
||||||
case Qt.Key_G:
|
|
||||||
SettingsData.setDesktopWidgetGridSetting(root.screenKey, "enabled", !root.gridEnabled);
|
|
||||||
event.accepted = true;
|
|
||||||
break;
|
|
||||||
case Qt.Key_Z:
|
|
||||||
SettingsData.setDesktopWidgetGridSetting(root.screenKey, "size", Math.max(10, root.gridSize - 10));
|
|
||||||
event.accepted = true;
|
|
||||||
break;
|
|
||||||
case Qt.Key_X:
|
|
||||||
SettingsData.setDesktopWidgetGridSetting(root.screenKey, "size", Math.min(200, root.gridSize + 10));
|
|
||||||
event.accepted = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: helperContent
|
id: helperContent
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|||||||
Reference in New Issue
Block a user