summaryrefslogtreecommitdiff
path: root/patch/combo.c
diff options
context:
space:
mode:
authorBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
committerBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
commit69262b01ced79c2d776fab9b889926d1816a1e7a (patch)
treef304cd6fa8734e83a7772d07dc9b484781565155 /patch/combo.c
Added DWM
Diffstat (limited to 'patch/combo.c')
-rw-r--r--patch/combo.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/patch/combo.c b/patch/combo.c
new file mode 100644
index 0000000..058b1f9
--- /dev/null
+++ b/patch/combo.c
@@ -0,0 +1,50 @@
+static int combo = 0;
+
+#if !BAR_HOLDBAR_PATCH
+void
+keyrelease(XEvent *e)
+{
+ combo = 0;
+}
+#endif // !BAR_HOLDBAR_PATCH
+
+void
+combotag(const Arg *arg)
+{
+ if (selmon->sel && arg->ui & TAGMASK) {
+ #if SWITCHTAG_PATCH
+ if (selmon->sel->switchtag)
+ selmon->sel->switchtag = 0;
+ #endif // SWITCHTAG_PATCH
+ if (combo) {
+ selmon->sel->tags |= arg->ui & TAGMASK;
+ } else {
+ combo = 1;
+ selmon->sel->tags = arg->ui & TAGMASK;
+ }
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+comboview(const Arg *arg)
+{
+ unsigned newtags = arg->ui & TAGMASK;
+ if (combo) {
+ selmon->tagset[selmon->seltags] |= newtags;
+ } else {
+ selmon->seltags ^= 1; /*toggle tagset*/
+ combo = 1;
+ if (newtags) {
+ #if PERTAG_PATCH
+ pertagview(&((Arg) { .ui = newtags }));
+ #else
+ selmon->tagset[selmon->seltags] = newtags;
+ #endif // PERTAG_PATCH
+ }
+ }
+ focus(NULL);
+ arrange(selmon);
+}
+