Closed mahor1221 closed 1 year ago
I've just found https://github.com/bakkeby/dwm-commented. Awesome! I'll try to implement this feature myself but any help would still be appreciated.
I have a working solution for auto-hiding a fullscreen scratchpad when a new client is spawned - that way the next time you toggle the scratchpad it will (still) be in fullscreen.
Based on your wording though it sounds like you want the scratchpad to go away whenever it loses focus. Possible to do for sure, but it would also be super annoying I recon unless you were to isolate the behaviour to a specific client. For example it would be impossible to view two different scratchpads side-by-side. That said if this is something that may add value in a workflow then I'd add that as a different toggle.
Ah, I apologize for my incorrect wording. The following behavior you've described is exactly what I'm looking for:
I have a working solution for auto-hiding a fullscreen scratchpad when a new client is spawned - that way the next time you toggle the scratchpad it will (still) be in fullscreen.
diff --git a/dwm.c b/dwm.c
index 66a380b..7497c65 100644
--- a/dwm.c
+++ b/dwm.c
@@ -4373,13 +4373,24 @@ unfocus(Client *c, int setfocus, Client *nextfocus)
selmon->pertag->prevclient[selmon->pertag->curtag] = c;
#endif // SWAPFOCUS_PATCH
#if LOSEFULLSCREEN_PATCH
- if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating)
+ if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating) {
+ #if RENAMED_SCRATCHPADS_PATCH && RENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
+ #if FAKEFULLSCREEN_CLIENT_PATCH
+ if (c->scratchkey != 0 && c->fakefullscreen != 1)
+ togglescratch(&((Arg) {.v = (const char*[]){ &c->scratchkey, NULL } }));
+ #else
+ if (c->scratchkey != 0)
+ togglescratch(&((Arg) {.v = (const char*[]){ &c->scratchkey, NULL } }));
+ #endif // FAKEFULLSCREEN_CLIENT_PATCH
+ else
+ #endif // RENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen != 1)
setfullscreen(c, 0);
#else
setfullscreen(c, 0);
#endif // #if FAKEFULLSCREEN_CLIENT_PATCH
+ }
#endif // LOSEFULLSCREEN_PATCH
grabbuttons(c, 0);
#if !BAR_FLEXWINTITLE_PATCH
The above is a change that I just now pushed for dwm-flexipatch.
The basic idea is that if the conditions are right, i.e
then we just make a call to togglescratch
to hide it. What is complicated here is passing the scratchkey
as an argument to the function.
Thank you so much! You have saved me days of work, and now my desktop is finally perfect.
I use a combination of fullscreen, floating and non-floating scratchpads. I modified your changes a little to better fit my use case:
#if LOSEFULLSCREEN_PATCH
#if RENAMED_SCRATCHPADS_PATCH && RENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
if (c->scratchkey != 0 && c->isfloating && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating) {
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen != 1)
togglescratch(&((Arg) {.v = (const char*[]){ &c->scratchkey, NULL } }));
#else
togglescratch(&((Arg) {.v = (const char*[]){ &c->scratchkey, NULL } }));
#endif // FAKEFULLSCREEN_CLIENT_PATCH
} else
#endif // #if RENAMED_SCRATCHPADS_PATCH && RENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon && nextfocus && !nextfocus->isfloating) {
#if FAKEFULLSCREEN_CLIENT_PATCH
if (c->fakefullscreen != 1)
setfullscreen(c, 0);
#else
setfullscreen(c, 0);
#endif // #if FAKEFULLSCREEN_CLIENT_PATCH
}
#endif // #if LOSEFULLSCREEN_PATCH
Would it be possible to auto hide scratchpads when, for example, a new window is spawned? It's a combination of
LOSEFULLSCREEN_PATCH
andRENAMED_SCRATCHPADS_AUTO_HIDE_PATCH
. I attempted to implement it by adding a new branch to theunfocus
functions, but it didn't work.