Commit graph

3271 commits

Author SHA1 Message Date
tokyo4j
66e26cd28a overlay: refactor
- Use a single `lab_scene_rect` for both overlay background and outlines,
  like I described in the TODO comment in ffd4005.
- Simplify the resource management by destroying the overlay tree when
  it's hidden. I think its overhead is pretty minimal.
- Share a single `lab_scene_rect` for both region/edge overlays.
2025-08-31 13:24:51 +01:00
tokyo4j
78d47c5c37 overlay.h: reduce included headers 2025-08-31 13:24:51 +01:00
01micko
d1a9529239 docs/labnag.1.scd: fix missed escape
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-08-30 21:27:46 +09:00
01micko
f0ccbfed18 docs/labnag.1.scd: add a labnag example 2025-08-30 12:38:05 +01:00
01micko
3499f40a6b meson.build: move lab-sensible-terminal install routine.
Moved to clients/meson.build as per the comment in meson.build.
2025-08-30 11:14:07 +01:00
tokyo4j
a382389e5e scaled-icon-buffer: fix large client-side icon not being loaded
This commit fixes that client-side icons were not loaded when the rendered
icon size is larger than icon sizes from the client. This bug has become
more likely to happen due to the new thumnail-style window switcher.

The cause was `abs(INT_MIN)` becomes `INT_MIN` due to integer overflow.
2025-08-30 08:50:03 +01:00
tokyo4j
2e9292b7a3 osd: support window switcher with thumbnails
The new-style window switcher can be enabled with
<windowSwitcher style="thumbnail">.

New theme entries:

osd.window-switcher.style-thumbnail.width.max: 80%
osd.window-switcher.style-thumbnail.padding: 4
osd.window-switcher.style-thumbnail.item.width: 300
osd.window-switcher.style-thumbnail.item.height: 250
osd.window-switcher.style-thumbnail.item.padding: 10
osd.window-switcher.style-thumbnail.item.active.border.width: 2
osd.window-switcher.style-thumbnail.item.active.border.color: #589bda
osd.window-switcher.style-thumbnail.item.active.bg.color: #c7e2fc
osd.window-switcher.style-thumbnail.item.icon.size: 60
2025-08-29 20:42:01 +01:00
tokyo4j
6e2805f692 theme: move osd.window-switcher.* to osd.window-switcher.style-classic.*
Backward compatibility is preserved.
2025-08-29 20:42:01 +01:00
tokyo4j
92ee5083f0 osd: split to osd.c and osd-classic.c 2025-08-29 20:42:01 +01:00
tokyo4j
57a1ea6cb5 Move osd.c and osd-field.c into src/osd 2025-08-29 20:42:01 +01:00
tokyo4j
f347a818e3 ssd: clean up scene management
Our codebase for ssd scenes has grown with a lot of technical debts:
- We needed to call `ssd_get_part()` everywhere to get the scene node of a
  ssd part. We then needed to cast it to `wlr_scene_rect` and
  `wlr_scene_buffer`. This bloated our codebase and even blocked
  duplicated button types in `<titlebar><layout>`.
- `ssd_get_part_type()` was a dirty hack. It compared parent, grandparent
  and grandgrandparent of a node with each subtree in the ssd to get the
  part type of the node.

To resolve this issues, this commit changes how ssd scenes are managed:
- Access scene rects and scene buffers just as a member of `struct ssd`.
- `ssd_part` is now a attachment to a scene node that can be accessed via
  node_descriptor->data, with a new node-descriptor type
  `LAB_NODE_DESC_SSD_PART`. `LAB_NODE_DESC_SSD_BUTTON` is unified into it.

Now the scene graph under ssd->tree looks like below. The parentheses
indicate the type of ssd_part attached to the node:

