diff options
Diffstat (limited to '.config/qtile/bars.py')
-rw-r--r-- | .config/qtile/bars.py | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/.config/qtile/bars.py b/.config/qtile/bars.py new file mode 100644 index 0000000..e6701d5 --- /dev/null +++ b/.config/qtile/bars.py @@ -0,0 +1,194 @@ +from libqtile import bar + +from qtile_extras import widget +from qtile_extras.widget.groupbox2 import GroupBoxRule + +from defaults import colors, powerline_0, powerline_1, powerline_2 + +class CapsLockWidget(widget.CapsNumLockIndicator): + def poll(self): + for lock, state in self.get_indicators(): + if lock == "Caps" and state == "on": + return "CAPS LOCK" + + return "" + +class NumLockWidget(widget.CapsNumLockIndicator): + def poll(self): + for lock, state in self.get_indicators(): + if lock == "Num" and state == "on": + return "NUM LOCK" + + return "" + +def default_bar(): + return bar.Bar( + [ + widget.Spacer( + length=1, + **powerline_1 + ), + + widget.Clock( + format=" %-I:%M%p", + padding=8, + background=colors[-1][0], + foreground=colors[-1][1], + **powerline_1 + ), + + widget.Clock( + format=" %d %B %Y (%A)", + padding=8, + background=colors[-2][0], + foreground=colors[-2][1], + **powerline_0 + ), + + widget.Battery( + format="{percent:2.0%}", + padding=8, + show_short_text=False, + update_interval=30, + low_background=colors[-3][0], + low_foreground=colors[-3][1], + background=colors[-4][0], + foreground=colors[-4][1], + charging_background=colors[-5][0], + charging_foreground=colors[-5][1], + **powerline_1 + ), + + widget.Backlight( + backlight_name = "amdgpu_bl1", + padding=8, + format=" {percent:2.0%}", + background=colors[-6][0], + foreground=colors[-6][1], + **powerline_0 + ), + + widget.PulseVolume( + padding=8, + mute_format="", + unmute_format=" {volume}%", + emoji=False, + emoji_list=["", "", "", ""], + background=colors[-7][0], + foreground=colors[-7][1], + **powerline_2 + ), + + widget.WindowName( + padding=10, + max_chars=60, + background=colors[11][0], + foreground=colors[11][1], + **powerline_0 + ), + + widget.Memory( + format=" {MemPercent}%", + padding=8, + background=colors[-10][0], + foreground=colors[-10][1], + **powerline_0 + ), + + widget.CPU( + format=" {load_percent}%", + padding=8, + background=colors[-9][0], + foreground=colors[-9][1], + **powerline_0 + ), + + widget.ThermalSensor( + format=" {temp:.1f}{unit}", + padding=8, + background=colors[-8][0], + foreground=colors[-8][1], + **powerline_0 + ), + + widget.WindowCount( + show_zero=True, + text_format=" {num}", + padding=6, + background=colors[10][0], + foreground=colors[10][1], + **powerline_0 + ), + + NumLockWidget( + fmt=" {}", + background=colors[9][0], + foreground=colors[9][1], + **powerline_0 + ), + + CapsLockWidget( + fmt=" {}", + background=colors[8][0], + foreground=colors[8][1], + **powerline_0 + ), + + widget.CurrentLayout( + fmt=" {}", + background=colors[7][0], + foreground=colors[7][1], + padding=10, + **powerline_2 + ), + + widget.Spacer(length=5), + + widget.Systray(), + + widget.Spacer(length=15), + + widget.GroupBox2( + font = "Source Han Sans JP", + highlight_method="block", + rounded=False, + borderwidth=4, + padding_y=6, + padding_x=10, + + rules = [ + GroupBoxRule( + line_width=3, + ).when(), + + GroupBoxRule( + line_colour=colors[5][0], + #text_colour=colors[5][1], + ).when(screen=GroupBoxRule.SCREEN_THIS), + + GroupBoxRule( + line_colour=colors[6][0], + #text_colour=colors[6][1], + ).when(screen=GroupBoxRule.SCREEN_OTHER), + + GroupBoxRule( + text_colour=colors[2][1], + ).when(occupied=False), + + GroupBoxRule( + text_colour=colors[3][1], + ).when(occupied=True), + + #doesn't work. just marks ALL groups as urgent + # GroupBoxRule( + # line_colour=colors[4][0], + # text_colour=colors[4][1], + # ).when(urgent=True), + ], + ) + ], + 32, + background = colors[1][0], + border_width=[0, 0, 1, 0], + border_color=[colors[0][0], colors[0][0], colors[0][1], colors[0][0]] + ) |