Skip to content

Commit f9acc1f

Browse files
committed
Add stretching of modules and modules-center toggling
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.
1 parent 8645115 commit f9acc1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+277
-10
lines changed

include/AModule.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class AModule : public IModule {
2323
/// Emitting on this dispatcher triggers a update() call
2424
Glib::Dispatcher dp;
2525

26+
bool expandEnabled() const;
27+
2628
protected:
2729
// Don't need to make an object directly
2830
// Derived classes are able to use it
@@ -50,6 +52,7 @@ class AModule : public IModule {
5052
private:
5153
bool handleUserEvent(GdkEventButton *const &ev);
5254
const bool isTooltip;
55+
const bool isExpand;
5356
bool hasUserEvents_;
5457
std::vector<int> pid_;
5558
gdouble distance_scrolled_y_;

man/waybar-backlight-slider.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ The brightness can be controlled by dragging the slider across the bar or clicki
3131
typeof: string ++
3232
The name of the preferred device to control. If left empty, a device will be chosen automatically.
3333

34+
*expand*: ++
35+
typeof: bool ++
36+
default: false ++
37+
Enables this module to consume all left over space dynamically.
38+
3439
# EXAMPLES
3540

3641
```

man/waybar-backlight.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ The *backlight* module displays the current backlight level.
9999
typeof: array ++
100100
The actions corresponding to the buttons of the menu.
101101

102+
*expand*: ++
103+
typeof: bool ++
104+
default: false ++
105+
Enables this module to consume all left over space dynamically.
106+
102107
# EXAMPLE:
103108

104109
```

man/waybar-battery.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
122122
typeof: array ++
123123
The actions corresponding to the buttons of the menu.
124124

125+
*expand*: ++
126+
typeof: bool ++
127+
default: false ++
128+
Enables this module to consume all left over space dynamically.
129+
125130
# FORMAT REPLACEMENTS
126131

127132
*{capacity}*: Capacity in percentage

man/waybar-bluetooth.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ Addressed by *bluetooth*
142142
typeof: array ++
143143
The actions corresponding to the buttons of the menu.
144144

145+
*expand*: ++
146+
typeof: bool ++
147+
default: false ++
148+
Enables this module to consume all left over space dynamically.
149+
145150
# FORMAT REPLACEMENTS
146151

147152
*{status}*: Status of the bluetooth device.

man/waybar-cffi.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Addressed by *cffi/<name>*
1515
typeof: string ++
1616
The path to the dynamic library to load to control the widget.
1717

18+
*expand*: ++
19+
typeof: bool ++
20+
default: false ++
21+
Enables this module to consume all left over space dynamically.
22+
1823
Some additional configuration may be required depending on the cffi dynamic library being used.
1924

2025

man/waybar-clock.5.scd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ $XDG_CONFIG_HOME/waybar/config ++
9696
:[ array
9797
:[
9898
:[ The actions corresponding to the buttons of the menu.
99+
|[ *expand*:
100+
:[ bool
101+
:[ false
102+
:[ Enables this module to consume all left over space dynamically.
99103

100104
View all valid format options in *strftime(3)* or have a look https://en.cppreference.com/w/cpp/chrono/duration/formatter
101105

man/waybar-cpu.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ The *cpu* module displays the current CPU utilization.
8282
default: true ++
8383
Option to disable tooltip on hover.
8484

85+
*expand*: ++
86+
typeof: bool ++
87+
default: false ++
88+
Enables this module to consume all left over space dynamically.
89+
8590
# FORMAT REPLACEMENTS
8691

8792
*{load}*: Current CPU load.

man/waybar-custom.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ Addressed by *custom/<name>*
138138
typeof: array ++
139139
The actions corresponding to the buttons of the menu.
140140

141+
*expand*: ++
142+
typeof: bool ++
143+
default: false ++
144+
Enables this module to consume all left over space dynamically.
145+
141146
# RETURN-TYPE
142147

143148
When *return-type* is set to *json*, Waybar expects the *exec*-script to output its data in JSON format.

man/waybar-disk.5.scd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ Addressed by *disk*
106106
typeof: array ++
107107
The actions corresponding to the buttons of the menu.
108108

109+
*expand*: ++
110+
typeof: bool ++
111+
default: false ++
112+
Enables this module to consume all left over space dynamically.
113+
109114
# FORMAT REPLACEMENTS
110115

111116
*{percentage_used}*: Percentage of disk in use.

0 commit comments

Comments
 (0)