diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-27 00:58:16 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-27 00:58:16 +0530 |
commit | 937c508691d16e6ce6da622b5cd372b99a490742 (patch) | |
tree | a93f4101960523cfbaed2aaff11d6fd9ea79b814 | |
parent | c0faee8f762f2bdf2d220befc76608daa7582883 (diff) |
cleaned up config
-rw-r--r-- | .config/qtile/bars.py | 194 | ||||
-rw-r--r-- | .config/qtile/config.py | 17 | ||||
-rw-r--r-- | .config/qtile/defaults.py | 7 | ||||
-rw-r--r-- | .config/qtile/screens.py | 9 |
4 files changed, 212 insertions, 15 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]] + ) diff --git a/.config/qtile/config.py b/.config/qtile/config.py index b7adab7..f2b2549 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -1,13 +1,6 @@ -from libqtile import layout, qtile, widget -from libqtile.config import Click, Drag, Group, Key, Match, Screen -from libqtile.lazy import lazy - -from qtile_extras import widget -from qtile_extras.widget.decorations import PowerLineDecoration - import defaults import keybindings -import bar +import screens groups = defaults.groups keys = keybindings.keybindings(defaults.mod, defaults._mod, groups) @@ -16,13 +9,7 @@ layouts = defaults.layouts floating_layout = defaults.floating_layout widget_defaults = defaults.widget_defaults extension_defaults = defaults.extension_defaults - -screens = [ - Screen( - top=bar.default_bar(), - ), -] - +screens = screens.screens floating_layout = defaults.floating_layout dgroups_key_binder = None diff --git a/.config/qtile/defaults.py b/.config/qtile/defaults.py index eafba13..1345f32 100644 --- a/.config/qtile/defaults.py +++ b/.config/qtile/defaults.py @@ -40,6 +40,10 @@ colors = [ groups = [Group(i) for i in "一二三四五六七八九十"] # groups = [Group(i) for i in ""] +center_floating_windows_by_class = [ + "arandr", "blueman-manager", "pavucontrol" +] + default_border_width=3 layouts = [ @@ -65,6 +69,9 @@ floating_layout = layout.Floating( border_width=default_border_width, border_normal=colors[0][4], border_focus=colors[0][5], + float_rules = [ + *[Match(wm_class=x) for x in center_floating_windows_by_class], + ], ) widget_defaults = dict( diff --git a/.config/qtile/screens.py b/.config/qtile/screens.py new file mode 100644 index 0000000..fb402a1 --- /dev/null +++ b/.config/qtile/screens.py @@ -0,0 +1,9 @@ +from libqtile.config import Screen + +import bars + +default_screen = Screen( + top=bars.default_bar(), +) + +screens = [default_screen] |