Compare commits
28 Commits
MMA_GOOD_2
...
master
Author | SHA1 | Date | |
---|---|---|---|
ecc8c14619 | |||
566bd7ce96 | |||
70a11edea4 | |||
|
98ad3780b8 | ||
|
7e91b3a514 | ||
0222481887 | |||
|
6572b98d69 | ||
|
7433a1ff99 | ||
6e2dd755d0 | |||
7b6e33ff43 | |||
|
8c52d4704c | ||
|
e1f8c63064 | ||
ea42a8bc8e | |||
|
b069830640 | ||
|
af73bc3996 | ||
|
9cdbf5f56f | ||
81d8afd365 | |||
|
624e92927b | ||
|
ea9dbfe022 | ||
|
7d8c2f8b8c | ||
|
5bb988bc80 | ||
|
c36d1f2957 | ||
|
83f59945a6 | ||
|
c076d343fc | ||
|
fb2c8e5f42 | ||
|
6e464bf35d | ||
41b2b04121 | |||
fe3654cde3 |
19
CHANGELOG.md
Normal file
19
CHANGELOG.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
## [1.0.3] - 2022-12-11
|
||||||
|
### Added
|
||||||
|
- New patches: markup-in-status-messages, show-status-on-selected-monitor (benc)
|
||||||
|
### Fixed
|
||||||
|
- Fixed crash when an output disappears
|
||||||
|
|
||||||
|
## [1.0.2] - 2022-11-27
|
||||||
|
### Fixed
|
||||||
|
- Fixed bug where hidden bar could not be shown anymore
|
||||||
|
|
||||||
|
## [1.0.1] - 2022-11-25
|
||||||
|
### Added
|
||||||
|
- Manpage
|
||||||
|
- New patches: indicator-size-props, hide-vacant-tags, colorless-status (medanisjbara)
|
||||||
|
### Fixed
|
||||||
|
- Remove spaces from title and layout symbol (benc)
|
||||||
|
|
||||||
|
## [1.0.0] - 2022-04-23
|
||||||
|
Initial release
|
91
contrib/clickable-tags-using-wtype.patch
Normal file
91
contrib/clickable-tags-using-wtype.patch
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
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
|
||||||
|
|
15
contrib/disable-window-title.patch
Normal file
15
contrib/disable-window-title.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
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;
|
34
contrib/dwm-like-tag-indicator.patch
Normal file
34
contrib/dwm-like-tag-indicator.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From: Henrique Possatto <henriquempossatto@gmail.com>
|
||||||
|
Date: Mon, 26 Dec 2022 18:01:35 -0300
|
||||||
|
Subject: [PATCH somebar] patch to show square tag indicator like dwm
|
||||||
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
|
index 507ce62..4fda8b0 100644
|
||||||
|
--- a/src/bar.cpp
|
||||||
|
+++ b/src/bar.cpp
|
||||||
|
@@ -245,12 +245,17 @@ void Bar::renderTags()
|
||||||
|
tag.state & TagState::Active ? colorActive : colorInactive,
|
||||||
|
tag.state & TagState::Urgent);
|
||||||
|
renderComponent(tag.component);
|
||||||
|
- auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
||||||
|
- for (auto ind = 0; ind < indicators; ind++) {
|
||||||
|
- auto w = ind == tag.focusedClient ? 7 : 1;
|
||||||
|
- cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
||||||
|
- cairo_rel_line_to(_painter, w, 0);
|
||||||
|
- cairo_close_path(_painter);
|
||||||
|
+
|
||||||
|
+ if(!tag.numClients)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ int s = barfont.height / 9;
|
||||||
|
+ int w = barfont.height / 6 + 2;
|
||||||
|
+ if (tag.focusedClient != -1) {
|
||||||
|
+ cairo_rectangle(_painter, tag.component.x + s, s, w, w);
|
||||||
|
+ cairo_fill(_painter);
|
||||||
|
+ } else {
|
||||||
|
+ cairo_rectangle(_painter, (double)(tag.component.x + s) + 0.5, (double)(s) + 0.5, w, w);
|
||||||
|
cairo_set_line_width(_painter, 1);
|
||||||
|
cairo_stroke(_painter);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.39.0
|
||||||
|
|
@ -5,30 +5,50 @@ diff --git a/src/bar.cpp b/src/bar.cpp
|
|||||||
index fab5a8f..38e7b5f 100644
|
index fab5a8f..38e7b5f 100644
|
||||||
--- a/src/bar.cpp
|
--- a/src/bar.cpp
|
||||||
+++ b/src/bar.cpp
|
+++ b/src/bar.cpp
|
||||||
@@ -240,12 +240,22 @@ void Bar::render()
|
@@ -240,13 +240,36 @@ void Bar::render()
|
||||||
|
|
||||||
void Bar::renderTags()
|
void Bar::renderTags()
|
||||||
{
|
{
|
||||||
+ bool focused;
|
+ // Check if all tags are active (Mod+0)
|
||||||
|
+ bool allActive = true;
|
||||||
for (auto &tag : _tags) {
|
for (auto &tag : _tags) {
|
||||||
- setColorScheme(
|
+ if (tag.state & TagState::Active){
|
||||||
- tag.state & TagState::Active ? colorActive : colorInactive,
|
+ if (!allActive){
|
||||||
- tag.state & TagState::Urgent);
|
+ allActive = true;
|
||||||
- renderComponent(tag.component);
|
+ break;
|
||||||
+ focused = false;
|
|
||||||
auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
|
||||||
+ for (auto ind = 0; ind < indicators; ind++) {
|
|
||||||
+ if (tag.focusedClient){
|
|
||||||
+ focused = true;
|
|
||||||
+ }
|
+ }
|
||||||
|
+ allActive = false;
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if (tag.state & TagState::Active || focused){
|
+ bool renderThis;
|
||||||
+ setColorScheme(
|
+ for (auto &tag : _tags) {
|
||||||
+ tag.state & TagState::Active ? colorActive : colorInactive,
|
+ renderThis = false;
|
||||||
+ tag.state & TagState::Urgent);
|
setColorScheme(
|
||||||
+ renderComponent(tag.component);
|
tag.state & TagState::Active ? colorActive : colorInactive,
|
||||||
+ }
|
tag.state & TagState::Urgent);
|
||||||
|
- renderComponent(tag.component);
|
||||||
|
+ // Reder active tag if it's the only one active
|
||||||
|
+ if (!allActive && tag.state & TagState::Active)
|
||||||
|
+ renderThis = true;
|
||||||
|
auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
||||||
for (auto ind = 0; ind < indicators; ind++) {
|
for (auto ind = 0; ind < indicators; ind++) {
|
||||||
|
+ // render tags having indicators
|
||||||
|
+ if (tag.focusedClient == -1)
|
||||||
|
+ renderThis = true;
|
||||||
|
+ // render tags having the focused client
|
||||||
|
+ if (tag.focusedClient == 0){
|
||||||
|
+ renderThis = true;
|
||||||
|
+ }
|
||||||
auto w = ind == tag.focusedClient ? 7 : 1;
|
auto w = ind == tag.focusedClient ? 7 : 1;
|
||||||
cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
||||||
|
cairo_rel_line_to(_painter, w, 0);
|
||||||
|
@@ -254,6 +277,8 @@ void Bar::renderTags()
|
||||||
|
cairo_set_line_width(_painter, 1);
|
||||||
|
cairo_stroke(_painter);
|
||||||
|
}
|
||||||
|
+ if (renderThis)
|
||||||
|
+ renderComponent(tag.component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -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 aed4480..12a3e2e 100644
|
index c905358..9b62a94 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 aed4480..12a3e2e 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);
|
||||||
@@ -59,6 +67,7 @@ WL_DELETER(wl_output, wl_output_release);
|
@@ -65,6 +73,7 @@ WL_DELETER(wl_output, wl_output_release_checked);
|
||||||
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 6198d8b..9e7549a 100644
|
index 6274959..01be870 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 6198d8b..9e7549a 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
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupStatusFifo()
|
bool createFifo(std::string path)
|
||||||
@@ -259,66 +331,6 @@ void setupStatusFifo()
|
@@ -273,68 +345,6 @@ void setupStatusFifo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +435,8 @@ index 6198d8b..9e7549a 100644
|
|||||||
- return;
|
- return;
|
||||||
- if (command == "title") {
|
- if (command == "title") {
|
||||||
- auto title = std::string {};
|
- auto title = std::string {};
|
||||||
- std::getline(stream, title);
|
- stream >> std::ws;
|
||||||
|
- std::getline(stream, title);
|
||||||
- mon->bar.setTitle(title);
|
- mon->bar.setTitle(title);
|
||||||
- } else if (command == "selmon") {
|
- } else if (command == "selmon") {
|
||||||
- uint32_t selected;
|
- uint32_t selected;
|
||||||
@ -461,6 +462,7 @@ index 6198d8b..9e7549a 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);
|
||||||
- }
|
- }
|
||||||
@ -471,7 +473,7 @@ index 6198d8b..9e7549a 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 ";
|
||||||
@@ -393,6 +405,10 @@ void onGlobalAdd(void*, wl_registry* registry, uint32_t name, const char* interf
|
@@ -409,6 +419,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;
|
||||||
}
|
}
|
||||||
@ -482,7 +484,7 @@ index 6198d8b..9e7549a 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);
|
||||||
@@ -494,10 +510,6 @@ int main(int argc, char* argv[])
|
@@ -522,10 +536,6 @@ int main(int argc, char* argv[])
|
||||||
.fd = displayFd,
|
.fd = displayFd,
|
||||||
.events = POLLIN,
|
.events = POLLIN,
|
||||||
});
|
});
|
||||||
@ -493,7 +495,7 @@ index 6198d8b..9e7549a 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");
|
||||||
}
|
}
|
||||||
@@ -522,8 +534,6 @@ int main(int argc, char* argv[])
|
@@ -550,8 +560,6 @@ int main(int argc, char* argv[])
|
||||||
ev.events = POLLIN;
|
ev.events = POLLIN;
|
||||||
waylandFlush();
|
waylandFlush();
|
||||||
}
|
}
|
||||||
|
65
contrib/markup-in-status-messages.patch
Normal file
65
contrib/markup-in-status-messages.patch
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
From: Ben Collerson <benc@benc.cc>
|
||||||
|
Date: Tue, 29 Nov 2022 11:29:15 +1000
|
||||||
|
Subject: [PATCH] markup in status messages
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Allows pango markup to be used in status messages which allow colours to
|
||||||
|
be used to highlight parts of status bar messages. eg:
|
||||||
|
|
||||||
|
battery: full <span color="#ffff00">🔇0</span> Tue 11-20 20:10
|
||||||
|
---
|
||||||
|
src/bar.cpp | 16 +++++++++++++++-
|
||||||
|
src/bar.hpp | 1 +
|
||||||
|
2 files changed, 16 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
|
index 507ce62..a96c547 100644
|
||||||
|
--- a/src/bar.cpp
|
||||||
|
+++ b/src/bar.cpp
|
||||||
|
@@ -81,6 +81,11 @@ void BarComponent::setText(const std::string& text)
|
||||||
|
pango_layout_set_text(pangoLayout.get(), _text->c_str(), _text->size());
|
||||||
|
}
|
||||||
|
|
||||||
|
+void BarComponent::setAttributes(PangoAttrList *attrs)
|
||||||
|
+{
|
||||||
|
+ pango_layout_set_attributes(pangoLayout.get(), attrs);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Bar::Bar()
|
||||||
|
{
|
||||||
|
_pangoContext.reset(pango_font_map_create_context(pango_cairo_font_map_get_default()));
|
||||||
|
@@ -156,7 +161,16 @@ void Bar::setTitle(const std::string& title)
|
||||||
|
}
|
||||||
|
void Bar::setStatus(const std::string& status)
|
||||||
|
{
|
||||||
|
- _statusCmp.setText(status);
|
||||||
|
+ char *buf;
|
||||||
|
+ GError *error = NULL;
|
||||||
|
+ PangoAttrList *attrs;
|
||||||
|
+ if (pango_parse_markup(status.c_str(), -1, 0, &attrs, &buf, NULL, &error)) {
|
||||||
|
+ _statusCmp.setText(buf);
|
||||||
|
+ _statusCmp.setAttributes(attrs);
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ _statusCmp.setText(error->message);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bar::invalidate()
|
||||||
|
diff --git a/src/bar.hpp b/src/bar.hpp
|
||||||
|
index 176a1bc..dfc2043 100644
|
||||||
|
--- a/src/bar.hpp
|
||||||
|
+++ b/src/bar.hpp
|
||||||
|
@@ -17,6 +17,7 @@ public:
|
||||||
|
explicit BarComponent(wl_unique_ptr<PangoLayout> layout);
|
||||||
|
int width() const;
|
||||||
|
void setText(const std::string& text);
|
||||||
|
+ void setAttributes(PangoAttrList *attrs);
|
||||||
|
wl_unique_ptr<PangoLayout> pangoLayout;
|
||||||
|
int x {0};
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.38.1
|
||||||
|
|
43
contrib/show-status-on-selected-monitor.patch
Normal file
43
contrib/show-status-on-selected-monitor.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 1ca4603b79e888980fb46d5dc6aa0d6f8afa2b3c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ben Collerson <benc@benc.cc>
|
||||||
|
Date: Mon, 28 Nov 2022 13:22:16 +1000
|
||||||
|
Subject: [PATCH] show status on selected monitor
|
||||||
|
|
||||||
|
---
|
||||||
|
src/bar.cpp | 7 ++++++-
|
||||||
|
src/main.cpp | 1 +
|
||||||
|
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
|
index 507ce62..f962927 100644
|
||||||
|
--- a/src/bar.cpp
|
||||||
|
+++ b/src/bar.cpp
|
||||||
|
@@ -156,7 +156,12 @@ void Bar::setTitle(const std::string& title)
|
||||||
|
}
|
||||||
|
void Bar::setStatus(const std::string& status)
|
||||||
|
{
|
||||||
|
- _statusCmp.setText(status);
|
||||||
|
+ if (_selected) {
|
||||||
|
+ _statusCmp.setText(status);
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ _statusCmp.setText("");
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bar::invalidate()
|
||||||
|
diff --git a/src/main.cpp b/src/main.cpp
|
||||||
|
index 6274959..c6fd401 100644
|
||||||
|
--- a/src/main.cpp
|
||||||
|
+++ b/src/main.cpp
|
||||||
|
@@ -307,6 +307,7 @@ static void handleStdin(const std::string& line)
|
||||||
|
uint32_t selected;
|
||||||
|
stream >> selected;
|
||||||
|
mon->bar.setSelected(selected);
|
||||||
|
+ mon->bar.setStatus(lastStatus);
|
||||||
|
if (selected) {
|
||||||
|
selmon = &*mon;
|
||||||
|
} else if (selmon == &*mon) {
|
||||||
|
--
|
||||||
|
2.38.1
|
||||||
|
|
181
protocols/dwl-ipc-unstable-v2.xml
Normal file
181
protocols/dwl-ipc-unstable-v2.xml
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This is largely ripped from somebar's ipc patchset; just with some personal modifications.
|
||||||
|
I would probably just submit raphi's patchset but I don't think that would be polite.
|
||||||
|
-->
|
||||||
|
<protocol name="dwl_ipc_unstable_v2">
|
||||||
|
<description summary="inter-proccess-communication about dwl's state">
|
||||||
|
This protocol allows clients to update and get updates from dwl.
|
||||||
|
|
||||||
|
Warning! The protocol described in this file is experimental and
|
||||||
|
backward incompatible changes may be made. Backward compatible
|
||||||
|
changes may be added together with the corresponding interface
|
||||||
|
version bump.
|
||||||
|
Backward incompatible changes are done by bumping the version
|
||||||
|
number in the protocol and interface names and resetting the
|
||||||
|
interface version. Once the protocol is to be declared stable,
|
||||||
|
the 'z' prefix and the version number in the protocol and
|
||||||
|
interface names are removed and the interface version number is
|
||||||
|
reset.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<interface name="zdwl_ipc_manager_v2" version="2">
|
||||||
|
<description summary="manage dwl state">
|
||||||
|
This interface is exposed as a global in wl_registry.
|
||||||
|
|
||||||
|
Clients can use this interface to get a dwl_ipc_output.
|
||||||
|
After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
|
||||||
|
The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="release" type="destructor">
|
||||||
|
<description summary="release dwl_ipc_manager">
|
||||||
|
Indicates that the client will not the dwl_ipc_manager object anymore.
|
||||||
|
Objects created through this instance are not affected.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_output">
|
||||||
|
<description summary="get a dwl_ipc_outout for a wl_output">
|
||||||
|
Get a dwl_ipc_outout for the specified wl_output.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="zdwl_ipc_output_v2"/>
|
||||||
|
<arg name="output" type="object" interface="wl_output"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="tags">
|
||||||
|
<description summary="Announces tag amount">
|
||||||
|
This event is sent after binding.
|
||||||
|
A roundtrip after binding guarantees the client recieved all tags.
|
||||||
|
</description>
|
||||||
|
<arg name="amount" type="uint"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="layout">
|
||||||
|
<description summary="Announces a layout">
|
||||||
|
This event is sent after binding.
|
||||||
|
A roundtrip after binding guarantees the client recieved all layouts.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="zdwl_ipc_output_v2" version="2">
|
||||||
|
<description summary="control dwl output">
|
||||||
|
Observe and control a dwl output.
|
||||||
|
|
||||||
|
Events are double-buffered:
|
||||||
|
Clients should cache events and redraw when a dwl_ipc_output.frame event is sent.
|
||||||
|
|
||||||
|
Request are not double-buffered:
|
||||||
|
The compositor will update immediately upon request.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<enum name="tag_state">
|
||||||
|
<entry name="none" value="0" summary="no state"/>
|
||||||
|
<entry name="active" value="1" summary="tag is active"/>
|
||||||
|
<entry name="urgent" value="2" summary="tag has at least one urgent client"/>
|
||||||
|
</enum>
|
||||||
|
|
||||||
|
<request name="release" type="destructor">
|
||||||
|
<description summary="release dwl_ipc_outout">
|
||||||
|
Indicates to that the client no longer needs this dwl_ipc_output.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="toggle_visibility">
|
||||||
|
<description summary="Toggle client visibilty">
|
||||||
|
Indicates the client should hide or show themselves.
|
||||||
|
If the client is visible then hide, if hidden then show.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="active">
|
||||||
|
<description summary="Update the selected output.">
|
||||||
|
Indicates if the output is active. Zero is invalid, nonzero is valid.
|
||||||
|
</description>
|
||||||
|
<arg name="active" type="uint"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="tag">
|
||||||
|
<description summary="Update the state of a tag.">
|
||||||
|
Indicates that a tag has been updated.
|
||||||
|
</description>
|
||||||
|
<arg name="tag" type="uint" summary="Index of the tag"/>
|
||||||
|
<arg name="state" type="uint" enum="tag_state" summary="The state of the tag."/>
|
||||||
|
<arg name="clients" type="uint" summary="The number of clients in the tag."/>
|
||||||
|
<arg name="focused" type="uint" summary="If there is a focused client. Nonzero being valid, zero being invalid."/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="layout">
|
||||||
|
<description summary="Update the layout.">
|
||||||
|
Indicates a new layout is selected.
|
||||||
|
</description>
|
||||||
|
<arg name="layout" type="uint" summary="Index of the layout."/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="title">
|
||||||
|
<description summary="Update the title.">
|
||||||
|
Indicates the title has changed.
|
||||||
|
</description>
|
||||||
|
<arg name="title" type="string" summary="The new title name."/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="appid" since="1">
|
||||||
|
<description summary="Update the appid.">
|
||||||
|
Indicates the appid has changed.
|
||||||
|
</description>
|
||||||
|
<arg name="appid" type="string" summary="The new appid."/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="layout_symbol" since="1">
|
||||||
|
<description summary="Update the current layout symbol">
|
||||||
|
Indicates the layout has changed. Since layout symbols are dynamic.
|
||||||
|
As opposed to the zdwl_ipc_manager.layout event, this should take precendence when displaying.
|
||||||
|
You can ignore the zdwl_ipc_output.layout event.
|
||||||
|
</description>
|
||||||
|
<arg name="layout" type="string" summary="The new layout"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="frame">
|
||||||
|
<description summary="The update sequence is done.">
|
||||||
|
Indicates that a sequence of status updates have finished and the client should redraw.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<request name="set_tags">
|
||||||
|
<description summary="Set the active tags of this output"/>
|
||||||
|
<arg name="tagmask" type="uint" summary="bitmask of the tags that should be set."/>
|
||||||
|
<arg name="toggle_tagset" type="uint" summary="toggle the selected tagset, zero for invalid, nonzero for valid."/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_client_tags">
|
||||||
|
<description summary="Set the tags of the focused client.">
|
||||||
|
The tags are updated as follows:
|
||||||
|
new_tags = (current_tags AND and_tags) XOR xor_tags
|
||||||
|
</description>
|
||||||
|
<arg name="and_tags" type="uint"/>
|
||||||
|
<arg name="xor_tags" type="uint"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_layout">
|
||||||
|
<description summary="Set the layout of this output"/>
|
||||||
|
<arg name="index" type="uint" summary="index of a layout recieved by dwl_ipc_manager.layout"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<!-- Version 2 -->
|
||||||
|
<event name="fullscreen" since="2">
|
||||||
|
<description summary="Update fullscreen status">
|
||||||
|
Indicates if the selected client on this output is fullscreen.
|
||||||
|
</description>
|
||||||
|
<arg name="is_fullscreen" type="uint" summary="If the selected client is fullscreen. Nonzero is valid, zero invalid"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="floating" since="2">
|
||||||
|
<description summary="Update the floating status">
|
||||||
|
Indicates if the selected client on this output is floating.
|
||||||
|
</description>
|
||||||
|
<arg name="is_floating" type="uint" summary="If the selected client is floating. Nonzero is valid, zero invalid"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
@ -15,7 +15,7 @@ wayland_xmls = [
|
|||||||
wl_protocol_dir + '/stable/xdg-shell/xdg-shell.xml',
|
wl_protocol_dir + '/stable/xdg-shell/xdg-shell.xml',
|
||||||
wl_protocol_dir + '/unstable/xdg-output/xdg-output-unstable-v1.xml',
|
wl_protocol_dir + '/unstable/xdg-output/xdg-output-unstable-v1.xml',
|
||||||
'wlr-layer-shell-unstable-v1.xml',
|
'wlr-layer-shell-unstable-v1.xml',
|
||||||
'net-tapesoftware-dwl-wm-unstable-v1.xml',
|
'dwl-ipc-unstable-v2.xml',
|
||||||
]
|
]
|
||||||
wayland_sources = [
|
wayland_sources = [
|
||||||
wayland_scanner_code.process(wayland_xmls),
|
wayland_scanner_code.process(wayland_xmls),
|
||||||
|
81
src/bar.cpp
81
src/bar.cpp
@ -87,8 +87,9 @@ Bar::Bar()
|
|||||||
if (!_pangoContext) {
|
if (!_pangoContext) {
|
||||||
die("pango_font_map_create_context");
|
die("pango_font_map_create_context");
|
||||||
}
|
}
|
||||||
for (const auto& tagName : tagNames) {
|
//for (const auto& tagName : tagNames) {
|
||||||
_tags.push_back({ TagState::None, 0, 0, createComponent(tagName) });
|
for (int ti = 1; ti < 10; ti++ ) {
|
||||||
|
_tags.push_back({ TagState::None, 0, 0, createComponent(std::to_string(ti)) });
|
||||||
}
|
}
|
||||||
_layoutCmp = createComponent();
|
_layoutCmp = createComponent();
|
||||||
_titleCmp = createComponent();
|
_titleCmp = createComponent();
|
||||||
@ -142,6 +143,16 @@ void Bar::setTag(int tag, int state, int numClients, int focusedClient)
|
|||||||
t.focusedClient = focusedClient;
|
t.focusedClient = focusedClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Bar::getSelectedTagNumClients()
|
||||||
|
{
|
||||||
|
for (auto &tag : _tags) {
|
||||||
|
if (tag.state == TagState::Active) {
|
||||||
|
return tag.numClients;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Bar::setSelected(bool selected)
|
void Bar::setSelected(bool selected)
|
||||||
{
|
{
|
||||||
_selected = selected;
|
_selected = selected;
|
||||||
@ -181,7 +192,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 (auto tag = _tags.size()-1; tag >= 0; tag--) {
|
} else for (int 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;
|
||||||
@ -200,7 +211,7 @@ void Bar::click(Monitor* mon, int x, int, int btn)
|
|||||||
void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height)
|
void Bar::layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
zwlr_layer_surface_v1_ack_configure(_layerSurface.get(), serial);
|
zwlr_layer_surface_v1_ack_configure(_layerSurface.get(), serial);
|
||||||
if (width == _bufs->width && height == _bufs->height) {
|
if (_bufs && width == _bufs->width && height == _bufs->height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_bufs.emplace(width, height, WL_SHM_FORMAT_XRGB8888);
|
_bufs.emplace(width, height, WL_SHM_FORMAT_XRGB8888);
|
||||||
@ -241,22 +252,52 @@ void Bar::render()
|
|||||||
void Bar::renderTags()
|
void Bar::renderTags()
|
||||||
{
|
{
|
||||||
for (auto &tag : _tags) {
|
for (auto &tag : _tags) {
|
||||||
setColorScheme(
|
setTagColorScheme(tag);
|
||||||
tag.state & TagState::Active ? colorActive : colorInactive,
|
|
||||||
tag.state & TagState::Urgent);
|
|
||||||
renderComponent(tag.component);
|
renderComponent(tag.component);
|
||||||
auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
||||||
for (auto ind = 0; ind < indicators; ind++) {
|
if (showIndicators == 1) {
|
||||||
auto w = ind == tag.focusedClient ? 7 : 1;
|
renderSingleIndicator(tag, indicators);
|
||||||
cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
} else if (showIndicators == 2) {
|
||||||
cairo_rel_line_to(_painter, w, 0);
|
renderMultiIndicators(tag, indicators);
|
||||||
cairo_close_path(_painter);
|
|
||||||
cairo_set_line_width(_painter, 1);
|
|
||||||
cairo_stroke(_painter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bar::renderMultiIndicators(const Tag& t, int inds)
|
||||||
|
{
|
||||||
|
for (auto ind = 0; ind < inds; ind++) {
|
||||||
|
auto w = ind == t.focusedClient ? 7 : 3;
|
||||||
|
cairo_move_to(_painter, t.component.x, ind*2+0.5);
|
||||||
|
cairo_rel_line_to(_painter, w, 0);
|
||||||
|
cairo_close_path(_painter);
|
||||||
|
cairo_set_line_width(_painter, 3);
|
||||||
|
cairo_stroke(_painter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bar::renderSingleIndicator(const Tag& t, int inds)
|
||||||
|
{
|
||||||
|
if (inds > 0) {
|
||||||
|
auto w = 4;
|
||||||
|
setColorScheme(colorIndicator);
|
||||||
|
cairo_move_to(_painter, t.component.x+1, 1);
|
||||||
|
cairo_rel_line_to(_painter, w, 0);
|
||||||
|
cairo_rel_line_to(_painter, 0, w);
|
||||||
|
cairo_rel_line_to(_painter, -w, 0);
|
||||||
|
cairo_close_path(_painter);
|
||||||
|
cairo_set_line_width(_painter, 1);
|
||||||
|
beginFg();
|
||||||
|
cairo_stroke_preserve(_painter);
|
||||||
|
if (t.state == TagState::Active) {
|
||||||
|
beginBg();
|
||||||
|
} else {
|
||||||
|
setTagColorScheme(t);
|
||||||
|
beginBg();
|
||||||
|
}
|
||||||
|
cairo_fill(_painter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Bar::renderStatus()
|
void Bar::renderStatus()
|
||||||
{
|
{
|
||||||
pango_cairo_update_layout(_painter, _statusCmp.pangoLayout.get());
|
pango_cairo_update_layout(_painter, _statusCmp.pangoLayout.get());
|
||||||
@ -266,7 +307,17 @@ void Bar::renderStatus()
|
|||||||
cairo_fill(_painter);
|
cairo_fill(_painter);
|
||||||
|
|
||||||
_x = start;
|
_x = start;
|
||||||
renderComponent(_statusCmp);
|
if (_statusCmp.width() > 0)
|
||||||
|
{
|
||||||
|
renderComponent(_statusCmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bar::setTagColorScheme(const Tag& t)
|
||||||
|
{
|
||||||
|
setColorScheme(
|
||||||
|
t.state & TagState::Active ? colorActive : colorInactive,
|
||||||
|
t.state & TagState::Urgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bar::setColorScheme(const ColorScheme& scheme, bool invert)
|
void Bar::setColorScheme(const ColorScheme& scheme, bool invert)
|
||||||
|
@ -50,9 +50,12 @@ class Bar {
|
|||||||
void layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height);
|
void layerSurfaceConfigure(uint32_t serial, uint32_t width, uint32_t height);
|
||||||
void render();
|
void render();
|
||||||
void renderTags();
|
void renderTags();
|
||||||
|
void renderMultiIndicators(const Tag& t, int inds);
|
||||||
|
void renderSingleIndicator(const Tag& t, int inds);
|
||||||
void renderStatus();
|
void renderStatus();
|
||||||
|
|
||||||
// low-level rendering
|
// low-level rendering
|
||||||
|
void setTagColorScheme(const Tag& t);
|
||||||
void setColorScheme(const ColorScheme& scheme, bool invert = false);
|
void setColorScheme(const ColorScheme& scheme, bool invert = false);
|
||||||
void beginFg();
|
void beginFg();
|
||||||
void beginBg();
|
void beginBg();
|
||||||
@ -65,6 +68,7 @@ public:
|
|||||||
void show(wl_output* output);
|
void show(wl_output* output);
|
||||||
void hide();
|
void hide();
|
||||||
void setTag(int tag, int state, int numClients, int focusedClient);
|
void setTag(int tag, int state, int numClients, int focusedClient);
|
||||||
|
uint32_t getSelectedTagNumClients();
|
||||||
void setSelected(bool selected);
|
void setSelected(bool selected);
|
||||||
void setLayout(const std::string& layout);
|
void setLayout(const std::string& layout);
|
||||||
void setTitle(const std::string& title);
|
void setTitle(const std::string& title);
|
||||||
|
@ -5,12 +5,14 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <linux/input-event-codes.h>
|
#include <linux/input-event-codes.h>
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
#include <pango/pango.h>
|
#include <pango/pango.h>
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h"
|
#include "dwl-ipc-unstable-v2-client-protocol.h"
|
||||||
|
|
||||||
struct Color {
|
struct Color {
|
||||||
Color() {}
|
Color() {}
|
||||||
@ -39,8 +41,8 @@ extern wl_display* display;
|
|||||||
extern wl_compositor* compositor;
|
extern wl_compositor* compositor;
|
||||||
extern wl_shm* shm;
|
extern wl_shm* shm;
|
||||||
extern zwlr_layer_shell_v1* wlrLayerShell;
|
extern zwlr_layer_shell_v1* wlrLayerShell;
|
||||||
extern std::vector<std::string> tagNames;
|
static std::vector<std::string> tagNames;
|
||||||
extern std::vector<std::string> layoutNames;
|
static std::vector<std::string> layoutNames;
|
||||||
|
|
||||||
void view(Monitor& m, const Arg& arg);
|
void view(Monitor& m, const Arg& arg);
|
||||||
void toggleview(Monitor& m, const Arg& arg);
|
void toggleview(Monitor& m, const Arg& arg);
|
||||||
@ -63,12 +65,18 @@ struct WlDeleter;
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
using wl_unique_ptr = std::unique_ptr<T, WlDeleter<T>>;
|
using wl_unique_ptr = std::unique_ptr<T, WlDeleter<T>>;
|
||||||
|
|
||||||
|
inline void wl_output_release_checked(wl_output* output) {
|
||||||
|
if (wl_output_get_version(output) >= WL_OUTPUT_RELEASE_SINCE_VERSION) {
|
||||||
|
wl_output_release(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WL_DELETER(wl_buffer, wl_buffer_destroy);
|
WL_DELETER(wl_buffer, wl_buffer_destroy);
|
||||||
WL_DELETER(wl_output, wl_output_release);
|
WL_DELETER(wl_output, wl_output_release_checked);
|
||||||
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);
|
||||||
WL_DELETER(znet_tapesoftware_dwl_wm_monitor_v1, znet_tapesoftware_dwl_wm_monitor_v1_release);
|
WL_DELETER(zdwl_ipc_output_v2, zdwl_ipc_output_v2_destroy);
|
||||||
WL_DELETER(zwlr_layer_surface_v1, zwlr_layer_surface_v1_destroy);
|
WL_DELETER(zwlr_layer_surface_v1, zwlr_layer_surface_v1_destroy);
|
||||||
|
|
||||||
WL_DELETER(cairo_t, cairo_destroy);
|
WL_DELETER(cairo_t, cairo_destroy);
|
||||||
|
@ -14,8 +14,11 @@ constexpr const char* font = "Iosevka 11";
|
|||||||
|
|
||||||
constexpr ColorScheme colorInactive = {Color(0xff, 0xff, 0xff), Color(0x88, 0x88, 0x88)};
|
constexpr ColorScheme colorInactive = {Color(0xff, 0xff, 0xff), Color(0x88, 0x88, 0x88)};
|
||||||
constexpr ColorScheme colorActive = {Color(0xff, 0xff, 0xff), Color(0xaa, 0x44, 0x44)};
|
constexpr ColorScheme colorActive = {Color(0xff, 0xff, 0xff), Color(0xaa, 0x44, 0x44)};
|
||||||
|
constexpr ColorScheme colorIndicator = {Color(0xff, 0xff, 0xff), Color(0xff, 0xff, 0xff)};
|
||||||
constexpr const char* termcmd[] = {"dwl_term", nullptr};
|
constexpr const char* termcmd[] = {"dwl_term", nullptr};
|
||||||
|
constexpr int showIndicators = 1; // 0 = no indicators
|
||||||
|
// 1 = single indicator
|
||||||
|
// 2 = multiple indicators
|
||||||
constexpr Button buttons[] = {
|
constexpr Button buttons[] = {
|
||||||
{ ClkTagBar, BTN_LEFT, view, {0} },
|
{ ClkTagBar, BTN_LEFT, view, {0} },
|
||||||
{ ClkTagBar, BTN_RIGHT, tag, {0} },
|
{ ClkTagBar, BTN_RIGHT, tag, {0} },
|
||||||
|
165
src/main.cpp
165
src/main.cpp
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <sstream>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -20,8 +21,9 @@
|
|||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||||
#include "xdg-shell-client-protocol.h"
|
#include "xdg-shell-client-protocol.h"
|
||||||
#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h"
|
#include "dwl-ipc-unstable-v2-client-protocol.h"
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
#include "config.hpp"
|
||||||
#include "bar.hpp"
|
#include "bar.hpp"
|
||||||
#include "line_buffer.hpp"
|
#include "line_buffer.hpp"
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ struct Monitor {
|
|||||||
bool desiredVisibility {true};
|
bool desiredVisibility {true};
|
||||||
bool hasData;
|
bool hasData;
|
||||||
uint32_t tags;
|
uint32_t tags;
|
||||||
wl_unique_ptr<znet_tapesoftware_dwl_wm_monitor_v1> dwlMonitor;
|
wl_unique_ptr<zdwl_ipc_output_v2> dwlMonitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SeatPointer {
|
struct SeatPointer {
|
||||||
@ -54,6 +56,8 @@ static void updatemon(Monitor &mon);
|
|||||||
static void onReady();
|
static void onReady();
|
||||||
static void setupStatusFifo();
|
static void setupStatusFifo();
|
||||||
static void onStatus();
|
static void onStatus();
|
||||||
|
static void onStdin();
|
||||||
|
static void handleStdin(const std::string& line);
|
||||||
static void updateVisibility(const std::string& name, bool(*updater)(bool));
|
static void updateVisibility(const std::string& name, bool(*updater)(bool));
|
||||||
static void onGlobalAdd(void*, wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
|
static void onGlobalAdd(void*, wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
|
||||||
static void onGlobalRemove(void*, wl_registry* registry, uint32_t name);
|
static void onGlobalRemove(void*, wl_registry* registry, uint32_t name);
|
||||||
@ -65,9 +69,8 @@ wl_display* display;
|
|||||||
wl_compositor* compositor;
|
wl_compositor* compositor;
|
||||||
wl_shm* shm;
|
wl_shm* shm;
|
||||||
zwlr_layer_shell_v1* wlrLayerShell;
|
zwlr_layer_shell_v1* wlrLayerShell;
|
||||||
znet_tapesoftware_dwl_wm_v1* dwlWm;
|
zdwl_ipc_manager_v2* dwlWm;
|
||||||
std::vector<std::string> tagNames;
|
char* log_txt;
|
||||||
std::vector<std::string> layoutNames;
|
|
||||||
static xdg_wm_base* xdgWmBase;
|
static xdg_wm_base* xdgWmBase;
|
||||||
static zxdg_output_manager_v1* xdgOutputManager;
|
static zxdg_output_manager_v1* xdgOutputManager;
|
||||||
static wl_surface* cursorSurface;
|
static wl_surface* cursorSurface;
|
||||||
@ -88,23 +91,23 @@ static bool quitting {false};
|
|||||||
|
|
||||||
void view(Monitor& m, const Arg& arg)
|
void view(Monitor& m, const Arg& arg)
|
||||||
{
|
{
|
||||||
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), arg.ui, 1);
|
zdwl_ipc_output_v2_set_tags(m.dwlMonitor.get(), arg.ui, 1);
|
||||||
}
|
}
|
||||||
void toggleview(Monitor& m, const Arg& arg)
|
void toggleview(Monitor& m, const Arg& arg)
|
||||||
{
|
{
|
||||||
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), m.tags ^ arg.ui, 0);
|
zdwl_ipc_output_v2_set_tags(m.dwlMonitor.get(), m.tags ^ arg.ui, 0);
|
||||||
}
|
}
|
||||||
void setlayout(Monitor& m, const Arg& arg)
|
void setlayout(Monitor& m, const Arg& arg)
|
||||||
{
|
{
|
||||||
znet_tapesoftware_dwl_wm_monitor_v1_set_layout(m.dwlMonitor.get(), arg.ui);
|
zdwl_ipc_output_v2_set_layout(m.dwlMonitor.get(), arg.ui);
|
||||||
}
|
}
|
||||||
void tag(Monitor& m, const Arg& arg)
|
void tag(Monitor& m, const Arg& arg)
|
||||||
{
|
{
|
||||||
znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), 0, arg.ui);
|
zdwl_ipc_output_v2_set_client_tags(m.dwlMonitor.get(), 0, arg.ui);
|
||||||
}
|
}
|
||||||
void toggletag(Monitor& m, const Arg& arg)
|
void toggletag(Monitor& m, const Arg& arg)
|
||||||
{
|
{
|
||||||
znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), ~0, arg.ui);
|
zdwl_ipc_output_v2_set_client_tags(m.dwlMonitor.get(), ~0, arg.ui);
|
||||||
}
|
}
|
||||||
void spawn(Monitor&, const Arg& arg)
|
void spawn(Monitor&, const Arg& arg)
|
||||||
{
|
{
|
||||||
@ -210,31 +213,35 @@ static const struct wl_seat_listener seatListener = {
|
|||||||
.name = [](void*, wl_seat*, const char* name) { }
|
.name = [](void*, wl_seat*, const char* name) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct znet_tapesoftware_dwl_wm_v1_listener dwlWmListener = {
|
static const struct zdwl_ipc_manager_v2_listener dwlWmListener = {
|
||||||
.tag = [](void*, znet_tapesoftware_dwl_wm_v1*, const char* name) {
|
.tags = [](void*, zdwl_ipc_manager_v2*, uint32_t tag_cnt) {
|
||||||
tagNames.push_back(name);
|
for (uint32_t ti=0; ti<=tag_cnt; ti++) {
|
||||||
|
tagNames.push_back(std::to_string(ti));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
.layout = [](void*, znet_tapesoftware_dwl_wm_v1*, const char* name) {
|
.layout = [](void*, zdwl_ipc_manager_v2*, const char* name) {
|
||||||
layoutNames.push_back(name);
|
layoutNames.push_back(name);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct znet_tapesoftware_dwl_wm_monitor_v1_listener dwlWmMonitorListener {
|
static const struct zdwl_ipc_output_v2_listener dwlWmMonitorListener {
|
||||||
.selected = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t selected) {
|
.toggle_visibility = [](void* mv, zdwl_ipc_output_v2*) {
|
||||||
|
},
|
||||||
|
.active = [](void* mv, zdwl_ipc_output_v2*, uint32_t active) {
|
||||||
auto mon = static_cast<Monitor*>(mv);
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
if (selected) {
|
if (active) {
|
||||||
selmon = mon;
|
selmon = mon;
|
||||||
} else if (selmon == mon) {
|
} else if (selmon == mon) {
|
||||||
selmon = nullptr;
|
selmon = nullptr;
|
||||||
}
|
}
|
||||||
mon->bar.setSelected(selected);
|
mon->bar.setSelected(active);
|
||||||
},
|
},
|
||||||
.tag = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t tag, uint32_t state, uint32_t numClients, int32_t focusedClient) {
|
.tag = [](void* mv, zdwl_ipc_output_v2*, uint32_t tag, uint32_t state, uint32_t numClients, uint32_t focusedClient) {
|
||||||
auto mon = static_cast<Monitor*>(mv);
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
int tagState = TagState::None;
|
int tagState = TagState::None;
|
||||||
if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE)
|
if (state & ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE)
|
||||||
tagState |= TagState::Active;
|
tagState |= TagState::Active;
|
||||||
if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT)
|
if (state & ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT)
|
||||||
tagState |= TagState::Urgent;
|
tagState |= TagState::Urgent;
|
||||||
mon->bar.setTag(tag, tagState, numClients, focusedClient);
|
mon->bar.setTag(tag, tagState, numClients, focusedClient);
|
||||||
uint32_t mask = 1 << tag;
|
uint32_t mask = 1 << tag;
|
||||||
@ -244,18 +251,40 @@ static const struct znet_tapesoftware_dwl_wm_monitor_v1_listener dwlWmMonitorLis
|
|||||||
mon->tags &= ~mask;
|
mon->tags &= ~mask;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.layout = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t layout) {
|
.layout = [](void* mv, zdwl_ipc_output_v2*, uint32_t layout) {
|
||||||
auto mon = static_cast<Monitor*>(mv);
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
mon->bar.setLayout(layoutNames[layout]);
|
if (layout == 2) {
|
||||||
|
char lout[4] = "[M]";
|
||||||
|
uint32_t numc = mon->bar.getSelectedTagNumClients();
|
||||||
|
if (numc > 0) {
|
||||||
|
sprintf(lout, "[%d]", numc);
|
||||||
|
}
|
||||||
|
mon->bar.setLayout(lout);
|
||||||
|
} else {
|
||||||
|
mon->bar.setLayout(layoutNames[layout]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
.title = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, const char* title) {
|
.title = [](void* mv, zdwl_ipc_output_v2*, const char* title) {
|
||||||
auto mon = static_cast<Monitor*>(mv);
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
mon->bar.setTitle(title);
|
mon->bar.setTitle(title);
|
||||||
},
|
},
|
||||||
.frame = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*) {
|
.appid = [](void* mv, zdwl_ipc_output_v2*, const char* appid) {
|
||||||
|
//auto mon = static_cast<Monitor*>(mv);
|
||||||
|
},
|
||||||
|
.layout_symbol = [](void* mv, zdwl_ipc_output_v2*, const char* layout) {
|
||||||
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
|
mon->bar.setLayout(layout);
|
||||||
|
},
|
||||||
|
.frame = [](void* mv, zdwl_ipc_output_v2*) {
|
||||||
auto mon = static_cast<Monitor*>(mv);
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
mon->hasData = true;
|
mon->hasData = true;
|
||||||
updatemon(*mon);
|
updatemon(*mon);
|
||||||
|
},
|
||||||
|
.fullscreen = [](void* mv, zdwl_ipc_output_v2*, uint32_t is_fullscreen) {
|
||||||
|
// auto mon = static_cast<Monitor*>(mv);
|
||||||
|
},
|
||||||
|
.floating = [](void* mv, zdwl_ipc_output_v2*, uint32_t is_floating) {
|
||||||
|
//auto mon = static_cast<Monitor*>(mv);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -264,8 +293,8 @@ void setupMonitor(uint32_t name, wl_output* output) {
|
|||||||
monitor.bar.setStatus(lastStatus);
|
monitor.bar.setStatus(lastStatus);
|
||||||
auto xdgOutput = zxdg_output_manager_v1_get_xdg_output(xdgOutputManager, monitor.wlOutput.get());
|
auto xdgOutput = zxdg_output_manager_v1_get_xdg_output(xdgOutputManager, monitor.wlOutput.get());
|
||||||
zxdg_output_v1_add_listener(xdgOutput, &xdgOutputListener, &monitor);
|
zxdg_output_v1_add_listener(xdgOutput, &xdgOutputListener, &monitor);
|
||||||
monitor.dwlMonitor.reset(znet_tapesoftware_dwl_wm_v1_get_monitor(dwlWm, monitor.wlOutput.get()));
|
monitor.dwlMonitor.reset(zdwl_ipc_manager_v2_get_output(dwlWm, monitor.wlOutput.get()));
|
||||||
znet_tapesoftware_dwl_wm_monitor_v1_add_listener(monitor.dwlMonitor.get(), &dwlWmMonitorListener, &monitor);
|
zdwl_ipc_output_v2_add_listener(monitor.dwlMonitor.get(), &dwlWmMonitorListener, &monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatemon(Monitor& mon)
|
void updatemon(Monitor& mon)
|
||||||
@ -291,7 +320,7 @@ void onReady()
|
|||||||
requireGlobal(shm, "wl_shm");
|
requireGlobal(shm, "wl_shm");
|
||||||
requireGlobal(wlrLayerShell, "zwlr_layer_shell_v1");
|
requireGlobal(wlrLayerShell, "zwlr_layer_shell_v1");
|
||||||
requireGlobal(xdgOutputManager, "zxdg_output_manager_v1");
|
requireGlobal(xdgOutputManager, "zxdg_output_manager_v1");
|
||||||
requireGlobal(dwlWm, "znet_tapesoftware_dwl_wm_v1");
|
requireGlobal(dwlWm, "zdwl_ipc_manager_v2_interface");
|
||||||
setupStatusFifo();
|
setupStatusFifo();
|
||||||
wl_display_roundtrip(display); // roundtrip so we receive all dwl tags etc.
|
wl_display_roundtrip(display); // roundtrip so we receive all dwl tags etc.
|
||||||
|
|
||||||
@ -299,12 +328,14 @@ void onReady()
|
|||||||
for (auto output : uninitializedOutputs) {
|
for (auto output : uninitializedOutputs) {
|
||||||
setupMonitor(output.first, output.second);
|
setupMonitor(output.first, output.second);
|
||||||
}
|
}
|
||||||
|
wl_display_roundtrip(display); // wait for xdg_output names before we read stdin
|
||||||
}
|
}
|
||||||
|
|
||||||
bool createFifo(std::string path)
|
bool createFifo(std::string path)
|
||||||
{
|
{
|
||||||
auto result = mkfifo(path.c_str(), 0666);
|
auto result = mkfifo(path.c_str(), 0666);
|
||||||
if (result == 0) {
|
// if (result == 0) {
|
||||||
|
if ((result == 0) || (errno == EEXIST)) {
|
||||||
auto fd = open(path.c_str(), O_CLOEXEC | O_NONBLOCK | O_RDONLY);
|
auto fd = open(path.c_str(), O_CLOEXEC | O_NONBLOCK | O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
diesys("open status fifo reader");
|
diesys("open status fifo reader");
|
||||||
@ -345,6 +376,69 @@ void setupStatusFifo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LineBuffer<512> stdinBuffer;
|
||||||
|
static void onStdin()
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
auto res = stdinBuffer.readLines(
|
||||||
|
[](void* p, size_t size) { return read(0, p, size); },
|
||||||
|
[](char* p, size_t size) { handleStdin({p, size}); });
|
||||||
|
if (res == 0) {
|
||||||
|
quitting = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handleStdin(const std::string& line)
|
||||||
|
{
|
||||||
|
// this parses the lines that dwl sends in printstatus()
|
||||||
|
std::string monName, command;
|
||||||
|
auto stream = std::istringstream {line};
|
||||||
|
stream >> monName >> command;
|
||||||
|
if (!stream.good()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto mon = std::find_if(begin(monitors), end(monitors), [&](const Monitor& mon) {
|
||||||
|
return mon.xdgName == monName;
|
||||||
|
});
|
||||||
|
if (mon == end(monitors))
|
||||||
|
return;
|
||||||
|
if (command == "title") {
|
||||||
|
auto title = std::string {};
|
||||||
|
stream >> std::ws;
|
||||||
|
std::getline(stream, title);
|
||||||
|
mon->bar.setTitle(title);
|
||||||
|
} else if (command == "selmon") {
|
||||||
|
uint32_t selected;
|
||||||
|
stream >> selected;
|
||||||
|
mon->bar.setSelected(selected);
|
||||||
|
if (selected) {
|
||||||
|
selmon = &*mon;
|
||||||
|
} else if (selmon == &*mon) {
|
||||||
|
selmon = nullptr;
|
||||||
|
}
|
||||||
|
} else if (command == "tags") {
|
||||||
|
uint32_t occupied, tags, clientTags, urgent;
|
||||||
|
stream >> occupied >> tags >> clientTags >> urgent;
|
||||||
|
for (auto i=0u; i<tagNames.size(); i++) {
|
||||||
|
auto tagMask = 1 << i;
|
||||||
|
int state = TagState::None;
|
||||||
|
if (tags & tagMask)
|
||||||
|
state |= TagState::Active;
|
||||||
|
if (urgent & tagMask)
|
||||||
|
state |= TagState::Urgent;
|
||||||
|
mon->bar.setTag(i, state, occupied & tagMask ? 1 : 0, clientTags & tagMask ? 0 : -1);
|
||||||
|
}
|
||||||
|
mon->tags = tags;
|
||||||
|
} else if (command == "layout") {
|
||||||
|
auto layout = std::string {};
|
||||||
|
stream >> std::ws;
|
||||||
|
std::getline(stream, layout);
|
||||||
|
mon->bar.setLayout(layout);
|
||||||
|
}
|
||||||
|
mon->hasData = true;
|
||||||
|
updatemon(*mon);
|
||||||
|
}
|
||||||
|
|
||||||
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 ";
|
||||||
@ -413,14 +507,14 @@ void onGlobalAdd(void*, wl_registry* registry, uint32_t name, const char* interf
|
|||||||
auto reg = HandleGlobalHelper { registry, name, interface };
|
auto reg = HandleGlobalHelper { registry, name, interface };
|
||||||
if (reg.handle(compositor, wl_compositor_interface, 4)) return;
|
if (reg.handle(compositor, wl_compositor_interface, 4)) return;
|
||||||
if (reg.handle(shm, wl_shm_interface, 1)) return;
|
if (reg.handle(shm, wl_shm_interface, 1)) return;
|
||||||
if (reg.handle(wlrLayerShell, zwlr_layer_shell_v1_interface, 4)) return;
|
if (reg.handle(wlrLayerShell, zwlr_layer_shell_v1_interface, 1)) return;
|
||||||
if (reg.handle(xdgOutputManager, zxdg_output_manager_v1_interface, 3)) return;
|
if (reg.handle(xdgOutputManager, zxdg_output_manager_v1_interface, 3)) return;
|
||||||
if (reg.handle(xdgWmBase, xdg_wm_base_interface, 2)) {
|
if (reg.handle(xdgWmBase, xdg_wm_base_interface, 2)) {
|
||||||
xdg_wm_base_add_listener(xdgWmBase, &xdgWmBaseListener, nullptr);
|
xdg_wm_base_add_listener(xdgWmBase, &xdgWmBaseListener, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (reg.handle(dwlWm, znet_tapesoftware_dwl_wm_v1_interface, 1)) {
|
if (reg.handle(dwlWm, zdwl_ipc_manager_v2_interface, 1)) {
|
||||||
znet_tapesoftware_dwl_wm_v1_add_listener(dwlWm, &dwlWmListener, nullptr);
|
zdwl_ipc_manager_v2_add_listener(dwlWm, &dwlWmListener, nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wl_seat* wlSeat; reg.handle(wlSeat, wl_seat_interface, 7)) {
|
if (wl_seat* wlSeat; reg.handle(wlSeat, wl_seat_interface, 7)) {
|
||||||
@ -450,6 +544,7 @@ static const struct wl_registry_listener registry_listener = {
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "chvs:")) != -1) {
|
while ((opt = getopt(argc, argv, "chvs:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 's':
|
case 's':
|
||||||
@ -536,6 +631,10 @@ int main(int argc, char* argv[])
|
|||||||
.fd = displayFd,
|
.fd = displayFd,
|
||||||
.events = POLLIN,
|
.events = POLLIN,
|
||||||
});
|
});
|
||||||
|
pollfds.push_back({
|
||||||
|
.fd = STDIN_FILENO,
|
||||||
|
.events = POLLIN,
|
||||||
|
});
|
||||||
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");
|
||||||
}
|
}
|
||||||
@ -560,6 +659,8 @@ int main(int argc, char* argv[])
|
|||||||
ev.events = POLLIN;
|
ev.events = POLLIN;
|
||||||
waylandFlush();
|
waylandFlush();
|
||||||
}
|
}
|
||||||
|
} else if (ev.fd == STDIN_FILENO && (ev.revents & POLLIN)) {
|
||||||
|
onStdin();
|
||||||
} else if (ev.fd == statusFifoFd && (ev.revents & POLLIN)) {
|
} else if (ev.fd == statusFifoFd && (ev.revents & POLLIN)) {
|
||||||
onStatus();
|
onStatus();
|
||||||
} else if (ev.fd == signalSelfPipe[0] && (ev.revents & POLLIN)) {
|
} else if (ev.fd == signalSelfPipe[0] && (ev.revents & POLLIN)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user