mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2025-01-16 15:41:25 +01:00
9704152414
Instead of having a build-time option to enable/disable xwayland support, just use the wlroots build config: enable xwayland in Sway if it was enabled when building wlroots. I don't see any use-case for disabling xwayland in Sway when enabled in wlroots: Sway doesn't pull in any additional dependency (just pulls in dependencies that wlroots already needs). We have a config command to disable xwayland at runtime anyways. This makes it so xwayland behaves the same way as other features such as libinput backend and session support. This also reduces the build matrix (less combinations of build options). I think we originally introduced the xwayland option when we didn't have a good way to figure out the wlroots build config from the Sway build system.
83 lines
2.1 KiB
C
83 lines
2.1 KiB
C
#ifndef _SWAY_CRITERIA_H
|
|
#define _SWAY_CRITERIA_H
|
|
|
|
#define PCRE2_CODE_UNIT_WIDTH 8
|
|
#include <pcre2.h>
|
|
#include "config.h"
|
|
#include "list.h"
|
|
#include "tree/view.h"
|
|
|
|
enum criteria_type {
|
|
CT_COMMAND = 1 << 0,
|
|
CT_ASSIGN_OUTPUT = 1 << 1,
|
|
CT_ASSIGN_WORKSPACE = 1 << 2,
|
|
CT_ASSIGN_WORKSPACE_NUMBER = 1 << 3,
|
|
CT_NO_FOCUS = 1 << 4,
|
|
};
|
|
|
|
enum pattern_type {
|
|
PATTERN_PCRE2,
|
|
PATTERN_FOCUSED,
|
|
};
|
|
|
|
struct pattern {
|
|
enum pattern_type match_type;
|
|
pcre2_code *regex;
|
|
};
|
|
|
|
struct criteria {
|
|
enum criteria_type type;
|
|
char *raw; // entire criteria string (for logging)
|
|
char *cmdlist;
|
|
char *target; // workspace or output name for `assign` criteria
|
|
|
|
struct pattern *title;
|
|
struct pattern *shell;
|
|
struct pattern *app_id;
|
|
struct pattern *con_mark;
|
|
uint32_t con_id; // internal ID
|
|
#if WLR_HAS_XWAYLAND
|
|
struct pattern *class;
|
|
uint32_t id; // X11 window ID
|
|
struct pattern *instance;
|
|
struct pattern *window_role;
|
|
enum atom_name window_type;
|
|
#endif
|
|
bool all;
|
|
bool floating;
|
|
bool tiling;
|
|
char urgent; // 'l' for latest or 'o' for oldest
|
|
struct pattern *workspace;
|
|
pid_t pid;
|
|
};
|
|
|
|
bool criteria_is_empty(struct criteria *criteria);
|
|
bool criteria_is_equal(struct criteria *left, struct criteria *right);
|
|
|
|
bool criteria_already_exists(struct criteria *criteria);
|
|
|
|
void criteria_destroy(struct criteria *criteria);
|
|
|
|
/**
|
|
* Generate a criteria struct from a raw criteria string such as
|
|
* [class="foo" instance="bar"] (brackets inclusive).
|
|
*
|
|
* The error argument is expected to be an address of a null pointer. If an
|
|
* error is encountered, the function will return NULL and the pointer will be
|
|
* changed to point to the error string. This string should be freed afterwards.
|
|
*/
|
|
struct criteria *criteria_parse(char *raw, char **error);
|
|
|
|
/**
|
|
* Compile a list of criterias matching the given view.
|
|
*
|
|
* Criteria types can be bitwise ORed.
|
|
*/
|
|
list_t *criteria_for_view(struct sway_view *view, enum criteria_type types);
|
|
|
|
/**
|
|
* Compile a list of containers matching the given criteria.
|
|
*/
|
|
list_t *criteria_get_containers(struct criteria *criteria);
|
|
|
|
#endif
|