sticky.patch 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From f113cdc0b4cecceaaf28679489852ae61a1aa3f5 Mon Sep 17 00:00:00 2001
  2. From: Rutherther <rutherther@proton.me>
  3. Date: Fri, 19 Jul 2024 16:29:43 +0200
  4. Subject: [PATCH] sticky
  5. ---
  6. dwl.c | 27 +++++++++++++++++++++++++--
  7. 1 file changed, 25 insertions(+), 2 deletions(-)
  8. diff --git a/dwl.c b/dwl.c
  9. index 5bf995e..820f4af 100644
  10. --- a/dwl.c
  11. +++ b/dwl.c
  12. @@ -73,7 +73,7 @@
  13. #define MAX(A, B) ((A) > (B) ? (A) : (B))
  14. #define MIN(A, B) ((A) < (B) ? (A) : (B))
  15. #define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
  16. -#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
  17. +#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && (((C)->tags & (M)->tagset[(M)->seltags]) || C->issticky))
  18. #define LENGTH(X) (sizeof X / sizeof X[0])
  19. #define END(A) ((A) + LENGTH(A))
  20. #define TAGMASK ((1u << TAGCOUNT) - 1)
  21. @@ -139,7 +139,7 @@ typedef struct {
  22. #endif
  23. unsigned int bw;
  24. uint32_t tags;
  25. - int isfloating, isurgent, isfullscreen;
  26. + int isfloating, isurgent, isfullscreen, issticky;
  27. uint32_t resize; /* configure serial of a pending resize */
  28. } Client;
  29. @@ -326,6 +326,7 @@ static void setcursor(struct wl_listener *listener, void *data);
  30. static void setcursorshape(struct wl_listener *listener, void *data);
  31. static void setfloating(Client *c, int floating);
  32. static void setfullscreen(Client *c, int fullscreen);
  33. +static void setsticky(Client *c, int sticky);
  34. static void setgamma(struct wl_listener *listener, void *data);
  35. static void setlayout(const Arg *arg);
  36. static void setmfact(const Arg *arg);
  37. @@ -339,6 +340,7 @@ static void tag(const Arg *arg);
  38. static void tagmon(const Arg *arg);
  39. static void tile(Monitor *m);
  40. static void togglefloating(const Arg *arg);
  41. +static void togglesticky(const Arg *arg);
  42. static void togglefullscreen(const Arg *arg);
  43. static void toggletag(const Arg *arg);
  44. static void toggleview(const Arg *arg);
  45. @@ -2351,6 +2353,17 @@ setgamma(struct wl_listener *listener, void *data)
  46. wlr_output_schedule_frame(m->wlr_output);
  47. }
  48. +void
  49. +setsticky(Client *c, int sticky)
  50. +{
  51. + if(sticky && !c->issticky) {
  52. + c->issticky = 1;
  53. + } else if(!sticky && c->issticky) {
  54. + c->issticky = 0;
  55. + arrange(c->mon);
  56. + }
  57. +}
  58. +
  59. void
  60. setlayout(const Arg *arg)
  61. {
  62. @@ -2738,6 +2751,16 @@ togglefullscreen(const Arg *arg)
  63. setfullscreen(sel, !sel->isfullscreen);
  64. }
  65. +void
  66. +togglesticky(const Arg *arg)
  67. +{
  68. + Client *c = focustop(selmon);
  69. + if(!c)
  70. + return;
  71. +
  72. + setsticky(c, !c->issticky);
  73. +}
  74. +
  75. void
  76. toggletag(const Arg *arg)
  77. {
  78. --
  79. 2.45.2