aboutsummaryrefslogtreecommitdiff
path: root/.config/qtile/widgets.py
blob: d1f7d8dd02c2d262f403c39676e4b4700d4bea89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Justine Smithies
# https://git.sr.ht/~justinesmithies/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.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(),
    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(),
]