mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
keybinds: add toggleWithPath
This commit is contained in:
@@ -326,6 +326,25 @@ Item {
|
||||
return `KEYBINDS_TOGGLE_FAILED: ${provider}`
|
||||
}
|
||||
|
||||
function toggleWithPath(provider: string, path: string): string {
|
||||
if (!provider) {
|
||||
return "ERROR: No provider specified"
|
||||
}
|
||||
|
||||
KeybindsService.loadProviderWithPath(provider, path)
|
||||
root.hyprKeybindsModalLoader.active = true
|
||||
|
||||
if (root.hyprKeybindsModalLoader.item) {
|
||||
if (root.hyprKeybindsModalLoader.item.shouldBeVisible) {
|
||||
root.hyprKeybindsModalLoader.item.close()
|
||||
} else {
|
||||
root.hyprKeybindsModalLoader.item.open()
|
||||
}
|
||||
return `KEYBINDS_TOGGLE_SUCCESS: ${provider} (${path})`
|
||||
}
|
||||
return `KEYBINDS_TOGGLE_FAILED: ${provider}`
|
||||
}
|
||||
|
||||
function open(provider: string): string {
|
||||
if (!provider) {
|
||||
return "ERROR: No provider specified"
|
||||
@@ -341,6 +360,21 @@ Item {
|
||||
return `KEYBINDS_OPEN_FAILED: ${provider}`
|
||||
}
|
||||
|
||||
function openWithPath(provider: string, path: string): string {
|
||||
if (!provider) {
|
||||
return "ERROR: No provider specified"
|
||||
}
|
||||
|
||||
KeybindsService.loadProviderWithPath(provider, path)
|
||||
root.hyprKeybindsModalLoader.active = true
|
||||
|
||||
if (root.hyprKeybindsModalLoader.item) {
|
||||
root.hyprKeybindsModalLoader.item.open()
|
||||
return `KEYBINDS_OPEN_SUCCESS: ${provider} (${path})`
|
||||
}
|
||||
return `KEYBINDS_OPEN_FAILED: ${provider}`
|
||||
}
|
||||
|
||||
function close(): string {
|
||||
if (root.hyprKeybindsModalLoader.item) {
|
||||
root.hyprKeybindsModalLoader.item.close()
|
||||
|
||||
@@ -16,7 +16,15 @@ Singleton {
|
||||
Process {
|
||||
id: getKeybinds
|
||||
running: false
|
||||
command: ["dms", "keybinds", "show", root.currentProvider]
|
||||
command: {
|
||||
let baseCmd = ["dms", "keybinds", "show"]
|
||||
if (root.overridePath) {
|
||||
baseCmd.push("--path")
|
||||
baseCmd.push(root.overridePath)
|
||||
}
|
||||
baseCmd.push(root.currentProvider)
|
||||
return baseCmd
|
||||
}
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
@@ -44,11 +52,19 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
property string overridePath: ""
|
||||
|
||||
function loadProvider(provider) {
|
||||
root.currentProvider = provider
|
||||
reload()
|
||||
}
|
||||
|
||||
function loadProviderWithPath(provider, path) {
|
||||
root.currentProvider = provider
|
||||
root.overridePath = path
|
||||
reload()
|
||||
}
|
||||
|
||||
function reload() {
|
||||
if (getKeybinds.running) {
|
||||
getKeybinds.running = false
|
||||
|
||||
Reference in New Issue
Block a user