mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
common: dont require id in runCommand helper
This commit is contained in:
@@ -13,18 +13,19 @@ Singleton {
|
|||||||
|
|
||||||
function runCommand(id, command, callback, debounceMs) {
|
function runCommand(id, command, callback, debounceMs) {
|
||||||
const wait = (typeof debounceMs === "number" && debounceMs >= 0) ? debounceMs : defaultDebounceMs
|
const wait = (typeof debounceMs === "number" && debounceMs >= 0) ? debounceMs : defaultDebounceMs
|
||||||
|
let procId = id ? id : Math.random()
|
||||||
|
|
||||||
if (!_procDebouncers[id]) {
|
if (!_procDebouncers[procId]) {
|
||||||
const t = Qt.createQmlObject('import QtQuick; Timer { repeat: false }', root)
|
const t = Qt.createQmlObject('import QtQuick; Timer { repeat: false }', root)
|
||||||
t.triggered.connect(function() { _launchProc(id) })
|
t.triggered.connect(function() { _launchProc(procId) })
|
||||||
_procDebouncers[id] = { timer: t, command: command, callback: callback, waitMs: wait }
|
_procDebouncers[procId] = { timer: t, command: command, callback: callback, waitMs: wait }
|
||||||
} else {
|
} else {
|
||||||
_procDebouncers[id].command = command
|
_procDebouncers[procId].command = command
|
||||||
_procDebouncers[id].callback = callback
|
_procDebouncers[procId].callback = callback
|
||||||
_procDebouncers[id].waitMs = wait
|
_procDebouncers[procId].waitMs = wait
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry = _procDebouncers[id]
|
const entry = _procDebouncers[procId]
|
||||||
entry.timer.interval = entry.waitMs
|
entry.timer.interval = entry.waitMs
|
||||||
entry.timer.restart()
|
entry.timer.restart()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ Rectangle {
|
|||||||
if (CompositorService.isNiri) {
|
if (CompositorService.isNiri) {
|
||||||
root.currentLayout = NiriService.getCurrentKeyboardLayoutName()
|
root.currentLayout = NiriService.getCurrentKeyboardLayoutName()
|
||||||
} else if (CompositorService.isHyprland) {
|
} else if (CompositorService.isHyprland) {
|
||||||
Proc.runCommand("hyprlandLayout", ["hyprctl", "-j", "devices"], (output, exitCode) => {
|
Proc.runCommand(null, ["hyprctl", "-j", "devices"], (output, exitCode) => {
|
||||||
if (exitCode !== 0) {
|
if (exitCode !== 0) {
|
||||||
root.currentLayout = "Unknown"
|
root.currentLayout = "Unknown"
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -10,14 +10,13 @@ IconImage {
|
|||||||
property real contrastOverride: 1
|
property real contrastOverride: 1
|
||||||
|
|
||||||
readonly property bool hasColorOverride: colorOverride !== ""
|
readonly property bool hasColorOverride: colorOverride !== ""
|
||||||
readonly property string uniqueId: `systemLogo_${Math.random()}`
|
|
||||||
|
|
||||||
smooth: true
|
smooth: true
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
layer.enabled: hasColorOverride
|
layer.enabled: hasColorOverride
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Proc.runCommand(uniqueId, ["sh", "-c", ". /etc/os-release && echo $LOGO"], (output, exitCode) => {
|
Proc.runCommand(null, ["sh", "-c", ". /etc/os-release && echo $LOGO"], (output, exitCode) => {
|
||||||
if (exitCode !== 0) return
|
if (exitCode !== 0) return
|
||||||
const logo = output.trim()
|
const logo = output.trim()
|
||||||
if (logo === "cachyos") {
|
if (logo === "cachyos") {
|
||||||
|
|||||||
Reference in New Issue
Block a user