mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 04:09:15 -04:00
feat(Hyprland): Introduce Lua support for Hyprland configurations
- Note: We do not convert your existing conf configs to lua. This update only reflects DMS defaults state - Updated README.md to reflect changes - Updated Keyboard shortcut support
This commit is contained in:
@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Modals.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
@@ -96,6 +97,32 @@ Item {
|
||||
expandedKey = bindData.action;
|
||||
}
|
||||
|
||||
function confirmRemoveBind(key, remainingKey) {
|
||||
removeBindConfirm.showWithOptions({
|
||||
title: I18n.tr("Remove Shortcut?"),
|
||||
message: KeybindsService.currentProvider === "hyprland" ? I18n.tr("Remove the shortcut %1? An unbind entry will be saved to dms/binds-user.lua so it stays removed across DMS updates.").arg(key) : I18n.tr("Remove the shortcut %1?").arg(key),
|
||||
confirmText: I18n.tr("Remove"),
|
||||
confirmColor: Theme.primary,
|
||||
onConfirm: () => {
|
||||
KeybindsService.removeBind(key);
|
||||
keybindsTab._editingKey = remainingKey;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmResetBind(key, remainingKey) {
|
||||
removeBindConfirm.showWithOptions({
|
||||
title: I18n.tr("Reset to Default?"),
|
||||
message: I18n.tr("Drop your override for %1 so the DMS default action re-applies?").arg(key),
|
||||
confirmText: I18n.tr("Reset"),
|
||||
confirmColor: Theme.primary,
|
||||
onConfirm: () => {
|
||||
KeybindsService.resetBind(key);
|
||||
keybindsTab._editingKey = remainingKey;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _onSaveSuccess() {
|
||||
if (showingNewBind) {
|
||||
showingNewBind = false;
|
||||
@@ -129,6 +156,10 @@ Item {
|
||||
onTriggered: keybindsTab._updateFiltered()
|
||||
}
|
||||
|
||||
ConfirmModal {
|
||||
id: removeBindConfirm
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: KeybindsService
|
||||
function onBindsLoaded() {
|
||||
@@ -238,7 +269,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
readonly property string bindsFile: KeybindsService.currentProvider === "niri" ? "dms/binds.kdl" : "dms/binds.conf"
|
||||
readonly property string bindsFile: KeybindsService.currentProvider === "niri" ? "dms/binds.kdl" : KeybindsService.currentProvider === "hyprland" ? "dms/binds-user.lua" : "dms/binds.conf"
|
||||
text: I18n.tr("Click any shortcut to edit. Changes save to %1").arg(bindsFile)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
@@ -336,7 +367,7 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
readonly property string bindsFile: KeybindsService.currentProvider === "niri" ? "dms/binds.kdl" : "dms/binds.conf"
|
||||
readonly property string bindsFile: KeybindsService.currentProvider === "niri" ? "dms/binds.kdl" : KeybindsService.currentProvider === "hyprland" ? "dms/binds-user.lua" : "dms/binds.conf"
|
||||
text: {
|
||||
if (warningBox.showSetup)
|
||||
return I18n.tr("Click 'Setup' to create %1 and add include to config.").arg(bindsFile);
|
||||
@@ -623,8 +654,11 @@ Item {
|
||||
}
|
||||
onRemoveBind: key => {
|
||||
const remainingKey = bindItem.keys.find(k => k.key !== key)?.key ?? "";
|
||||
KeybindsService.removeBind(key);
|
||||
keybindsTab._editingKey = remainingKey;
|
||||
keybindsTab.confirmRemoveBind(key, remainingKey);
|
||||
}
|
||||
onResetBind: key => {
|
||||
const remainingKey = bindItem.keys.find(k => k.key !== key)?.key ?? "";
|
||||
keybindsTab.confirmResetBind(key, remainingKey);
|
||||
}
|
||||
onIsExpandedChanged: {
|
||||
if (!isExpanded || !keybindsTab._editingKey)
|
||||
|
||||
Reference in New Issue
Block a user