aboutsummaryrefslogtreecommitdiffstats
path: root/simple_scratchpad.c
diff options
context:
space:
mode:
Diffstat (limited to 'simple_scratchpad.c')
-rw-r--r--simple_scratchpad.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/simple_scratchpad.c b/simple_scratchpad.c
index cd62d83..271e72e 100644
--- a/simple_scratchpad.c
+++ b/simple_scratchpad.c
@@ -12,10 +12,31 @@
/* */
/* ************************************************************************** */
+void draw_scratchpad(void) {
+ Client *c;
+ Monitor *m = selmon;
+
+ if (scratchpad_visible[scratchpad_sel]) {
+ wl_list_for_each(c, &scratchpad_clients[scratchpad_sel], link_temp) {
+ c->mon = m;
+ c->tags = m->tagset[m->seltags];
+ arrange(m);
+ focusclient(c, 1);
+ }
+ } else {
+ wl_list_for_each(c, &scratchpad_clients[scratchpad_sel], link_temp) {
+ c->tags = 0;
+ focusclient(focustop(m), 1);
+ arrange(m);
+ }
+ }
+}
+
void
addscratchpad(const Arg *arg)
{
Client *cc, *c = focustop(selmon);
+ Monitor *m = selmon;
if (!c)
return;
@@ -29,47 +50,42 @@ addscratchpad(const Arg *arg)
if (!c->isfloating) {
setfloating(c, 1);
}
+ scratchpad_visible[scratchpad_sel] = 0;
+ draw_scratchpad();
wl_list_insert(&scratchpad_clients[scratchpad_sel], &c->link_temp);
+ c->tags = 0;
+ arrange(m);
+ focusclient(focustop(m), 1);
+ arrange(m);
}
void
togglescratchpad(const Arg *arg)
{
- Client *c;
- Monitor *m = selmon;
-
scratchpad_visible[scratchpad_sel] = !scratchpad_visible[scratchpad_sel];
- if (scratchpad_visible[scratchpad_sel]) {
- wl_list_for_each(c, &scratchpad_clients[scratchpad_sel], link_temp) {
- c->mon = m;
- c->tags = m->tagset[m->seltags];
- arrange(m);
- focusclient(c, 1);
- }
- } else {
- wl_list_for_each(c, &scratchpad_clients[scratchpad_sel], link_temp) {
- c->tags = 0;
- focusclient(focustop(m), 1);
- arrange(m);
- }
- }
+ draw_scratchpad();
}
void
removescratchpad(const Arg *arg)
{
Client *sc, *c = focustop(selmon);
+ Monitor *m = selmon;
if (!c)
return;
for (int i = 0; i < SCRATCHPAD_COUNT; i++) {
/* Check if c is in scratchpad_clients */
wl_list_for_each(sc, &scratchpad_clients[i], link_temp) {
if (sc == c) {
- wl_list_remove(&c->link_temp);
+ wl_list_remove(&sc->link_temp);
+ setfloating(sc, 0);
+ arrange(m);
+ focusclient(sc, 1);
return;
}
}
}
+
}
void