From 2f6a70f34e9984b32b4ac9d9362b7031827215fb Mon Sep 17 00:00:00 2001 From: Moritz Jordan Date: Fri, 3 Jan 2020 15:46:59 +0100 Subject: [PATCH 01/27] man: document gtk-layer-shell configuration option --- man/waybar.5.scd | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/man/waybar.5.scd b/man/waybar.5.scd index 3278c636..72146359 100644 --- a/man/waybar.5.scd +++ b/man/waybar.5.scd @@ -66,6 +66,12 @@ Also a minimal example configuration can be found on the at the bottom of this m typeof: string ++ Optional name added as a CSS class, for styling multiple waybars. +*gtk-layer-shell* ++ + typeof: bool ++ + default: true ++ + Option to disable the use of gtk-layer-shell for popups. + Only functional if compiled with gtk-layer-shell support. + # MODULE FORMAT You can use PangoMarkupFormat (See https://developer.gnome.org/pango/stable/PangoMarkupFormat.html#PangoMarkupFormat). From f01ddb9ab39ced295aa5b612702537c83b6c5998 Mon Sep 17 00:00:00 2001 From: Moritz Jordan Date: Fri, 3 Jan 2020 15:50:05 +0100 Subject: [PATCH 02/27] man: clarify options for layer configuration --- man/waybar.5.scd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man/waybar.5.scd b/man/waybar.5.scd index 72146359..758d90a9 100644 --- a/man/waybar.5.scd +++ b/man/waybar.5.scd @@ -23,7 +23,8 @@ Also a minimal example configuration can be found on the at the bottom of this m *layer* ++ typeof: string ++ default: bottom ++ - Decide if the bar is displayed in front of the windows or behind them. + Decide if the bar is displayed in front (*top*) of the windows or behind (*bottom*) + them. *output* ++ typeof: string|array ++ From 4836333bffdaab998ace77730301e909de852ad4 Mon Sep 17 00:00:00 2001 From: Moritz Jordan Date: Sat, 4 Jan 2020 03:26:06 +0100 Subject: [PATCH 03/27] man: document family configuration option in network module --- man/waybar-network.5.scd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/man/waybar-network.5.scd b/man/waybar-network.5.scd index ed8451f4..248b8b33 100644 --- a/man/waybar-network.5.scd +++ b/man/waybar-network.5.scd @@ -21,6 +21,11 @@ Addressed by *network* default: 60 ++ The interval in which the network information gets polled (e.g. signal strength). +*family*: ++ + typeof: string ++ + default: *ipv4* ++ + The address family that is used for the format replacement {ipaddr} and to determine if a network connection is present. + *format*: ++ typeof: string ++ default: *{ifname}* ++ From 173a7bb8cdd32e6e3d4d662d5bf7293ab24490f7 Mon Sep 17 00:00:00 2001 From: Moritz Jordan Date: Sat, 4 Jan 2020 04:31:24 +0100 Subject: [PATCH 04/27] man: fix layout in battery module --- man/waybar-battery.5.scd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/man/waybar-battery.5.scd b/man/waybar-battery.5.scd index 94a99e4f..81ee22dd 100644 --- a/man/waybar-battery.5.scd +++ b/man/waybar-battery.5.scd @@ -37,32 +37,32 @@ The *battery* module displays the current capacity and state (eg. charging) of y default: {H} h {M} min ++ The format, how the time should be displayed. -*format-icons* - typeof: array/object +*format-icons*: ++ + typeof: array/object ++ Based on the current capacity, the corresponding icon gets selected. ++ The order is *low* to *high*. Or by the state if it is an object. -*max-length* ++ +*max-length*: ++ typeof: integer++ The maximum length in character the module should display. -*rotate* ++ +*rotate*: ++ typeof: integer++ Positive value to rotate the text label. -*on-click* ++ +*on-click*: ++ typeof: string ++ Command to execute when clicked on the module. -*on-click-right* ++ +*on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. -*on-scroll-up* ++ +*on-scroll-up*: ++ typeof: string ++ Command to execute when scrolling up on the module. -*on-scroll-down* ++ +*on-scroll-down*: ++ typeof: string ++ Command to execute when scrolling down on the module. From 1125119dc695d5daf1864f7fd5213bde5332997b Mon Sep 17 00:00:00 2001 From: Moritz Jordan Date: Sat, 4 Jan 2020 04:33:04 +0100 Subject: [PATCH 05/27] man: add icon and format-icon to network module --- man/waybar-network.5.scd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/man/waybar-network.5.scd b/man/waybar-network.5.scd index 248b8b33..b06cbaed 100644 --- a/man/waybar-network.5.scd +++ b/man/waybar-network.5.scd @@ -47,6 +47,11 @@ Addressed by *network* typeof: string ++ This format is used when the displayed interface is disconnected. +*format-icons*: ++ + typeof: array/object ++ + Based on the current signal strength, the corresponding icon gets selected. ++ + The order is *low* to *high*. Or by the state if it is an object. + *rotate*: ++ typeof: integer ++ Positive value to rotate the text label. @@ -122,6 +127,8 @@ Addressed by *network* *{bandwidthDownOctets}*: Instant down speed in octets/seconds. +*{icon}*: Icon, as defined in *format-icons*. + # EXAMPLES ``` From 1f379fa5f6afdc8682517e1e62fdd352a8254130 Mon Sep 17 00:00:00 2001 From: gammafn Date: Sun, 5 Jan 2020 10:22:52 -0600 Subject: [PATCH 06/27] Don't specify WindowId property https://github.com/Alexays/Waybar/pull/536#issuecomment-570847035 --- protocol/dbus-status-notifier-item.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol/dbus-status-notifier-item.xml b/protocol/dbus-status-notifier-item.xml index e46eb3c6..c33cd846 100644 --- a/protocol/dbus-status-notifier-item.xml +++ b/protocol/dbus-status-notifier-item.xml @@ -31,7 +31,9 @@ + @@ -44,4 +46,4 @@ - \ No newline at end of file + From 1145788ab34b728940d255305585890b83dc9b10 Mon Sep 17 00:00:00 2001 From: Moritz Jordan Date: Sat, 4 Jan 2020 03:11:34 +0100 Subject: [PATCH 07/27] fix(network): display of IPv6 address --- src/modules/network.cpp | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/modules/network.cpp b/src/modules/network.cpp index a332d5a2..f9146c75 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -439,7 +439,6 @@ out: } void waybar::modules::Network::getInterfaceAddress() { - unsigned int cidrRaw; struct ifaddrs *ifaddr, *ifa; cidr_ = 0; int success = getifaddrs(&ifaddr); @@ -451,18 +450,34 @@ void waybar::modules::Network::getInterfaceAddress() { if (ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == family_ && ifa->ifa_name == ifname_) { char ipaddr[INET6_ADDRSTRLEN]; - ipaddr_ = inet_ntop(family_, - &reinterpret_cast(ifa->ifa_addr)->sin_addr, - ipaddr, - INET6_ADDRSTRLEN); char netmask[INET6_ADDRSTRLEN]; - auto net_addr = reinterpret_cast(ifa->ifa_netmask); - netmask_ = inet_ntop(family_, &net_addr->sin_addr, netmask, INET6_ADDRSTRLEN); - cidrRaw = net_addr->sin_addr.s_addr; unsigned int cidr = 0; - while (cidrRaw) { - cidr += cidrRaw & 1; - cidrRaw >>= 1; + if (family_ == AF_INET) { + ipaddr_ = inet_ntop(AF_INET, + &reinterpret_cast(ifa->ifa_addr)->sin_addr, + ipaddr, + INET_ADDRSTRLEN); + auto net_addr = reinterpret_cast(ifa->ifa_netmask); + netmask_ = inet_ntop(AF_INET, &net_addr->sin_addr, netmask, INET_ADDRSTRLEN); + unsigned int cidrRaw = net_addr->sin_addr.s_addr; + while (cidrRaw) { + cidr += cidrRaw & 1; + cidrRaw >>= 1; + } + } else { + ipaddr_ = inet_ntop(AF_INET6, + &reinterpret_cast(ifa->ifa_addr)->sin6_addr, + ipaddr, + INET6_ADDRSTRLEN); + auto net_addr = reinterpret_cast(ifa->ifa_netmask); + netmask_ = inet_ntop(AF_INET6, &net_addr->sin6_addr, netmask, INET6_ADDRSTRLEN); + for (size_t i = 0; i < sizeof(net_addr->sin6_addr.s6_addr); ++i) { + unsigned char cidrRaw = net_addr->sin6_addr.s6_addr[i]; + while (cidrRaw) { + cidr += cidrRaw & 1; + cidrRaw >>= 1; + } + } } cidr_ = cidr; break; From f6864e4a43b09d77eda317990cd200e902983c06 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:11:22 -0800 Subject: [PATCH 08/27] Update waybar-memory.5.scd --- man/waybar-memory.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-memory.5.scd b/man/waybar-memory.5.scd index a9dfb3ab..70718e14 100644 --- a/man/waybar-memory.5.scd +++ b/man/waybar-memory.5.scd @@ -38,6 +38,10 @@ Addressed by *memory* typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From c41cedd40761b1422b0e9b2f49a97508ac7f9125 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:14:33 -0800 Subject: [PATCH 09/27] Update waybar-mpd.5.scd --- man/waybar-mpd.5.scd | 124 ++++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/man/waybar-mpd.5.scd b/man/waybar-mpd.5.scd index 155e7b30..598cbc63 100644 --- a/man/waybar-mpd.5.scd +++ b/man/waybar-mpd.5.scd @@ -13,110 +13,114 @@ The *mpd* module displays information about a running "Music Player Daemon" inst Addressed by *mpd* *server*: ++ - typeof: string ++ - The network address or Unix socket path of the MPD server. If empty, connect to the default host. + typeof: string ++ + The network address or Unix socket path of the MPD server. If empty, connect to the default host. *port*: ++ - typeof: integer ++ - The port MPD listens to. If empty, use the default port. + typeof: integer ++ + The port MPD listens to. If empty, use the default port. *interval*: ++ - typeof: integer++ - default: 5 ++ - The interval in which the connection to the MPD server is retried + typeof: integer++ + default: 5 ++ + The interval in which the connection to the MPD server is retried *timeout*: ++ - typeof: integer++ - default: 30 ++ - The timeout for the connection. Change this if your MPD server has a low `connection_timeout` setting + typeof: integer++ + default: 30 ++ + The timeout for the connection. Change this if your MPD server has a low `connection_timeout` setting *unknown-tag*: ++ - typeof: string ++ - default: "N/A" ++ - The text to display when a tag is not present in the current song, but used in `format` + typeof: string ++ + default: "N/A" ++ + The text to display when a tag is not present in the current song, but used in `format` *format*: ++ - typeof: string ++ - default: "{album} - {artist} - {title}" ++ - Information displayed when a song is playing or paused + typeof: string ++ + default: "{album} - {artist} - {title}" ++ + Information displayed when a song is playing or paused *format-stopped*: ++ - typeof: string ++ - default: "stopped" ++ - Information displayed when the player is stopped. + typeof: string ++ + default: "stopped" ++ + Information displayed when the player is stopped. *format-disconnected*: ++ - typeof: string ++ - default: "disconnected" ++ - Information displayed when the MPD server can't be reached. + typeof: string ++ + default: "disconnected" ++ + Information displayed when the MPD server can't be reached. *tooltip*: ++ - typeof: bool ++ - default: true ++ - Option to disable tooltip on hover. + typeof: bool ++ + default: true ++ + Option to disable tooltip on hover. *tooltip-format*: ++ - typeof: string ++ - default: "MPD (connected)" ++ - Tooltip information displayed when connected to MPD. + typeof: string ++ + default: "MPD (connected)" ++ + Tooltip information displayed when connected to MPD. *tooltip-format-disconnected*: ++ - typeof: string ++ - default: "MPD (disconnected)" ++ - Tooltip information displayed when the MPD server can't be reached. + typeof: string ++ + default: "MPD (disconnected)" ++ + Tooltip information displayed when the MPD server can't be reached. *rotate*: ++ - typeof: integer ++ - Positive value to rotate the text label. + typeof: integer ++ + Positive value to rotate the text label. *max-length*: ++ - typeof: integer ++ - The maximum length in character the module should display. + typeof: integer ++ + The maximum length in character the module should display. *on-click*: ++ - typeof: string ++ - Command to execute when clicked on the module. + typeof: string ++ + Command to execute when clicked on the module. + +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. *on-click-right*: ++ - typeof: string ++ - Command to execute when you right clicked on the module. + typeof: string ++ + Command to execute when you right clicked on the module. *on-scroll-up*: ++ - typeof: string ++ - Command to execute when scrolling up on the module. + typeof: string ++ + Command to execute when scrolling up on the module. *on-scroll-down*: ++ - typeof: string ++ - Command to execute when scrolling down on the module. + typeof: string ++ + Command to execute when scrolling down on the module. *smooth-scrolling-threshold*: ++ - typeof: double ++ - Threshold to be used when scrolling. + typeof: double ++ + Threshold to be used when scrolling. *state-icons*: ++ - typeof: object ++ - default: {} ++ - Icon to show depending on the play/pause state of the player (*{ "playing": "...", "paused": "..." }*) + typeof: object ++ + default: {} ++ + Icon to show depending on the play/pause state of the player (*{ "playing": "...", "paused": "..." }*) *consume-icons*: ++ - typeof: object ++ - default: {} ++ - Icon to show depending on the "consume" option (*{ "on": "...", "off": "..." }*) + typeof: object ++ + default: {} ++ + Icon to show depending on the "consume" option (*{ "on": "...", "off": "..." }*) *random-icons*: ++ - typeof: object ++ - default: {} ++ - Icon to show depending on the "random" option (*{ "on": "...", "off": "..." }*) + typeof: object ++ + default: {} ++ + Icon to show depending on the "random" option (*{ "on": "...", "off": "..." }*) *repeat-icons*: ++ - typeof: object ++ - default: {} ++ - Icon to show depending on the "repeat" option (*{ "on": "...", "off": "..." }*) + typeof: object ++ + default: {} ++ + Icon to show depending on the "repeat" option (*{ "on": "...", "off": "..." }*) *single-icons*: ++ - typeof: object ++ - default: {} ++ - Icon to show depending on the "single" option (*{ "on": "...", "off": "..." }*) + typeof: object ++ + default: {} ++ + Icon to show depending on the "single" option (*{ "on": "...", "off": "..." }*) # FORMAT REPLACEMENTS From e8f2bd3ad10c1bc8787d78474f2b74380d6f5573 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:19:11 -0800 Subject: [PATCH 10/27] Update waybar-backlight.5.scd --- man/waybar-backlight.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-backlight.5.scd b/man/waybar-backlight.5.scd index 2d971997..5f2bb82b 100644 --- a/man/waybar-backlight.5.scd +++ b/man/waybar-backlight.5.scd @@ -36,6 +36,10 @@ The *backlight* module displays the current backlight level. typeof: string ++ Command to execute when the module is clicked. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right* ++ typeof: string ++ Command to execute when the module is right clicked. From 4d7e19ae665b4cd2e9c94db2797e7392b04945d9 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:19:45 -0800 Subject: [PATCH 11/27] Update waybar-battery.5.scd --- man/waybar-battery.5.scd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/man/waybar-battery.5.scd b/man/waybar-battery.5.scd index 81ee22dd..f96f85cb 100644 --- a/man/waybar-battery.5.scd +++ b/man/waybar-battery.5.scd @@ -54,7 +54,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y typeof: string ++ Command to execute when clicked on the module. -*on-click-right*: ++ +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + +*on-click-right* ++ typeof: string ++ Command to execute when you right clicked on the module. From de3be8b2ab56e7afa04a5c09ec7386ec7a612dd1 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:20:18 -0800 Subject: [PATCH 12/27] Update waybar-clock.5.scd --- man/waybar-clock.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-clock.5.scd b/man/waybar-clock.5.scd index d979a673..959ec94b 100644 --- a/man/waybar-clock.5.scd +++ b/man/waybar-clock.5.scd @@ -32,6 +32,10 @@ The *clock* module displays the current date and time. typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From 443281f0bc473e14395dcdf00f883cd26a6f282d Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:20:29 -0800 Subject: [PATCH 13/27] Update waybar-cpu.5.scd --- man/waybar-cpu.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-cpu.5.scd b/man/waybar-cpu.5.scd index e4e52504..27dde96f 100644 --- a/man/waybar-cpu.5.scd +++ b/man/waybar-cpu.5.scd @@ -36,6 +36,10 @@ The *cpu* module displays the current cpu utilization. typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From abeb406166a1ba6c2f2eb336c1a136c6df241955 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:21:03 -0800 Subject: [PATCH 14/27] Update waybar-custom.5.scd --- man/waybar-custom.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-custom.5.scd b/man/waybar-custom.5.scd index a427be38..0ae7f4cd 100644 --- a/man/waybar-custom.5.scd +++ b/man/waybar-custom.5.scd @@ -59,6 +59,10 @@ Addressed by *custom/* typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From 01b85273337944a710877ed2ef5ac0f4440b1cbb Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:21:14 -0800 Subject: [PATCH 15/27] Update waybar-disk.5.scd --- man/waybar-disk.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-disk.5.scd b/man/waybar-disk.5.scd index 2a69cf49..25d00b1c 100644 --- a/man/waybar-disk.5.scd +++ b/man/waybar-disk.5.scd @@ -39,6 +39,10 @@ Addressed by *disk* typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From 1d087f96bd35352cf45877a3089940ecdfa59a54 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:21:25 -0800 Subject: [PATCH 16/27] Update waybar-idle-inhibitor.5.scd --- man/waybar-idle-inhibitor.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-idle-inhibitor.5.scd b/man/waybar-idle-inhibitor.5.scd index 74e21928..1fba291e 100644 --- a/man/waybar-idle-inhibitor.5.scd +++ b/man/waybar-idle-inhibitor.5.scd @@ -31,6 +31,10 @@ screensaving, also known as "presentation mode". typeof: string ++ Command to execute when clicked on the module. A click also toggles the state +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From 9602360d2823627da250a5043ad6f5249027ae7d Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:21:45 -0800 Subject: [PATCH 17/27] Update waybar-network.5.scd --- man/waybar-network.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-network.5.scd b/man/waybar-network.5.scd index b06cbaed..a557aa32 100644 --- a/man/waybar-network.5.scd +++ b/man/waybar-network.5.scd @@ -64,6 +64,10 @@ Addressed by *network* typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From abcac464fae1b31db078ef67625682aabd1acf50 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:21:59 -0800 Subject: [PATCH 18/27] Update waybar-pulseaudio.5.scd --- man/waybar-pulseaudio.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-pulseaudio.5.scd b/man/waybar-pulseaudio.5.scd index 2b117782..7640c706 100644 --- a/man/waybar-pulseaudio.5.scd +++ b/man/waybar-pulseaudio.5.scd @@ -59,6 +59,10 @@ Additionally you can control the volume by scrolling *up* or *down* while the cu typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From ee0db260213b2da620c538ad1d4a49a408781038 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:22:36 -0800 Subject: [PATCH 19/27] Update waybar-sway-mode.5.scd --- man/waybar-sway-mode.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-sway-mode.5.scd b/man/waybar-sway-mode.5.scd index 64d9a3e8..85a25d13 100644 --- a/man/waybar-sway-mode.5.scd +++ b/man/waybar-sway-mode.5.scd @@ -29,6 +29,10 @@ Addressed by *sway/mode* typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From 33798c31d04ff065028cf94ce9b13a387f09a8df Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:22:53 -0800 Subject: [PATCH 20/27] Update waybar-sway-window.5.scd --- man/waybar-sway-window.5.scd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/waybar-sway-window.5.scd b/man/waybar-sway-window.5.scd index 75a974c4..6a9d4e31 100644 --- a/man/waybar-sway-window.5.scd +++ b/man/waybar-sway-window.5.scd @@ -29,6 +29,10 @@ Addressed by *sway/window* typeof: string ++ Command to execute when clicked on the module. +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. + *on-click-right*: ++ typeof: string ++ Command to execute when you right clicked on the module. From 35f7fdf684ed43d7fc5da191c3c100d7612de9b5 Mon Sep 17 00:00:00 2001 From: fuzxi <33790641+fuzxi@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:24:33 -0800 Subject: [PATCH 21/27] Update waybar-temperature.5.scd --- man/waybar-temperature.5.scd | 70 +++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/man/waybar-temperature.5.scd b/man/waybar-temperature.5.scd index 8177969e..437cd29d 100644 --- a/man/waybar-temperature.5.scd +++ b/man/waybar-temperature.5.scd @@ -13,67 +13,71 @@ The *temperature* module displays the current temperature from a thermal zone. Addressed by *temperature* *thermal-zone*: ++ - typeof: integer ++ - The thermal zone, as in */sys/class/thermal/*. + typeof: integer ++ + The thermal zone, as in */sys/class/thermal/*. *hwmon-path*: ++ - typeof: string ++ - The temperature path to use, e.g. */sys/class/hwmon/hwmon2/temp1_input* instead of one in */sys/class/thermal/*. + typeof: string ++ + The temperature path to use, e.g. */sys/class/hwmon/hwmon2/temp1_input* instead of one in */sys/class/thermal/*. *critical-threshold*: ++ - typeof: integer ++ - The threshold before it is considered critical (Celcius). + typeof: integer ++ + The threshold before it is considered critical (Celcius). *interval*: ++ - typeof: integer ++ - default: 10 ++ - The interval in which the information gets polled. + typeof: integer ++ + default: 10 ++ + The interval in which the information gets polled. *format-critical*: ++ - typeof: string ++ - The format to use when temperature is considered critical + typeof: string ++ + The format to use when temperature is considered critical *format*: ++ - typeof: string ++ - default: {temperatureC}°C ++ - The format (Celcius/Farenheit) in which the temperature should be displayed. + typeof: string ++ + default: {temperatureC}°C ++ + The format (Celcius/Farenheit) in which the temperature should be displayed. *format-icons*: ++ - typeof: array ++ - Based on the current temperature (Celcius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*. + typeof: array ++ + Based on the current temperature (Celcius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*. *rotate*: ++ - typeof: integer ++ - Positive value to rotate the text label. + typeof: integer ++ + Positive value to rotate the text label. *max-length*: ++ - typeof: integer ++ - The maximum length in characters the module should display. + typeof: integer ++ + The maximum length in characters the module should display. *on-click*: ++ - typeof: string ++ - Command to execute when you clicked on the module. + typeof: string ++ + Command to execute when you clicked on the module. + +*on-click-middle*: ++ + typeof: string ++ + Command to execute when middle-clicked on the module using mousewheel. *on-click-right*: ++ - typeof: string ++ - Command to execute when you right clicked on the module. + typeof: string ++ + Command to execute when you right clicked on the module. *on-scroll-up*: ++ - typeof: string ++ - Command to execute when scrolling up on the module. + typeof: string ++ + Command to execute when scrolling up on the module. *on-scroll-down*: ++ - typeof: string ++ - Command to execute when scrolling down on the module. + typeof: string ++ + Command to execute when scrolling down on the module. *smooth-scrolling-threshold*: ++ - typeof: double ++ - Threshold to be used when scrolling. + typeof: double ++ + Threshold to be used when scrolling. *tooltip*: ++ - typeof: bool ++ - default: true ++ - Option to disable tooltip on hover. + typeof: bool ++ + default: true ++ + Option to disable tooltip on hover. # FORMAT REPLACEMENTS From 75c6e2e7d53b5d2a7efbae38b6cf1225d446aee4 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Tue, 15 Oct 2019 09:24:04 -0700 Subject: [PATCH 22/27] mpd: add paused format string --- include/modules/mpd.hpp | 1 + man/waybar-mpd.5.scd | 6 +++++- src/modules/mpd.cpp | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/modules/mpd.hpp b/include/modules/mpd.hpp index d69618a9..d08b28b2 100644 --- a/include/modules/mpd.hpp +++ b/include/modules/mpd.hpp @@ -36,6 +36,7 @@ class MPD : public ALabel { bool stopped(); bool playing(); + bool paused(); const std::string module_name_; diff --git a/man/waybar-mpd.5.scd b/man/waybar-mpd.5.scd index 598cbc63..fc3b1b36 100644 --- a/man/waybar-mpd.5.scd +++ b/man/waybar-mpd.5.scd @@ -38,13 +38,17 @@ Addressed by *mpd* *format*: ++ typeof: string ++ default: "{album} - {artist} - {title}" ++ - Information displayed when a song is playing or paused + Information displayed when a song is playing. *format-stopped*: ++ typeof: string ++ default: "stopped" ++ Information displayed when the player is stopped. +*format-paused*: ++ + typeof: string ++ + This format is used when a song is paused. + *format-disconnected*: ++ typeof: string ++ default: "disconnected" ++ diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index 7bad855b..13ab9f0d 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -140,7 +140,9 @@ void waybar::modules::MPD::setLabel() { if (playing()) { label_.get_style_context()->add_class("playing"); label_.get_style_context()->remove_class("paused"); - } else { + } else if (paused()) { + format = + config_["format-paused"].isString() ? config_["format-paused"].asString() : config_["format"].asString(); label_.get_style_context()->add_class("paused"); label_.get_style_context()->remove_class("playing"); } @@ -346,3 +348,5 @@ bool waybar::modules::MPD::stopped() { } bool waybar::modules::MPD::playing() { return connection_ != nullptr && state_ == MPD_STATE_PLAY; } + +bool waybar::modules::MPD::paused() { return connection_ != nullptr && state_ == MPD_STATE_PAUSE; } From 129713fe1b8986fb4722b8e439b16508f063b3e7 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Tue, 7 Jan 2020 20:27:31 +0100 Subject: [PATCH 23/27] fix(network): add missing include Fixes: ../src/modules/network.cpp:68:3: error: 'assert' was not declared in this scope 68 | assert(starts_with(read, category)); | ^~~~~~ ../src/modules/network.cpp:6:1: note: 'assert' is defined in header ''; did you forget to '#include '? 5 | #include "util/format.hpp" +++ |+#include 6 | --- src/modules/network.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/network.cpp b/src/modules/network.cpp index f9146c75..43f29f67 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "util/format.hpp" From 569f40de9bf31d67a1c7f733146d2ab7ae7d6326 Mon Sep 17 00:00:00 2001 From: Louis des Landes Date: Thu, 9 Jan 2020 16:59:45 +1030 Subject: [PATCH 24/27] Keep aspect ratio when scaling tray icons. --- src/modules/sni/item.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index bcc66e22..b298e442 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -265,7 +265,11 @@ void Item::updateImage() { if (pixbuf->gobj() != nullptr) { // An icon specified by path and filename may be the wrong size for // the tray - pixbuf = pixbuf->scale_simple(icon_size, icon_size, Gdk::InterpType::INTERP_BILINEAR); + // Keep the aspect ratio and scale to make the height equal to icon_size + // If people have non square icons, assume they want it to grow in width not height + int width = icon_size * pixbuf->get_width() / pixbuf->get_height(); + + pixbuf = pixbuf->scale_simple(width, icon_size, Gdk::InterpType::INTERP_BILINEAR); image.set(pixbuf); } } else { From 8fb3211594ced057025d2b8a9acc1b63a27cb388 Mon Sep 17 00:00:00 2001 From: PlusMinus0 Date: Mon, 13 Jan 2020 11:18:19 +0100 Subject: [PATCH 25/27] Use PA_PROP_DEVICE_FORM_FACTOR for device icon. --- include/modules/pulseaudio.hpp | 1 + src/modules/pulseaudio.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/modules/pulseaudio.hpp b/include/modules/pulseaudio.hpp index d575f627..ba5a2aaf 100644 --- a/include/modules/pulseaudio.hpp +++ b/include/modules/pulseaudio.hpp @@ -34,6 +34,7 @@ class Pulseaudio : public ALabel { pa_cvolume pa_volume_; bool muted_; std::string port_name_; + std::string form_factor_; std::string desc_; std::string monitor_; // SOURCE diff --git a/src/modules/pulseaudio.cpp b/src/modules/pulseaudio.cpp index ef2bc273..eb05b8c7 100644 --- a/src/modules/pulseaudio.cpp +++ b/src/modules/pulseaudio.cpp @@ -158,6 +158,9 @@ void waybar::modules::Pulseaudio::sinkInfoCb(pa_context * /*context*/, const pa_ pa->desc_ = i->description; pa->monitor_ = i->monitor_source_name; pa->port_name_ = i->active_port != nullptr ? i->active_port->name : "Unknown"; + if (auto ff = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_FORM_FACTOR)) { + pa->form_factor_ = ff; + } pa->dp.emit(); } } @@ -185,7 +188,7 @@ static const std::array ports = { }; const std::string waybar::modules::Pulseaudio::getPortIcon() const { - std::string nameLC = port_name_; + std::string nameLC = port_name_ + form_factor_; std::transform(nameLC.begin(), nameLC.end(), nameLC.begin(), ::tolower); for (auto const &port : ports) { if (nameLC.find(port) != std::string::npos) { From f80270519b55d7b12d06538df5d989c615eea1df Mon Sep 17 00:00:00 2001 From: Aleksei Bavshin Date: Mon, 13 Jan 2020 23:27:57 -0800 Subject: [PATCH 26/27] refactor(client): use std::list to store outputs std::unique_ptr is not required here as the only benefit it gives is stability of address on vector resize and it's easy to invalidate it accidentaly. std::list provides the same guarantee of stable addresses of the elements and correct destruction while avoiding smart pointer overhead. Also fixes #554, caused by incorrect usage of std::remove_if. --- include/client.hpp | 16 ++++++++-------- src/client.cpp | 42 +++++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/include/client.hpp b/include/client.hpp index 65a814fc..39b6ae3b 100644 --- a/include/client.hpp +++ b/include/client.hpp @@ -30,12 +30,12 @@ class Client { const std::string &style) const; void bindInterfaces(); const std::string getValidPath(const std::vector &paths) const; - void handleOutput(std::unique_ptr &output); - bool isValidOutput(const Json::Value &config, std::unique_ptr &output); + void handleOutput(struct waybar_output &output); + bool isValidOutput(const Json::Value &config, struct waybar_output &output); auto setupConfig(const std::string &config_file) -> void; auto setupCss(const std::string &css_file) -> void; - std::unique_ptr &getOutput(void *); - std::vector getOutputConfigs(std::unique_ptr &output); + struct waybar_output &getOutput(void *); + std::vector getOutputConfigs(struct waybar_output &output); static void handleGlobal(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version); @@ -44,10 +44,10 @@ class Client { void handleMonitorAdded(Glib::RefPtr monitor); void handleMonitorRemoved(Glib::RefPtr monitor); - Json::Value config_; - Glib::RefPtr style_context_; - Glib::RefPtr css_provider_; - std::vector> outputs_; + Json::Value config_; + Glib::RefPtr style_context_; + Glib::RefPtr css_provider_; + std::list outputs_; }; } // namespace waybar diff --git a/src/client.cpp b/src/client.cpp index dd4cd50e..f7c70e06 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -49,7 +49,7 @@ void waybar::Client::handleGlobalRemove(void * data, struct wl_registry * /*re // Nothing here } -void waybar::Client::handleOutput(std::unique_ptr &output) { +void waybar::Client::handleOutput(struct waybar_output &output) { static const struct zxdg_output_v1_listener xdgOutputListener = { .logical_position = [](void *, struct zxdg_output_v1 *, int32_t, int32_t) {}, .logical_size = [](void *, struct zxdg_output_v1 *, int32_t, int32_t) {}, @@ -58,42 +58,39 @@ void waybar::Client::handleOutput(std::unique_ptr &output) .description = [](void *, struct zxdg_output_v1 *, const char *) {}, }; // owned by output->monitor; no need to destroy - auto wl_output = gdk_wayland_monitor_get_wl_output(output->monitor->gobj()); - output->xdg_output.reset(zxdg_output_manager_v1_get_xdg_output(xdg_output_manager, wl_output)); - zxdg_output_v1_add_listener(output->xdg_output.get(), &xdgOutputListener, output.get()); + auto wl_output = gdk_wayland_monitor_get_wl_output(output.monitor->gobj()); + output.xdg_output.reset(zxdg_output_manager_v1_get_xdg_output(xdg_output_manager, wl_output)); + zxdg_output_v1_add_listener(output.xdg_output.get(), &xdgOutputListener, &output); } -bool waybar::Client::isValidOutput(const Json::Value & config, - std::unique_ptr &output) { +bool waybar::Client::isValidOutput(const Json::Value &config, struct waybar_output &output) { bool found = true; if (config["output"].isArray()) { bool in_array = false; for (auto const &output_conf : config["output"]) { - if (output_conf.isString() && output_conf.asString() == output->name) { + if (output_conf.isString() && output_conf.asString() == output.name) { in_array = true; break; } } found = in_array; } - if (config["output"].isString() && config["output"].asString() != output->name) { + if (config["output"].isString() && config["output"].asString() != output.name) { found = false; } return found; } -std::unique_ptr &waybar::Client::getOutput(void *addr) { - auto it = std::find_if(outputs_.begin(), outputs_.end(), [&addr](const auto &output) { - return output.get() == addr; - }); +struct waybar::waybar_output &waybar::Client::getOutput(void *addr) { + auto it = std::find_if( + outputs_.begin(), outputs_.end(), [&addr](const auto &output) { return &output == addr; }); if (it == outputs_.end()) { throw std::runtime_error("Unable to find valid output"); } return *it; } -std::vector waybar::Client::getOutputConfigs( - std::unique_ptr &output) { +std::vector waybar::Client::getOutputConfigs(struct waybar_output &output) { std::vector configs; if (config_.isArray()) { for (auto const &config : config_) { @@ -112,18 +109,18 @@ void waybar::Client::handleOutputName(void * data, struct zxdg_output_v1 * auto client = waybar::Client::inst(); try { auto &output = client->getOutput(data); - output->name = name; + output.name = name; spdlog::debug("Output detected: {} ({} {})", name, - output->monitor->get_manufacturer(), - output->monitor->get_model()); + output.monitor->get_manufacturer(), + output.monitor->get_model()); auto configs = client->getOutputConfigs(output); if (configs.empty()) { - output->xdg_output.reset(); + output.xdg_output.reset(); } else { wl_display_roundtrip(client->wl_display); for (const auto &config : configs) { - client->bars.emplace_back(std::make_unique(output.get(), config)); + client->bars.emplace_back(std::make_unique(&output, config)); Glib::RefPtr screen = client->bars.back()->window.get_screen(); client->style_context_->add_provider_for_screen( screen, client->css_provider_, GTK_STYLE_PROVIDER_PRIORITY_USER); @@ -135,7 +132,8 @@ void waybar::Client::handleOutputName(void * data, struct zxdg_output_v1 * } void waybar::Client::handleMonitorAdded(Glib::RefPtr monitor) { - auto &output = outputs_.emplace_back(new struct waybar_output({monitor})); + auto &output = outputs_.emplace_back(); + output.monitor = monitor; handleOutput(output); } @@ -151,9 +149,7 @@ void waybar::Client::handleMonitorRemoved(Glib::RefPtr monitor) { ++it; } } - std::remove_if(outputs_.begin(), outputs_.end(), [&monitor](const auto &output) { - return output->monitor == monitor; - }); + outputs_.remove_if([&monitor](const auto &output) { return output.monitor == monitor; }); } std::tuple waybar::Client::getConfigs( From 99dde1aff8db2d77a7b351985233c98c5f5cd377 Mon Sep 17 00:00:00 2001 From: Thomas Wucher Date: Thu, 16 Jan 2020 11:09:32 +0100 Subject: [PATCH 27/27] Download patch files from Github instead of wrapdb Currently wrapdb.mesonbuild.com is offline and its not clear when it will be up again. Github seems to be the more reliable source for these files. --- subprojects/fmt.wrap | 2 +- subprojects/spdlog.wrap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap index b60b22a4..eb79283c 100644 --- a/subprojects/fmt.wrap +++ b/subprojects/fmt.wrap @@ -5,6 +5,6 @@ source_url = https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz source_filename = fmt-5.3.0.tar.gz source_hash = defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89 -patch_url = https://wrapdb.mesonbuild.com/v1/projects/fmt/5.3.0/1/get_zip +patch_url = https://github.com/mesonbuild/fmt/releases/download/5.3.0-1/fmt.zip patch_filename = fmt-5.3.0-1-wrap.zip patch_hash = 18f21a3b8833949c35d4ac88a7059577d5fa24b98786e4b1b2d3d81bb811440f \ No newline at end of file diff --git a/subprojects/spdlog.wrap b/subprojects/spdlog.wrap index 9dac4d8d..750036b9 100644 --- a/subprojects/spdlog.wrap +++ b/subprojects/spdlog.wrap @@ -5,6 +5,6 @@ source_url = https://github.com/gabime/spdlog/archive/v1.3.1.tar.gz source_filename = v1.3.1.tar.gz source_hash = 160845266e94db1d4922ef755637f6901266731c4cb3b30b45bf41efa0e6ab70 -patch_url = https://wrapdb.mesonbuild.com/v1/projects/spdlog/1.3.1/1/get_zip +patch_url = https://github.com/mesonbuild/spdlog/releases/download/1.3.1-1/spdlog.zip patch_filename = spdlog-1.3.1-1-wrap.zip patch_hash = 715a0229781019b853d409cc0bf891ee4b9d3a17bec0cf87f4ad30b28bbecc87