diff --git a/contrib/clickable-tags-using-wtype.patch b/contrib/clickable-tags-using-wtype.patch new file mode 100644 index 0000000..0906b3a --- /dev/null +++ b/contrib/clickable-tags-using-wtype.patch @@ -0,0 +1,77 @@ +From: Ben Collerson +Date: Sat, 1 Apr 2023 09:16:19 +1000 +Subject: [PATCH somebar] clickable tags using wtype + +--- + src/bar.cpp | 3 ++- + src/common.hpp | 2 ++ + src/config.def.hpp | 2 ++ + src/main.cpp | 11 +++++++++++ + 4 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/src/bar.cpp b/src/bar.cpp +index 507ce62..c2f2a27 100644 +--- a/src/bar.cpp ++++ b/src/bar.cpp +@@ -182,9 +182,10 @@ void Bar::click(Monitor* mon, int x, int, int btn) + } else if (x > _layoutCmp.x) { + control = ClkLayoutSymbol; + } else for (auto tag = _tags.size()-1; tag >= 0; tag--) { ++ // you may need logic to skip tags if they are hidden elsewhere. + if (x > _tags[tag].component.x) { + control = ClkTagBar; +- arg.ui = 1< tagNames = { + }; + + constexpr Button buttons[] = { ++ { ClkTagBar, BTN_LEFT, view, {0} }, ++ { ClkTagBar, BTN_RIGHT, tag, {0} }, + { ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} }, + }; +diff --git a/src/main.cpp b/src/main.cpp +index 6274959..14a6e4f 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -85,6 +85,17 @@ static int statusFifoFd {-1}; + static int statusFifoWriter {-1}; + static bool quitting {false}; + ++// update keybindings to match your dwl ++void view(Monitor& m, const Arg& arg) ++{ ++ int tag = arg.ui + 1; ++ system((std::string("wtype -M alt ") + std::to_string(tag) ).c_str()); ++} ++void tag(Monitor& m, const Arg& arg) ++{ ++ int tag = arg.ui + 1; ++ system((std::string("wtype -M alt -M shift ") + std::to_string(tag) ).c_str()); ++} + void spawn(Monitor&, const Arg& arg) + { + if (fork() == 0) { +-- +2.40.0 +