From 2955ef2e06506b96a45fd7c0a430934c41b2d150 Mon Sep 17 00:00:00 2001 From: augety Date: Sat, 20 Jul 2024 21:37:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(dwm):=20=E6=B7=BB=E5=8A=A0=20viewontag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dwm/config.def.h | 1 + dwm/dwm.c | 2 ++ dwm/patches/dwm-r1522-viewontag.diff | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 dwm/patches/dwm-r1522-viewontag.diff diff --git a/dwm/config.def.h b/dwm/config.def.h index 24bacd7..6059f23 100644 --- a/dwm/config.def.h +++ b/dwm/config.def.h @@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ +static const Bool viewontag = True; /* Switch view on tag switch */ static const char *fonts[] = { "Hack Nerd Font Mono:size=12", "Noto Color Emoji:size=12" diff --git a/dwm/dwm.c b/dwm/dwm.c index f7b07e4..310f28d 100644 --- a/dwm/dwm.c +++ b/dwm/dwm.c @@ -1958,6 +1958,8 @@ tag(const Arg *arg) selmon->sel->tags = arg->ui & TAGMASK; focus(NULL); arrange(selmon); + if(viewontag) + view(arg); } } diff --git a/dwm/patches/dwm-r1522-viewontag.diff b/dwm/patches/dwm-r1522-viewontag.diff new file mode 100644 index 0000000..6f87cd5 --- /dev/null +++ b/dwm/patches/dwm-r1522-viewontag.diff @@ -0,0 +1,23 @@ +diff -r 0d86faf4b05c config.def.h +--- a/config.def.h Sun Jul 25 09:58:25 2010 +0100 ++++ b/config.def.h Sun Jul 25 16:32:38 2010 +0200 +@@ -12,6 +12,7 @@ + static const unsigned int snap = 32; /* snap pixel */ + static const Bool showbar = True; /* False means no bar */ + static const Bool topbar = True; /* False means bottom bar */ ++static const Bool viewontag = True; /* Switch view on tag switch */ + + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +diff -r 0d86faf4b05c dwm.c +--- a/dwm.c Sun Jul 25 09:58:25 2010 +0100 ++++ b/dwm.c Sun Jul 25 16:32:38 2010 +0200 +@@ -1613,6 +1613,8 @@ + if(selmon->sel && arg->ui & TAGMASK) { + selmon->sel->tags = arg->ui & TAGMASK; + arrange(selmon); ++ if(viewontag) ++ view(arg); + } + } +