Merge branch 'master' into river-tags-monitor-focus

This commit is contained in:
lilly-lizard
2024-11-29 17:36:20 +13:00
74 changed files with 488 additions and 108 deletions
+1
View File
@@ -8,6 +8,7 @@ on:
jobs: jobs:
build-and-push: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'Alexays/Waybar'
strategy: strategy:
fail-fast: false # don't fail the other jobs if one of the images fails to build fail-fast: false # don't fail the other jobs if one of the images fails to build
matrix: matrix:
@@ -9,6 +9,7 @@ on:
jobs: jobs:
lockfile: lockfile:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name != 'schedule' || github.repository == 'Alexays/Waybar'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
Generated
+3 -3
View File
@@ -18,11 +18,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1724819573, "lastModified": 1730200266,
"narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd",
"type": "github" "type": "github"
}, },
"original": { "original": {
+3
View File
@@ -23,6 +23,8 @@ class AModule : public IModule {
/// Emitting on this dispatcher triggers a update() call /// Emitting on this dispatcher triggers a update() call
Glib::Dispatcher dp; Glib::Dispatcher dp;
bool expandEnabled() const;
protected: protected:
// Don't need to make an object directly // Don't need to make an object directly
// Derived classes are able to use it // Derived classes are able to use it
@@ -50,6 +52,7 @@ class AModule : public IModule {
private: private:
bool handleUserEvent(GdkEventButton *const &ev); bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip; const bool isTooltip;
const bool isExpand;
bool hasUserEvents_; bool hasUserEvents_;
std::vector<int> pid_; std::vector<int> pid_;
gdouble distance_scrolled_y_; gdouble distance_scrolled_y_;
+1 -1
View File
@@ -42,7 +42,7 @@ struct bar_margins {
}; };
struct bar_mode { struct bar_mode {
std::optional<bar_layer> layer; bar_layer layer;
bool exclusive; bool exclusive;
bool passthrough; bool passthrough;
bool visible; bool visible;
+1
View File
@@ -39,6 +39,7 @@ class Cava final : public ALabel {
std::chrono::seconds suspend_silence_delay_{0}; std::chrono::seconds suspend_silence_delay_{0};
bool silence_{false}; bool silence_{false};
bool hide_on_silence_{false}; bool hide_on_silence_{false};
std::string format_silent_{""};
int sleep_counter_{0}; int sleep_counter_{0};
// Cava method // Cava method
void pause_resume(); void pause_resume();
+1
View File
@@ -18,6 +18,7 @@ class Temperature : public ALabel {
private: private:
float getTemperature(); float getTemperature();
bool isCritical(uint16_t); bool isCritical(uint16_t);
bool isWarning(uint16_t);
std::string file_path_; std::string file_path_;
util::SleeperThread thread_; util::SleeperThread thread_;
+2
View File
@@ -38,6 +38,8 @@ class AudioBackend {
std::string desc_; std::string desc_;
std::string monitor_; std::string monitor_;
std::string current_sink_name_; std::string current_sink_name_;
std::string default_sink_name;
bool default_sink_running_;
bool current_sink_running_; bool current_sink_running_;
// SOURCE // SOURCE
uint32_t source_idx_{0}; uint32_t source_idx_{0};
+5
View File
@@ -31,6 +31,11 @@ The brightness can be controlled by dragging the slider across the bar or clicki
typeof: string ++ typeof: string ++
The name of the preferred device to control. If left empty, a device will be chosen automatically. The name of the preferred device to control. If left empty, a device will be chosen automatically.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
``` ```
+10
View File
@@ -81,6 +81,11 @@ The *backlight* module displays the current backlight level.
default: 1.0 ++ default: 1.0 ++
The speed at which to change the brightness when scrolling. The speed at which to change the brightness when scrolling.
*min-brightness*: ++
typeof: double ++
default: 0.0 ++
The minimum brightness of the backlight.
*menu*: ++ *menu*: ++
typeof: string ++ typeof: string ++
Action that popups the menu. Action that popups the menu.
@@ -94,6 +99,11 @@ The *backlight* module displays the current backlight level.
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLE: # EXAMPLE:
``` ```
+5
View File
@@ -122,6 +122,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{capacity}*: Capacity in percentage *{capacity}*: Capacity in percentage
+5
View File
@@ -142,6 +142,11 @@ Addressed by *bluetooth*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{status}*: Status of the bluetooth device. *{status}*: Status of the bluetooth device.
+9
View File
@@ -64,6 +64,10 @@ libcava lives in:
:[ bool :[ bool
:[ false :[ false
:[ Hides the widget if no input (after sleep_timer elapsed) :[ Hides the widget if no input (after sleep_timer elapsed)
|[ *format_silent*
:[ string
:[
:[ Widget's text after sleep_timer elapsed (hide_on_silence has to be false)
|[ *method* |[ *method*
:[ string :[ string
:[ pulse :[ pulse
@@ -196,3 +200,8 @@ In case when cava releases new version and you're wanna get it, it should be rai
} }
}, },
``` ```
# STYLE
- *#cava*
- *#cava.silent* Applied after no sound has been detected for sleep_timer seconds
- *#cava.updated* Applied when a new frame is shown
+5
View File
@@ -15,6 +15,11 @@ Addressed by *cffi/<name>*
typeof: string ++ typeof: string ++
The path to the dynamic library to load to control the widget. The path to the dynamic library to load to control the widget.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
Some additional configuration may be required depending on the cffi dynamic library being used. Some additional configuration may be required depending on the cffi dynamic library being used.
+4
View File
@@ -96,6 +96,10 @@ $XDG_CONFIG_HOME/waybar/config ++
:[ array :[ array
:[ :[
:[ The actions corresponding to the buttons of the menu. :[ The actions corresponding to the buttons of the menu.
|[ *expand*:
:[ bool
:[ false
:[ Enables this module to consume all left over space dynamically.
View all valid format options in *strftime(3)* or have a look https://en.cppreference.com/w/cpp/chrono/duration/formatter View all valid format options in *strftime(3)* or have a look https://en.cppreference.com/w/cpp/chrono/duration/formatter
+5
View File
@@ -82,6 +82,11 @@ The *cpu* module displays the current CPU utilization.
default: true ++ default: true ++
Option to disable tooltip on hover. Option to disable tooltip on hover.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{load}*: Current CPU load. *{load}*: Current CPU load.
+13 -8
View File
@@ -55,8 +55,8 @@ Addressed by *custom/<name>*
*format*: ++ *format*: ++
typeof: string ++ typeof: string ++
default: {} ++ default: {text} ++
The format, how information should be displayed. On {} data gets inserted. The format, how information should be displayed. On {text} data gets inserted.
*format-icons*: ++ *format-icons*: ++
typeof: array ++ typeof: array ++
@@ -138,6 +138,11 @@ Addressed by *custom/<name>*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# RETURN-TYPE # RETURN-TYPE
When *return-type* is set to *json*, Waybar expects the *exec*-script to output its data in JSON format. When *return-type* is set to *json*, Waybar expects the *exec*-script to output its data in JSON format.
@@ -160,7 +165,7 @@ $text\\n$tooltip\\n$class*
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{}*: Output of the script. *{text}*: Output of the script.
*{percentage}* Percentage which can be set via a json return type. *{percentage}* Percentage which can be set via a json return type.
@@ -172,7 +177,7 @@ $text\\n$tooltip\\n$class*
``` ```
"custom/spotify": { "custom/spotify": {
"format": " {}", "format": " {text}",
"max-length": 40, "max-length": 40,
"interval": 30, // Remove this if your script is endless and write in loop "interval": 30, // Remove this if your script is endless and write in loop
"exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder "exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder
@@ -185,7 +190,7 @@ $text\\n$tooltip\\n$class*
``` ```
"custom/mpd": { "custom/mpd": {
"format": "♪ {}", "format": "♪ {text}",
//"max-length": 15, //"max-length": 15,
"interval": 10, "interval": 10,
"exec": "mpc current", "exec": "mpc current",
@@ -199,7 +204,7 @@ $text\\n$tooltip\\n$class*
``` ```
"custom/cmus": { "custom/cmus": {
"format": "♪ {}", "format": "♪ {text}",
//"max-length": 15, //"max-length": 15,
"interval": 10, "interval": 10,
"exec": "cmus-remote -C \"format_print '%a - %t'\"", // artist - title "exec": "cmus-remote -C \"format_print '%a - %t'\"", // artist - title
@@ -214,7 +219,7 @@ $text\\n$tooltip\\n$class*
``` ```
"custom/pacman": { "custom/pacman": {
"format": "{} ", "format": "{text} ",
"interval": "once", "interval": "once",
"exec": "pacman_packages", "exec": "pacman_packages",
"on-click": "update-system", "on-click": "update-system",
@@ -226,7 +231,7 @@ $text\\n$tooltip\\n$class*
``` ```
"custom/pacman": { "custom/pacman": {
"format": "{} ", "format": "{text} ",
"interval": 3600, // every hour "interval": 3600, // every hour
"exec": "checkupdates | wc -l", // # of updates "exec": "checkupdates | wc -l", // # of updates
"exec-if": "exit 0", // always run; consider advanced run conditions "exec-if": "exit 0", // always run; consider advanced run conditions
+5
View File
@@ -106,6 +106,11 @@ Addressed by *disk*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{percentage_used}*: Percentage of disk in use. *{percentage_used}*: Percentage of disk in use.
+5
View File
@@ -26,6 +26,11 @@ Addressed by *dwl/tags*
default: false ++ default: false ++
If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled. If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLE # EXAMPLE
``` ```
+5
View File
@@ -84,6 +84,11 @@ Addressed by *dwl/window*
default: 24 ++ default: 24 ++
Option to change the size of the application icon. Option to change the size of the application icon.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{title}*: The title of the focused window. *{title}*: The title of the focused window.
+5
View File
@@ -61,6 +61,11 @@ Feral Gamemode optimizations.
default: 4 ++ default: 4 ++
Defines the spacing between the icon and the text. Defines the spacing between the icon and the text.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{glyph}*: The string icon glyph to use instead. *{glyph}*: The string icon glyph to use instead.
+5
View File
@@ -38,6 +38,11 @@ Addressed by *hyprland/language*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
+5
View File
@@ -93,6 +93,11 @@ Addressed by *hyprland/submap*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
+5
View File
@@ -35,6 +35,11 @@ Addressed by *hyprland/window*
default: 24 ++ default: 24 ++
Option to change the size of the application icon. Option to change the size of the application icon.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
See the output of "hyprctl clients" for examples See the output of "hyprctl clients" for examples
+5
View File
@@ -78,6 +78,11 @@ Addressed by *hyprland/workspaces*
If set to id, workspaces will sort by id. If set to id, workspaces will sort by id.
If none of those, workspaces will sort with default behavior. If none of those, workspaces will sort with default behavior.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{id}*: id of workspace assigned by compositor *{id}*: id of workspace assigned by compositor
+5
View File
@@ -102,6 +102,11 @@ screensaver, also known as "presentation mode".
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{status}*: status (*activated* or *deactivated*) *{status}*: status (*activated* or *deactivated*)
+5
View File
@@ -64,6 +64,11 @@ The *image* module displays an image from a path.
default: true ++ default: true ++
Option to enable tooltip on hover. Option to enable tooltip on hover.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# SCRIPT OUTPUT # SCRIPT OUTPUT
Similar to the *custom* module, output values of the script are *newline* separated. Similar to the *custom* module, output values of the script are *newline* separated.
+5
View File
@@ -89,6 +89,11 @@ See *systemd-inhibit*(1) for more information.
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{status}*: status (*activated* or *deactivated*) *{status}*: status (*activated* or *deactivated*)
+5
View File
@@ -98,6 +98,11 @@ Addressed by *jack*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{load}*: The current CPU load estimated by JACK. *{load}*: The current CPU load estimated by JACK.
+5
View File
@@ -53,6 +53,11 @@ You must be a member of the input group to use this module.
default: [58, 69, 70] ++ default: [58, 69, 70] ++
Customize the key to trigger this module, the key number can be found in /usr/include/linux/input-event-codes.h or running sudo libinput debug-events --show-keycodes. Customize the key to trigger this module, the key number can be found in /usr/include/linux/input-event-codes.h or running sudo libinput debug-events --show-keycodes.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{name}*: Caps, Num, or Scroll. *{name}*: Caps, Num, or Scroll.
+5
View File
@@ -97,6 +97,11 @@ Addressed by *memory*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{percentage}*: Percentage of memory in use. *{percentage}*: Percentage of memory in use.
+5
View File
@@ -175,6 +175,11 @@ Addressed by *mpd*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
## WHEN PLAYING/PAUSED ## WHEN PLAYING/PAUSED
+5
View File
@@ -148,6 +148,11 @@ The *mpris* module displays currently playing media via libplayerctl.
typeof: map[string]string ++ typeof: map[string]string ++
Allows setting _{status_icon}_ based on player status (playing, paused, stopped). Allows setting _{status_icon}_ based on player status (playing, paused, stopped).
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
+5
View File
@@ -142,6 +142,11 @@ Addressed by *network*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{ifname}*: Name of the network interface. *{ifname}*: Name of the network interface.
+5
View File
@@ -33,6 +33,11 @@ Addressed by *niri/language*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{short}*: Short name of layout (e.g. "us"). Equals to {}. *{short}*: Short name of layout (e.g. "us"). Equals to {}.
+5
View File
@@ -35,6 +35,11 @@ Addressed by *niri/window*
default: 24 ++ default: 24 ++
Option to change the size of the application icon. Option to change the size of the application icon.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
See the output of "niri msg windows" for examples See the output of "niri msg windows" for examples
+5
View File
@@ -45,6 +45,11 @@ Addressed by *niri/workspaces*
typeof: string ++ typeof: string ++
Command to execute when the module is updated. Command to execute when the module is updated.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{value}*: Name of the workspace, or index for unnamed workspaces, *{value}*: Name of the workspace, or index for unnamed workspaces,
+7
View File
@@ -35,6 +35,13 @@ $XDG_CONFIG_HOME/waybar/config
:[ object :[ object
:[ See default value in the example below. :[ See default value in the example below.
:[ Icons used to represent the various power-profile. *Note*: the default configuration uses the font-awesome icons. You may want to override it if you don't have this font installed on your system. :[ Icons used to represent the various power-profile. *Note*: the default configuration uses the font-awesome icons. You may want to override it if you don't have this font installed on your system.
|[ *expand*:
:[ bool
:[ false
:[ Enables this module to consume all left over space dynamically.
# CONFIGURATION EXAMPLES # CONFIGURATION EXAMPLES
+5
View File
@@ -32,6 +32,11 @@ the screen or playing audio.
Which privacy modules to monitor. See *MODULES CONFIGURATION* for++ Which privacy modules to monitor. See *MODULES CONFIGURATION* for++
more information. more information.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# MODULES CONFIGURATION # MODULES CONFIGURATION
*type*: ++ *type*: ++
+5
View File
@@ -27,6 +27,11 @@ The volume can be controlled by dragging the slider across the bar or clicking o
default: horizontal ++ default: horizontal ++
The orientation of the slider. Can be either `horizontal` or `vertical`. The orientation of the slider. Can be either `horizontal` or `vertical`.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
``` ```
+5
View File
@@ -126,6 +126,11 @@ Additionally, you can control the volume by scrolling *up* or *down* while the c
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{desc}*: Pulseaudio port's description, for bluetooth it'll be the device name. *{desc}*: Pulseaudio port's description, for bluetooth it'll be the device name.
+5
View File
@@ -64,6 +64,11 @@ Addressed by *river/layout*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLE # EXAMPLE
``` ```
+5
View File
@@ -78,6 +78,11 @@ Addressed by *river/mode*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
``` ```
+5
View File
@@ -26,6 +26,11 @@ Addressed by *river/tags*
default: false ++ default: false ++
If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled. If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLE # EXAMPLE
``` ```
+5
View File
@@ -62,6 +62,11 @@ Addressed by *river/window*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
``` ```
+5
View File
@@ -87,6 +87,11 @@ cursor is over the module, and clicking on the module toggles mute.
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{volume}*: Volume in percentage. *{volume}*: Volume in percentage.
+5
View File
@@ -45,6 +45,11 @@ Addressed by *sway/language*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{short}*: Short name of layout (e.g. "us"). Equals to {}. *{short}*: Short name of layout (e.g. "us"). Equals to {}.
+5
View File
@@ -83,6 +83,11 @@ Addressed by *sway/mode*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
``` ```
+5
View File
@@ -49,6 +49,11 @@ Addressed by *sway/scratchpad*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{icon}*: Icon, as defined in *format-icons*. *{icon}*: Icon, as defined in *format-icons*.
+5
View File
@@ -103,6 +103,11 @@ Addressed by *sway/window*
default: 24 ++ default: 24 ++
Option to change the size of the application icon. Option to change the size of the application icon.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{title}*: The title of the focused window. *{title}*: The title of the focused window.
+5
View File
@@ -99,6 +99,11 @@ warp-on-scroll: ++
default: " " ++ default: " " ++
The separator to be used between windows in a workspace. The separator to be used between windows in a workspace.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
+5
View File
@@ -49,6 +49,11 @@ Addressed by *systemd-failed-units*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{nr_failed_system}*: Number of failed units from systemwide (PID=1) systemd. *{nr_failed_system}*: Number of failed units from systemwide (PID=1) systemd.
+13
View File
@@ -31,6 +31,10 @@ Addressed by *temperature*
typeof: string ++ typeof: string ++
The temperature filename of your *hwmon-path-abs*, e.g. *temp1_input* The temperature filename of your *hwmon-path-abs*, e.g. *temp1_input*
*warning-threshold*: ++
typeof: integer ++
The threshold before it is considered warning (Celsius).
*critical-threshold*: ++ *critical-threshold*: ++
typeof: integer ++ typeof: integer ++
The threshold before it is considered critical (Celsius). The threshold before it is considered critical (Celsius).
@@ -40,6 +44,10 @@ Addressed by *temperature*
default: 10 ++ default: 10 ++
The interval in which the information gets polled. The interval in which the information gets polled.
*format-warning*: ++
typeof: string ++
The format to use when temperature is considered warning
*format-critical*: ++ *format-critical*: ++
typeof: string ++ typeof: string ++
The format to use when temperature is considered critical The format to use when temperature is considered critical
@@ -124,6 +132,11 @@ Addressed by *temperature*
typeof: array ++ typeof: array ++
The actions corresponding to the buttons of the menu. The actions corresponding to the buttons of the menu.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# FORMAT REPLACEMENTS # FORMAT REPLACEMENTS
*{temperatureC}*: Temperature in Celsius. *{temperatureC}*: Temperature in Celsius.
+5
View File
@@ -37,6 +37,11 @@ Addressed by *tray*
typeof: string ++ typeof: string ++
Command to execute when the module is updated. Command to execute when the module is updated.
*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
# EXAMPLES # EXAMPLES
``` ```
+33
View File
@@ -23,6 +23,21 @@ The visual display elements for waybar use a CSS stylesheet, see *waybar-styles(
# BAR CONFIGURATION # BAR CONFIGURATION
*expand-center* ++
typeof: bool ++
default: false ++
Enables the modules-center to consume all left over space dynamically.
*expand-left* ++
typeof: bool ++
default: false ++
Enables the modules-left to consume all left over space dynamically.
*expand-right* ++
typeof: bool ++
default: false ++
Enables the modules-left to consume all left over space dynamically.
*layer* ++ *layer* ++
typeof: string ++ typeof: string ++
default: bottom ++ default: bottom ++
@@ -68,6 +83,11 @@ The visual display elements for waybar use a CSS stylesheet, see *waybar-styles(
typeof: integer ++ typeof: integer ++
Margins value without units. Margins value without units.
*no-center* ++
typeof: bool ++
default: false ++
Option to disable the center modules fully usefull together with expand-\*.
*spacing* ++ *spacing* ++
typeof: integer ++ typeof: integer ++
Size of gaps in between the different modules. Size of gaps in between the different modules.
@@ -181,6 +201,19 @@ A minimal *config* file could look like this:
} }
``` ```
# SIGNALS
Waybar accepts the following signals:
*SIGUSR1*
Toggles the bar visibility (hides if shown, shows if hidden)
*SIGUSR2*
Reloads (resets) the bar
*SIGINT*
Quits the bar
For example, to toggle the bar programmatically, you can invoke `killall -SIGUSR1 waybar`.
# MULTI OUTPUT CONFIGURATION # MULTI OUTPUT CONFIGURATION
## Limit a configuration to some outputs ## Limit a configuration to some outputs
+2 -2
View File
@@ -106,7 +106,7 @@ if libsndio.found()
endif endif
endif endif
gtk_layer_shell = dependency('gtk-layer-shell-0', version: ['>=0.6.0'], gtk_layer_shell = dependency('gtk-layer-shell-0', version: ['>=0.9.0'],
default_options: ['introspection=false', 'vapi=false'], default_options: ['introspection=false', 'vapi=false'],
fallback: ['gtk-layer-shell', 'gtk_layer_shell']) fallback: ['gtk-layer-shell', 'gtk_layer_shell'])
systemd = dependency('systemd', required: get_option('systemd')) systemd = dependency('systemd', required: get_option('systemd'))
@@ -482,7 +482,7 @@ if get_option('experimental')
endif endif
cava = dependency('cava', cava = dependency('cava',
version : '>=0.10.2', version : '>=0.10.3',
required: get_option('cava'), required: get_option('cava'),
fallback : ['cava', 'cava_dep'], fallback : ['cava', 'cava_dep'],
not_found_message: 'cava is not found. Building waybar without cava') not_found_message: 'cava is not found. Building waybar without cava')
+5 -2
View File
@@ -5,12 +5,12 @@
}: }:
let let
libcava = rec { libcava = rec {
version = "0.10.2"; version = "0.10.3";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "LukashonakV"; owner = "LukashonakV";
repo = "cava"; repo = "cava";
rev = version; rev = version;
hash = "sha256-jU7RQV2txruu/nUUl0TzjK4nai7G38J1rcTjO7UXumY="; hash = "sha256-ZDFbI69ECsUTjbhlw2kHRufZbQMu+FQSMmncCJ5pagg=";
}; };
}; };
in in
@@ -25,6 +25,9 @@ in
mesonFlags = lib.remove "-Dgtk-layer-shell=enabled" oldAttrs.mesonFlags; mesonFlags = lib.remove "-Dgtk-layer-shell=enabled" oldAttrs.mesonFlags;
# downstream patch should not affect upstream
patches = [];
buildInputs = (builtins.filter (p: p.pname != "wireplumber") oldAttrs.buildInputs) ++ [ buildInputs = (builtins.filter (p: p.pname != "wireplumber") oldAttrs.buildInputs) ++ [
pkgs.wireplumber pkgs.wireplumber
]; ];
+1 -1
View File
@@ -189,7 +189,7 @@
"on-click": "pavucontrol" "on-click": "pavucontrol"
}, },
"custom/media": { "custom/media": {
"format": "{icon} {}", "format": "{icon} {text}",
"return-type": "json", "return-type": "json",
"max-length": 40, "max-length": 40,
"format-icons": { "format-icons": {
+9
View File
@@ -154,6 +154,15 @@ void AAppIconLabel::updateAppIcon() {
update_app_icon_ = false; update_app_icon_ = false;
if (app_icon_name_.empty()) { if (app_icon_name_.empty()) {
image_.set_visible(false); image_.set_visible(false);
} else if (app_icon_name_.front() == '/') {
auto pixbuf = Gdk::Pixbuf::create_from_file(app_icon_name_);
int scaled_icon_size = app_icon_size_ * image_.get_scale_factor();
pixbuf = Gdk::Pixbuf::create_from_file(app_icon_name_, scaled_icon_size, scaled_icon_size);
auto surface = Gdk::Cairo::create_surface_from_pixbuf(pixbuf, image_.get_scale_factor(),
image_.get_window());
image_.set(surface);
image_.set_visible(true);
} else { } else {
image_.set_from_icon_name(app_icon_name_, Gtk::ICON_SIZE_INVALID); image_.set_from_icon_name(app_icon_name_, Gtk::ICON_SIZE_INVALID);
image_.set_visible(true); image_.set_visible(true);
+2
View File
@@ -15,6 +15,7 @@ AModule::AModule(const Json::Value& config, const std::string& name, const std::
: name_(name), : name_(name),
config_(config), config_(config),
isTooltip{config_["tooltip"].isBool() ? config_["tooltip"].asBool() : true}, isTooltip{config_["tooltip"].isBool() ? config_["tooltip"].asBool() : true},
isExpand{config_["expand"].isBool() ? config_["expand"].asBool() : false},
distance_scrolled_y_(0.0), distance_scrolled_y_(0.0),
distance_scrolled_x_(0.0) { distance_scrolled_x_(0.0) {
// Configure module action Map // Configure module action Map
@@ -273,6 +274,7 @@ bool AModule::handleScroll(GdkEventScroll* e) {
} }
bool AModule::tooltipEnabled() const { return isTooltip; } bool AModule::tooltipEnabled() const { return isTooltip; }
bool AModule::expandEnabled() const { return isExpand; }
AModule::operator Gtk::Widget&() { return event_box_; } AModule::operator Gtk::Widget&() { return event_box_; }
+43 -19
View File
@@ -37,19 +37,19 @@ const Bar::bar_mode_map Bar::PRESET_MODES = { //
.visible = true}}, .visible = true}},
{"hide", {"hide",
{// {//
.layer = bar_layer::TOP, .layer = bar_layer::OVERLAY,
.exclusive = false, .exclusive = false,
.passthrough = false, .passthrough = false,
.visible = true}}, .visible = true}},
{"invisible", {"invisible",
{// {//
.layer = std::nullopt, .layer = bar_layer::BOTTOM,
.exclusive = false, .exclusive = false,
.passthrough = true, .passthrough = true,
.visible = false}}, .visible = false}},
{"overlay", {"overlay",
{// {//
.layer = bar_layer::TOP, .layer = bar_layer::OVERLAY,
.exclusive = false, .exclusive = false,
.passthrough = true, .passthrough = true,
.visible = true}}}; .visible = true}}};
@@ -59,7 +59,7 @@ const std::string Bar::MODE_INVISIBLE = "invisible";
const std::string_view DEFAULT_BAR_ID = "bar-0"; const std::string_view DEFAULT_BAR_ID = "bar-0";
/* Deserializer for enum bar_layer */ /* Deserializer for enum bar_layer */
void from_json(const Json::Value& j, std::optional<bar_layer>& l) { void from_json(const Json::Value& j, bar_layer& l) {
if (j == "bottom") { if (j == "bottom") {
l = bar_layer::BOTTOM; l = bar_layer::BOTTOM;
} else if (j == "top") { } else if (j == "top") {
@@ -132,6 +132,7 @@ void from_json(const Json::Value& j, std::map<Key, Value>& m) {
waybar::Bar::Bar(struct waybar_output* w_output, const Json::Value& w_config) waybar::Bar::Bar(struct waybar_output* w_output, const Json::Value& w_config)
: output(w_output), : output(w_output),
config(w_config), config(w_config),
surface(nullptr),
window{Gtk::WindowType::WINDOW_TOPLEVEL}, window{Gtk::WindowType::WINDOW_TOPLEVEL},
x_global(0), x_global(0),
y_global(0), y_global(0),
@@ -316,13 +317,13 @@ void waybar::Bar::setMode(const std::string& mode) {
void waybar::Bar::setMode(const struct bar_mode& mode) { void waybar::Bar::setMode(const struct bar_mode& mode) {
auto* gtk_window = window.gobj(); auto* gtk_window = window.gobj();
if (mode.layer == bar_layer::BOTTOM) { auto layer = GTK_LAYER_SHELL_LAYER_BOTTOM;
gtk_layer_set_layer(gtk_window, GTK_LAYER_SHELL_LAYER_BOTTOM); if (mode.layer == bar_layer::TOP) {
} else if (mode.layer == bar_layer::TOP) { layer = GTK_LAYER_SHELL_LAYER_TOP;
gtk_layer_set_layer(gtk_window, GTK_LAYER_SHELL_LAYER_TOP);
} else if (mode.layer == bar_layer::OVERLAY) { } else if (mode.layer == bar_layer::OVERLAY) {
gtk_layer_set_layer(gtk_window, GTK_LAYER_SHELL_LAYER_OVERLAY); layer = GTK_LAYER_SHELL_LAYER_OVERLAY;
} }
gtk_layer_set_layer(gtk_window, layer);
if (mode.exclusive) { if (mode.exclusive) {
gtk_layer_auto_exclusive_zone_enable(gtk_window); gtk_layer_auto_exclusive_zone_enable(gtk_window);
@@ -339,6 +340,13 @@ void waybar::Bar::setMode(const struct bar_mode& mode) {
window.get_style_context()->add_class("hidden"); window.get_style_context()->add_class("hidden");
window.set_opacity(0); window.set_opacity(0);
} }
/*
* All the changes above require `wl_surface_commit`.
* gtk-layer-shell schedules a commit on the next frame event in GTK, but this could fail in
* certain scenarios, such as fully occluded bar.
*/
gtk_layer_try_force_commit(gtk_window);
wl_display_flush(Client::inst()->wl_display);
} }
void waybar::Bar::setPassThrough(bool passthrough) { void waybar::Bar::setPassThrough(bool passthrough) {
@@ -526,13 +534,22 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos,
auto waybar::Bar::setupWidgets() -> void { auto waybar::Bar::setupWidgets() -> void {
window.add(box_); window.add(box_);
box_.pack_start(left_, false, false);
if (config["fixed-center"].isBool() ? config["fixed-center"].asBool() : true) { bool expand_left = config["expand-left"].isBool() ? config["expand-left"].asBool() : false;
box_.set_center_widget(center_); bool expand_center = config["expand-center"].isBool() ? config["expand-center"].asBool() : false;
} else { bool expand_right = config["expand-right"].isBool() ? config["expand-right"].asBool() : false;
box_.pack_start(center_, true, false); bool no_center = config["no-center"].isBool() ? config["no-center"].asBool() : false;
box_.pack_start(left_, expand_left, expand_left);
if (!no_center) {
if (config["fixed-center"].isBool() ? config["fixed-center"].asBool() : true) {
box_.set_center_widget(center_);
} else {
spdlog::error("No fixed center_");
box_.pack_start(center_, true, expand_center);
}
} }
box_.pack_end(right_, false, false); box_.pack_end(right_, expand_right, expand_right);
// Convert to button code for every module that is used. // Convert to button code for every module that is used.
setupAltFormatKeyForModuleList("modules-left"); setupAltFormatKeyForModuleList("modules-left");
@@ -541,14 +558,21 @@ auto waybar::Bar::setupWidgets() -> void {
Factory factory(*this, config); Factory factory(*this, config);
getModules(factory, "modules-left"); getModules(factory, "modules-left");
getModules(factory, "modules-center"); if (!no_center) {
getModules(factory, "modules-center");
}
getModules(factory, "modules-right"); getModules(factory, "modules-right");
for (auto const& module : modules_left_) { for (auto const& module : modules_left_) {
left_.pack_start(*module, false, false); left_.pack_start(*module, module->expandEnabled(), module->expandEnabled());
} }
for (auto const& module : modules_center_) {
center_.pack_start(*module, false, false); if (!no_center) {
for (auto const& module : modules_center_) {
center_.pack_start(*module, false, false);
}
} }
std::reverse(modules_right_.begin(), modules_right_.end()); std::reverse(modules_right_.begin(), modules_right_.end());
for (auto const& module : modules_right_) { for (auto const& module : modules_right_) {
right_.pack_end(*module, false, false); right_.pack_end(*module, false, false);
+4
View File
@@ -107,6 +107,10 @@ int main(int argc, char* argv[]) {
ret = client->main(argc, argv); ret = client->main(argc, argv);
} while (reload); } while (reload);
std::signal(SIGUSR1, SIG_IGN);
std::signal(SIGUSR2, SIG_IGN);
std::signal(SIGINT, SIG_IGN);
delete client; delete client;
return ret; return ret;
} catch (const std::exception& e) { } catch (const std::exception& e) {
+8
View File
@@ -112,6 +112,14 @@ bool waybar::modules::Backlight::handleScroll(GdkEventScroll *e) {
step = config_["scroll-step"].asDouble(); step = config_["scroll-step"].asDouble();
} }
double min_brightness = 0;
if (config_["min-brightness"].isDouble()) {
min_brightness = config_["min-brightness"].asDouble();
}
if (backend.get_scaled_brightness(preferred_device_) <= min_brightness &&
ct == util::ChangeType::Decrease) {
return true;
}
backend.set_brightness(preferred_device_, ct, step); backend.set_brightness(preferred_device_, ct, step);
return true; return true;
+11 -1
View File
@@ -59,6 +59,7 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
if (config_["input_delay"].isInt()) if (config_["input_delay"].isInt())
fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt()); fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt());
if (config_["hide_on_silence"].isBool()) hide_on_silence_ = config_["hide_on_silence"].asBool(); if (config_["hide_on_silence"].isBool()) hide_on_silence_ = config_["hide_on_silence"].asBool();
if (config_["format_silent"].isString()) format_silent_ = config_["format_silent"].asString();
// Make cava parameters configuration // Make cava parameters configuration
plan_ = new cava::cava_plan{}; plan_ = new cava::cava_plan{};
@@ -172,10 +173,19 @@ auto waybar::modules::Cava::update() -> void {
label_.set_markup(text_); label_.set_markup(text_);
label_.show(); label_.show();
ALabel::update(); ALabel::update();
label_.get_style_context()->add_class("updated");
} }
label_.get_style_context()->remove_class("silent");
} else { } else {
upThreadDelay(frame_time_milsec_, suspend_silence_delay_); upThreadDelay(frame_time_milsec_, suspend_silence_delay_);
if (hide_on_silence_) label_.hide(); if (hide_on_silence_)
label_.hide();
else if (config_["format_silent"].isString())
label_.set_markup(format_silent_);
label_.get_style_context()->add_class("silent");
label_.get_style_context()->remove_class("updated");
} }
} }
+1
View File
@@ -24,6 +24,7 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
m_tlpFmt_{(config_["tooltip-format"].isString()) ? config_["tooltip-format"].asString() : ""}, m_tlpFmt_{(config_["tooltip-format"].isString()) ? config_["tooltip-format"].asString() : ""},
m_tooltip_{new Gtk::Label()}, m_tooltip_{new Gtk::Label()},
cldInTooltip_{m_tlpFmt_.find("{" + kCldPlaceholder + "}") != std::string::npos}, cldInTooltip_{m_tlpFmt_.find("{" + kCldPlaceholder + "}") != std::string::npos},
cldYearShift_{January / 1 / 1900},
tzInTooltip_{m_tlpFmt_.find("{" + kTZPlaceholder + "}") != std::string::npos}, tzInTooltip_{m_tlpFmt_.find("{" + kTZPlaceholder + "}") != std::string::npos},
tzCurrIdx_{0}, tzCurrIdx_{0},
ordInTooltip_{m_tlpFmt_.find("{" + kOrdPlaceholder + "}") != std::string::npos} { ordInTooltip_{m_tlpFmt_.find("{" + kOrdPlaceholder + "}") != std::string::npos} {
+43 -34
View File
@@ -159,43 +159,52 @@ auto waybar::modules::Custom::update() -> void {
parseOutputRaw(); parseOutputRaw();
} }
auto str = fmt::format(fmt::runtime(format_), text_, fmt::arg("alt", alt_), try {
fmt::arg("icon", getIcon(percentage_, alt_)), auto str = fmt::format(fmt::runtime(format_), fmt::arg("text", text_), fmt::arg("alt", alt_),
fmt::arg("percentage", percentage_)); fmt::arg("icon", getIcon(percentage_, alt_)),
if ((config_["hide-empty-text"].asBool() && text_.empty()) || str.empty()) { fmt::arg("percentage", percentage_));
event_box_.hide(); if ((config_["hide-empty-text"].asBool() && text_.empty()) || str.empty()) {
} else { event_box_.hide();
label_.set_markup(str); } else {
if (tooltipEnabled()) { label_.set_markup(str);
if (tooltip_format_enabled_) { if (tooltipEnabled()) {
auto tooltip = config_["tooltip-format"].asString(); if (tooltip_format_enabled_) {
tooltip = fmt::format(fmt::runtime(tooltip), text_, fmt::arg("alt", alt_), auto tooltip = config_["tooltip-format"].asString();
fmt::arg("icon", getIcon(percentage_, alt_)), tooltip = fmt::format(
fmt::arg("percentage", percentage_)); fmt::runtime(tooltip), fmt::arg("text", text_), fmt::arg("alt", alt_),
label_.set_tooltip_markup(tooltip); fmt::arg("icon", getIcon(percentage_, alt_)), fmt::arg("percentage", percentage_));
} else if (text_ == tooltip_) { label_.set_tooltip_markup(tooltip);
if (label_.get_tooltip_markup() != str) { } else if (text_ == tooltip_) {
label_.set_tooltip_markup(str); if (label_.get_tooltip_markup() != str) {
} label_.set_tooltip_markup(str);
} else { }
if (label_.get_tooltip_markup() != tooltip_) { } else {
label_.set_tooltip_markup(tooltip_); if (label_.get_tooltip_markup() != tooltip_) {
label_.set_tooltip_markup(tooltip_);
}
} }
} }
auto style = label_.get_style_context();
auto classes = style->list_classes();
for (auto const& c : classes) {
if (c == id_) continue;
style->remove_class(c);
}
for (auto const& c : class_) {
style->add_class(c);
}
style->add_class("flat");
style->add_class("text-button");
style->add_class(MODULE_CLASS);
event_box_.show();
} }
auto style = label_.get_style_context(); } catch (const fmt::format_error& e) {
auto classes = style->list_classes(); if (std::strcmp(e.what(), "cannot switch from manual to automatic argument indexing") != 0)
for (auto const& c : classes) { throw;
if (c == id_) continue;
style->remove_class(c); throw fmt::format_error(
} "mixing manual and automatic argument indexing is no longer supported; "
for (auto const& c : class_) { "try replacing \"{}\" with \"{text}\" in your format specifier");
style->add_class(c);
}
style->add_class("flat");
style->add_class("text-button");
style->add_class(MODULE_CLASS);
event_box_.show();
} }
} }
// Call parent update // Call parent update
+3
View File
@@ -18,6 +18,9 @@ namespace waybar::modules::hyprland {
std::filesystem::path IPC::socketFolder_; std::filesystem::path IPC::socketFolder_;
std::filesystem::path IPC::getSocketFolder(const char* instanceSig) { std::filesystem::path IPC::getSocketFolder(const char* instanceSig) {
static std::mutex folderMutex;
std::unique_lock lock(folderMutex);
// socket path, specified by EventManager of Hyprland // socket path, specified by EventManager of Hyprland
if (!socketFolder_.empty()) { if (!socketFolder_.empty()) {
return socketFolder_; return socketFolder_;
-6
View File
@@ -191,12 +191,6 @@ void Window::queryActiveWorkspace() {
solo_ = true; solo_ = true;
} }
// Grouped windows have a tab bar and therefore don't look fullscreen or solo
if (windowData_.grouped) {
fullscreen_ = false;
solo_ = false;
}
if (solo_) { if (solo_) {
soloClass_ = windowData_.class_name; soloClass_ = windowData_.class_name;
} else { } else {
+9 -14
View File
@@ -104,11 +104,9 @@ void Item::proxyReady(Glib::RefPtr<Gio::AsyncResult>& result) {
this->updateImage(); this->updateImage();
} catch (const Glib::Error& err) { } catch (const Glib::Error& err) {
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, err.what());
std::string(err.what()));
} catch (const std::exception& err) { } catch (const std::exception& err) {
spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, spdlog::error("Failed to create DBus Proxy for {} {}: {}", bus_name, object_path, err.what());
std::string(err.what()));
} }
} }
@@ -126,15 +124,14 @@ ToolTip get_variant<ToolTip>(const Glib::VariantBase& value) {
result.text = get_variant<Glib::ustring>(container.get_child(2)); result.text = get_variant<Glib::ustring>(container.get_child(2));
auto description = get_variant<Glib::ustring>(container.get_child(3)); auto description = get_variant<Glib::ustring>(container.get_child(3));
if (!description.empty()) { if (!description.empty()) {
result.text = fmt::format("<b>{}</b>\n{}", std::string(result.text), std::string(description)); result.text = fmt::format("<b>{}</b>\n{}", result.text, description);
} }
return result; return result;
} }
void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) { void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
try { try {
spdlog::trace("Set tray item property: {}.{} = {}", id.empty() ? bus_name : id, spdlog::trace("Set tray item property: {}.{} = {}", id.empty() ? bus_name : id, name, value);
std::string(name), get_variant<std::string>(value));
if (name == "Category") { if (name == "Category") {
category = get_variant<std::string>(value); category = get_variant<std::string>(value);
@@ -179,12 +176,10 @@ void Item::setProperty(const Glib::ustring& name, Glib::VariantBase& value) {
} }
} catch (const Glib::Error& err) { } catch (const Glib::Error& err) {
spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}", spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}",
id.empty() ? bus_name : id, std::string(name), get_variant<std::string>(value), id.empty() ? bus_name : id, name, value, err.what());
std::string(err.what()));
} catch (const std::exception& err) { } catch (const std::exception& err) {
spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}", spdlog::warn("Failed to set tray item property: {}.{}, value = {}, err = {}",
id.empty() ? bus_name : id, std::string(name), get_variant<std::string>(value), id.empty() ? bus_name : id, name, value, err.what());
std::string(err.what()));
} }
} }
@@ -226,9 +221,9 @@ void Item::processUpdatedProperties(Glib::RefPtr<Gio::AsyncResult>& _result) {
this->updateImage(); this->updateImage();
} catch (const Glib::Error& err) { } catch (const Glib::Error& err) {
spdlog::warn("Failed to update properties: {}", std::string(err.what())); spdlog::warn("Failed to update properties: {}", err.what());
} catch (const std::exception& err) { } catch (const std::exception& err) {
spdlog::warn("Failed to update properties: {}", std::string(err.what())); spdlog::warn("Failed to update properties: {}", err.what());
} }
update_pending_.clear(); update_pending_.clear();
} }
@@ -250,7 +245,7 @@ static const std::map<std::string_view, std::set<std::string_view>> signal2props
void Item::onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name, void Item::onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments) { const Glib::VariantContainerBase& arguments) {
spdlog::trace("Tray item '{}' got signal {}", id, std::string(signal_name)); spdlog::trace("Tray item '{}' got signal {}", id, signal_name);
auto changed = signal2props.find(signal_name.raw()); auto changed = signal2props.find(signal_name.raw());
if (changed != signal2props.end()) { if (changed != signal2props.end()) {
if (update_pending_.empty()) { if (update_pending_.empty()) {
+10
View File
@@ -69,12 +69,17 @@ auto waybar::modules::Temperature::update() -> void {
uint16_t temperature_f = std::round(temperature * 1.8 + 32); uint16_t temperature_f = std::round(temperature * 1.8 + 32);
uint16_t temperature_k = std::round(temperature + 273.15); uint16_t temperature_k = std::round(temperature + 273.15);
auto critical = isCritical(temperature_c); auto critical = isCritical(temperature_c);
auto warning = isWarning(temperature_c);
auto format = format_; auto format = format_;
if (critical) { if (critical) {
format = config_["format-critical"].isString() ? config_["format-critical"].asString() : format; format = config_["format-critical"].isString() ? config_["format-critical"].asString() : format;
label_.get_style_context()->add_class("critical"); label_.get_style_context()->add_class("critical");
} else if (warning) {
format = config_["format-warning"].isString() ? config_["format-warning"].asString() : format;
label_.get_style_context()->add_class("warning");
} else { } else {
label_.get_style_context()->remove_class("critical"); label_.get_style_context()->remove_class("critical");
label_.get_style_context()->remove_class("warning");
} }
if (format.empty()) { if (format.empty()) {
@@ -135,6 +140,11 @@ float waybar::modules::Temperature::getTemperature() {
#endif #endif
} }
bool waybar::modules::Temperature::isWarning(uint16_t temperature_c) {
return config_["warning-threshold"].isInt() &&
temperature_c >= config_["warning-threshold"].asInt();
}
bool waybar::modules::Temperature::isCritical(uint16_t temperature_c) { bool waybar::modules::Temperature::isCritical(uint16_t temperature_c) {
return config_["critical-threshold"].isInt() && return config_["critical-threshold"].isInt() &&
temperature_c >= config_["critical-threshold"].asInt(); temperature_c >= config_["critical-threshold"].asInt();
+19 -3
View File
@@ -1,9 +1,12 @@
#include "util/audio_backend.hpp" #include "util/audio_backend.hpp"
#include <fmt/core.h> #include <fmt/core.h>
#include <pulse/def.h>
#include <pulse/error.h> #include <pulse/error.h>
#include <pulse/introspect.h>
#include <pulse/subscribe.h> #include <pulse/subscribe.h>
#include <pulse/volume.h> #include <pulse/volume.h>
#include <spdlog/spdlog.h>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
@@ -139,6 +142,10 @@ void AudioBackend::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, i
void *data) { void *data) {
if (i == nullptr) return; if (i == nullptr) return;
auto running = i->state == PA_SINK_RUNNING;
auto idle = i->state == PA_SINK_IDLE;
spdlog::trace("Sink name {} Running:[{}] Idle:[{}]", i->name, running, idle);
auto *backend = static_cast<AudioBackend *>(data); auto *backend = static_cast<AudioBackend *>(data);
if (!backend->ignored_sinks_.empty()) { if (!backend->ignored_sinks_.empty()) {
@@ -155,11 +162,19 @@ void AudioBackend::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, i
} }
} }
if (backend->current_sink_name_ == i->name) { backend->default_sink_running_ = backend->default_sink_name == i->name &&
backend->current_sink_running_ = i->state == PA_SINK_RUNNING; (i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE);
if (i->name != backend->default_sink_name && !backend->default_sink_running_) {
return;
} }
if (!backend->current_sink_running_ && i->state == PA_SINK_RUNNING) { if (backend->current_sink_name_ == i->name) {
backend->current_sink_running_ = (i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE);
}
if (!backend->current_sink_running_ &&
(i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE)) {
backend->current_sink_name_ = i->name; backend->current_sink_name_ = i->name;
backend->current_sink_running_ = true; backend->current_sink_running_ = true;
} }
@@ -207,6 +222,7 @@ void AudioBackend::sourceInfoCb(pa_context * /*context*/, const pa_source_info *
void AudioBackend::serverInfoCb(pa_context *context, const pa_server_info *i, void *data) { void AudioBackend::serverInfoCb(pa_context *context, const pa_server_info *i, void *data) {
auto *backend = static_cast<AudioBackend *>(data); auto *backend = static_cast<AudioBackend *>(data);
backend->current_sink_name_ = i->default_sink_name; backend->current_sink_name_ = i->default_sink_name;
backend->default_sink_name = i->default_sink_name;
backend->default_source_name_ = i->default_source_name; backend->default_source_name_ = i->default_source_name;
pa_context_get_sink_info_list(context, sinkInfoCb, data); pa_context_get_sink_info_list(context, sinkInfoCb, data);
+2
View File
@@ -126,6 +126,7 @@ void PipewireBackend::handleRegistryEventGlobal(uint32_t id, uint32_t permission
if (proxy == nullptr) return; if (proxy == nullptr) return;
auto *pNodeInfo = (PrivacyNodeInfo *)pw_proxy_get_user_data(proxy); auto *pNodeInfo = (PrivacyNodeInfo *)pw_proxy_get_user_data(proxy);
new(pNodeInfo) PrivacyNodeInfo{};
pNodeInfo->id = id; pNodeInfo->id = id;
pNodeInfo->data = this; pNodeInfo->data = this;
pNodeInfo->type = mediaType; pNodeInfo->type = mediaType;
@@ -142,6 +143,7 @@ void PipewireBackend::handleRegistryEventGlobalRemove(uint32_t id) {
mutex_.lock(); mutex_.lock();
auto iter = privacy_nodes.find(id); auto iter = privacy_nodes.find(id);
if (iter != privacy_nodes.end()) { if (iter != privacy_nodes.end()) {
privacy_nodes[id]->~PrivacyNodeInfo();
privacy_nodes.erase(id); privacy_nodes.erase(id);
} }
mutex_.unlock(); mutex_.unlock();
+4 -4
View File
@@ -1,7 +1,7 @@
[wrap-file] [wrap-file]
directory = cava-0.10.2 directory = cava-0.10.3
source_url = https://github.com/LukashonakV/cava/archive/0.10.2.tar.gz source_url = https://github.com/LukashonakV/cava/archive/0.10.3.tar.gz
source_filename = cava-0.10.2.tar.gz source_filename = cava-0.10.3.tar.gz
source_hash = dff78c4787c9843583086408a0a6e5bde7a5dee1fa17ae526847366846cb19c3 source_hash = aab0a4ed3f999e8461ad9de63ef8a77f28b6b2011f7dd0c69ba81819d442f6f9
[provide] [provide]
cava = cava_dep cava = cava_dep
+9 -9
View File
@@ -1,13 +1,13 @@
[wrap-file] [wrap-file]
directory = fmt-11.0.1 directory = fmt-11.0.2
source_url = https://github.com/fmtlib/fmt/archive/11.0.1.tar.gz source_url = https://github.com/fmtlib/fmt/archive/11.0.2.tar.gz
source_filename = fmt-11.0.1.tar.gz source_filename = fmt-11.0.2.tar.gz
source_hash = 7d009f7f89ac84c0a83f79ed602463d092fbf66763766a907c97fd02b100f5e9 source_hash = 6cb1e6d37bdcb756dbbe59be438790db409cdb4868c66e888d5df9f13f7c027f
patch_filename = fmt_11.0.1-1_patch.zip patch_filename = fmt_11.0.2-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/fmt_11.0.1-1/get_patch patch_url = https://wrapdb.mesonbuild.com/v2/fmt_11.0.2-1/get_patch
patch_hash = 0a8b93d1ee6d84a82d3872a9bfb4c3977d8a53f7f484d42d1f7ed63ed496d549 patch_hash = 90c9e3b8e8f29713d40ca949f6f93ad115d78d7fb921064112bc6179e6427c5e
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_11.0.1-1/fmt-11.0.1.tar.gz source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/fmt_11.0.2-1/fmt-11.0.2.tar.gz
wrapdb_version = 11.0.1-1 wrapdb_version = 11.0.2-1
[provide] [provide]
fmt = fmt_dep fmt = fmt_dep