Skip to content

Commit 4c46d7d

Browse files
authored
Merge pull request #2887 from dann-merlin/master
Add justify config option for Labels
2 parents 3806075 + 25b8580 commit 4c46d7d

24 files changed

+126
-24
lines changed

man/waybar-backlight.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ The *backlight* module displays the current backlight level.
3030

3131
*align*: ++
3232
typeof: float ++
33-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
33+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
34+
35+
*justify*: ++
36+
typeof: string ++
37+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3438

3539
*rotate*: ++
3640
typeof: integer ++

man/waybar-battery.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ The *battery* module displays the current capacity and state (eg. charging) of y
6161

6262
*align*: ++
6363
typeof: float ++
64-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
64+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
65+
66+
*justify*: ++
67+
typeof: string ++
68+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
6569

6670
*rotate*: ++
6771
typeof: integer++

man/waybar-bluetooth.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ Addressed by *bluetooth*
6666

6767
*align*: ++
6868
typeof: float ++
69-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
69+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
70+
71+
*justify*: ++
72+
typeof: string ++
73+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
7074

7175
*on-click*: ++
7276
typeof: string ++

man/waybar-cpu.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ The *cpu* module displays the current CPU utilization.
3535

3636
*align*: ++
3737
typeof: float ++
38-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
38+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
39+
40+
*justify*: ++
41+
typeof: string ++
42+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3943

4044
*rotate*: ++
4145
typeof: integer ++

man/waybar-custom.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ Addressed by *custom/<name>*
7272

7373
*align*: ++
7474
typeof: float ++
75-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
75+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
76+
77+
*justify*: ++
78+
typeof: string ++
79+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
7680

7781
*on-click*: ++
7882
typeof: string ++

man/waybar-disk.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ Addressed by *disk*
4545

4646
*align*: ++
4747
typeof: float ++
48-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
48+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
49+
50+
*justify*: ++
51+
typeof: string ++
52+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
4953

5054
*on-click*: ++
5155
typeof: string ++

man/waybar-hyprland-submap.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Addressed by *hyprland/submap*
3131

3232
*align*: ++
3333
typeof: float ++
34-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
34+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
35+
36+
*justify*: ++
37+
typeof: string ++
38+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3539

3640
*on-click*: ++
3741
typeof: string ++

man/waybar-idle-inhibitor.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ screensaver, also known as "presentation mode".
3333

3434
*align*: ++
3535
typeof: float ++
36-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
36+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
37+
38+
*justify*: ++
39+
typeof: string ++
40+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3741

3842
*on-click*: ++
3943
typeof: string ++

man/waybar-inhibitor.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ See *systemd-inhibit*(1) for more information.
3737

3838
*align*: ++
3939
typeof: float ++
40-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
40+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
41+
42+
*justify*: ++
43+
typeof: string ++
44+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
4145

4246
*on-click*: ++
4347
typeof: string ++

man/waybar-jack.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ Addressed by *jack*
6363

6464
*align*: ++
6565
typeof: float ++
66-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
66+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
67+
68+
*justify*: ++
69+
typeof: string ++
70+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
6771

6872
*on-click*: ++
6973
typeof: string ++

man/waybar-memory.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ Addressed by *memory*
4545

4646
*align*: ++
4747
typeof: float ++
48-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
48+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
49+
50+
*justify*: ++
51+
typeof: string ++
52+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
4953

5054
*on-click*: ++
5155
typeof: string ++

man/waybar-mpd.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ Addressed by *mpd*
103103

104104
*align*: ++
105105
typeof: float ++
106-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
106+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
107+
108+
*justify*: ++
109+
typeof: string ++
110+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
107111

108112
*on-click*: ++
109113
typeof: string ++

man/waybar-mpris.5.scd

+5-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ The *mpris* module displays currently playing media via libplayerctl.
119119

