Commit graph

19 commits

Author SHA1 Message Date
tokyo4j
a62441ff77 cycle: show non-dialog child windows in window switcher
Before this commit, the window switcher skipped all the child windows.

However, as child windows not marked as modal dialogs can lose focus
(ref. `desktop_focus_view()`), it will make sense to include them in the
window switcher so that users can refocus them with keyboard.
This behavior follows KWin.
2026-01-27 21:10:32 +00:00
tokyo4j
97b31429a0 cycle: cycle: ensure server->cycle is cleared in destroy_cycle()
...as I'm adding more state variables there for scrolling mechanism.
2025-12-31 22:46:53 +00:00
tokyo4j
8ad96c0410 cycle: add server->cycle_preview_tree
This doesn't change any behaviors.
2025-12-28 21:03:03 +00:00
tokyo4j
dfe428ae14 cycle: refactor to aggregate type definitions into cycle.h
We declared `cycle_state` struct in `labwc.h` and `cycle_osd_scene`
struct in `output.h`, which was unclean in terms of separation of
concerns.

So this commit firstly moves `cycle_state` to `cycle.h`, then replaces
`cycle_osd_scene` in `output.h` with `cycle_osd_output` in `cycle.h`
which is dynamically allocated in a similar manner to
`session_lock_output`. This ensures that all states about alt-tabbing
are stored in `server->cycle`.

Also, this commit fixes a rare memory leak in `output->cycle_osd.items`
when an output is destroyed while alt-tabbing, by freeing it when the
osd tree is destroyed.
2025-12-28 20:57:37 +00:00
tokyo4j
610d869561 cycle: add <action name="NextWindow" output="" and identifier="">
Some checks failed
labwc.github.io / notify (push) Has been cancelled
output="all|focused|cursor" filters windows by the output they are on.
identifier="all|current" filters windows by their app-id.
2025-12-26 05:25:54 +09:00
tokyo4j
a5c6ff499c cycle: support <action name="NextWindow" workspace="current|all">
This commit deprecates <windowSwitcher allWorkspaces="yes|no"> and adds
per-action argument <action name="NextWindow" workspace="current|all">.
2025-12-26 05:25:54 +09:00
tokyo4j
c9b088e343 cycle: add and use get_outputs_by_filter()
This function can be reused for filtering windows to cycle through.
2025-12-22 18:57:51 +00:00
tokyo4j
64af206114 Rename cycle_osd_output_criteria to cycle_output_filter 2025-12-22 18:57:51 +00:00
tokyo4j
e2d83ff7f5 rcxml: sync rcxml.window_switcher with XML format 2025-12-22 18:57:51 +00:00
Maik Broemme
8fdf375af3
window-switcher: add order parameter to allow stable window list ordering
Some checks failed
labwc.github.io / notify (push) Has been cancelled
Add a new configuration option to control the window switcher traversal order.

`order="focus"` cycling is convenient for quick toggling, but some users - me as well -
prefer a stable taskbar-like order which can now be achieved with `order="age"`.
2025-12-08 18:54:23 +01:00
tokyo4j
c4277ab507 cycle: update config to <osd output="all|cursor|focused">
I think `<windowSwitcher><osd output="keyboard">` is a bit unclear and
hard to interpret as "show OSD in the output with keyboard focus". Also,
we use "cursor" instead of "pointer" in other configurations like
`<placement policy="cursor">` and `<action name="ShowMenu" atCursor="">`.

So let's replace `output="all|pointer|keyboard"` with
`output="all|cursor|focused"`. In documentation, I reordered them to
`output="all|focused|cursor"` as "focused" feels like a bit more
sophisticated and general policy.
2025-12-02 17:09:54 +01:00
tokyo4j
9f5ff391cc cycle: remember cycled window list in server->cycle.views
This allows changing the cycled order in the future, e.g. focused order vs
created order.

Functionally, this commit also changes the initially selected window;
before this commit, the previous/next of the topmost window was always
selected, but now the previous/next of the active window is selected first
if it is in the cycled list. This won't change behaviors for most users,
but this ensures that the user can go back to the focused window with
Alt-Tab + Alt-Shift-Tab even when it is not the topmost window.

This commit fixes the TODO in the previous commit by trying to preserve
the selected view when a view is destroyed during window cycling.
2025-11-30 21:33:46 +00:00
tokyo4j
b6c1a9ea59 cycle: clarify the lifecycle of window switcher
This commit clarifies the lifecycle of the window switcher (cycle) by:
- init_cycle(): initializes the window switcher (e.g. OSD).
- update_cycle(): updates the window switcher states including OSD,
  preview and outlines.
- destroy_cycle(): clears all the window switcher states.

This commit temporarily regresses by not trying to preserve the selected
view when a view is destroyed. This will be addressed in the next commit.
2025-11-30 21:33:46 +00:00
tokyo4j
1783b805e1 cycle: factor out get_osd_impl() 2025-11-30 21:33:46 +00:00
tokyo4j
7527717caa cycle: move & rename destroy_osd_scenes() 2025-11-30 21:33:46 +00:00
tokyo4j
2b28c41b23 cycle: use dummy node to remember the scene position of previewed window
With this approach, we only need to store cycle->dummy_node instead of
cycle->preview_anchor and cycle->preview_parent and we don't need to care
about annoying cases like when the previewed window has no siblings or
when a window tracked by cycle->preview_anchor is destroyed.
2025-11-30 20:56:34 +09:00
tokyo4j
c1f3286cfe src/cycle/cycle.c: remove node->enabled check before _set_enabled()
wlr_scene_node_set_enabled() just returns early when it doesn't change
enabled state.
2025-11-30 20:56:34 +09:00
tokyo4j
4fcb873f6f Use "cycle" instead of "osd" across the codebase
We were using the word "osd" to describe the window switcher, but it can
be used with on-screen display (OSD) disabled by
`<windowSwitcher><osd show="false">`. Let's use "cycle" instead to avoid
confusion.
2025-11-30 16:20:16 +09:00
tokyo4j
65cc2e40ba Rename osd.{h,c} to cycle.{h,c} 2025-11-30 16:20:16 +09:00
Renamed from src/osd/osd.c (Browse further)