Skip to content

feat: add focused_only option for workspaces and taskbar widgets#3069

Open
joao-paulo-santos wants to merge 1 commit into
noctalia-dev:mainfrom
joao-paulo-santos:feat/workspace-focused-highlight
Open

feat: add focused_only option for workspaces and taskbar widgets#3069
joao-paulo-santos wants to merge 1 commit into
noctalia-dev:mainfrom
joao-paulo-santos:feat/workspace-focused-highlight

Conversation

@joao-paulo-santos

@joao-paulo-santos joao-paulo-santos commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

New config option focused_only = false (default) for the workspaces widget and taskbar widget. When enabled, only the monitor with keyboard or pointer focus shows the active workspace highlight color. Other monitors show their active workspace as occupied color instead.

Motivation

In multi-monitor setups, every monitor simultaneously highlights its own active workspace, making it ambiguous which monitor actually has focus. This opt-in setting makes the focused monitor visually distinct from peripheral monitors.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Build / packaging

Related Issue

N/A

Testing

  • ninja -C build clean build
  • python3 tools/i18n-check.py passes
  • clang-format --dry-run --Werror passes
  • Tested on Hyprland with two monitors. Verified that switching focus between monitors updates workspace colors live on both the workspaces widget (pill colors) and taskbar widget (disc labels).

Manual Coverage

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors

Screenshots / Videos

N/A.

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format with clang-format v22+ installed, or this PR has no code changes.
  • I ran the relevant build or test commands, or explained why they were not run.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I will update end-user documentation after merge, or this PR does not change user-facing configuration or behavior.
  • I added or updated assets/translations/en.json, or this PR adds no new user-facing strings.
  • I did not edit non-English translation files unless this PR is explicitly for translation tooling, an import/export sync, or a maintainer-requested locale change.
  • I used the existing canonical names for config keys, IPC names, paths, and identifiers.

Additional Notes

Config example:

[widget.workspaces]
focused_only = true

[widget.taskbar]
focused_only = true

Implementation: workspaceFillColor() checks isFocusedOutput() when focused_only is enabled. The doUpdate() loop in both widgets tracks m_wasFocusedOutput and triggers a retarget/rebuild when focus changes, so colors update immediately when switching monitors. The taskbar setting is visible in the settings GUI when "Show Workspace Label" is enabled.

@joao-paulo-santos joao-paulo-santos force-pushed the feat/workspace-focused-highlight branch 2 times, most recently from 53f253d to e135f56 Compare June 19, 2026 02:52
@joao-paulo-santos joao-paulo-santos changed the title feat(workspaces): add focused_only option for focused-monitor highlighting feat: add focused_only option for workspaces and taskbar widgets Jun 19, 2026
@joao-paulo-santos joao-paulo-santos force-pushed the feat/workspace-focused-highlight branch from e135f56 to 6f9f56c Compare June 19, 2026 05:01
@ItsLemmy

ItsLemmy commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR!
This would need to be rebased and tested on Niri too since 71% of our users are on Niri.

@ItsLemmy ItsLemmy marked this pull request as draft June 20, 2026 23:40
@joao-paulo-santos

Copy link
Copy Markdown
Contributor Author

Thanks for the PR! This would need to be rebased and tested on Niri too since 71% of our users are on Niri.

On it, let me install Niri and setup the compositor to my liking and then test the PR branch there + rebase.

@joao-paulo-santos joao-paulo-santos force-pushed the feat/workspace-focused-highlight branch from 6f9f56c to a1c3ab8 Compare June 21, 2026 00:35
@joao-paulo-santos

Copy link
Copy Markdown
Contributor Author

Rebased and tested working on Niri

@joao-paulo-santos joao-paulo-santos marked this pull request as ready for review June 21, 2026 01:02
@joao-paulo-santos joao-paulo-santos force-pushed the feat/workspace-focused-highlight branch from a1c3ab8 to 6b1d154 Compare June 24, 2026 02:32
New config option for the workspaces widget and taskbar widget:
focused_only = false (default).

When enabled, only the monitor with keyboard/pointer focus shows the
active workspace highlight color. Other monitors show their active
workspace as occupied color instead.

For the workspaces widget, detects output focus changes live via
preferredInteractiveOutput() comparison, so colors update immediately
when switching monitors without requiring a workspace event.

For the taskbar widget, applies the same logic to workspace disc
labels. The doUpdate() loop detects focus changes and triggers a
rebuild so disc colors update live across monitors.

Config example:
[widget.workspaces]
focused_only = true

[widget.taskbar]
focused_only = true

Visible in the settings GUI for both widgets.
@joao-paulo-santos joao-paulo-santos force-pushed the feat/workspace-focused-highlight branch from 6b1d154 to 6f93068 Compare June 24, 2026 05:36
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.

2 participants