From 6aaea9cf4b283d41016e60735f52c8feb3cd0c9e Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Tue, 22 Aug 2023 19:46:15 +0100 Subject: Initial commit --- .config/qtile/widgets.py | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 .config/qtile/widgets.py (limited to '.config/qtile/widgets.py') diff --git a/.config/qtile/widgets.py b/.config/qtile/widgets.py new file mode 100644 index 0000000..1072c09 --- /dev/null +++ b/.config/qtile/widgets.py @@ -0,0 +1,106 @@ +# Justine Smithies +# https://github.com/justinesmithies/qtile-wayland-dotfiles + +# Widgets setup +# Get the icons at https://www.nerdfonts.com/cheat-sheet + +import os +import subprocess +from libqtile import qtile +from libqtile import widget +from colors import colors +from ordinaldate import custom_date +from keys import terminal + + +widget_defaults = dict( + font='GoMono Nerd Font', + fontsize='12', + padding=2, + foreground=colors['light0'] +) +extension_defaults = widget_defaults.copy() + +primary_widgets = [ + widget.Spacer(length=10), + widget.GroupBox( + padding=0, + active=colors['light0'], + borderwidth=3, + inactive=colors['light4'], + this_current_screen_border=colors['neutral_green'], + this_screen_border=colors['neutral_green'], + other_screen_border='#00000000', + other_current_screen_border='#00000000', + font='GoMono Nerd Font', + fontsize=12, + highlight_method='line', + highlight_color=['00000000', '00000000'] + ), + widget.CurrentLayoutIcon(scale=0.5, **widget_defaults), + widget.CurrentLayout(**widget_defaults), + widget.Spacer(), + widget.GenPollText( + func=custom_date, + update_interval=1, + **widget_defaults, + mouse_callbacks={ + 'Button1': lambda: qtile.cmd_spawn(os.path.expanduser("~/.config/qtile/statusbar/calendar.sh show"), shell=True), + 'Button3': lambda: qtile.cmd_spawn(os.path.expanduser("~/.config/qtile/statusbar/calendar.sh edit"), shell=True) + } + ), + widget.Spacer(), + widget.CheckUpdates( + **widget_defaults, + update_interval=600, + distro='Arch_paru', + custom_command='~/.config/qtile/statusbar/void-updates.sh', + display_format=' {updates}', + colour_have_updates=colors['neutral_green'], + execute='foot bash -c "sudo xbps-install -Suv"' + ), + widget.Spacer(length=5), + widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.config/qtile/statusbar/idleinhibit")).decode(), mouse_callbacks={'Button1': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/idleinhibit toggle"), shell=True)}), + widget.Spacer(length=5), + widget.KeyboardLayout(configured_keyboards=['us', 'gb']), + widget.Spacer(length=5), + widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.config/qtile/statusbar/brightnesscontrol")).decode(), mouse_callbacks={'Button1': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/brightnesscontrol down"), shell=True), 'Button3': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/brightnesscontrol up"), shell=True)}), + widget.Spacer(length=5), + widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.config/qtile/statusbar/volumecontrol")).decode(), mouse_callbacks={'Button1': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/volumecontrol down"), shell=True), 'Button2': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/volumecontrol mute"), shell=True), 'Button3': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/volumecontrol up"), shell=True)}), + widget.Spacer(length=5), + widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.config/qtile/statusbar/battery.py")).decode(), mouse_callbacks={'Button1': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/battery.py --c left-click"), shell=True)}), + widget.Spacer(length=5), + widget.GenPollText(update_interval=1, **widget_defaults, func=lambda: subprocess.check_output(os.path.expanduser("~/.config/qtile/statusbar/network.sh")).decode(), mouse_callbacks={'Button1': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/network.sh ShowInfo"), shell=True), 'Button3': lambda: qtile.spawn(terminal + ' -e nmtui', shell=True)}), + widget.Spacer(length=10), +] + +secondary_widgets = [ + widget.Spacer(length=10), + widget.GroupBox( + padding=0, + active=colors['light0'], + borderwidth=3, + inactive=colors['light4'], + this_current_screen_border=colors['neutral_green'], + this_screen_border=colors['neutral_green'], + other_screen_border='#00000000', + other_current_screen_border='#00000000', + font='GoMono Nerd Font', + fontsize=12, + highlight_method='line', + highlight_color=['00000000', '00000000'] + ), + widget.CurrentLayoutIcon(scale=0.6, **widget_defaults), + widget.CurrentLayout(**widget_defaults), + widget.Spacer(length=440), + widget.GenPollText( + func=custom_date, + update_interval=1, + **widget_defaults, + mouse_callbacks={ + 'Button1': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/calendar.sh show"), shell=True), + 'Button3': lambda: qtile.spawn(os.path.expanduser("~/.config/qtile/statusbar/calendar.sh edit"), shell=True) + } + ), + widget.Spacer(), +] -- cgit v1.2.3