Compare commits
No commits in common. "9d432b045cc34a3523387aa409512dd41862262e" and "26c90ab7dca723651179251301aad65b5f748269" have entirely different histories.
9d432b045c
...
26c90ab7dc
|
@ -1,91 +0,0 @@
|
||||||
From: Ben Collerson <benc@benc.cc>
|
|
||||||
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 | 5 +++++
|
|
||||||
src/main.cpp | 15 +++++++++++++++
|
|
||||||
4 files changed, 24 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/bar.cpp b/src/bar.cpp
|
|
||||||
index af92f49..8b68759 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 (int 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<<tag;
|
|
||||||
+ arg.ui = tag;
|
|
||||||
argp = &arg;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
diff --git a/src/common.hpp b/src/common.hpp
|
|
||||||
index c905358..a386029 100644
|
|
||||||
--- a/src/common.hpp
|
|
||||||
+++ b/src/common.hpp
|
|
||||||
@@ -39,6 +39,8 @@ extern wl_compositor* compositor;
|
|
||||||
extern wl_shm* shm;
|
|
||||||
extern zwlr_layer_shell_v1* wlrLayerShell;
|
|
||||||
|
|
||||||
+void view(Monitor& m, const Arg& arg);
|
|
||||||
+void tag(Monitor& m, const Arg& arg);
|
|
||||||
void spawn(Monitor&, const Arg& arg);
|
|
||||||
void setCloexec(int fd);
|
|
||||||
[[noreturn]] void die(const char* why);
|
|
||||||
diff --git a/src/config.def.hpp b/src/config.def.hpp
|
|
||||||
index 40a8c95..de193ea 100644
|
|
||||||
--- a/src/config.def.hpp
|
|
||||||
+++ b/src/config.def.hpp
|
|
||||||
@@ -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[] = {
|
|
||||||
+ { 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..3c35b20 100644
|
|
||||||
--- a/src/main.cpp
|
|
||||||
+++ b/src/main.cpp
|
|
||||||
@@ -85,6 +85,21 @@ 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)
|
|
||||||
+{
|
|
||||||
+ char tag[2];
|
|
||||||
+ 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)
|
|
||||||
+{
|
|
||||||
+ char tag[2];
|
|
||||||
+ 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)
|
|
||||||
{
|
|
||||||
if (fork() == 0) {
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
From: Sam Nystrom <samuel.l.nystrom@gmail.com>
|
|
||||||
Date: Sat, 4 Mar 2023 17:38:12 -0500
|
|
||||||
Description: disable window title
|
|
||||||
diff --git a/src/bar.cpp b/src/bar.cpp
|
|
||||||
index 507ce62..1b6f771 100644
|
|
||||||
--- a/src/bar.cpp
|
|
||||||
+++ b/src/bar.cpp
|
|
||||||
@@ -227,7 +227,6 @@ void Bar::render()
|
|
||||||
renderTags();
|
|
||||||
setColorScheme(_selected ? colorActive : colorInactive);
|
|
||||||
renderComponent(_layoutCmp);
|
|
||||||
- renderComponent(_titleCmp);
|
|
||||||
renderStatus();
|
|
||||||
|
|
||||||
_painter = nullptr;
|
|
|
@ -193,7 +193,7 @@ index 0000000..390f5a1
|
||||||
+ </interface>
|
+ </interface>
|
||||||
+</protocol>
|
+</protocol>
|
||||||
diff --git a/src/common.hpp b/src/common.hpp
|
diff --git a/src/common.hpp b/src/common.hpp
|
||||||
index c905358..9b62a94 100644
|
index aed4480..12a3e2e 100644
|
||||||
--- a/src/common.hpp
|
--- a/src/common.hpp
|
||||||
+++ b/src/common.hpp
|
+++ b/src/common.hpp
|
||||||
@@ -10,6 +10,7 @@
|
@@ -10,6 +10,7 @@
|
||||||
|
@ -219,7 +219,7 @@ index c905358..9b62a94 100644
|
||||||
void spawn(Monitor&, const Arg& arg);
|
void spawn(Monitor&, const Arg& arg);
|
||||||
void setCloexec(int fd);
|
void setCloexec(int fd);
|
||||||
[[noreturn]] void die(const char* why);
|
[[noreturn]] void die(const char* why);
|
||||||
@@ -65,6 +73,7 @@ WL_DELETER(wl_output, wl_output_release_checked);
|
@@ -59,6 +67,7 @@ WL_DELETER(wl_output, wl_output_release);
|
||||||
WL_DELETER(wl_pointer, wl_pointer_release);
|
WL_DELETER(wl_pointer, wl_pointer_release);
|
||||||
WL_DELETER(wl_seat, wl_seat_release);
|
WL_DELETER(wl_seat, wl_seat_release);
|
||||||
WL_DELETER(wl_surface, wl_surface_destroy);
|
WL_DELETER(wl_surface, wl_surface_destroy);
|
||||||
|
@ -250,7 +250,7 @@ index 40a8c95..a9560cb 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..01be870 100644
|
index 6198d8b..9e7549a 100644
|
||||||
--- a/src/main.cpp
|
--- a/src/main.cpp
|
||||||
+++ b/src/main.cpp
|
+++ b/src/main.cpp
|
||||||
@@ -3,7 +3,6 @@
|
@@ -3,7 +3,6 @@
|
||||||
|
@ -403,8 +403,8 @@ index 6274959..01be870 100644
|
||||||
- wl_display_roundtrip(display); // wait for xdg_output names before we read stdin
|
- wl_display_roundtrip(display); // wait for xdg_output names before we read stdin
|
||||||
}
|
}
|
||||||
|
|
||||||
bool createFifo(std::string path)
|
void setupStatusFifo()
|
||||||
@@ -273,68 +345,6 @@ void setupStatusFifo()
|
@@ -259,66 +331,6 @@ void setupStatusFifo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,7 +435,6 @@ index 6274959..01be870 100644
|
||||||
- return;
|
- return;
|
||||||
- if (command == "title") {
|
- if (command == "title") {
|
||||||
- auto title = std::string {};
|
- auto title = std::string {};
|
||||||
- stream >> std::ws;
|
|
||||||
- std::getline(stream, title);
|
- std::getline(stream, title);
|
||||||
- mon->bar.setTitle(title);
|
- mon->bar.setTitle(title);
|
||||||
- } else if (command == "selmon") {
|
- } else if (command == "selmon") {
|
||||||
|
@ -462,7 +461,6 @@ index 6274959..01be870 100644
|
||||||
- mon->tags = tags;
|
- mon->tags = tags;
|
||||||
- } else if (command == "layout") {
|
- } else if (command == "layout") {
|
||||||
- auto layout = std::string {};
|
- auto layout = std::string {};
|
||||||
- stream >> std::ws;
|
|
||||||
- std::getline(stream, layout);
|
- std::getline(stream, layout);
|
||||||
- mon->bar.setLayout(layout);
|
- mon->bar.setLayout(layout);
|
||||||
- }
|
- }
|
||||||
|
@ -473,7 +471,7 @@ index 6274959..01be870 100644
|
||||||
const std::string prefixStatus = "status ";
|
const std::string prefixStatus = "status ";
|
||||||
const std::string prefixShow = "show ";
|
const std::string prefixShow = "show ";
|
||||||
const std::string prefixHide = "hide ";
|
const std::string prefixHide = "hide ";
|
||||||
@@ -409,6 +419,10 @@ void onGlobalAdd(void*, wl_registry* registry, uint32_t name, const char* interf
|
@@ -393,6 +405,10 @@ void onGlobalAdd(void*, wl_registry* registry, uint32_t name, const char* interf
|
||||||
xdg_wm_base_add_listener(xdgWmBase, &xdgWmBaseListener, nullptr);
|
xdg_wm_base_add_listener(xdgWmBase, &xdgWmBaseListener, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +482,7 @@ index 6274959..01be870 100644
|
||||||
if (wl_seat* wlSeat; reg.handle(wlSeat, wl_seat_interface, 7)) {
|
if (wl_seat* wlSeat; reg.handle(wlSeat, wl_seat_interface, 7)) {
|
||||||
auto& seat = seats.emplace_back(Seat {name, wl_unique_ptr<wl_seat> {wlSeat}});
|
auto& seat = seats.emplace_back(Seat {name, wl_unique_ptr<wl_seat> {wlSeat}});
|
||||||
wl_seat_add_listener(wlSeat, &seatListener, &seat);
|
wl_seat_add_listener(wlSeat, &seatListener, &seat);
|
||||||
@@ -522,10 +536,6 @@ int main(int argc, char* argv[])
|
@@ -494,10 +510,6 @@ int main(int argc, char* argv[])
|
||||||
.fd = displayFd,
|
.fd = displayFd,
|
||||||
.events = POLLIN,
|
.events = POLLIN,
|
||||||
});
|
});
|
||||||
|
@ -495,7 +493,7 @@ index 6274959..01be870 100644
|
||||||
if (fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK) < 0) {
|
if (fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK) < 0) {
|
||||||
diesys("fcntl F_SETFL");
|
diesys("fcntl F_SETFL");
|
||||||
}
|
}
|
||||||
@@ -550,8 +560,6 @@ int main(int argc, char* argv[])
|
@@ -522,8 +534,6 @@ int main(int argc, char* argv[])
|
||||||
ev.events = POLLIN;
|
ev.events = POLLIN;
|
||||||
waylandFlush();
|
waylandFlush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ void Bar::click(Monitor* mon, int x, int, int btn)
|
||||||
control = ClkWinTitle;
|
control = ClkWinTitle;
|
||||||
} else if (x > _layoutCmp.x) {
|
} else if (x > _layoutCmp.x) {
|
||||||
control = ClkLayoutSymbol;
|
control = ClkLayoutSymbol;
|
||||||
} else for (int tag = _tags.size()-1; tag >= 0; tag--) {
|
} else for (auto tag = _tags.size()-1; tag >= 0; tag--) {
|
||||||
if (x > _tags[tag].component.x) {
|
if (x > _tags[tag].component.x) {
|
||||||
control = ClkTagBar;
|
control = ClkTagBar;
|
||||||
arg.ui = 1<<tag;
|
arg.ui = 1<<tag;
|
||||||
|
|
Loading…
Reference in New Issue