Commit graph

68 commits

Author SHA1 Message Date
Johan Malm
26bd02d457 Add translate.h for HAVE_NLS includes/defines
...to shrink labwc.h footprint
2025-09-26 10:43:23 -04:00
John Lindgren
9d49d19cd2 include: add config/types.h 2025-08-21 16:55:25 +09:00
John Lindgren
e1475a1e47 include: reduce global includes in labwc.h 2025-07-30 21:04:31 +01:00
Consolatis
ca01dcaa95 main: add feature flags to --version 2025-06-28 20:33:57 +01:00
tokyo4j
ca287de584 Gracefully exit when no fonts are installed
...rather than emitting ugly errors like:

labwc: ../src/buffer.c:85: buffer_adopt_cairo_surface: Assertion
`cairo_image_surface_get_format(surface) == CAIRO_FORMAT_ARGB32' failed.
2025-05-09 20:20:54 +01:00
tinyboxvk
1a6dd845a2 Fix typos
Signed-off-by: tinyboxvk <13696594+tinyboxvk@users.noreply.github.com>
2025-01-09 06:59:57 +00:00
tokyo4j
eaf11face6 server: release all the resources on exit
Release all the resources including wlr_allocator, wlr_renderer,
wlr_backend and wlr_scene. This makes it a lot easier to detect memory
leaks with ASAN.

On wlroots side, the commit ce615a44 needs to be reverted to detect memory
leaks with EGL renderer.
2024-11-12 16:21:06 +09:00
01micko
4d3efb4339 src/main.c: add environment variable LABWC_VER
src/config/session.c add env var LABWC_VER
This could be useful going forward for helper programs
such as `labwc-menu-generator` or `labwc-tweaks`
2024-10-28 21:40:01 +00:00
tokyo4j
2e00630d80 src/main.c: initialize locale after reading environments file
This makes the locale for client-menu items and workspace names follow
the env var `LANG` defined in `~/.config/environments`.
2024-06-23 01:02:03 +02:00
tokyo4j
23b96ad2a6 Replace _ with - in source file names 2024-05-22 07:10:51 +01:00
Consolatis
941290fb4b src/main: delay startup of applications until event loop is ready
This mostly allows for using scripts that trigger a labwc SIGHUP
to work as expected. Before this patch, there was a race between
the event loop starting up and the autostart scripts executing.

One example of such a use-case is dynamically setting the keyboard
layout or cursor theme via environment variable based on feedback
from a dbus service like discussed in #1588.
2024-05-19 18:49:43 +01:00
tokyo4j
b0ba585ff8 overlay: allow to draw both/either of filled/outlined rectangle
Filled/outlined rectangles shown as snapping overlay are now enabled/disabled
independently with `snapping.overlay.[region|edge].bg.enabled` and
`snapping.overlay.[region|edge].border.enabled`.

To keep the default behavior, `*.bg.enabled` is yes and `*.border.enabled` is
no for hardware-based renderers, while `*.bg.enabled` is no and
`*.border.enabled` is yes for software-based (pixman) renderer.

Users can now use a filled rectangle as an overlay even with pixman renderer.
However, this may severely impact performance when used with translucent
`snapping.overlay.[region|edge].bg.color`.

This commit includes a refactor to use substruct `theme_snapping_overlay`
inside `theme` in order to pass it to `create_overlay_rect()` in a cleaner way.

Breaking changes is:
- `snapping.overlay.[region|edge].fill` is now removed.
2024-04-22 19:22:23 +01:00
Johan Malm
c841a25acf Add -S|--session <command> option
...to start <command> on startup and to terminate the compositor when
<command> exits.

This is useful for session management as it allows the session client (for
example `lxqt-session`) to terminate labwc - be exiting itself.

Under X, xinit starts the server and keeps it alive for as long as
lxqt-session runs. Thus either the session client starts the Window
Manager, or the Window Manager can be launched independently first.  On
Wayland, the Compositor is both Display Server and Window Manager, so the
described session management mechanisms do not work because the Compositor
needs to be running before the session can function.

As some session clients support both X11 and Wayland, this command line
option avoids re-writes and fragmentation.

Co-authored-by: @Consolatis
2024-04-14 13:05:25 +02:00
Andrew J. Hesford
c9d08f8218 session: only update activation environment...
...when running DRM backend or by explicit request
2024-03-04 01:57:32 +01:00
Andrew J. Hesford
f90b7dca2a session: run shutdown script, clean up activation env before exit 2024-03-02 21:30:03 -05:00
Johan Malm
dfb6664906 Honour -c <file> on --reconfigure 2024-01-18 20:20:36 +00:00
Johan Malm
698c7ace07 config: support merging multiple config files
Add the -m|--merge-config command line option to iterate backwards over
XDG Base Dir paths and read config/theme files multiple times.

For example if both ~/.config/labwc/rc.xml and /etc/xdg/labwc/rc.xml
exist, the latter will be read first and then the former (if
--merge-config is enabled).

When $XDG_CONFIG_HOME is defined, make it replace (not augment)
$HOME/.config. Similarly, make $XDG_CONFIG_DIRS replace /etc/xdg when
defined.

XDG Base Dir Spec does not specify whether or not an application (or a
compositor!) should (a) define that only the file under the most important
base directory should be used, or (b) define rules for merging the
information from the different files.

ref: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

In the case of labwc there is a use-case for both positions, just to be
clear, the default behaviour, described by position (a) above, does NOT
change.

This change affects the following config/theme files:
  - rc.xml
  - menu.xml
  - autostart
  - environment
  - themerc
  - themerc-override
  - Theme buttons, for example max.xbm

Instead of caching global config/theme directories, create lists of paths
(e.g.  '/home/foo/.config/labwc/rc.xml', '/etc/xdg/labwc/rc.xml', etc).
This creates more common parsing logic and just reversing the direction
of iteration and breaks early if config-merge is not wanted.

Enable better fallback for themes. For example if a particular theme does
not exist in $HOME/.local/share/themes, it will be searched for in
~/.themes/ and so on. This also applies to theme buttons which now
fallback on an individual basis.

Avoid using stat() in most situations and just go straight to fopen().

Fixes #1406
2024-01-18 20:20:36 +00:00
Johan Malm
a105c8781a menu: use wl_list instead of array
...to make it easier to split menu.c into smaller chunks without
exposing nr_menus variable.
2023-10-10 06:17:37 +01:00
Consolatis
ccf68c5950 menu: Add generic menu_init() entry point 2022-12-06 21:08:43 +00:00
Johan Malm
573a521cf1 Refuse to start when SUID is detected
This ensures that those surprised by the deprecation of SUID operation
receive an error rather than accidentally having run as root.

swaywm/sway@e572805
2022-11-16 10:40:59 -05:00
Johan Malm
3e1a800c14 Add --exit and --reconfigure 2022-10-15 00:19:18 +02:00
Johan Malm
8c139e4185 Add long command line options 2022-10-15 00:19:18 +02:00
Johan Malm
2c06b902f4 Set environment variable LABWC_PID
...to the pid of the compositor so that SIGHUP and SIGTERM can be sent to
specific instances using `kill -s <signal> <pid>` rather than
`killall -s <signal> labwc`

Issue #573
2022-10-15 00:19:18 +02:00
John Lindgren
cb40cdc36c common: Add additional memory utilities (xzalloc() etc.) 2022-09-17 10:57:30 -04:00
Joshua Ashton
722aa042b7 main: Increase FD limit
This defaults to 1024, which is tiny, but is a requirement
for processes using the deprecated `select` function.

We must reset this back whenever we fork to start a new process,
as this is inherited, and breaks applications using `select` otherwise.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2022-07-17 00:59:23 +00:00
01micko
cbed8acf01 nls: add native language support
- adds labwc.pot and po files for de, es, it and sv
- added notes in NEWS.md and CONTRIBUTING.md
- addresses #269
- conditional upon `msgfmt` being installed
- can be disabled at build time
2022-05-02 10:33:42 +01:00
Johan Malm
edc5338af4 Add command line option -C to specify config directory
Also expand usage message to explain what each option means
2022-04-22 17:00:36 +01:00
Consolatis
e4f1f9a975 ssd: use dynamic titlebar height based on font size and padding 2022-03-12 15:32:44 +00:00
Consolatis
044388a5cd Prepare to move from wlr_texture to lab_data_buffer 2022-02-23 21:47:01 +00:00
Consolatis
759b26b5c1 Add window menu 2022-01-26 06:17:41 +00:00
Johan Malm
b878db57a7 menu: support submenus
Support submenus defined as follows:

<menu id="submenu" label="Submenu">
  <item label="item1.1"></item>
  <item label="item1.2"></item>
</menu>

<menu id="root-menu" label="">
  <menu id="submenu" />
  <item label="item0"></item>
</menu>
2021-11-02 18:31:19 +00:00
Johan Malm
ebb632419b *.c: add SPDX-License-Identifier 2021-09-24 21:45:48 +01:00
Johan Malm
82e47ac1f5 Remove src/common/log.c
Use wlr_log() instead
2021-07-23 21:15:55 +01:00
Johan Malm
20fd8f59a7 Remove info() and die() 2021-07-22 21:30:17 +01:00
Johan Malm
5101ee87eb main.c: add -v, -V, -d command line options 2021-03-06 11:38:17 +00:00
Johan Malm
ce73d23127 main.c: declare theme within main() 2021-02-25 22:14:07 +00:00
Johan Malm
de88b69d62 mv theme.c .. 2021-02-21 22:18:34 +00:00
Johan Malm
cb2a504440 theme: add theme_finish() 2021-02-21 22:03:14 +00:00
Johan Malm
1b263e1f67 Un-global theme variable 2021-02-21 21:54:40 +00:00
Johan Malm
9af7bd744f Reload buttons in SIGHUP
Call xbm_load() from theme_init()
2021-02-21 21:14:06 +00:00
Johan Malm
f0d8eb0a60 menu: reload on SIGHUP 2021-02-19 23:05:14 +00:00
Johan Malm
64b6c37e7c Sort #includes 2020-11-01 22:22:15 +00:00
Johan Malm
58fdf9776f Move pango_cairo_font_map_set_default() to font.c 2020-10-31 15:41:06 +00:00
Johan Malm
93145ebc2a main: add -v option 2020-10-23 20:08:56 +01:00
Johan Malm
d39b158cec menu: add menu_finish() 2020-10-22 19:43:27 +01:00
Johan Malm
dc5d1ab976 Support a very simple root-menu 2020-10-19 22:14:17 +01:00
Johan Malm
45b13fc9a0 Support ~/.config/labwc/{autostart,environment} 2020-10-08 20:50:20 +01:00
Johan Malm
96e05057a3 Update .clang-format
Align with wlroots style
2020-09-28 20:41:41 +01:00
Johan Malm
1721b339da Reload config+theme on SIGHUP 2020-09-25 19:42:40 +01:00
Johan Malm
fd8d9a395d mv xbm/ .. 2020-08-31 20:01:08 +01:00