mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-08 20:55:16 +00:00
feat(tray): Implement debouncing for tray item updates
This commit is contained in:
@@ -65,7 +65,18 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
function updateFilteredItems() {
|
||||
// Debounce timer for updateFilteredItems to prevent excessive calls
|
||||
// when multiple events (e.g., SystemTray changes, settings saves)
|
||||
// trigger it in rapid succession, reducing redundant processing.
|
||||
Timer {
|
||||
id: updateDebounceTimer
|
||||
interval: 100 // milliseconds
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: _performFilteredItemsUpdate()
|
||||
}
|
||||
|
||||
function _performFilteredItemsUpdate() {
|
||||
if (!root.blacklist || root.blacklist.length === 0) {
|
||||
if (SystemTray.items && SystemTray.items.values) {
|
||||
filteredItems = SystemTray.items.values
|
||||
@@ -103,6 +114,10 @@ Rectangle {
|
||||
filteredItems = newItems
|
||||
}
|
||||
|
||||
function updateFilteredItems() {
|
||||
updateDebounceTimer.restart()
|
||||
}
|
||||
|
||||
function onLoaded() {
|
||||
// When the widget is fully initialized with its props set the screen for the trayMenu
|
||||
if (trayMenu.item) {
|
||||
|
||||
Reference in New Issue
Block a user