mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
keybinds: add toggleWithPath
This commit is contained in:
@@ -326,6 +326,25 @@ Item {
|
|||||||
return `KEYBINDS_TOGGLE_FAILED: ${provider}`
|
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 {
|
function open(provider: string): string {
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
return "ERROR: No provider specified"
|
return "ERROR: No provider specified"
|
||||||
@@ -341,6 +360,21 @@ Item {
|
|||||||
return `KEYBINDS_OPEN_FAILED: ${provider}`
|
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 {
|
function close(): string {
|
||||||
if (root.hyprKeybindsModalLoader.item) {
|
if (root.hyprKeybindsModalLoader.item) {
|
||||||
root.hyprKeybindsModalLoader.item.close()
|
root.hyprKeybindsModalLoader.item.close()
|
||||||
|
|||||||
@@ -16,7 +16,15 @@ Singleton {
|
|||||||
Process {
|
Process {
|
||||||
id: getKeybinds
|
id: getKeybinds
|
||||||
running: false
|
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 {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
@@ -44,11 +52,19 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string overridePath: ""
|
||||||
|
|
||||||
function loadProvider(provider) {
|
function loadProvider(provider) {
|
||||||
root.currentProvider = provider
|
root.currentProvider = provider
|
||||||
reload()
|
reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadProviderWithPath(provider, path) {
|
||||||
|
root.currentProvider = provider
|
||||||
|
root.overridePath = path
|
||||||
|
reload()
|
||||||
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
if (getKeybinds.running) {
|
if (getKeybinds.running) {
|
||||||
getKeybinds.running = false
|
getKeybinds.running = false
|
||||||
|
|||||||
Reference in New Issue
Block a user