mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2026-09-20 14:22:59 +00:00
simple_scratchpad: update
- Updated to current main
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
### Description
|
||||
|
||||
# simple_scratchpad — A very simple scratchpad utility.
|
||||
# simple_scratchpad - A very simple scratchpad utility.
|
||||
|
||||
Adds functions to add, toggle and remove clients to/from scratchpad client lists.
|
||||

|
||||
|
||||
|
||||
---
|
||||
|
||||
1. **addscratchpad**
|
||||
@@ -18,12 +18,12 @@ Adds functions to add, toggle and remove clients to/from scratchpad client lists
|
||||
|
||||
4. **setscratchpad**
|
||||
- Sets current scratchpad number
|
||||
|
||||
|
||||
|
||||
### Download
|
||||
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/simple_scratchpad)
|
||||
- [scratchpad-wlroots-next-d41ecb7.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/simple_scratchpad/simple_scratchpad-wlroots-next-d41ecb7.patch)
|
||||
- [scratchpad-v0.8.patch](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/simple_scratchpad/simple_scratchpad-v0.8.patch)
|
||||
- [git branch](https://codeberg.org/julmajustus/dwl/src/branch/simple_scratchpad-0.9)
|
||||
- [main-d16036e](./simple_scratchpad-d16036e.patch)
|
||||
- [scratchpad-v0.8.patch](./simple_scratchpad-v0.8.patch)
|
||||
|
||||
### Authors
|
||||
- [julmajustus](https://codeberg.org/julmajustus)
|
||||
|
||||
+54
-39
@@ -1,21 +1,35 @@
|
||||
From be4f7488eac6ea502e0e9d1cc5595e01d97cb345 Mon Sep 17 00:00:00 2001
|
||||
From da5b4335fab5ca589ac6a9e569aa99aaa091eae9 Mon Sep 17 00:00:00 2001
|
||||
From: julmajustus <julmajustus@tutanota.com>
|
||||
Date: Thu, 21 May 2026 00:28:41 +0300
|
||||
Subject: [PATCH] simple_scratchpad: Spring update scratchpad V2
|
||||
Date: Sun, 20 Sep 2026 02:23:44 +0300
|
||||
Subject: [PATCH] simple_scratchpad d16036e refactor
|
||||
|
||||
- Added support for multiple scratchpads
|
||||
---
|
||||
Makefile | 3 +-
|
||||
config.def.h | 7 ++++
|
||||
dwl.c | 43 +++++++++++++++++++++--
|
||||
simple_scratchpad.c | 85 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 133 insertions(+), 2 deletions(-)
|
||||
create mode 100644 simple_scratchpad.c
|
||||
dwl.c | 40 +++++++++++++++++++-
|
||||
simple_scratchpad.h | 89 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 136 insertions(+), 3 deletions(-)
|
||||
create mode 100644 simple_scratchpad.h
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 8304245..4592dff 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -20,7 +20,8 @@ all: dwl
|
||||
dwl: dwl.c client.h config.h ime.h util.h config.mk cursor-shape-v1-protocol.h \
|
||||
ext-image-copy-capture-v1-protocol.h \
|
||||
pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \
|
||||
- wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h
|
||||
+ wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \
|
||||
+ simple_scratchpad.h
|
||||
$(CC) dwl.c $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
|
||||
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8a6eda0..a527e09 100644
|
||||
index 13c5322..acd44d9 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -14,6 +14,7 @@ static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
@@ -15,6 +15,7 @@ static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||
|
||||
@@ -35,27 +49,27 @@ index 8a6eda0..a527e09 100644
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
@@ -144,6 +148,9 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_comma, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_period, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_1, setscratchpad, {.i = 0} },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_2, setscratchpad, {.i = 1} },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_3, setscratchpad, {.i = 2} },
|
||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||
TAGKEYS( XKB_KEY_1, 0),
|
||||
TAGKEYS( XKB_KEY_2, 1),
|
||||
TAGKEYS( XKB_KEY_3, 2),
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 8101ffa..1c858a8 100644
|
||||
index 4cfd0fd..91a7628 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -143,6 +143,7 @@ typedef struct {
|
||||
@@ -159,6 +159,7 @@ typedef struct {
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
+ struct wl_list link_temp;
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
@@ -244,6 +245,7 @@ typedef struct {
|
||||
@@ -260,6 +261,7 @@ typedef struct {
|
||||
} SessionLock;
|
||||
|
||||
/* function declarations */
|
||||
@@ -63,7 +77,7 @@ index 8101ffa..1c858a8 100644
|
||||
static void applybounds(Client *c, struct wlr_box *bbox);
|
||||
static void applyrules(Client *c);
|
||||
static void arrange(Monitor *m);
|
||||
@@ -318,6 +320,7 @@ static void printstatus(void);
|
||||
@@ -335,6 +337,7 @@ static void printstatus(void);
|
||||
static void powermgrsetmode(struct wl_listener *listener, void *data);
|
||||
static void quit(const Arg *arg);
|
||||
static void rendermon(struct wl_listener *listener, void *data);
|
||||
@@ -71,7 +85,7 @@ index 8101ffa..1c858a8 100644
|
||||
static void requestdecorationmode(struct wl_listener *listener, void *data);
|
||||
static void requeststartdrag(struct wl_listener *listener, void *data);
|
||||
static void requestmonstate(struct wl_listener *listener, void *data);
|
||||
@@ -331,6 +334,7 @@ static void setlayout(const Arg *arg);
|
||||
@@ -348,6 +351,7 @@ static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||
static void setpsel(struct wl_listener *listener, void *data);
|
||||
@@ -79,7 +93,7 @@ index 8101ffa..1c858a8 100644
|
||||
static void setsel(struct wl_listener *listener, void *data);
|
||||
static void setup(void);
|
||||
static void spawn(const Arg *arg);
|
||||
@@ -340,6 +344,7 @@ static void tagmon(const Arg *arg);
|
||||
@@ -357,6 +361,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
@@ -87,19 +101,16 @@ index 8101ffa..1c858a8 100644
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -459,6 +464,11 @@ static struct wlr_xwayland *xwayland;
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
@@ -484,6 +489,8 @@ static struct wlr_xwayland *xwayland;
|
||||
|
||||
+static struct wl_list scratchpad_clients[SCRATCHPAD_COUNT];
|
||||
+static int scratchpad_visible[SCRATCHPAD_COUNT];
|
||||
+static int scratchpad_sel = 0;
|
||||
+#include "simple_scratchpad.c"
|
||||
#include "ime.h"
|
||||
|
||||
+#include "simple_scratchpad.h"
|
||||
+
|
||||
/* function implementations */
|
||||
void
|
||||
applybounds(Client *c, struct wlr_box *bbox)
|
||||
@@ -1332,10 +1342,21 @@ void
|
||||
@@ -1427,10 +1434,21 @@ void
|
||||
destroynotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
/* Called when the xdg_toplevel is destroyed. */
|
||||
@@ -122,7 +133,7 @@ index 8101ffa..1c858a8 100644
|
||||
#ifdef XWAYLAND
|
||||
if (c->type != XDGShell) {
|
||||
wl_list_remove(&c->activate.link);
|
||||
@@ -2337,11 +2358,24 @@ setcursorshape(struct wl_listener *listener, void *data)
|
||||
@@ -2490,11 +2508,24 @@ setcursorshape(struct wl_listener *listener, void *data)
|
||||
void
|
||||
setfloating(Client *c, int floating)
|
||||
{
|
||||
@@ -148,7 +159,7 @@ index 8101ffa..1c858a8 100644
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
|
||||
(p && p->isfullscreen) ? LyrFS
|
||||
: c->isfloating ? LyrFloat : LyrTile]);
|
||||
@@ -2561,6 +2595,11 @@ setup(void)
|
||||
@@ -2714,6 +2745,11 @@ setup(void)
|
||||
*/
|
||||
wl_list_init(&clients);
|
||||
wl_list_init(&fstack);
|
||||
@@ -160,26 +171,30 @@ index 8101ffa..1c858a8 100644
|
||||
|
||||
xdg_shell = wlr_xdg_shell_create(dpy, 6);
|
||||
wl_signal_add(&xdg_shell->events.new_toplevel, &new_xdg_toplevel);
|
||||
diff --git a/simple_scratchpad.c b/simple_scratchpad.c
|
||||
diff --git a/simple_scratchpad.h b/simple_scratchpad.h
|
||||
new file mode 100644
|
||||
index 0000000..0e23ddd
|
||||
index 0000000..36a564e
|
||||
--- /dev/null
|
||||
+++ b/simple_scratchpad.c
|
||||
@@ -0,0 +1,85 @@
|
||||
+++ b/simple_scratchpad.h
|
||||
@@ -0,0 +1,89 @@
|
||||
+/* ************************************************************************** */
|
||||
+/* @@@ @@@@@@@@ */
|
||||
+/* @@@ @@@@@@@@@@ */
|
||||
+/* @@! @@! @@@@ */
|
||||
+/* !@! !@! @!@!@ */
|
||||
+/* simple_scratchpad.c @!! @!@ @! !@! */
|
||||
+/* simple_scratchpad.h @!! @!@ @! !@! */
|
||||
+/* !!! !@!!! !!! */
|
||||
+/* By: julmajustus <julmajustus@tutanota.com> !!: !!:! !!! */
|
||||
+/* ::! :!: !:! */
|
||||
+/* Created: 2024/12/19 19:35:02 by jmakkone :: ::::::: :: */
|
||||
+/* Updated: 2026/05/20 23:56:35 by julmajustus : : : : : : */
|
||||
+/* Updated: 2026/09/20 02:14:02 by julmajustus : : : : : : */
|
||||
+/* */
|
||||
+/* ************************************************************************** */
|
||||
+
|
||||
+static struct wl_list scratchpad_clients[SCRATCHPAD_COUNT];
|
||||
+static int scratchpad_visible[SCRATCHPAD_COUNT];
|
||||
+static int scratchpad_sel = 0;
|
||||
+
|
||||
+void
|
||||
+addscratchpad(const Arg *arg)
|
||||
+{
|
||||
@@ -252,5 +267,5 @@ index 0000000..0e23ddd
|
||||
+ scratchpad_sel = idx;
|
||||
+}
|
||||
--
|
||||
2.53.0
|
||||
2.55.0
|
||||
|
||||
Reference in New Issue
Block a user