Compare commits
5 Commits
1926a14860
...
41b2b04121
Author | SHA1 | Date | |
---|---|---|---|
41b2b04121 | |||
fe3654cde3 | |||
63480f7fa4 | |||
|
77c2c1de97 | ||
|
85b7b6290a |
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
![Screenshot](screenshot.png)
|
![Screenshot](screenshot.png)
|
||||||
|
|
||||||
This project is rather new. Beware of bugs.
|
|
||||||
|
|
||||||
The mailing list for this project is
|
The mailing list for this project is
|
||||||
[~raphi/public-inbox@lists.sr.ht](mailto:~raphi/public-inbox@lists.sr.ht).
|
[~raphi/public-inbox@lists.sr.ht](mailto:~raphi/public-inbox@lists.sr.ht).
|
||||||
|
|
||||||
@ -85,6 +83,10 @@ If you apply the IPC patch to somebar, then
|
|||||||
**dwl must have the [wayland-ipc patch](https://git.sr.ht/~raphi/dwl/blob/master/patches/wayland-ipc.patch) applied too**,
|
**dwl must have the [wayland-ipc patch](https://git.sr.ht/~raphi/dwl/blob/master/patches/wayland-ipc.patch) applied too**,
|
||||||
since dwl must implement the wayland extension too.
|
since dwl must implement the wayland extension too.
|
||||||
|
|
||||||
|
## Other patches
|
||||||
|
|
||||||
|
Like all suckless software, somebar can be customized via patches. You can find some patches in the contrib folder with descriptions written in them.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
somebar - dwm-like bar for dwl
|
somebar - dwm-like bar for dwl
|
||||||
|
15
contrib/colorless-status.patch
Normal file
15
contrib/colorless-status.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
From: medanisjbara anis2834133766619@gmail.com
|
||||||
|
Date: Mon, 14 Nov 2022 10:28:00
|
||||||
|
Description: sets the color of status component to inactive
|
||||||
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
|
index fab5a8f..aebe28b 100644
|
||||||
|
--- a/src/bar.cpp
|
||||||
|
+++ b/src/bar.cpp
|
||||||
|
@@ -266,6 +266,7 @@ void Bar::renderStatus()
|
||||||
|
cairo_fill(_painter);
|
||||||
|
|
||||||
|
_x = start;
|
||||||
|
+ setColorScheme(colorInactive);
|
||||||
|
renderComponent(_statusCmp);
|
||||||
|
}
|
||||||
|
|
34
contrib/hide-vacant-tags.patch
Normal file
34
contrib/hide-vacant-tags.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From: medanisjbara anis2834133766619@gmail.com
|
||||||
|
Date: Mon, 14 Nov 2022 22:52:00
|
||||||
|
Description: somebar equivalent of https://dwm.suckless.org/patches/hide_vacant_tags
|
||||||
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
|
index fab5a8f..38e7b5f 100644
|
||||||
|
--- a/src/bar.cpp
|
||||||
|
+++ b/src/bar.cpp
|
||||||
|
@@ -240,12 +240,22 @@ void Bar::render()
|
||||||
|
|
||||||
|
void Bar::renderTags()
|
||||||
|
{
|
||||||
|
+ bool focused;
|
||||||
|
for (auto &tag : _tags) {
|
||||||
|
- setColorScheme(
|
||||||
|
- tag.state & TagState::Active ? colorActive : colorInactive,
|
||||||
|
- tag.state & TagState::Urgent);
|
||||||
|
- renderComponent(tag.component);
|
||||||
|
+ 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;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (tag.state & TagState::Active || focused){
|
||||||
|
+ setColorScheme(
|
||||||
|
+ tag.state & TagState::Active ? colorActive : colorInactive,
|
||||||
|
+ tag.state & TagState::Urgent);
|
||||||
|
+ renderComponent(tag.component);
|
||||||
|
+ }
|
||||||
|
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);
|
54
contrib/indicator-size-props.patch
Normal file
54
contrib/indicator-size-props.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From: medanisjbara anis2834133766619@gmail.com
|
||||||
|
Date: Mon, 15 Nov 2022 08:16:00
|
||||||
|
Description: lets config.h customize indicators sizes
|
||||||
|
diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
|
index fab5a8f..c0e070c 100644
|
||||||
|
--- a/src/bar.cpp
|
||||||
|
+++ b/src/bar.cpp
|
||||||
|
@@ -247,11 +247,11 @@ void Bar::renderTags()
|
||||||
|
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;
|
||||||
|
+ auto w = ind == tag.focusedClient ? indprops.focused_width : indprops.width;
|
||||||
|
cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
||||||
|
cairo_rel_line_to(_painter, w, 0);
|
||||||
|
cairo_close_path(_painter);
|
||||||
|
- cairo_set_line_width(_painter, 1);
|
||||||
|
+ cairo_set_line_width(_painter, ind == tag.focusedClient ? indprops.focused_height : indprops.height);
|
||||||
|
cairo_stroke(_painter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/common.hpp b/src/common.hpp
|
||||||
|
index aed4480..acdca1b 100644
|
||||||
|
--- a/src/common.hpp
|
||||||
|
+++ b/src/common.hpp
|
||||||
|
@@ -34,6 +34,13 @@ struct Button {
|
||||||
|
const Arg arg;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct IndicatorProps {
|
||||||
|
+ int width;
|
||||||
|
+ int height;
|
||||||
|
+ int focused_width;
|
||||||
|
+ int focused_height;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
extern wl_display* display;
|
||||||
|
extern wl_compositor* compositor;
|
||||||
|
extern wl_shm* shm;
|
||||||
|
diff --git a/src/config.def.hpp b/src/config.def.hpp
|
||||||
|
index 40a8c95..d51fee8 100644
|
||||||
|
--- a/src/config.def.hpp
|
||||||
|
+++ b/src/config.def.hpp
|
||||||
|
@@ -25,3 +25,10 @@ static std::vector<std::string> tagNames = {
|
||||||
|
constexpr Button buttons[] = {
|
||||||
|
{ ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} },
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+constexpr IndicatorProps indprops = {
|
||||||
|
+ 5, /* unfocused indicator width */
|
||||||
|
+ 5, /* unfocused indicator height */
|
||||||
|
+ 7, /* focused indicator width */
|
||||||
|
+ 1 /* focused indicator height */
|
||||||
|
+};
|
@ -27,3 +27,5 @@ executable('somebar',
|
|||||||
],
|
],
|
||||||
install: true,
|
install: true,
|
||||||
cpp_args: '-DSOMEBAR_VERSION="@0@"'.format(meson.project_version()))
|
cpp_args: '-DSOMEBAR_VERSION="@0@"'.format(meson.project_version()))
|
||||||
|
|
||||||
|
install_man('somebar.1')
|
||||||
|
@ -15,6 +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',
|
||||||
]
|
]
|
||||||
wayland_sources = [
|
wayland_sources = [
|
||||||
wayland_scanner_code.process(wayland_xmls),
|
wayland_scanner_code.process(wayland_xmls),
|
||||||
|
164
protocols/net-tapesoftware-dwl-wm-unstable-v1.xml
Normal file
164
protocols/net-tapesoftware-dwl-wm-unstable-v1.xml
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<protocol name="net_tapesoftware_dwl_wm_unstable_v1">
|
||||||
|
<copyright>
|
||||||
|
Copyright (c) 2021 Raphael Robatsch
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the
|
||||||
|
next paragraph) shall be included in all copies or substantial portions
|
||||||
|
of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<interface name="znet_tapesoftware_dwl_wm_v1" version="1">
|
||||||
|
<description summary="control the dwl state">
|
||||||
|
This interface is exposed as a global in the wl_registry.
|
||||||
|
|
||||||
|
Clients can use this protocol to receive updates of the window manager
|
||||||
|
state (active tags, active layout, and focused window).
|
||||||
|
Clients can also control this state.
|
||||||
|
|
||||||
|
After binding, the client will receive the available tags and layouts
|
||||||
|
with the 'tag' and 'layout' events. These can be used in subsequent
|
||||||
|
dwl_wm_monitor_v1.set_tags/set_layout requests, and to interpret the
|
||||||
|
dwl_wm_monitor_v1.layout/tag events.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<request name="release" type="destructor">
|
||||||
|
<description summary="release dwl_wm">
|
||||||
|
This request indicates that the client will not use the dwl_wm
|
||||||
|
object any more. Objects that have been created through this instance
|
||||||
|
are not affected.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="get_monitor">
|
||||||
|
<description summary="gets a dwl monitor from an output">
|
||||||
|
Gets a dwl monitor for the specified output. The window manager
|
||||||
|
state on the output can be controlled using the monitor.
|
||||||
|
</description>
|
||||||
|
<arg name="id" type="new_id" interface="znet_tapesoftware_dwl_wm_monitor_v1" />
|
||||||
|
<arg name="output" type="object" interface="wl_output" />
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="tag">
|
||||||
|
<description summary="announces the presence of a tag">
|
||||||
|
This event is sent immediately after binding.
|
||||||
|
A roundtrip after binding guarantees that the client has received all tags.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="layout">
|
||||||
|
<description summary="announces the presence of a layout">
|
||||||
|
This event is sent immediately after binding.
|
||||||
|
A roundtrip after binding guarantees that the client has received all layouts.
|
||||||
|
</description>
|
||||||
|
<arg name="name" type="string"/>
|
||||||
|
</event>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
<interface name="znet_tapesoftware_dwl_wm_monitor_v1" version="1">
|
||||||
|
<description summary="control one monitor">
|
||||||
|
Observes and controls one monitor.
|
||||||
|
|
||||||
|
Events are double-buffered: Clients should cache all events and only
|
||||||
|
redraw themselves once the 'frame' event is sent.
|
||||||
|
|
||||||
|
Requests are not double-buffered: The compositor will update itself
|
||||||
|
immediately.
|
||||||
|
</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_monitor">
|
||||||
|
This request indicates that the client is done with this dwl_monitor.
|
||||||
|
All further requests are ignored.
|
||||||
|
</description>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<event name="selected">
|
||||||
|
<description summary="updates the selected state of the monitor">
|
||||||
|
If 'selected' is nonzero, this monitor is the currently selected one.
|
||||||
|
</description>
|
||||||
|
<arg name="selected" type="uint"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="tag">
|
||||||
|
<description summary="updates the state of one tag">
|
||||||
|
Announces the update of a tag. num_clients and focused_client can be
|
||||||
|
used to draw client indicators.
|
||||||
|
</description>
|
||||||
|
<arg name="tag" type="uint" summary="index of a tag received by the dwl_wm_v1.tag event." />
|
||||||
|
<arg name="state" type="uint" enum="tag_state"/>
|
||||||
|
<arg name="num_clients" type="uint" summary="number of clients on this tag"/>
|
||||||
|
<arg name="focused_client" type="int" summary="out of num_clients. -1 if there is no focused client"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="layout">
|
||||||
|
<description summary="updates the selected layout">
|
||||||
|
Announces the update of the selected layout.
|
||||||
|
</description>
|
||||||
|
<arg name="layout" type="uint" summary="index of a layout received by the dwl_wm_v1.layout event."/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="title">
|
||||||
|
<description summary="updates the focused client">
|
||||||
|
Announces the update of the selected client.
|
||||||
|
</description>
|
||||||
|
<arg name="title" type="string"/>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<event name="frame">
|
||||||
|
<description summary="end of status update sequence">
|
||||||
|
Sent after all other events belonging to the status update has been sent.
|
||||||
|
Clients should redraw themselves now.
|
||||||
|
</description>
|
||||||
|
</event>
|
||||||
|
|
||||||
|
<request name="set_tags">
|
||||||
|
<description summary="sets the active tags on this monitor.">
|
||||||
|
Changes are applied immediately.
|
||||||
|
</description>
|
||||||
|
<arg name="tagmask" type="uint" summary="bitmask of the tags that should be set."/>
|
||||||
|
<arg name="toggle_tagset" type="uint"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_client_tags">
|
||||||
|
<description summary="updates the tags of the focused client.">
|
||||||
|
tags are updated as follows:
|
||||||
|
new_tags = (current_tags AND and_tags) XOR xor_tags
|
||||||
|
|
||||||
|
Changes are applied immediately.
|
||||||
|
</description>
|
||||||
|
<arg name="and_tags" type="uint"/>
|
||||||
|
<arg name="xor_tags" type="uint"/>
|
||||||
|
</request>
|
||||||
|
|
||||||
|
<request name="set_layout">
|
||||||
|
<description summary="sets the active layout on this monitor.">
|
||||||
|
Changes are applied immediately.
|
||||||
|
</description>
|
||||||
|
<arg name="layout" type="uint" summary="index of a layout received by the dwl_wm_v1.layout event."/>
|
||||||
|
</request>
|
||||||
|
</interface>
|
||||||
|
</protocol>
|
55
somebar.1
Normal file
55
somebar.1
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
.TH somebar 1 somebar\-1.0
|
||||||
|
.SH NAME
|
||||||
|
somebar \- dwm-like bar for dwl
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B somebar
|
||||||
|
.RB [ \-h ]
|
||||||
|
.RB [ \-v ]
|
||||||
|
.RB [ \-s
|
||||||
|
.IR path ]
|
||||||
|
.RB [ \-c
|
||||||
|
.IR command
|
||||||
|
arguments... ]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
somebar is a status bar for dwl, visually and functionally resembling the
|
||||||
|
dwm bar.
|
||||||
|
.SH USAGE
|
||||||
|
You must start somebar using dwl's `-s` flag, e.g. `dwl -s somebar`.
|
||||||
|
|
||||||
|
Somebar can be controlled by writing to $XDG_RUNTIME_DIR/somebar-0, or the path
|
||||||
|
defined by the `-s` argument. The following commands are supported:
|
||||||
|
.TP
|
||||||
|
.B status TEXT
|
||||||
|
Updates the status bar
|
||||||
|
.TP
|
||||||
|
.B hide MONITOR
|
||||||
|
Hides somebar on the specified monitor
|
||||||
|
.TP
|
||||||
|
.B show MONITOR
|
||||||
|
Shows somebar on the specified monitor
|
||||||
|
.TP
|
||||||
|
.B toggle MONITOR
|
||||||
|
Toggles somebar on the specified monitor
|
||||||
|
.P
|
||||||
|
MONITOR is an zxdg_output_v1 name, which can be determined e.g. using `weston-info`.
|
||||||
|
Additionally, MONITOR can be `all` (all monitors) or `selected` (the monitor with focus).
|
||||||
|
|
||||||
|
Commands can be sent either by writing to the file name above, or equivalently by calling
|
||||||
|
somebar with the `-c` argument. For example: `somebar -c toggle all`. This is recommended
|
||||||
|
for shell scripts, as there is no race-free way to write to a file only if it exists.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B \-h
|
||||||
|
Displays a short help text and exits
|
||||||
|
.TP
|
||||||
|
.B \-v
|
||||||
|
Displays version information and exits
|
||||||
|
.TP
|
||||||
|
.B \-s
|
||||||
|
Sets the path to the somebar control FIFO. The default value is
|
||||||
|
$XDG_RUNTIME_DIR/somebar-0
|
||||||
|
.TP
|
||||||
|
.B \-c
|
||||||
|
Sends a command to the control FIFO. See the USAGE section.
|
||||||
|
.SH BUGS
|
||||||
|
Send bug reports to ~raphi/public-inbox@lists.sr.ht
|
67
src/bar.cpp
67
src/bar.cpp
@ -142,6 +142,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;
|
||||||
@ -241,22 +251,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());
|
||||||
@ -269,6 +309,13 @@ void Bar::renderStatus()
|
|||||||
renderComponent(_statusCmp);
|
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)
|
||||||
{
|
{
|
||||||
_colorScheme = invert
|
_colorScheme = 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);
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#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"
|
||||||
|
|
||||||
struct Color {
|
struct Color {
|
||||||
Color() {}
|
Color() {}
|
||||||
@ -38,6 +39,14 @@ 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;
|
||||||
|
extern std::vector<std::string> layoutNames;
|
||||||
|
|
||||||
|
void view(Monitor& m, const Arg& arg);
|
||||||
|
void toggleview(Monitor& m, const Arg& arg);
|
||||||
|
void setlayout(Monitor& m, const Arg& arg);
|
||||||
|
void tag(Monitor& m, const Arg& arg);
|
||||||
|
void toggletag(Monitor& m, const Arg& arg);
|
||||||
|
|
||||||
void spawn(Monitor&, const Arg& arg);
|
void spawn(Monitor&, const Arg& arg);
|
||||||
void setCloexec(int fd);
|
void setCloexec(int fd);
|
||||||
@ -59,6 +68,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);
|
||||||
|
WL_DELETER(znet_tapesoftware_dwl_wm_monitor_v1, znet_tapesoftware_dwl_wm_monitor_v1_release);
|
||||||
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);
|
||||||
|
@ -16,12 +16,11 @@ constexpr ColorScheme colorInactive = {Color(0xbb, 0xbb, 0xbb), Color(0x22, 0x22
|
|||||||
constexpr ColorScheme colorActive = {Color(0xee, 0xee, 0xee), Color(0x00, 0x55, 0x77)};
|
constexpr ColorScheme colorActive = {Color(0xee, 0xee, 0xee), Color(0x00, 0x55, 0x77)};
|
||||||
constexpr const char* termcmd[] = {"foot", nullptr};
|
constexpr const char* termcmd[] = {"foot", nullptr};
|
||||||
|
|
||||||
static std::vector<std::string> tagNames = {
|
|
||||||
"1", "2", "3",
|
|
||||||
"4", "5", "6",
|
|
||||||
"7", "8", "9",
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr Button buttons[] = {
|
constexpr Button buttons[] = {
|
||||||
|
{ ClkTagBar, BTN_LEFT, view, {0} },
|
||||||
|
{ ClkTagBar, BTN_RIGHT, tag, {0} },
|
||||||
|
{ ClkTagBar, BTN_MIDDLE, toggletag, {0} },
|
||||||
|
{ ClkLayoutSymbol, BTN_LEFT, setlayout, {.ui = 0} },
|
||||||
|
{ ClkLayoutSymbol, BTN_RIGHT, setlayout, {.ui = 2} },
|
||||||
{ ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} },
|
{ ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} },
|
||||||
};
|
};
|
||||||
|
29
src/config.hpp
Normal file
29
src/config.hpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// somebar - dwl bar
|
||||||
|
// See LICENSE file for copyright and license details.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "common.hpp"
|
||||||
|
|
||||||
|
constexpr bool topbar = true;
|
||||||
|
|
||||||
|
constexpr int paddingX = 10;
|
||||||
|
constexpr int paddingY = 3;
|
||||||
|
|
||||||
|
// See https://docs.gtk.org/Pango/type_func.FontDescription.from_string.html
|
||||||
|
constexpr const char* font = "Iosevka 11";
|
||||||
|
|
||||||
|
constexpr ColorScheme colorInactive = {Color(0xff, 0xff, 0xff), Color(0x88, 0x88, 0x88)};
|
||||||
|
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 int showIndicators = 1; // 0 = no indicators
|
||||||
|
// 1 = single indicator
|
||||||
|
// 2 = multiple indicators
|
||||||
|
constexpr Button buttons[] = {
|
||||||
|
{ ClkTagBar, BTN_LEFT, view, {0} },
|
||||||
|
{ ClkTagBar, BTN_RIGHT, tag, {0} },
|
||||||
|
{ ClkTagBar, BTN_MIDDLE, toggletag, {0} },
|
||||||
|
{ ClkLayoutSymbol, BTN_LEFT, setlayout, {.ui = 0} },
|
||||||
|
{ ClkLayoutSymbol, BTN_RIGHT, setlayout, {.ui = 2} },
|
||||||
|
{ ClkStatusText, BTN_RIGHT, spawn, {.v = termcmd} },
|
||||||
|
};
|
161
src/main.cpp
161
src/main.cpp
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <sstream>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -21,8 +20,8 @@
|
|||||||
#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 "common.hpp"
|
#include "common.hpp"
|
||||||
#include "config.hpp"
|
|
||||||
#include "bar.hpp"
|
#include "bar.hpp"
|
||||||
#include "line_buffer.hpp"
|
#include "line_buffer.hpp"
|
||||||
|
|
||||||
@ -34,6 +33,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SeatPointer {
|
struct SeatPointer {
|
||||||
@ -54,8 +54,6 @@ 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);
|
||||||
@ -67,6 +65,9 @@ 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;
|
||||||
|
std::vector<std::string> tagNames;
|
||||||
|
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;
|
||||||
@ -85,6 +86,26 @@ static int statusFifoFd {-1};
|
|||||||
static int statusFifoWriter {-1};
|
static int statusFifoWriter {-1};
|
||||||
static bool quitting {false};
|
static bool quitting {false};
|
||||||
|
|
||||||
|
void view(Monitor& m, const Arg& arg)
|
||||||
|
{
|
||||||
|
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), arg.ui, 1);
|
||||||
|
}
|
||||||
|
void toggleview(Monitor& m, const Arg& arg)
|
||||||
|
{
|
||||||
|
znet_tapesoftware_dwl_wm_monitor_v1_set_tags(m.dwlMonitor.get(), m.tags ^ arg.ui, 0);
|
||||||
|
}
|
||||||
|
void setlayout(Monitor& m, const Arg& arg)
|
||||||
|
{
|
||||||
|
znet_tapesoftware_dwl_wm_monitor_v1_set_layout(m.dwlMonitor.get(), arg.ui);
|
||||||
|
}
|
||||||
|
void tag(Monitor& m, const Arg& arg)
|
||||||
|
{
|
||||||
|
znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), 0, arg.ui);
|
||||||
|
}
|
||||||
|
void toggletag(Monitor& m, const Arg& arg)
|
||||||
|
{
|
||||||
|
znet_tapesoftware_dwl_wm_monitor_v1_set_client_tags(m.dwlMonitor.get(), ~0, arg.ui);
|
||||||
|
}
|
||||||
void spawn(Monitor&, const Arg& arg)
|
void spawn(Monitor&, const Arg& arg)
|
||||||
{
|
{
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
@ -189,11 +210,71 @@ 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 = {
|
||||||
|
.tag = [](void*, znet_tapesoftware_dwl_wm_v1*, const char* name) {
|
||||||
|
tagNames.push_back(name);
|
||||||
|
},
|
||||||
|
.layout = [](void*, znet_tapesoftware_dwl_wm_v1*, const char* name) {
|
||||||
|
layoutNames.push_back(name);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct znet_tapesoftware_dwl_wm_monitor_v1_listener dwlWmMonitorListener {
|
||||||
|
.selected = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t selected) {
|
||||||
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
|
if (selected) {
|
||||||
|
selmon = mon;
|
||||||
|
} else if (selmon == mon) {
|
||||||
|
selmon = nullptr;
|
||||||
|
}
|
||||||
|
mon->bar.setSelected(selected);
|
||||||
|
},
|
||||||
|
.tag = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t tag, uint32_t state, uint32_t numClients, int32_t focusedClient) {
|
||||||
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
|
int tagState = TagState::None;
|
||||||
|
if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_ACTIVE)
|
||||||
|
tagState |= TagState::Active;
|
||||||
|
if (state & ZNET_TAPESOFTWARE_DWL_WM_MONITOR_V1_TAG_STATE_URGENT)
|
||||||
|
tagState |= TagState::Urgent;
|
||||||
|
mon->bar.setTag(tag, tagState, numClients, focusedClient);
|
||||||
|
uint32_t mask = 1 << tag;
|
||||||
|
if (tagState & TagState::Active) {
|
||||||
|
mon->tags |= mask;
|
||||||
|
} else {
|
||||||
|
mon->tags &= ~mask;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.layout = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*, uint32_t layout) {
|
||||||
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
|
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) {
|
||||||
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
|
mon->bar.setTitle(title);
|
||||||
|
},
|
||||||
|
.frame = [](void* mv, znet_tapesoftware_dwl_wm_monitor_v1*) {
|
||||||
|
auto mon = static_cast<Monitor*>(mv);
|
||||||
|
mon->hasData = true;
|
||||||
|
updatemon(*mon);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void setupMonitor(uint32_t name, wl_output* output) {
|
void setupMonitor(uint32_t name, wl_output* output) {
|
||||||
auto& monitor = monitors.emplace_back(Monitor {name, {}, wl_unique_ptr<wl_output> {output}});
|
auto& monitor = monitors.emplace_back(Monitor {name, {}, wl_unique_ptr<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()));
|
||||||
|
znet_tapesoftware_dwl_wm_monitor_v1_add_listener(monitor.dwlMonitor.get(), &dwlWmMonitorListener, &monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updatemon(Monitor& mon)
|
void updatemon(Monitor& mon)
|
||||||
@ -219,6 +300,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");
|
||||||
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.
|
||||||
|
|
||||||
@ -226,7 +308,6 @@ 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)
|
||||||
@ -273,66 +354,6 @@ void setupStatusFifo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static LineBuffer<512> stdinBuffer;
|
|
||||||
static void onStdin()
|
|
||||||
{
|
|
||||||
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 {};
|
|
||||||
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 {};
|
|
||||||
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 ";
|
||||||
@ -407,6 +428,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;
|
||||||
}
|
}
|
||||||
|
if (reg.handle(dwlWm, znet_tapesoftware_dwl_wm_v1_interface, 1)) {
|
||||||
|
znet_tapesoftware_dwl_wm_v1_add_listener(dwlWm, &dwlWmListener, nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
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);
|
||||||
@ -520,10 +545,6 @@ 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");
|
||||||
}
|
}
|
||||||
@ -548,8 +569,6 @@ 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…
Reference in New Issue
Block a user