clickable tags patch improvement
This commit is contained in:
parent
e1f8c63064
commit
8c52d4704c
1 changed files with 28 additions and 14 deletions
|
@ -5,18 +5,18 @@ Subject: [PATCH somebar] clickable tags using wtype
|
||||||
---
|
---
|
||||||
src/bar.cpp | 3 ++-
|
src/bar.cpp | 3 ++-
|
||||||
src/common.hpp | 2 ++
|
src/common.hpp | 2 ++
|
||||||
src/config.def.hpp | 2 ++
|
src/config.def.hpp | 5 +++++
|
||||||
src/main.cpp | 11 +++++++++++
|
src/main.cpp | 15 +++++++++++++++
|
||||||
4 files changed, 17 insertions(+), 1 deletion(-)
|
4 files changed, 24 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/bar.cpp b/src/bar.cpp
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
index 507ce62..c2f2a27 100644
|
index af92f49..8b68759 100644
|
||||||
--- a/src/bar.cpp
|
--- a/src/bar.cpp
|
||||||
+++ b/src/bar.cpp
|
+++ b/src/bar.cpp
|
||||||
@@ -182,9 +182,10 @@ void Bar::click(Monitor* mon, int x, int, int btn)
|
@@ -182,9 +182,10 @@ void Bar::click(Monitor* mon, int x, int, int btn)
|
||||||
} else if (x > _layoutCmp.x) {
|
} else if (x > _layoutCmp.x) {
|
||||||
control = ClkLayoutSymbol;
|
control = ClkLayoutSymbol;
|
||||||
} else for (auto tag = _tags.size()-1; tag >= 0; tag--) {
|
} else for (int tag = _tags.size()-1; tag >= 0; tag--) {
|
||||||
+ // you may need logic to skip tags if they are hidden elsewhere.
|
+ // you may need logic to skip tags if they are hidden elsewhere.
|
||||||
if (x > _tags[tag].component.x) {
|
if (x > _tags[tag].component.x) {
|
||||||
control = ClkTagBar;
|
control = ClkTagBar;
|
||||||
|
@ -39,10 +39,20 @@ index c905358..a386029 100644
|
||||||
void setCloexec(int fd);
|
void setCloexec(int fd);
|
||||||
[[noreturn]] void die(const char* why);
|
[[noreturn]] void die(const char* why);
|
||||||
diff --git a/src/config.def.hpp b/src/config.def.hpp
|
diff --git a/src/config.def.hpp b/src/config.def.hpp
|
||||||
index 40a8c95..2bdf507 100644
|
index 40a8c95..de193ea 100644
|
||||||
--- a/src/config.def.hpp
|
--- a/src/config.def.hpp
|
||||||
+++ b/src/config.def.hpp
|
+++ b/src/config.def.hpp
|
||||||
@@ -23,5 +23,7 @@ static std::vector<std::string> tagNames = {
|
@@ -4,6 +4,9 @@
|
||||||
|
#pragma once
|
||||||
|
#include "common.hpp"
|
||||||
|
|
||||||
|
+#define WTYPE "/usr/bin/wtype"
|
||||||
|
+#define MODKEY "alt"
|
||||||
|
+
|
||||||
|
constexpr bool topbar = true;
|
||||||
|
|
||||||
|
constexpr int paddingX = 10;
|
||||||
|
@@ -23,5 +26,7 @@ static std::vector<std::string> tagNames = {
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr Button buttons[] = {
|
constexpr Button buttons[] = {
|
||||||
|
@ -51,27 +61,31 @@ index 40a8c95..2bdf507 100644
|
||||||
{ ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} },
|
{ ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} },
|
||||||
};
|
};
|
||||||
diff --git a/src/main.cpp b/src/main.cpp
|
diff --git a/src/main.cpp b/src/main.cpp
|
||||||
index 6274959..14a6e4f 100644
|
index 6274959..3c35b20 100644
|
||||||
--- a/src/main.cpp
|
--- a/src/main.cpp
|
||||||
+++ b/src/main.cpp
|
+++ b/src/main.cpp
|
||||||
@@ -85,6 +85,17 @@ static int statusFifoFd {-1};
|
@@ -85,6 +85,21 @@ static int statusFifoFd {-1};
|
||||||
static int statusFifoWriter {-1};
|
static int statusFifoWriter {-1};
|
||||||
static bool quitting {false};
|
static bool quitting {false};
|
||||||
|
|
||||||
+// update keybindings to match your dwl
|
+// update keybindings to match your dwl
|
||||||
+void view(Monitor& m, const Arg& arg)
|
+void view(Monitor& m, const Arg& arg)
|
||||||
+{
|
+{
|
||||||
+ int tag = arg.ui + 1;
|
+ char tag[2];
|
||||||
+ system((std::string("wtype -M alt ") + std::to_string(tag) ).c_str());
|
+ snprintf(tag, 2, "%i", arg.ui + 1);
|
||||||
|
+ if(fork() == 0)
|
||||||
|
+ execl(WTYPE, "wtype", "-M", MODKEY, tag, (char*)NULL);
|
||||||
+}
|
+}
|
||||||
+void tag(Monitor& m, const Arg& arg)
|
+void tag(Monitor& m, const Arg& arg)
|
||||||
+{
|
+{
|
||||||
+ int tag = arg.ui + 1;
|
+ char tag[2];
|
||||||
+ system((std::string("wtype -M alt -M shift ") + std::to_string(tag) ).c_str());
|
+ snprintf(tag, 2, "%i", arg.ui + 1);
|
||||||
|
+ if(fork() == 0)
|
||||||
|
+ execl(WTYPE, "wtype", "-M", MODKEY, "-M", "shift", tag, (char*)NULL);
|
||||||
+}
|
+}
|
||||||
void spawn(Monitor&, const Arg& arg)
|
void spawn(Monitor&, const Arg& arg)
|
||||||
{
|
{
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
--
|
--
|
||||||
2.40.0
|
2.40.1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue