nwg-piotr / nwg-dock

GTK3-based dock for sway
MIT License
170 stars 9 forks source link

Fix High CPU utilization #25

Closed Raffy23 closed 2 years ago

Raffy23 commented 2 years ago

This PR fixes Issue #24. Now tasks are only loaded if changes are detected (opening / closing windows or modifying the UI). I have not fully tested everything, so it is possible that not all state changes are tracked correctly and may result in an inconsistent state of the user interface.

nwg-piotr commented 2 years ago

Tested with my two presets that use dock, it seems to behave perfectly well.

nwg-piotr commented 2 years ago

...apart from the workspaces button not being refreshed.

Raffy23 commented 2 years ago

With the latest commit the workspace button should be refreshed. I also had to fix some functions that handled showing images, otherwise in my debug environment only app images would be displayed ... I'm not sure if the workspace button works currently correctly since I'm unable to trigger the scroll event for the button and the workspace value may reset while the user scrolls thought it, if the currently focused workspace changes.

Btw it seems like the sway ipc dependency doesn't map the subscribe event correctly for workspaces, so my solution needs to re-query the workspace information from sway to get the number of the focused workspace.

nwg-piotr commented 2 years ago

Workspaces button behaves well for me.

There's still one minor issue: unpinned items do not disappear from the dock right after being unpinned. You need to start the application and then close it. Especially well visible if you keep the dock permanently on the screen.

Raffy23 commented 2 years ago

Pin/Unpin actions should now work

nwg-piotr commented 2 years ago

Yes, everything seems to work just well. Thank you for your work.