120120
*align*: ++
121121
typeof: float ++
122-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. ++
123-
If the module is rotated, it will follow the flow of the text.
122+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
123+
124+
*justify*: ++
125+
typeof: string ++
126+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
124127

125128
*on-click*: ++
126129
typeof: string ++

man/waybar-network.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ Addressed by *network*
7070

7171
*align*: ++
7272
typeof: float ++
73-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
73+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
74+
75+
*justify*: ++
76+
typeof: string ++
77+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
7478

7579
*on-click*: ++
7680
typeof: string ++

man/waybar-pulseaudio.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ Additionally, you can control the volume by scrolling *up* or *down* while the c
5656

5757
*align*: ++
5858
typeof: float ++
59-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
59+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
60+
61+
*justify*: ++
62+
typeof: string ++
63+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
6064

6165
*scroll-step*: ++
6266
typeof: float ++

man/waybar-river-layout.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ Addressed by *river/layout*
3333

3434
*align*: ++
3535
typeof: float ++
36-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
36+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
37+
38+
*justify*: ++
39+
typeof: string ++
40+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3741

3842
*on-click*: ++
3943
typeof: string ++

man/waybar-river-mode.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Addressed by *river/mode*
3131

3232
*align*: ++
3333
typeof: float ++
34-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
34+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
35+
36+
*justify*: ++
37+
typeof: string ++
38+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3539

3640
*on-click*: ++
3741
typeof: string ++

man/waybar-river-window.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Addressed by *river/window*
3131

3232
*align*: ++
3333
typeof: float ++
34-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
34+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
35+
36+
*justify*: ++
37+
typeof: string ++
38+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3539

3640
*on-click*: ++
3741
typeof: string ++

man/waybar-sndio.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ cursor is over the module, and clicking on the module toggles mute.
3232

3333
*align*: ++
3434
typeof: float ++
35-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
35+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
36+
37+
*justify*: ++
38+
typeof: string ++
39+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3640

3741
*scroll-step*: ++
3842
typeof: int ++

man/waybar-sway-mode.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Addressed by *sway/mode*
3131

3232
*align*: ++
3333
typeof: float ++
34-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
34+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
35+
36+
*justify*: ++
37+
typeof: string ++
38+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3539

3640
*on-click*: ++
3741
typeof: string ++

man/waybar-sway-window.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ Addressed by *sway/window*
3131

3232
*align*: ++
3333
typeof: float ++
34-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
34+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
35+
36+
*justify*: ++
37+
typeof: string ++
38+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
3539

3640
*on-click*: ++
3741
typeof: string ++

man/waybar-temperature.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ Addressed by *temperature*
7171

7272
*align*: ++
7373
typeof: float ++
74-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
74+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
75+
76+
*justify*: ++
77+
typeof: string ++
78+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
7579

7680
*on-click*: ++
7781
typeof: string ++

man/waybar-wireplumber.5.scd

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ The *wireplumber* module displays the current volume reported by WirePlumber.
4747

4848
*align*: ++
4949
typeof: float ++
50-
The alignment of the text, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
50+
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
51+
52+
*justify*: ++
53+
typeof: string ++
54+
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
5155

5256
*scroll-step*: ++
5357
typeof: float ++

src/ALabel.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st
5050
label_.set_xalign(align);
5151
}
5252
}
53+
54+
if (config_["justify"].isString()) {
55+
auto justify_str = config_["justify"].asString();
56+
if (justify_str == "left") {
57+
label_.set_justify(Gtk::Justification::JUSTIFY_LEFT);
58+
} else if (justify_str == "right") {
59+
label_.set_justify(Gtk::Justification::JUSTIFY_RIGHT);
60+
} else if (justify_str == "center") {
61+
label_.set_justify(Gtk::Justification::JUSTIFY_CENTER);
62+
}
63+
}
5364
}
5465

5566
auto ALabel::update() -> void { AModule::update(); }

0 commit comments

Comments
 (0)