ssd->tree (LAB_SSD_NONE)
+--titlebar (LAB_SSD_PART_TITLEBAR)
|  +--inactive
|  |  +--background bar
|  |  +--left corner
|  |  +--right corner
|  |  +--title (LAB_SSD_PART_TITLE)
|  |  +--iconify button (LAB_SSD_BUTTON_ICONIFY)
|  |  |  +--normal close icon image
|  |  |  +--hovered close icon image
|  |  |  +--...
|  |  +--window icon (LAB_SSD_BUTTON_WINDOW_ICON)
|  |  |  +--window icon image
|  |  +--...
|  +--active
|     +--...
+--border
|  +--inactive
|  |  +--top
|  |  +--...
|  +--active
|     +--top
|     +--...
+--shadow
|  +--inactive
|  |  +--top
|  |  +--...
|  +--active
|     +--top
|     +--...
+--extents
   +--top
   +--...

When hovering on SSD, `get_cursor_context()` traverses this scene node
from the leaf. If it finds a `ssd_part` attached to the node, it returns
`ssd_part_type` that represents the resizing direction, button types or
`Title`/`Titlebar`.
2025-08-28 21:06:51 +01:00
tokyo4j
aa3dbb4f85 ssd-extents: factor out resize_extent_within_usable() 2025-08-28 21:06:51 +01:00
tokyo4j
a59f98525e ssd-titlebar: create title buffer in ssd_titlebar_create() 2025-08-28 21:06:51 +01:00
Johan Malm
da90e62346 NEWS.md: interim update 2025-08-27 21:58:05 +01:00
John Lindgren
c8943ca242 seat: improve debug logging when configuring input devices
Some checks failed
labwc.github.io / notify (push) Has been cancelled
I needed to debug an input configuration issue and found the debug
output not-super-helpful, so I made some improvements:

- Print the name and "sysname" (e.g. event11) of the device being
  configured. Note that the name alone isn't enough since there can
  be multiple identically-named devices.

- Print the config category matched for each device.

- Print the config values (if any) being applied. For enums, only the
  numeric value is printed since I'm lazy.

