From 34ac3849c3b5bec5ce72ba31803d487e78dd300e Mon Sep 17 00:00:00 2001 From: korei999 Date: Wed, 29 Nov 2023 22:37:25 +0200 Subject: [PATCH] inhibit idle if fullscreen client is focused --- config.def.h | 2 +- dwl.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index bf41336..d3c9121 100644 --- a/config.def.h +++ b/config.def.h @@ -231,7 +231,7 @@ static const Key keys[] = { { SUPER, Key_s, setlayout, { .v = &layouts[1] } }, { SUPER, Key_v, setlayout, { .v = &layouts[2] } }, { SUPER, Key_grave, togglefloating, { 0 } }, - // { SUPER | SHIFT, Key_s, togglesticky, { 0 } }, + { SUPER | SHIFT, Key_s, togglesticky, { 0 } }, { SUPER, Key_f, togglefullscreen, { 0 } }, { SUPER, Key_g, zoom, { 0 } }, { SUPER, Key_Tab, view, { 0 } }, diff --git a/dwl.c b/dwl.c index 9603b66..42411bf 100644 --- a/dwl.c +++ b/dwl.c @@ -68,7 +68,7 @@ #define MAX(A, B) ((A) > (B) ? (A) : (B)) #define MIN(A, B) ((A) < (B) ? (A) : (B)) #define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS) -#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) +#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags] || (C)->issticky)) #define LENGTH(X) (sizeof X / sizeof X[0]) #define END(A) ((A) + LENGTH(A)) #define TAGMASK ((1u << TAGCOUNT) - 1) @@ -131,7 +131,7 @@ typedef struct { #endif unsigned int bw; uint32_t tags; - int isfloating, isurgent, isfullscreen; + int isfloating, isurgent, isfullscreen, issticky; uint32_t resize; /* configure serial of a pending resize */ xkb_layout_index_t layout_idx; } Client; @@ -342,6 +342,7 @@ static void tile(Monitor *m); static void vertile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglesticky(const Arg *arg); static void togglefullscreen(const Arg *arg); static void toggleview(const Arg *arg); static void unlocksession(struct wl_listener *listener, void *data); @@ -666,6 +667,8 @@ void checkidleinhibitor(struct wlr_surface *exclude) { int inhibited = 0, unused_lx, unused_ly; + Client *c = focustop(selmon, 0); + struct wlr_idle_inhibitor_v1 *inhibitor; wl_list_for_each(inhibitor, &idle_inhibit_mgr->inhibitors, link) { struct wlr_surface *surface = wlr_surface_get_root_surface(inhibitor->surface); @@ -677,6 +680,9 @@ checkidleinhibitor(struct wlr_surface *exclude) } } + if (c && c->isfullscreen) + inhibited = 1; + wlr_idle_notifier_v1_set_inhibited(idle_notifier, inhibited); } @@ -2871,6 +2877,16 @@ togglefloating(const Arg *arg) setfloating(sel, !sel->isfloating); } +void +togglesticky(const Arg *arg) +{ + Client *sel = focustop(selmon, 0); + if (!sel) + return; + sel->issticky = !sel->issticky; + arrange(selmon); +} + void togglefullscreen(const Arg *arg) {