* [PR PATCH] Waybar: add support for river urgent tags
@ 2022-01-04 0:23 cinerea0
2022-01-05 7:27 ` [PR PATCH] [Merged]: " ericonr
0 siblings, 1 reply; 2+ messages in thread
From: cinerea0 @ 2022-01-04 0:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]
There is a new pull request by cinerea0 against master on the void-packages repository
https://github.com/cinerea0/void-packages way
https://github.com/void-linux/void-packages/pull/34839
Waybar: add support for river urgent tags
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/34839.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-way-34839.patch --]
[-- Type: text/x-diff, Size: 7952 bytes --]
From 844f7e59eba1227b9ad8b3a5aea2d014bce73e5d Mon Sep 17 00:00:00 2001
From: cinerea0 <cinerea0@disroot.org>
Date: Mon, 3 Jan 2022 19:23:04 -0500
Subject: [PATCH] Waybar: add support for river urgent tags
---
srcpkgs/Waybar/patches/river-tags.patch | 164 ++++++++++++++++++++++++
srcpkgs/Waybar/template | 6 +-
2 files changed, 166 insertions(+), 4 deletions(-)
create mode 100644 srcpkgs/Waybar/patches/river-tags.patch
diff --git a/srcpkgs/Waybar/patches/river-tags.patch b/srcpkgs/Waybar/patches/river-tags.patch
new file mode 100644
index 000000000000..63491535e0f0
--- /dev/null
+++ b/srcpkgs/Waybar/patches/river-tags.patch
@@ -0,0 +1,164 @@
+From 024fd42e272f79cb08e594eb3af86c93b1446c91 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Thu, 19 Aug 2021 14:59:25 +0200
+Subject: [PATCH] river/tags: support urgent tags
+
+Upstream river has a concept of urgent views/tags as of commit e59c2a73.
+Introduce a new urgent style to expose this in the waybar module.
+---
+ include/modules/river/tags.hpp | 1 +
+ man/waybar-river-tags.5.scd | 6 ++++--
+ protocol/river-status-unstable-v1.xml | 17 +++++++++++++----
+ src/modules/river/tags.cpp | 27 +++++++++++++++++++++++++--
+ 4 files changed, 43 insertions(+), 8 deletions(-)
+
+diff --git a/include/modules/river/tags.hpp b/include/modules/river/tags.hpp
+index f80b3c591..9b75fbd3b 100644
+--- a/include/modules/river/tags.hpp
++++ b/include/modules/river/tags.hpp
+@@ -18,6 +18,7 @@ class Tags : public waybar::AModule {
+ // Handlers for wayland events
+ void handle_focused_tags(uint32_t tags);
+ void handle_view_tags(struct wl_array *tags);
++ void handle_urgent_tags(uint32_t tags);
+
+ struct zriver_status_manager_v1 *status_manager_;
+
+diff --git a/man/waybar-river-tags.5.scd b/man/waybar-river-tags.5.scd
+index 0f0272491..65b90332a 100644
+--- a/man/waybar-river-tags.5.scd
++++ b/man/waybar-river-tags.5.scd
+@@ -15,7 +15,7 @@ Addressed by *river/tags*
+ *num-tags*: ++
+ typeof: uint ++
+ default: 9 ++
+- The number of tags that should be displayed.
++ The number of tags that should be displayed. Max 32.
+
+ *tag-labels*: ++
+ typeof: array ++
+@@ -34,8 +34,10 @@ Addressed by *river/tags*
+ - *#tags button*
+ - *#tags button.occupied*
+ - *#tags button.focused*
++- *#tags button.urgent*
+
+-Note that a tag can be both occupied and focused at the same time.
++Note that occupied/focused/urgent status may overlap. That is, a tag may be
++both occupied and focused at the same time.
+
+ # SEE ALSO
+
+diff --git a/protocol/river-status-unstable-v1.xml b/protocol/river-status-unstable-v1.xml
+index a4d6f4e57..13affaa77 100644
+--- a/protocol/river-status-unstable-v1.xml
++++ b/protocol/river-status-unstable-v1.xml
+@@ -1,7 +1,7 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+ <protocol name="river_status_unstable_v1">
+ <copyright>
+- Copyright 2020 Isaac Freund
++ Copyright 2020 The River Developers
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+@@ -16,7 +16,7 @@
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ </copyright>
+
+- <interface name="zriver_status_manager_v1" version="1">
++ <interface name="zriver_status_manager_v1" version="2">
+ <description summary="manage river status objects">
+ A global factory for objects that receive status information specific
+ to river. It could be used to implement, for example, a status bar.
+@@ -47,7 +47,7 @@
+ </request>
+ </interface>
+
+- <interface name="zriver_output_status_v1" version="1">
++ <interface name="zriver_output_status_v1" version="2">
+ <description summary="track output tags and focus">
+ This interface allows clients to receive information about the current
+ windowing state of an output.
+@@ -75,12 +75,21 @@
+ </description>
+ <arg name="tags" type="array" summary="array of 32-bit bitfields"/>
+ </event>
++
++ <event name="urgent_tags" since="2">
++ <description summary="tags of the output with an urgent view">
++ Sent once on binding the interface and again whenever the set of
++ tags with at least one urgent view changes.
++ </description>
++ <arg name="tags" type="uint" summary="32-bit bitfield"/>
++ </event>
+ </interface>
+
+ <interface name="zriver_seat_status_v1" version="1">
+ <description summary="track seat focus">
+ This interface allows clients to receive information about the current
+- focus of a seat.
++ focus of a seat. Note that (un)focused_output events will only be sent
++ if the client has bound the relevant wl_output globals.
+ </description>
+
+ <request name="destroy" type="destrucor">
+diff --git a/src/modules/river/tags.cpp b/src/modules/river/tags.cpp
+index e96b20169..2628af2db 100644
+--- a/src/modules/river/tags.cpp
++++ b/src/modules/river/tags.cpp
+@@ -22,14 +22,24 @@ static void listen_view_tags(void *data, struct zriver_output_status_v1 *zriver_
+ static_cast<Tags *>(data)->handle_view_tags(tags);
+ }
+
++static void listen_urgent_tags(void *data, struct zriver_output_status_v1 *zriver_output_status_v1,
++ uint32_t tags) {
++ static_cast<Tags *>(data)->handle_urgent_tags(tags);
++}
++
+ static const zriver_output_status_v1_listener output_status_listener_impl{
+ .focused_tags = listen_focused_tags,
+ .view_tags = listen_view_tags,
++ .urgent_tags = listen_urgent_tags,
+ };
+
+ static void handle_global(void *data, struct wl_registry *registry, uint32_t name,
+ const char *interface, uint32_t version) {
+ if (std::strcmp(interface, zriver_status_manager_v1_interface.name) == 0) {
++ version = std::min<uint32_t>(version, 2);
++ if (version < ZRIVER_OUTPUT_STATUS_V1_URGENT_TAGS_SINCE_VERSION) {
++ spdlog::warn("river server does not support urgent tags");
++ }
+ static_cast<Tags *>(data)->status_manager_ = static_cast<struct zriver_status_manager_v1 *>(
+ wl_registry_bind(registry, name, &zriver_status_manager_v1_interface, version));
+ }
+@@ -64,8 +74,9 @@ Tags::Tags(const std::string &id, const waybar::Bar &bar, const Json::Value &con
+ }
+ event_box_.add(box_);
+
+- // Default to 9 tags
+- const uint32_t num_tags = config["num-tags"].isUInt() ? config_["num-tags"].asUInt() : 9;
++ // Default to 9 tags, cap at 32
++ const uint32_t num_tags =
++ config["num-tags"].isUInt() ? std::min<uint32_t>(32, config_["num-tags"].asUInt()) : 9;
+
+ std::vector<std::string> tag_labels(num_tags);
+ for (uint32_t tag = 0; tag < num_tags; ++tag) {
+@@ -129,4 +140,16 @@ void Tags::handle_view_tags(struct wl_array *view_tags) {
+ }
+ }
+
++void Tags::handle_urgent_tags(uint32_t tags) {
++ uint32_t i = 0;
++ for (auto &button : buttons_) {
++ if ((1 << i) & tags) {
++ button.get_style_context()->add_class("urgent");
++ } else {
++ button.get_style_context()->remove_class("urgent");
++ }
++ ++i;
++ }
++}
++
+ } /* namespace waybar::modules::river */
+
diff --git a/srcpkgs/Waybar/template b/srcpkgs/Waybar/template
index ac01043daa5f..23d5b8221e13 100644
--- a/srcpkgs/Waybar/template
+++ b/srcpkgs/Waybar/template
@@ -1,10 +1,8 @@
# Template file for 'Waybar'
pkgname=Waybar
version=0.9.8
-revision=1
+revision=2
_date_version=3.0.0
-create_wrksrc=yes
-build_wrksrc=${pkgname}-${version}
build_style=meson
configure_args="-Dgtk-layer-shell=enabled -Dlibudev=enabled -Dman-pages=enabled
-Dsystemd=disabled -Drfkill=enabled
@@ -43,7 +41,7 @@ desc_option_dbusmenugtk="Enable support for tray"
desc_option_mpd="Enable support for MPD"
post_extract() {
- mv date-${_date_version} ${build_wrksrc}/subprojects/
+ mv ../date-${_date_version} subprojects/
}
post_install() {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PR PATCH] [Merged]: Waybar: add support for river urgent tags
2022-01-04 0:23 [PR PATCH] Waybar: add support for river urgent tags cinerea0
@ 2022-01-05 7:27 ` ericonr
0 siblings, 0 replies; 2+ messages in thread
From: ericonr @ 2022-01-05 7:27 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
There's a merged pull request on the void-packages repository
Waybar: add support for river urgent tags
https://github.com/void-linux/void-packages/pull/34839
Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-05 7:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 0:23 [PR PATCH] Waybar: add support for river urgent tags cinerea0
2022-01-05 7:27 ` [PR PATCH] [Merged]: " ericonr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).