sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-tagothermonitor-6.2.diff (2308B)


      1 From 9d9ffce06c0ac0903917e19a7e70a78813e12e2f Mon Sep 17 00:00:00 2001
      2 From: Dennis Witzig <dennis@wtzg.de>
      3 Date: Mon, 1 Jun 2020 23:02:45 +0200
      4 Subject: [PATCH] Add ability to move a window to specific tag on the next or
      5  previous monitor
      6 
      7 ---
      8  config.def.h |  4 +++-
      9  dwm.c        | 33 +++++++++++++++++++++++++++++++++
     10  2 files changed, 36 insertions(+), 1 deletion(-)
     11 
     12 diff --git a/config.def.h b/config.def.h
     13 index 1c0b587..580382e 100644
     14 --- a/config.def.h
     15 +++ b/config.def.h
     16 @@ -49,7 +49,9 @@ static const Layout layouts[] = {
     17  	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     18  	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     19  	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     20 -	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     21 +	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} }, \
     22 +	{ MODKEY|Mod4Mask,              KEY,      tagnextmon,     {.ui = 1 << TAG} }, \
     23 +	{ MODKEY|Mod4Mask|ShiftMask,    KEY,      tagprevmon,     {.ui = 1 << TAG} },
     24  
     25  /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     26  #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
     27 diff --git a/dwm.c b/dwm.c
     28 index 4465af1..d3ace89 100644
     29 --- a/dwm.c
     30 +++ b/dwm.c
     31 @@ -208,6 +208,9 @@ static void sigchld(int unused);
     32  static void spawn(const Arg *arg);
     33  static void tag(const Arg *arg);
     34  static void tagmon(const Arg *arg);
     35 +static void tagnextmon(const Arg *arg);
     36 +static void tagprevmon(const Arg *arg);
     37 +static void tagothermon(const Arg *arg, int dir);
     38  static void tile(Monitor *);
     39  static void togglebar(const Arg *arg);
     40  static void togglefloating(const Arg *arg);
     41 @@ -1670,6 +1673,36 @@ tagmon(const Arg *arg)
     42  	sendmon(selmon->sel, dirtomon(arg->i));
     43  }
     44  
     45 +void
     46 +tagnextmon(const Arg *arg)
     47 +{
     48 +	tagothermon(arg, 1);
     49 +}
     50 +
     51 +void
     52 +tagprevmon(const Arg *arg)
     53 +{
     54 +	tagothermon(arg, -1);
     55 +}
     56 +
     57 +void
     58 +tagothermon(const Arg *arg, int dir)
     59 +{
     60 +	Client *sel;
     61 +	Monitor *newmon;
     62 +
     63 +	if (!selmon->sel || !mons->next)
     64 +		return;
     65 +	sel = selmon->sel;
     66 +	newmon = dirtomon(dir);
     67 +	sendmon(sel, newmon);
     68 +	if (arg->ui & TAGMASK) {
     69 +		sel->tags = arg->ui & TAGMASK;
     70 +		focus(NULL);
     71 +		arrange(newmon);
     72 +	}
     73 +}
     74 +
     75  void
     76  tile(Monitor *m)
     77  {
     78 -- 
     79 2.26.2
     80