2021-11-13 21:56:53 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2023-05-13 16:10:33 +03:00
|
|
|
#ifndef LABWC_RCXML_H
|
|
|
|
|
#define LABWC_RCXML_H
|
2020-06-05 23:04:54 +01:00
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2020-09-28 20:41:41 +01:00
|
|
|
#include <stdio.h>
|
2020-06-16 07:21:53 +01:00
|
|
|
#include <wayland-server-core.h>
|
2020-06-05 23:04:54 +01:00
|
|
|
|
2023-06-06 19:52:57 +01:00
|
|
|
#include "common/border.h"
|
2020-07-31 21:31:03 +01:00
|
|
|
#include "common/buf.h"
|
2022-09-15 10:53:49 -04:00
|
|
|
#include "common/font.h"
|
2024-12-31 15:25:31 +00:00
|
|
|
#include "common/three-state.h"
|
2024-01-19 10:06:53 +01:00
|
|
|
#include "config/touch.h"
|
2023-12-29 10:06:17 +01:00
|
|
|
#include "config/tablet.h"
|
2024-07-05 06:17:29 +02:00
|
|
|
#include "config/tablet-tool.h"
|
2021-10-15 10:26:00 -04:00
|
|
|
#include "config/libinput.h"
|
2024-05-22 09:56:16 +09:00
|
|
|
#include "resize-indicator.h"
|
2024-08-17 14:45:25 +02:00
|
|
|
#include "ssd.h"
|
2022-03-09 05:40:54 +01:00
|
|
|
#include "theme.h"
|
2020-06-19 22:00:22 +01:00
|
|
|
|
2023-12-10 21:00:05 -05:00
|
|
|
enum view_placement_policy {
|
2024-05-07 09:46:05 -04:00
|
|
|
LAB_PLACE_INVALID = 0,
|
|
|
|
|
LAB_PLACE_CENTER,
|
2023-12-24 13:57:46 -05:00
|
|
|
LAB_PLACE_CURSOR,
|
2024-05-04 06:26:27 +09:00
|
|
|
LAB_PLACE_AUTOMATIC,
|
|
|
|
|
LAB_PLACE_CASCADE,
|
2023-12-10 21:00:05 -05:00
|
|
|
};
|
|
|
|
|
|
2023-12-30 17:35:41 +02:00
|
|
|
enum adaptive_sync_mode {
|
|
|
|
|
LAB_ADAPTIVE_SYNC_DISABLED,
|
|
|
|
|
LAB_ADAPTIVE_SYNC_ENABLED,
|
|
|
|
|
LAB_ADAPTIVE_SYNC_FULLSCREEN,
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-06 22:23:10 +02:00
|
|
|
enum tearing_mode {
|
|
|
|
|
LAB_TEARING_DISABLED = 0,
|
|
|
|
|
LAB_TEARING_ENABLED,
|
|
|
|
|
LAB_TEARING_FULLSCREEN,
|
|
|
|
|
LAB_TEARING_FULLSCREEN_FORCED,
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-22 22:11:53 -05:00
|
|
|
enum tiling_events_mode {
|
|
|
|
|
LAB_TILING_EVENTS_NEVER = 0,
|
|
|
|
|
LAB_TILING_EVENTS_REGION = 1 << 0,
|
|
|
|
|
LAB_TILING_EVENTS_EDGE = 1 << 1,
|
|
|
|
|
LAB_TILING_EVENTS_ALWAYS =
|
|
|
|
|
(LAB_TILING_EVENTS_REGION | LAB_TILING_EVENTS_EDGE),
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-17 14:45:25 +02:00
|
|
|
struct title_button {
|
|
|
|
|
enum ssd_part_type type;
|
|
|
|
|
struct wl_list link;
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-06 19:52:57 +01:00
|
|
|
struct usable_area_override {
|
|
|
|
|
struct border margin;
|
|
|
|
|
char *output;
|
|
|
|
|
struct wl_list link; /* struct rcxml.usable_area_overrides */
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-05 23:04:54 +01:00
|
|
|
struct rcxml {
|
2024-01-18 19:45:49 +00:00
|
|
|
/* from command line */
|
2022-04-22 17:00:36 +01:00
|
|
|
char *config_dir;
|
2024-01-18 19:45:49 +00:00
|
|
|
char *config_file;
|
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-09 22:00:45 +00:00
|
|
|
bool merge_config;
|
2022-04-22 17:00:36 +01:00
|
|
|
|
2021-10-22 20:24:39 +01:00
|
|
|
/* core */
|
2020-09-15 21:10:02 +01:00
|
|
|
bool xdg_shell_server_side_deco;
|
2021-08-22 14:32:19 +01:00
|
|
|
int gap;
|
2023-12-30 17:35:41 +02:00
|
|
|
enum adaptive_sync_mode adaptive_sync;
|
2024-08-06 22:23:10 +02:00
|
|
|
enum tearing_mode allow_tearing;
|
2024-12-27 15:13:12 -05:00
|
|
|
bool auto_enable_outputs;
|
2023-01-23 07:15:55 +01:00
|
|
|
bool reuse_output_mode;
|
2023-12-10 21:00:05 -05:00
|
|
|
enum view_placement_policy placement_policy;
|
2024-07-03 13:43:04 -04:00
|
|
|
bool xwayland_persistence;
|
2024-05-04 06:26:27 +09:00
|
|
|
int placement_cascade_offset_x;
|
|
|
|
|
int placement_cascade_offset_y;
|
2021-10-22 20:24:39 +01:00
|
|
|
|
|
|
|
|
/* focus */
|
2021-05-27 02:11:11 +03:00
|
|
|
bool focus_follow_mouse;
|
2023-04-02 02:18:25 +02:00
|
|
|
bool focus_follow_mouse_requires_movement;
|
2021-05-27 02:11:11 +03:00
|
|
|
bool raise_on_focus;
|
2021-10-22 20:24:39 +01:00
|
|
|
|
|
|
|
|
/* theme */
|
2020-07-09 22:41:54 +01:00
|
|
|
char *theme_name;
|
2024-09-06 17:00:40 +09:00
|
|
|
char *icon_theme_name;
|
2025-01-12 16:52:37 +09:00
|
|
|
char *fallback_app_icon_name;
|
2024-08-17 14:45:25 +02:00
|
|
|
struct wl_list title_buttons_left;
|
|
|
|
|
struct wl_list title_buttons_right;
|
2021-03-30 22:39:52 +01:00
|
|
|
int corner_radius;
|
2024-08-17 14:45:25 +02:00
|
|
|
bool show_title;
|
|
|
|
|
bool title_layout_loaded;
|
2023-04-14 09:01:13 +02:00
|
|
|
bool ssd_keep_border;
|
2024-04-22 19:27:53 +01:00
|
|
|
bool shadows_enabled;
|
2022-09-15 10:53:49 -04:00
|
|
|
struct font font_activewindow;
|
2023-12-07 09:28:27 +01:00
|
|
|
struct font font_inactivewindow;
|
2024-08-21 12:27:07 -05:00
|
|
|
struct font font_menuheader;
|
2022-09-15 10:53:49 -04:00
|
|
|
struct font font_menuitem;
|
|
|
|
|
struct font font_osd;
|
2024-04-22 19:27:53 +01:00
|
|
|
|
2022-03-09 05:40:54 +01:00
|
|
|
/* Pointer to current theme */
|
|
|
|
|
struct theme *theme;
|
2021-10-22 20:24:39 +01:00
|
|
|
|
2023-06-06 19:52:57 +01:00
|
|
|
/* <margin top="" bottom="" left="" right="" output="" /> */
|
|
|
|
|
struct wl_list usable_area_overrides;
|
|
|
|
|
|
2021-10-22 20:24:39 +01:00
|
|
|
/* keyboard */
|
|
|
|
|
int repeat_rate;
|
|
|
|
|
int repeat_delay;
|
2024-12-31 15:25:31 +00:00
|
|
|
enum three_state kb_numlock_enable;
|
2023-09-07 16:41:47 +02:00
|
|
|
bool kb_layout_per_window;
|
2022-06-10 19:42:34 +02:00
|
|
|
struct wl_list keybinds; /* struct keybind.link */
|
2021-10-22 20:24:39 +01:00
|
|
|
|
|
|
|
|
/* mouse */
|
2022-06-10 19:42:34 +02:00
|
|
|
long doubleclick_time; /* in ms */
|
|
|
|
|
struct wl_list mousebinds; /* struct mousebind.link */
|
2021-10-22 20:24:39 +01:00
|
|
|
|
2024-01-13 00:19:44 +01:00
|
|
|
/* touch tablet */
|
2024-01-19 10:06:53 +01:00
|
|
|
struct wl_list touch_configs;
|
2024-01-13 00:19:44 +01:00
|
|
|
|
2023-12-29 10:06:17 +01:00
|
|
|
/* graphics tablet */
|
|
|
|
|
struct tablet_config {
|
2024-04-22 17:21:55 +02:00
|
|
|
bool force_mouse_emulation;
|
2024-01-07 22:19:05 +01:00
|
|
|
char *output_name;
|
2024-01-01 18:26:38 +01:00
|
|
|
struct wlr_fbox box;
|
2023-12-29 22:36:06 +01:00
|
|
|
enum rotation rotation;
|
2023-12-29 10:06:17 +01:00
|
|
|
uint16_t button_map_count;
|
|
|
|
|
struct button_map_entry button_map[BUTTON_MAP_MAX];
|
|
|
|
|
} tablet;
|
2024-07-05 06:17:29 +02:00
|
|
|
struct tablet_tool_config {
|
|
|
|
|
enum motion motion;
|
2024-07-05 06:32:28 +02:00
|
|
|
double relative_motion_sensitivity;
|
2024-07-05 06:17:29 +02:00
|
|
|
} tablet_tool;
|
2023-12-29 10:06:17 +01:00
|
|
|
|
2021-10-22 20:24:39 +01:00
|
|
|
/* libinput */
|
2021-10-15 10:26:00 -04:00
|
|
|
struct wl_list libinput_categories;
|
2021-10-24 12:08:30 -04:00
|
|
|
|
|
|
|
|
/* resistance */
|
|
|
|
|
int screen_edge_strength;
|
2024-01-20 21:59:46 -05:00
|
|
|
int window_edge_strength;
|
2024-08-08 09:19:52 +09:00
|
|
|
int unsnap_threshold;
|
2024-08-07 09:17:25 +09:00
|
|
|
int unmaximize_threshold;
|
2022-01-08 11:25:18 +01:00
|
|
|
|
|
|
|
|
/* window snapping */
|
|
|
|
|
int snap_edge_range;
|
2024-04-21 02:22:28 +09:00
|
|
|
bool snap_overlay_enabled;
|
|
|
|
|
int snap_overlay_delay_inner;
|
|
|
|
|
int snap_overlay_delay_outer;
|
2022-01-08 11:25:18 +01:00
|
|
|
bool snap_top_maximize;
|
2024-01-22 22:11:53 -05:00
|
|
|
enum tiling_events_mode snap_tiling_events_mode;
|
2022-01-20 11:38:23 -08:00
|
|
|
|
2023-08-17 18:59:29 +02:00
|
|
|
enum resize_indicator_mode resize_indicator;
|
2024-05-29 11:06:39 +09:00
|
|
|
bool resize_draw_contents;
|
2025-02-01 14:51:47 +09:00
|
|
|
int resize_corner_range;
|
2025-01-17 11:07:07 -05:00
|
|
|
int resize_minimum_area;
|
2023-08-17 18:59:29 +02:00
|
|
|
|
2022-06-15 01:07:45 +02:00
|
|
|
struct {
|
|
|
|
|
int popuptime;
|
2023-06-24 20:36:06 +08:00
|
|
|
int min_nr_workspaces;
|
2024-03-11 17:19:03 -05:00
|
|
|
char *prefix;
|
2022-06-15 01:07:45 +02:00
|
|
|
struct wl_list workspaces; /* struct workspace.link */
|
|
|
|
|
} workspace_config;
|
2022-07-06 17:21:02 +02:00
|
|
|
|
|
|
|
|
/* Regions */
|
|
|
|
|
struct wl_list regions; /* struct region.link */
|
2023-04-19 14:44:41 +01:00
|
|
|
|
2024-03-03 20:03:32 +00:00
|
|
|
/* Window Switcher */
|
2023-04-19 14:44:41 +01:00
|
|
|
struct {
|
2023-04-20 22:31:26 +01:00
|
|
|
bool show;
|
|
|
|
|
bool preview;
|
|
|
|
|
bool outlines;
|
2024-03-03 20:03:32 +00:00
|
|
|
uint32_t criteria;
|
2023-04-19 14:44:41 +01:00
|
|
|
struct wl_list fields; /* struct window_switcher_field.link */
|
|
|
|
|
} window_switcher;
|
2023-04-28 21:41:41 +01:00
|
|
|
|
|
|
|
|
struct wl_list window_rules; /* struct window_rule.link */
|
2024-04-26 09:03:17 +09:00
|
|
|
|
|
|
|
|
/* Menu */
|
|
|
|
|
unsigned int menu_ignore_button_release_period;
|
2025-01-27 17:19:20 +01:00
|
|
|
bool menu_show_icons;
|
2024-05-15 23:07:23 +01:00
|
|
|
|
|
|
|
|
/* Magnifier */
|
|
|
|
|
int mag_width;
|
|
|
|
|
int mag_height;
|
|
|
|
|
float mag_scale;
|
|
|
|
|
float mag_increment;
|
|
|
|
|
bool mag_filter;
|
2020-06-05 23:04:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern struct rcxml rc;
|
|
|
|
|
|
2020-06-09 21:40:46 +01:00
|
|
|
void rcxml_parse_xml(struct buf *b);
|
2020-06-05 23:04:54 +01:00
|
|
|
void rcxml_read(const char *filename);
|
2020-08-13 20:18:48 +01:00
|
|
|
void rcxml_finish(void);
|
2020-06-05 23:04:54 +01:00
|
|
|
|
2023-05-13 16:10:33 +03:00
|
|
|
#endif /* LABWC_RCXML_H */
|