Merge pull request #448 from Rexcrazy804/xray-lockscreen

feat: support transparent wlr session lock
This commit is contained in:
DreamMaoMao
2025-11-29 16:23:42 +08:00
committed by GitHub
3 changed files with 12 additions and 2 deletions

View File

@@ -339,6 +339,7 @@ typedef struct {
int adaptive_sync; int adaptive_sync;
int allow_tearing; int allow_tearing;
int allow_shortcuts_inhibit; int allow_shortcuts_inhibit;
int transparent_wlr_lock;
struct xkb_rule_names xkb_rules; struct xkb_rule_names xkb_rules;
@@ -1221,6 +1222,8 @@ void parse_option(Config *config, char *key, char *value) {
config->allow_tearing = atoi(value); config->allow_tearing = atoi(value);
} else if (strcmp(key, "allow_shortcuts_inhibit") == 0) { } else if (strcmp(key, "allow_shortcuts_inhibit") == 0) {
config->allow_shortcuts_inhibit = atoi(value); config->allow_shortcuts_inhibit = atoi(value);
} else if (strcmp(key, "transparent_wlr_lock") == 0) {
config->transparent_wlr_lock = atoi(value);
} else if (strcmp(key, "no_border_when_single") == 0) { } else if (strcmp(key, "no_border_when_single") == 0) {
config->no_border_when_single = atoi(value); config->no_border_when_single = atoi(value);
} else if (strcmp(key, "no_radius_when_single") == 0) { } else if (strcmp(key, "no_radius_when_single") == 0) {
@@ -2671,6 +2674,7 @@ void override_config(void) {
adaptive_sync = CLAMP_INT(config.adaptive_sync, 0, 1); adaptive_sync = CLAMP_INT(config.adaptive_sync, 0, 1);
allow_tearing = CLAMP_INT(config.allow_tearing, 0, 2); allow_tearing = CLAMP_INT(config.allow_tearing, 0, 2);
allow_shortcuts_inhibit = CLAMP_INT(config.allow_shortcuts_inhibit, 0, 1); allow_shortcuts_inhibit = CLAMP_INT(config.allow_shortcuts_inhibit, 0, 1);
transparent_wlr_lock = CLAMP_INT(config.transparent_wlr_lock, 0, 1);
axis_bind_apply_timeout = axis_bind_apply_timeout =
CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000); CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000);
focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1); focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1);
@@ -2849,6 +2853,7 @@ void set_value_default() {
config.adaptive_sync = adaptive_sync; config.adaptive_sync = adaptive_sync;
config.allow_tearing = allow_tearing; config.allow_tearing = allow_tearing;
config.allow_shortcuts_inhibit = allow_shortcuts_inhibit; config.allow_shortcuts_inhibit = allow_shortcuts_inhibit;
config.transparent_wlr_lock = transparent_wlr_lock;
config.no_border_when_single = no_border_when_single; config.no_border_when_single = no_border_when_single;
config.no_radius_when_single = no_radius_when_single; config.no_radius_when_single = no_radius_when_single;
config.snap_distance = snap_distance; config.snap_distance = snap_distance;

View File

@@ -103,6 +103,7 @@ int warpcursor = 1; /* Warp cursor to focused client */
int xwayland_persistence = 1; /* xwayland persistence */ int xwayland_persistence = 1; /* xwayland persistence */
int syncobj_enable = 0; int syncobj_enable = 0;
int adaptive_sync = 0; int adaptive_sync = 0;
int transparent_wlr_lock = 0;
double drag_refresh_interval = 30.0; double drag_refresh_interval = 30.0;
int allow_tearing = TEARING_DISABLED; int allow_tearing = TEARING_DISABLED;
int allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE; int allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;

View File

@@ -3036,7 +3036,9 @@ void destroylock(SessionLock *lock, int unlock) {
if ((locked = !unlock)) if ((locked = !unlock))
goto destroy; goto destroy;
wlr_scene_node_set_enabled(&locked_bg->node, false); if (locked_bg->node.enabled) {
wlr_scene_node_set_enabled(&locked_bg->node, false);
}
focusclient(focustop(selmon), 0); focusclient(focustop(selmon), 0);
motionnotify(0, NULL, 0, 0, 0, 0); motionnotify(0, NULL, 0, 0, 0, 0);
@@ -3574,7 +3576,9 @@ void pending_kill_client(Client *c) {
void locksession(struct wl_listener *listener, void *data) { void locksession(struct wl_listener *listener, void *data) {
struct wlr_session_lock_v1 *session_lock = data; struct wlr_session_lock_v1 *session_lock = data;
SessionLock *lock; SessionLock *lock;
wlr_scene_node_set_enabled(&locked_bg->node, true); if (!transparent_wlr_lock) {
wlr_scene_node_set_enabled(&locked_bg->node, true);
}
if (cur_lock) { if (cur_lock) {
wlr_session_lock_v1_destroy(session_lock); wlr_session_lock_v1_destroy(session_lock);
return; return;