Skip to content

ActiveWindow: per-screen focus tracking (sway) & instant updates#1783

Open
yorickvP wants to merge 3 commits intonoctalia-dev:mainfrom
yorickvP:activewindow-sway
Open

ActiveWindow: per-screen focus tracking (sway) & instant updates#1783
yorickvP wants to merge 3 commits intonoctalia-dev:mainfrom
yorickvP:activewindow-sway

Conversation

@yorickvP
Copy link

Pull Request

  • I used AI to create these changes, and as such, probably missed some of the implementation nuance. However, I've thoroughly tested the feature on my multi-monitor sway setup and it seems to work well. Feel free to close on that basis.

Motivation

This PR changes the ActiveWindow widget, mainly on sway, to:

  • increase the update speed by removing the debounce timer
  • add an option to do focus tracking per-screen (just like on waybar)
  • properly hide when an empty workspace is selected
  • also update the widget when the relevant window changes its title
  • remove the user-desktop fallback icon, since it doesn't load for me and the widget auto-hides when it would be shown.

Type of Change

Mark the relevant option with an "x".

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring

Testing

Describe how you tested your changes and mark the relevant items.

  • Tested on niri
  • Tested on Hyprland
  • Tested on sway
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors (if applicable)

Screenshots / Videos

If applicable, include screenshots or videos to help illustrate your changes.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my code
  • No new warnings or errors
  • Documentation or comments updated (if relevant)

Additional Notes

  • The per-screen focus setting does nothing on other WMs, which might be an issue.

Replace the debounce timer with direct calls: onActiveToplevelChanged now
invokes safeUpdateWindows()+activeWindowChanged() immediately, a new
onTitleChanged handler keeps titles current, and onRawEvent filters by
event type so workspace/window queries only run when relevant.
Stop looking up a fallback icon when nothing is focused: return an empty
string instead of ThemeIcons.iconFromName(fallbackIcon) so the icon
provider does not log warnings for the "user-desktop" name.
Add per-output focus map so each bar instance shows the window last
focused on its own screen, with live title reads for unfocused outputs.
Includes stale-handle validation, empty-workspace sync via the tree
query, a per-screen toggle in widget settings, and the default enabled
in BarWidgetRegistry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant