labwc/include/config/rcxml.h

165 lines
3.5 KiB
C
Raw Normal View History

2021-11-13 21:56:53 +00:00
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_RCXML_H
#define LABWC_RCXML_H
2020-06-05 23:04:54 +01:00
#include <stdbool.h>
#include <stdio.h>
2020-06-16 07:21:53 +01:00
#include <wayland-server-core.h>
2020-06-05 23:04:54 +01:00
#include "common/border.h"
2020-07-31 21:31:03 +01:00
#include "common/buf.h"
#include "common/font.h"
#include "config/touch.h"
#include "config/tablet.h"
2021-10-15 10:26:00 -04:00
#include "config/libinput.h"
2023-08-17 18:59:29 +02:00
#include "resize_indicator.h"
#include "theme.h"
2020-06-19 22:00:22 +01:00
enum window_switcher_field_content {
LAB_FIELD_NONE = 0,
LAB_FIELD_TYPE,
LAB_FIELD_IDENTIFIER,
LAB_FIELD_TRIMMED_IDENTIFIER,
LAB_FIELD_TITLE,
LAB_FIELD_WORKSPACE,
LAB_FIELD_WIN_STATE,
LAB_FIELD_TYPE_SHORT,
LAB_FIELD_OUTPUT,
};
enum view_placement_policy {
LAB_PLACE_CENTER = 0,
LAB_PLACE_CURSOR,
LAB_PLACE_AUTOMATIC
};
enum adaptive_sync_mode {
LAB_ADAPTIVE_SYNC_DISABLED,
LAB_ADAPTIVE_SYNC_ENABLED,
LAB_ADAPTIVE_SYNC_FULLSCREEN,
};
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),
};
struct usable_area_override {
struct border margin;
char *output;
struct wl_list link; /* struct rcxml.usable_area_overrides */
};
struct window_switcher_field {
enum window_switcher_field_content content;
int width;
struct wl_list link; /* struct rcxml.window_switcher.fields */
};
2020-06-05 23:04:54 +01:00
struct rcxml {
2024-01-18 19:45:49 +00:00
/* from command line */
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;
/* core */
bool xdg_shell_server_side_deco;
int gap;
enum adaptive_sync_mode adaptive_sync;
bool allow_tearing;
2023-01-23 07:15:55 +01:00
bool reuse_output_mode;
enum view_placement_policy placement_policy;
/* focus */
2021-05-27 02:11:11 +03:00
bool focus_follow_mouse;
bool focus_follow_mouse_requires_movement;
2021-05-27 02:11:11 +03:00
bool raise_on_focus;
/* theme */
char *theme_name;
2021-03-30 22:39:52 +01:00
int corner_radius;
bool ssd_keep_border;
struct font font_activewindow;
struct font font_inactivewindow;
struct font font_menuitem;
struct font font_osd;
/* Pointer to current theme */
struct theme *theme;
/* <margin top="" bottom="" left="" right="" output="" /> */
struct wl_list usable_area_overrides;
/* keyboard */
int repeat_rate;
int repeat_delay;
bool kb_numlock_enable;
bool kb_layout_per_window;
struct wl_list keybinds; /* struct keybind.link */
/* mouse */
long doubleclick_time; /* in ms */
struct wl_list mousebinds; /* struct mousebind.link */
double scroll_factor;
/* touch tablet */
struct wl_list touch_configs;
/* graphics tablet */
struct tablet_config {
char *output_name;
2024-01-01 18:26:38 +01:00
struct wlr_fbox box;
enum rotation rotation;
uint16_t button_map_count;
struct button_map_entry button_map[BUTTON_MAP_MAX];
} tablet;
/* 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;
int window_edge_strength;
/* window snapping */
int snap_edge_range;
bool snap_preview_enabled;
int snap_preview_delay_inner;
int snap_preview_delay_outer;
bool snap_top_maximize;
enum tiling_events_mode snap_tiling_events_mode;
2023-08-17 18:59:29 +02:00
enum resize_indicator_mode resize_indicator;
2022-06-15 01:07:45 +02:00
struct {
int popuptime;
2023-06-24 20:36:06 +08:00
int min_nr_workspaces;
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 */
/* Window Switcher */
struct {
bool show;
bool preview;
bool outlines;
uint32_t criteria;
struct wl_list fields; /* struct window_switcher_field.link */
} window_switcher;
struct wl_list window_rules; /* struct window_rule.link */
2020-06-05 23:04:54 +01:00
};
extern struct rcxml rc;
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
#endif /* LABWC_RCXML_H */