1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 22:15:38 -05:00

hyprland: some targeted improvements

This commit is contained in:
bbedward
2025-10-29 17:23:38 -04:00
parent 0569906f7c
commit 7ed0b752a8
3 changed files with 57 additions and 6 deletions

View File

@@ -29,6 +29,9 @@ Singleton {
property bool _hasRefreshedOnce: false
property var _coordCache: ({})
property int _refreshCount: 0
property real _refreshWindowStart: 0
readonly property int _maxRefreshesPerSecond: 3
function getScreenScale(screen) {
if (!screen) return 1
@@ -77,6 +80,19 @@ Singleton {
function scheduleRefresh() {
if (!isHyprland) return
if (_refreshScheduled) return
const now = Date.now()
if (now - _refreshWindowStart > 1000) {
_refreshCount = 0
_refreshWindowStart = now
}
if (_refreshCount >= _maxRefreshesPerSecond) {
console.warn("CompositorService: Refresh rate limit exceeded, skipping refresh")
return
}
_refreshCount++
_refreshScheduled = true
refreshTimer.restart()
}
@@ -158,6 +174,18 @@ Singleton {
} catch(e) { return fb }
}
let currentAddresses = new Set()
for (let i = 0; i < items.length; i++) {
const addr = items[i]?.address
if (addr) currentAddresses.add(addr)
}
for (let cachedAddr in _coordCache) {
if (!currentAddresses.has(cachedAddr)) {
delete _coordCache[cachedAddr]
}
}
let snap = []
let missingAnyPosition = false
let hasNewWindow = false

View File

@@ -19,7 +19,7 @@ Singleton {
Process {
id: getKeybinds
running: true
running: false
command: [root.scriptPath, "--path", root.hyprConfigPath]
stdout: SplitParser {
@@ -31,9 +31,22 @@ Singleton {
}
}
}
onExited: (code) => {
if (code !== 0) {
console.warn("[HyprKeybindsService] Process exited with code:", code)
}
}
}
Component.onCompleted: {
getKeybinds.running = true
}
function reload() {
getKeybinds.running = true
getKeybinds.running = false
Qt.callLater(function() {
getKeybinds.running = true
})
}
}