mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
keybinds: initial support for writable hyprland and mangoWC
fixes #1204
This commit is contained in:
@@ -99,6 +99,8 @@ Item {
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll) {
|
||||
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
|
||||
focusedScreenName = focusedWs?.monitor?.name || "";
|
||||
} else if (CompositorService.isDwl && DwlService.activeOutput) {
|
||||
focusedScreenName = DwlService.activeOutput;
|
||||
}
|
||||
|
||||
if (!focusedScreenName && barVariants.instances.length > 0) {
|
||||
@@ -126,6 +128,8 @@ Item {
|
||||
} else if (CompositorService.isSway || CompositorService.isScroll) {
|
||||
const focusedWs = I3.workspaces?.values?.find(ws => ws.focused === true);
|
||||
focusedScreenName = focusedWs?.monitor?.name || "";
|
||||
} else if (CompositorService.isDwl && DwlService.activeOutput) {
|
||||
focusedScreenName = DwlService.activeOutput;
|
||||
}
|
||||
|
||||
if (!focusedScreenName && barVariants.instances.length > 0) {
|
||||
|
||||
@@ -136,12 +136,12 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function _ensureNiriProvider() {
|
||||
function _ensureCurrentProvider() {
|
||||
if (!KeybindsService.available)
|
||||
return;
|
||||
const cachedProvider = KeybindsService.keybinds?.provider;
|
||||
if (cachedProvider !== "niri" || KeybindsService._dataVersion === 0) {
|
||||
KeybindsService.currentProvider = "niri";
|
||||
const targetProvider = KeybindsService.currentProvider;
|
||||
if (cachedProvider !== targetProvider || KeybindsService._dataVersion === 0) {
|
||||
KeybindsService.loadBinds();
|
||||
return;
|
||||
}
|
||||
@@ -152,13 +152,13 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: _ensureNiriProvider()
|
||||
Component.onCompleted: _ensureCurrentProvider()
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible)
|
||||
return;
|
||||
Qt.callLater(scrollToTop);
|
||||
_ensureNiriProvider();
|
||||
_ensureCurrentProvider();
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
@@ -213,7 +213,8 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Click any shortcut to edit. Changes save to dms/binds.kdl")
|
||||
readonly property string bindsFile: KeybindsService.currentProvider === "niri" ? "dms/binds.kdl" : "dms/binds.conf"
|
||||
text: I18n.tr("Click any shortcut to edit. Changes save to %1").arg(bindsFile)
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
@@ -310,11 +311,12 @@ Item {
|
||||
}
|
||||
|
||||
StyledText {
|
||||
readonly property string bindsFile: KeybindsService.currentProvider === "niri" ? "dms/binds.kdl" : "dms/binds.conf"
|
||||
text: {
|
||||
if (warningBox.showSetup)
|
||||
return I18n.tr("Click 'Setup' to create dms/binds.kdl and add include to config.kdl.");
|
||||
return I18n.tr("Click 'Setup' to create %1 and add include to config.").arg(bindsFile);
|
||||
if (warningBox.showError)
|
||||
return I18n.tr("dms/binds.kdl exists but is not included in config.kdl. Custom keybinds will not work until this is fixed.");
|
||||
return I18n.tr("%1 exists but is not included in config. Custom keybinds will not work until this is fixed.").arg(bindsFile);
|
||||
if (warningBox.showWarning) {
|
||||
const count = warningBox.status.overriddenBy;
|
||||
return I18n.tr("%1 DMS bind(s) may be overridden by config binds that come after the include.").arg(count);
|
||||
|
||||
@@ -352,6 +352,14 @@ FocusScope {
|
||||
}
|
||||
refreshPluginList();
|
||||
}
|
||||
function onPluginDataChanged(pluginId) {
|
||||
var plugin = PluginService.availablePlugins[pluginId];
|
||||
if (!plugin || !PluginService.isPluginLoaded(pluginId))
|
||||
return;
|
||||
var isLauncher = plugin.type === "launcher" || (plugin.capabilities && plugin.capabilities.includes("launcher"));
|
||||
if (isLauncher)
|
||||
PluginService.reloadPlugin(pluginId);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
||||
Reference in New Issue
Block a user