Commit graph

3232 commits

Author SHA1 Message Date
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
Johan Malm
c63d35c942 Add labnag
Based on swaynag (https://github.com/swaywm/sway/tree/master/swaynag)

Copied at commit:
03483ff370

Contains the following modifiations:

- Some functional changes including:
  - Disable exclusive-zone by default (Written-by: @Consolatis) and add
    command line option -x|--exclusive-zone
  - Add close timeout (Written-by: @Consolatis) and -t|--timeout option
  - Use index of button (from right-to-left) for exit code
  - Disable reading from config file and remove associated --type option
- Refactoring including:
  - Use wlr_log() instead of the log.{c,h} functions
  - Use wl_list instead of sway's list.c implementation
  - In the pango wrapper functions, use glib's g_strdup_vprintf() rather
    than the original stringop.c functions
- Align with labwc coding style to pass checkpatch.pl
- Re-licenced from MIT to GPL-2.0, and add Copyright notices for original
  authors

v2

- Remove option -s|--dismiss-button and the default "X" button. To get
  such a button, "-Z X :"
- Remove options -b and -z because there is no requirement to run
  in a terminal.
- Remove *-no-terminal from options --button and --button-dismiss because
  commands are now always run directly without a terminal.

v3

- Allow -B/-Z options without action-argument
- Invert button order of -B/-Z so that `labnag -m foo -Z x -Z y -Z z`
  results in three buttons with "x" furthest to the left, and "z" on the
  right (rather than the other way around).
- Use signalfd() to prevent race conditions on SIGTERM

v4

- Limit number of stdin lines to 200 to avoid hogging CPU

Co-Authored-by: tokyo4j
2025-08-09 10:44:03 +01:00
Johan Malm
6fd14987dd build: refactor in preparation for man page not beginning with 'labwc-'
No functional change intended.
2025-08-09 10:44:03 +01:00
Consolatis
fba73a0036 action: add support for <prompt> in 'If' actions
...and allow If Action without activator view.

For example:

    <action name="If">
      <prompt message="Toggle maximize?"/>
      <then>
        <action name="ToggleMaximize" />
      </then>
    </action>

Also revert the change in b9c84f9 that <else> branch is always taken when
no window is focused.

Co-Authored-by: johanmalm
Co-Authored-by: tokyo4j
2025-08-09 10:44:03 +01:00
Consolatis
32e308b5d5 scaled-icon-buffer: prevent accidental downcasting of scale
This causes blurry icons on non-integer scales and triggers
an assert within cairo when using a output scale < 1.

Fixes: #2983
2025-08-09 16:52:10 +09:00
tokyo4j
418f9cb059 ime: fix segfault when IME is killed
Fixes up e530f43.

When IME (e.g. fcitx5) is killed, relay->input_method is destroyed and
then relay->input_method->keyboard_grab is destroyed, which causes null
pointer dereference and crashes labwc.

Possible solutions are:
- Let wlroots keep emitting keyboard grab as `data` from keyboard grab's
  destroy handler just like before
- Let wlroots destroy keyboard grab before input method
- Let compositor store keyboard grab as relay->keyboard_grab

But let's just revert the change in e530f43 for now.
2025-08-08 20:52:23 +09:00
John Lindgren
02df0a15d7 foreign-toplevel: simplify and fully separate ext-foreign/wlr-foreign
Currently, the dependencies between foreign-toplevel[-internal],
ext-foreign, and wlr-foreign are cyclical and a bit complex.

I suggest we reorganize it into a simpler hierarchy:

  foreign-toplevel/
    -> foreign.c/h
      -> (depends on) ext-foreign.c/h
      -> (depends on) wlr-foreign.c/h

The refactored code is smaller and (IMO) easier to follow.

In detail:

- Add include/foreign-toplevel folder mirroring src/foreign-toplevel
- Split foreign-toplevel-internal.h to ext-foreign.h and wlr-foreign.h
- Eliminate ext-/wlr-foreign.c -> foreign.c reverse dependencies
  (including internal signals and foreign_request* functions)
- Make struct foreign_toplevel private to foreign.c

Lightly tested with qmpanel (which uses wlr-foreign-toplevel).

v2: reorder foreign-toplevel internal API funcs
2025-08-07 23:27:04 -04:00
John Lindgren
55b495f398 foreign-toplevel: disconnect internal signals from handle_handle_destroy()
If the handle gets destroyed from the wlroots side before the view
is destroyed, the internal signals (emitted from the view) are not
disconnected and will assert() if invoked.
2025-08-07 23:27:04 -04:00
Johan Malm
d87ef7568a common/xml.c: fix memory leak in lab_xml_get_bool() 2025-08-06 21:11:42 +01:00
John Lindgren
508df093c4 xdg: try to keep view on the same output in timeout case 2025-08-06 18:14:24 +09:00
John Lindgren
9557091a1a xdg: don't try to reposition unmapped view in timeout handler 2025-08-06 18:14:24 +09:00
tokyo4j
e530f43708 ime: don't use data argument in some signal handlers
In wlroots 0.20, the those data argument will be just NULL.
2025-08-05 11:43:09 +09:00
John Lindgren
2547f96984 view: assert internal signals are disconnected before destroy
If they are not empty, then we are headed for use-after-free shortly.
An assert() failure is easier to debug than UAF, so let's fail early.

Inspired by:
8f56f7ca43
2025-08-05 04:20:57 +02:00
John Lindgren
bc34461977 output: make autoEnableOutputs=no apply only to drm outputs
It is not really useful for other output backends and just results
in no outputs being enabled at all. (This is mainly an annoyance for
developers normally running with drm but occasionally nested.)
2025-08-05 04:18:43 +02:00
tokyo4j
17d66e5603 menu: refactor parser
...with the same approach as rcxml.c

- `If` actions now works for menus
- `name` argument no longer have to be the first argument of <action>
- `label` argument no longer have to be the first argument of <item>
2025-08-04 21:41:14 +01:00
tokyo4j
bfaab101af Make append_actions() public
Also rename it to append_parsed_actions()
2025-08-04 21:41:14 +01:00
tokyo4j
2f183cdcb6 interactive: allow snapping to corner edges
In addition to <snapping><range>, <snapping><cornerRange> configures the
distance from the screen corner to trigger quater window snapping.

Also, new values "up-left", "up-right", "down-left" and "down-right" are
allowed for <action name="(Toggle)SnapToEdge" direction="[value]"> and
<query tiled="[value]">.
2025-08-04 21:24:12 +01:00
tokyo4j
b0ff2911b6 src/overlay.c: minor refactor 2025-08-04 21:24:12 +01:00
tokyo4j
6441bd58f3 view: don't use bitset for VIEW_EDGE_ALL
We will use bitset for views snapped to corner (e.g. top-left = TOP|LEFT)
2025-08-04 21:24:12 +01:00
tokyo4j
4b0ac0234c view: refactor view_edge_parse() 2025-08-04 21:24:12 +01:00
tokyo4j
03004cf44b menu: fix segfault with toplevel <separator>
Before this patch, labwc crashed menu.xml like this:

<openbox_menu>
  <separator />
</openbox_menu>
2025-08-03 15:07:35 +01:00
tokyo4j
00ed40454d common/xml: parse CDATA as text
Before this patch, <![CDATA[xxx]]> was ignored in many cases.

For example, this didn't work:

  <core>
    <gap><![CDATA[10]]></gap>
  </core>
2025-08-03 15:05:53 +01:00
tokyo4j
5a50d87ee2 common/xml: let LAB_XML_FOR_EACH() skip first child text nodes
Before this patch, first text nodes like the spaces between <a> and <b>
below were also travered by LAB_XML_FOR_EACH():

  <a>  <b>foo</b></a>
2025-08-03 15:05:53 +01:00
tokyo4j
b9c84f9c38 action: allow if-action without activator view
..in preparation for If/ForEach action with <prompt>, which should be
executed whether or not any window is focused.

This patch makes <If> actions execute <else> branch if no window is
focused or hovered.
2025-08-02 13:19:35 +01:00
tokyo4j
15e3c32b5b action.c: split actions_run() 2025-08-02 13:19:35 +01:00
Johan Malm
6c50a62817 NEWS.md: update notes for 0.9.1 2025-08-02 12:45:11 +01:00
Weblate
9fe1509e33 Translation updates from weblate
Co-authored-by: Dimitrios Glentadakis <dglent@free.fr>
Co-authored-by: Weblate <noreply@weblate.org>
Co-authored-by: 이정희 <daemul72@gmail.com>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/el/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ko/
Translation: Labwc/labwc
2025-08-02 12:32:17 +01:00
tokyo4j
6e7c4a181e overlay: take into account <core><gap> for region overlay 2025-08-02 12:31:16 +01:00
tokyo4j
38e57891b5 overlay: take into account <core><gap> for edge overlay
This also deduplicates get_edge_snap_box() in interactive.c and
view_get_edge_snap_box() in view.c.
2025-08-02 12:31:16 +01:00
tokyo4j
ca8d98e80f cursor: fix Scroll mousebinds not inhibited with ToggleKeybinds
fixup for 024ab280
2025-08-02 12:27:26 +01:00
tokyo4j
d5c03ab7fb include/edges.h: remove unimplemented function 2025-08-02 16:40:04 +09:00
Weblate
b966a1ed73 Translation updates from weblate
Co-authored-by: BigELK176 ≡ <BigELK176@gmail.com>
Co-authored-by: Valera <ValeraDX@yandex.ru>
Co-authored-by: Weblate <noreply@weblate.org>
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/ru/
Translate-URL: https://translate.lxqt-project.org/projects/labwc/labwc/zh_TW/
Translation: Labwc/labwc
2025-07-30 21:05:19 +01:00
John Lindgren
2e6b30eb50 include: move a few types from labwc.h to better locations 2025-07-30 21:04:31 +01:00
John Lindgren
e1475a1e47 include: reduce global includes in labwc.h 2025-07-30 21:04:31 +01:00
John Lindgren
e21fc065c4 include: split output.h from labwc.h 2025-07-30 21:04:31 +01:00
tokyo4j
2f414a438b rcxml: simplify the logic to traverse xml tree 2025-07-30 20:36:27 +01:00
tokyo4j
ad970544e1 string-helper: add str_space_only() 2025-07-30 20:36:27 +01:00
tokyo4j
67f36d9e13 rcxml: rewrite <tablet><map> parser 2025-07-30 20:36:27 +01:00
tokyo4j
619cae67fa rcxml: rewrite <theme><font> parser 2025-07-30 20:36:27 +01:00
tokyo4j
a865cc0777 rcxml: reorder functions 2025-07-30 20:36:27 +01:00