URI: 
       dwm-throwtoothertag.diff - sites - public wiki contents of suckless.org
  HTML git clone git://git.suckless.org/sites
   DIR Log
   DIR Files
   DIR Refs
       ---
       dwm-throwtoothertag.diff (1624B)
       ---
            1 From bca2e4381ab60a54174bac3c15ba8776740274f3 Mon Sep 17 00:00:00 2001
            2 From: "Mike S. Stevenson" <mikess@disroot.org>
            3 Date: Tue, 8 Oct 2024 20:20:29 -0600
            4 Subject: [PATCH] tag({0}) tags the selected window to the previous tagset.
            5 
            6 In the same way that view({0}) toggles between tagsets.
            7 
            8 Likewise, tag({0}) shall be bound to mod+shift+tab, corresponding to the
            9 existing mod+tab binding.
           10 ---
           11  config.def.h |  1 +
           12  dwm.c        | 11 +++++++----
           13  2 files changed, 8 insertions(+), 4 deletions(-)
           14 
           15 diff --git a/config.def.h b/config.def.h
           16 index 9efa774..97606d7 100644
           17 --- a/config.def.h
           18 +++ b/config.def.h
           19 @@ -73,6 +73,7 @@ static const Key keys[] = {
           20          { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
           21          { MODKEY,                       XK_Return, zoom,           {0} },
           22          { MODKEY,                       XK_Tab,    view,           {0} },
           23 +        { MODKEY|ShiftMask,             XK_Tab,    tag,            {0} },
           24          { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
           25          { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
           26          { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
           27 diff --git a/dwm.c b/dwm.c
           28 index 2f2b871..a11aa99 100644
           29 --- a/dwm.c
           30 +++ b/dwm.c
           31 @@ -1669,11 +1669,14 @@ spawn(const Arg *arg)
           32  void
           33  tag(const Arg *arg)
           34  {
           35 -        if (selmon->sel && arg->ui & TAGMASK) {
           36 +        if(!selmon->sel)
           37 +                return;
           38 +        if (arg->ui & TAGMASK)
           39                  selmon->sel->tags = arg->ui & TAGMASK;
           40 -                focus(NULL);
           41 -                arrange(selmon);
           42 -        }
           43 +        else
           44 +                selmon->sel->tags = selmon->tagset[selmon->seltags ^ 1];
           45 +        focus(NULL);
           46 +        arrange(selmon);
           47  }
           48  
           49  void
           50 -- 
           51 2.46.2
           52