sites

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

dwm-switchallmonitortags-6.3.diff (1909B)


      1 From 31b89fe119b4a0298da98891aa37b134facb6311 Mon Sep 17 00:00:00 2001
      2 From: yasumori <ysmr@protonmail.com>
      3 Date: Fri, 27 May 2022 00:21:27 -0400
      4 Subject: [PATCH] This patch allows the user to switch the selected tag of all
      5  monitors.
      6 
      7 For example, if monitor A is currently on tag 1, and monitor B is on tag 2,
      8 and the user presses MODKEY+SUPERKEY+3, both monitor A and B will switch to
      9 tag 3 (without changing the currently selected monitor).
     10 ---
     11  config.def.h |  2 ++
     12  dwm.c        | 13 +++++++++++++
     13  2 files changed, 15 insertions(+)
     14 
     15 diff --git a/config.def.h b/config.def.h
     16 index a2ac963..3f504ab 100644
     17 --- a/config.def.h
     18 +++ b/config.def.h
     19 @@ -46,8 +46,10 @@ static const Layout layouts[] = {
     20  
     21  /* key definitions */
     22  #define MODKEY Mod1Mask
     23 +#define SUPERKEY Mod4Mask
     24  #define TAGKEYS(KEY,TAG) \
     25  	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     26 +	{ MODKEY|SUPERKEY,              KEY,      viewall,        {.ui = 1 << TAG} }, \
     27  	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     28  	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     29  	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     30 diff --git a/dwm.c b/dwm.c
     31 index 5646a5c..28736ee 100644
     32 --- a/dwm.c
     33 +++ b/dwm.c
     34 @@ -228,6 +228,7 @@ static void updatetitle(Client *c);
     35  static void updatewindowtype(Client *c);
     36  static void updatewmhints(Client *c);
     37  static void view(const Arg *arg);
     38 +static void viewall(const Arg *arg);
     39  static Client *wintoclient(Window w);
     40  static Monitor *wintomon(Window w);
     41  static int xerror(Display *dpy, XErrorEvent *ee);
     42 @@ -2054,6 +2055,18 @@ view(const Arg *arg)
     43  	arrange(selmon);
     44  }
     45  
     46 +void
     47 +viewall(const Arg *arg)
     48 +{
     49 +	Monitor *m;
     50 +
     51 +	for (m = mons; m; m = m->next) {
     52 +		m->tagset[m->seltags] = arg->ui;
     53 +		arrange(m);
     54 +	}
     55 +	focus(NULL);
     56 +}
     57 +
     58  Client *
     59  wintoclient(Window w)
     60  {
     61 -- 
     62 2.36.1
     63