- Don't print "pointer acceleration configured" if neither a pointer
  speed nor acceleration profile is configured (it's confusing).
2025-08-27 13:07:01 -04:00
John Lindgren
80b28f16c7 tree-wide: use enum types/constants where appropriate
- add LAB_WINDOW_TYPE_INVALID in place of literal -1
- document more clearly that enum lab_view_criteria is a bitset
- other one-off replacements of integer values/types for consistency

Note: variables of type enum lab_view_criteria are already used
extensively throughout the code to contain combinations of the declared
enum values. I am not introducing any new usage here, just changing the
single uint32_t to be consistent with all the other usages.
2025-08-28 01:33:23 +09:00
John Lindgren
ef766d16f0 common: flesh out enum lab_edge and prefer over wlr_edges/wlr_direction
I like the new common/edge.h. I don't like how inconsistently we use it.

Current situation:

 - enum wlr_edges and wlr_direction are designed to be used as bitset,
   and are defined compatibly

 - enum lab_edge is *also* designed to be used as bitset, but
   incompatible with the others (LEFT/RIGHT come before UP/DOWN)

 - we use an inconsistent mix of all three *AND* uint32_t (usually with
   the WLR_EDGE constants rather than the LAB_EDGE constants), and
   convert between them on an ad-hoc basis, sometimes implicitly

Let's clean this up:

 - reorder enum lab_edge to be compatible with the two wlr enums
   (check this by static_assert)

 - use TOP/BOTTOM naming rather than UP/DOWN (matches wlr_edges)

 - add constants for the remaining possible combinations of the 4 edges

 - use lab_edge for all internal edge/direction fields, consistently

 - add lab_edge_is_cardinal() as a sanity check before casting to
   enum wlr_direction, and then eliminate all of direction.c/h

Instead of "enum wlr_edges direction", we now have
"enum lab_edge direction" which is not that much better. At least we
are now clear that we're overloading one enum with two meanings.
2025-08-26 20:36:43 -04:00
David Barr
4d1be7eada
menu: add brackets around minimised window titles in client-list menu (#3002) 2025-08-26 21:08:31 +01:00
Rainer Kuemmerle
657c08aaa1 action: add toggle for GoToDesktop
Adds an option "toogle" to GoToDesktop.
In case the target is already where we are, we go back to the last desktop
instead.

Example of rc.xml

<keybind key="C-F1">
  <action name="GoToDesktop">
    <to>1</to>
    <toggle>yes</toggle>
  </action>
</keybind>
2025-08-26 21:03:06 +01:00
tokyo4j
55ee96761a window-rules: fix window rules not being applied
In 943f5751, I initialized heap-allocated `view_query` used for
`If` actions with `decoration=LAB_SSD_MODE_INVALID`, but I forgot to do
that for stack-allocated `view_query` used for window rules.
2025-08-25 23:42:00 +09:00
John Lindgren
ebd39dfe0d view: respect client-initiated resize of non-maximized axis
Some checks failed
labwc.github.io / notify (push) Has been cancelled
When implementing single-axis maximize some time ago, I made the
simplifying assumption that a view couldn't be resized while maximized
(even in only one axis). And indeed for compositor-initiated resize,
we always unmaximize the view first.

However, I didn't account for the client resizing the non-maximized
axis, which we can't (and shouldn't) prevent. When this happens, we
should also update the natural geometry of that single axis so that we
don't undo the resize when un-maximizing.

P.S. xdg-shell clients resizing the *maximized* axis is still an
unsolved problem, exacerbated by the fact that xdg-shell protocol
doesn't allow clients to even know about single-axis maximize.

P.P.S. the view_invalidate_last_layout_geometry() logic may need
similar updates, I'm not sure.
2025-08-24 23:05:59 +09:00
tokyo4j
888dbedeed ssd: allow hiding titlebar on maximization
<core disableMaximizedServerDecor="yes"> hides the titlebar when a window
is maximized.

Co-authored-by: @CosmicFusion
2025-08-24 12:41:41 +01:00
tokyo4j
943f5751ee view: unify ssd_enabled and ssd_titlebar_hidden to ssd_mode 2025-08-24 12:41:41 +01:00
tokyo4j
48ba23fc8d Add common/edge.c
Some checks failed
labwc.github.io / notify (push) Has been cancelled
2025-08-21 21:17:52 +01:00
01micko
1b575ce816 docs/labnag.1.scd: fix typo 2025-08-21 21:05:04 +01:00
John Lindgren
beb3c0fa09 config: add comment to enum lab_motion 2025-08-21 16:55:25 +09:00
John Lindgren
9d49d19cd2 include: add config/types.h 2025-08-21 16:55:25 +09:00
Marvin Dostal
6dea8c0dcc desktop-entry: fix partial string matching
Use the base instead of the full string for the comparison.
2025-08-20 21:15:35 +01:00
01micko
3ee12b1e95 clients/labnag.c: add newline to color errors. 2025-08-20 21:10:21 +01:00
01micko
35ec696bd9 docs/rc.xml.all: clean up libinput section.
- add alternative accepted values for [yes|no]
- re #3006
2025-08-20 02:47:33 +09:00
tokyo4j
d1d4037335 seat.c: reset libinput device config on reconfigure
Before this commit, setting empty values in <libinput> entires and
executing Reconfigure left libinput devices with old configurations.

This commit makes sure that default values are set in libinput devices
on every Reconfigure to make rc.xml more declarative.
2025-08-19 17:18:08 +09:00
tokyo4j
7041accb56 rcxml: allow empty values in <libinput>
This restores the old behavior prior to a0d2e6a6.
2025-08-19 17:18:08 +09:00
Weblate
b1a8eb7d3a Translation updates from weblate
Co-authored-by: Qayyum Yazid <purrnama@proton.me>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ms/
Translation: Labwc/labwc
2025-08-18 21:25:50 +01:00
John Lindgren
6574c82aed keybind: refactor update_keycodes_iter() to reduce nesting
update_keycodes_iter() currently has 4(!) levels of nested loops, which
makes the logic (especially the break/continue statements) difficult to
understand. The logic also appears to continue looping uselessly after
a given keycode has already been added to a keybind.

Refactor by adding some small utility functions:

- keybind_contains_keycode()
- keybind_contains_keysym()
- keybind_contains_any_keysym()

No functional change intended.
2025-08-18 19:54:18 +01:00
Weblate
28513cbdbe Translation updates from weblate
Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Co-authored-by: Ihor Hordiichuk <igor_ck@outlook.com>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/de/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/uk/
Translation: Labwc/labwc
2025-08-17 15:12:59 +01:00
Johan Malm
8d60fb27cd labwc-menu(5): reflect use of client-send-to-menu in client menu 2025-08-16 14:54:48 +01:00
Johan Malm
8bcea29a1c menu: fix leak in update_client_send_to_menu() 2025-08-16 14:54:48 +01:00
Johan Malm
6fe61f8846 menu: use client-send-to-menu as 'Workspace' submenu
...because that is more flexible and how it is in openbox.

I have had in mind that we should do this since the original
implementation, and #2994 just jogged my memory.
2025-08-16 14:54:48 +01:00
John Lindgren
d9f7ccf3aa menu: fix use-after-free at exit with sub-menu selected
Sequence of events:

- menu_finish() frees the sub-menu first
- the selection.menu of the parent menu is now dangling
- menu_finish() frees the parent menu
- menu_free() calls menu_close_root() on the parent menu
- menu_close_root() tries to close the (freed) sub-menu
- boom

Extending nullify_item_pointing_to_this_menu() avoids the crash.
2025-08-15 18:46:34 +09:00
John Lindgren
6e949e623a input/cursor: fix assignment/equality mix-up 2025-08-15 06:48:19 +01:00
tokyo4j
72e1945a4c menu: allow overwriting submenu icon
Allow overwriting the icon of item linking to another menu like below
(the icon for "krita" should be shown):

<openbox_menu>
  <menu id="static-menu" label="Static Menu" icon="mpv" />
  <menu id="root-menu" label="Root">
    <menu id="static-menu" icon="krita" />
  </menu>
</openbox_menu>

This commit also fixes my mistake in 17d66e5 (s/parent->icon/menu->icon/)
that showed incorrect icon in an item linking to another menu.
2025-08-14 20:47:43 +01:00
tokyo4j
2a039d4f24 menu: fix client-send-to-menu
Fixes 17d66e5
2025-08-13 20:29:23 +01:00
tokyo4j
2ce3f39c1f menu: allow client-{list-combined,send-to}-menu as submenu of static menu
Also, their labels are changed to "Windows" and "Send to desktop" which
are the same as Openbox.
2025-08-13 20:29:23 +01:00
Weblate
01a7ac7995 Translation updates from weblate
Co-authored-by: Oliver Chiasson <olivierchiasson@hotmail.fr>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/fr/
Translation: Labwc/labwc
2025-08-13 20:10:06 +01:00
Narrat
e05b924e4d docs/menu.xml: adjust labnag example
It was missing the respective closing tag
2025-08-12 22:35:19 +01:00
Johan Malm
09b4e9605e labnag: return special value on timeout
...to avoid taking either of the <then> or <else> branches on timeout.
2025-08-12 03:10:14 +09:00
tokyo4j
073fd02300 osd: add null-check for output->osd_scene.tree
`wlr_scene_node_destroy(&output->osd_scene.tree->node);` does nothing
for null pointer, but ASAN is unhappy about accessing (NULL)->node.
2025-08-09 12:03:41 +01:00
Johan Malm
7c3a587015 action: fix labnag button order 2025-08-09 11:04:36 +01:00
Johan Malm
6c3cf84b07 labnag: fix FreeBSD signalfd() build error 2025-08-09 10:44:03 +01:00
Johan Malm
8a5a04cc1a labwc-action(5): describe If action <prompt> 2025-08-09 10:44:03 +01:00