1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

keybind: dont make shortcut inhbitor at compile time

This commit is contained in:
bbedward
2025-12-03 00:50:34 -05:00
parent de055e8260
commit 46effd2ca4

View File

@@ -26,6 +26,15 @@ Item {
property string _actionType: ""
property bool addingNewKey: false
property bool useCustomCompositor: false
property var _shortcutInhibitor: null
readonly property bool _shortcutInhibitorAvailable: {
try {
return typeof ShortcutInhibitor !== "undefined";
} catch (e) {
return false;
}
}
readonly property var keys: bindData.keys || []
readonly property bool hasOverride: {
@@ -47,6 +56,8 @@ Item {
implicitHeight: contentColumn.implicitHeight
height: implicitHeight
Component.onDestruction: _destroyShortcutInhibitor()
onIsExpandedChanged: {
if (isExpanded)
resetEdits();
@@ -118,7 +129,34 @@ Item {
addingNewKey = false;
}
function _createShortcutInhibitor() {
if (!_shortcutInhibitorAvailable || _shortcutInhibitor)
return;
const qmlString = `
import QtQuick
import Quickshell.Wayland
ShortcutInhibitor {
enabled: false
window: null
}
`;
_shortcutInhibitor = Qt.createQmlObject(qmlString, root, "KeybindItem.ShortcutInhibitor");
_shortcutInhibitor.enabled = Qt.binding(() => root.recording);
_shortcutInhibitor.window = Qt.binding(() => root.panelWindow);
}
function _destroyShortcutInhibitor() {
if (_shortcutInhibitor) {
_shortcutInhibitor.destroy();
_shortcutInhibitor = null;
}
}
function startRecording() {
_createShortcutInhibitor();
recording = true;
}
@@ -288,12 +326,6 @@ Item {
property alias currentTitle: titleField.text
ShortcutInhibitor {
id: shortcutInhibitor
enabled: root.recording
window: root.panelWindow
}
ColumnLayout {
id: expandedContent
anchors.left: parent.left