Skip to content

Commit

Permalink
Add stretching of modules and modules-center toggling
Browse files Browse the repository at this point in the history
This Patch allows the stretching of modules-{left,center,right} as well
add a "expand" flag to AModule. This allows one module to consume the
leftover space.
To allow the left or right modules to fully consume the center, the
changes also include a way to remove the center box (center_)
altogether.
  • Loading branch information
TripleTrable committed Oct 30, 2024
1 parent 5f26051 commit 94883be
Show file tree
Hide file tree
Showing 49 changed files with 277 additions and 10 deletions.
3 changes: 3 additions & 0 deletions include/AModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class AModule : public IModule {
/// Emitting on this dispatcher triggers a update() call
Glib::Dispatcher dp;

bool expandEnabled() const;

protected:
// Don't need to make an object directly
// Derived classes are able to use it
Expand Down Expand Up @@ -50,6 +52,7 @@ class AModule : public IModule {
private:
bool handleUserEvent(GdkEventButton *const &ev);
const bool isTooltip;
const bool isExpand;
bool hasUserEvents_;
std::vector<int> pid_;
gdouble distance_scrolled_y_;
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-backlight-slider.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ The brightness can be controlled by dragging the slider across the bar or clicki
typeof: string ++
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

```
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-backlight.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ The *backlight* module displays the current backlight level.
typeof: array ++
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:

```
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-battery.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
typeof: array ++
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

*{capacity}*: Capacity in percentage
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-bluetooth.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ Addressed by *bluetooth*
typeof: array ++
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

*{status}*: Status of the bluetooth device.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-cffi.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Addressed by *cffi/<name>*
typeof: string ++
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.


Expand Down
4 changes: 4 additions & 0 deletions man/waybar-clock.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ $XDG_CONFIG_HOME/waybar/config ++
:[ array
:[
:[ 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

Expand Down
5 changes: 5 additions & 0 deletions man/waybar-cpu.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ The *cpu* module displays the current CPU utilization.
default: true ++
Option to disable tooltip on hover.

*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.

# FORMAT REPLACEMENTS

*{load}*: Current CPU load.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-custom.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ Addressed by *custom/<name>*
typeof: array ++
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

When *return-type* is set to *json*, Waybar expects the *exec*-script to output its data in JSON format.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-disk.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ Addressed by *disk*
typeof: array ++
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

*{percentage_used}*: Percentage of disk in use.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-dwl-tags.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ Addressed by *dwl/tags*
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.

*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.

# EXAMPLE

```
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-dwl-window.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ Addressed by *dwl/window*
default: 24 ++
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

*{title}*: The title of the focused window.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-gamemode.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ Feral Gamemode optimizations.
default: 4 ++
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

*{glyph}*: The string icon glyph to use instead.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-hyprland-language.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Addressed by *hyprland/language*
typeof: array ++
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

Expand Down
5 changes: 5 additions & 0 deletions man/waybar-hyprland-submap.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ Addressed by *hyprland/submap*
typeof: array ++
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

Expand Down
5 changes: 5 additions & 0 deletions man/waybar-hyprland-window.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Addressed by *hyprland/window*
default: 24 ++
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
See the output of "hyprctl clients" for examples

Expand Down
5 changes: 5 additions & 0 deletions man/waybar-hyprland-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Addressed by *hyprland/workspaces*
If set to id, workspaces will sort by id.
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

*{id}*: id of workspace assigned by compositor
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-idle-inhibitor.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ screensaver, also known as "presentation mode".
typeof: array ++
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

*{status}*: status (*activated* or *deactivated*)
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-image.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ The *image* module displays an image from a path.
default: true ++
Option to enable tooltip on hover.

*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.

# SCRIPT OUTPUT

Similar to the *custom* module, output values of the script are *newline* separated.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-inhibitor.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ See *systemd-inhibit*(1) for more information.
typeof: array ++
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

*{status}*: status (*activated* or *deactivated*)
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-jack.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ Addressed by *jack*
typeof: array ++
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

*{load}*: The current CPU load estimated by JACK.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-keyboard-state.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ You must be a member of the input group to use this module.
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.

*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.

# FORMAT REPLACEMENTS

*{name}*: Caps, Num, or Scroll.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-memory.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ Addressed by *memory*
typeof: array ++
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

*{percentage}*: Percentage of memory in use.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-mpd.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ Addressed by *mpd*
typeof: array ++
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

## WHEN PLAYING/PAUSED
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-mpris.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ The *mpris* module displays currently playing media via libplayerctl.
typeof: map[string]string ++
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

Expand Down
5 changes: 5 additions & 0 deletions man/waybar-network.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ Addressed by *network*
typeof: array ++
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

*{ifname}*: Name of the network interface.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-niri-language.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Addressed by *niri/language*
typeof: array ++
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

*{short}*: Short name of layout (e.g. "us"). Equals to {}.
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-niri-window.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Addressed by *niri/window*
default: 24 ++
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

See the output of "niri msg windows" for examples
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-niri-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ Addressed by *niri/workspaces*
typeof: string ++
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

*{value}*: Name of the workspace, or index for unnamed workspaces,
Expand Down
7 changes: 7 additions & 0 deletions man/waybar-power-profiles-daemon.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ $XDG_CONFIG_HOME/waybar/config
:[ object
:[ 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.
|[ *expand*:
:[ bool
:[ false
:[ Enables this module to consume all left over space dynamically.





# CONFIGURATION EXAMPLES
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-privacy.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ the screen or playing audio.
Which privacy modules to monitor. See *MODULES CONFIGURATION* for++
more information.

*expand*: ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.

# MODULES CONFIGURATION

*type*: ++
Expand Down
5 changes: 5 additions & 0 deletions man/waybar-pulseaudio-slider.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ The volume can be controlled by dragging the slider across the bar or clicking o
default: horizontal ++
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

```
Expand Down
Loading

0 comments on commit 94883be

Please sign in to comment.