multiple backgrounds, translucent bar, bugfixes

This commit is contained in:
Dan MacLeod
2023-11-13 10:32:14 +10:30
parent e3e684133c
commit 0286a051c6

View File

@@ -33,7 +33,8 @@ from qtile_extras.widget.decorations import PowerLineDecoration
import subprocess import subprocess
import os import os
import logging import logging
from libqtile import hook import random
from libqtile import hook, qtile
@hook.subscribe.startup @hook.subscribe.startup
def dbus_register(): def dbus_register():
@@ -61,6 +62,15 @@ def autostart_once():
def autostart(): def autostart():
subprocess.run('/home/danmac/.config/qtile/refresh.sh') subprocess.run('/home/danmac/.config/qtile/refresh.sh')
def get_random_wallpaper():
wallpaper_folder = '/home/shared/Pictures/wallpapers/'
wallpapers = os.listdir(wallpaper_folder)
return f'{wallpaper_folder}{random.choice(wallpapers)}'
def change_wallpaper():
for screen in screens:
lazy.screen.set_background(get_random_wallpaper())
colors = { colors = {
"orange": "F8954F", "orange": "F8954F",
"teal": "34C2D4", "teal": "34C2D4",
@@ -82,7 +92,6 @@ keys = [
Key([mod], "Right", lazy.layout.right(), desc="Move focus to right"), Key([mod], "Right", lazy.layout.right(), desc="Move focus to right"),
Key([mod], "Down", lazy.layout.down(), desc="Move focus down"), Key([mod], "Down", lazy.layout.down(), desc="Move focus down"),
Key([mod], "Up", lazy.layout.up(), desc="Move focus up"), Key([mod], "Up", lazy.layout.up(), desc="Move focus up"),
Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
Key([mod, "shift"], "Left", lazy.next_screen(), desc="Move to next screen"), Key([mod, "shift"], "Left", lazy.next_screen(), desc="Move to next screen"),
Key([mod, "shift"], "Right", lazy.prev_screen(), desc="Move to previous screen"), Key([mod, "shift"], "Right", lazy.prev_screen(), desc="Move to previous screen"),
# Move windows between left/right columns or move up/down in current stack. # Move windows between left/right columns or move up/down in current stack.
@@ -119,12 +128,12 @@ keys = [
Key([mod, "control"], "y", lazy.spawn("gtk-launch FFPWA-01HATKWJX09JCYK2HQ0E2MGSRY.desktop"), desc="Launch YouTube"), Key([mod, "control"], "y", lazy.spawn("gtk-launch FFPWA-01HATKWJX09JCYK2HQ0E2MGSRY.desktop"), desc="Launch YouTube"),
Key([mod, "control"], "v", lazy.spawn("VirtualBox"), desc="Launch VirtualBox"), Key([mod, "control"], "v", lazy.spawn("VirtualBox"), desc="Launch VirtualBox"),
Key([mod, "control"], "c", lazy.spawn("gtk launch arch-codium.dekstop"), desc="Launch VSCodium"), Key([mod, "control"], "c", lazy.spawn("gtk launch arch-codium.dekstop"), desc="Launch VSCodium"),
Key([mod, "control"], "j", lazy.spawn("gtk-launch arch-pycharm-professional.desktop"), desc="Launch PyCharm"),
Key([], "Print", lazy.spawn("flatpak run org.flameshot.Flameshot gui"), desc="Screenshot"), Key([], "Print", lazy.spawn("flatpak run org.flameshot.Flameshot gui"), desc="Screenshot"),
# Toggle between different layouts as defined below # Toggle between different layouts as defined below
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
Key([mod, "shift"], "Tab", lazy.prev_layout(), desc="Toggle between layouts"), Key([mod, "shift"], "Tab", lazy.prev_layout(), desc="Toggle between layouts"),
Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), Key([mod], "q", lazy.window.kill(), desc="Kill focused window"),
Key([mod, "shift"], "b", lazy.screen.set_wallpaper(get_random_wallpaper()), desc="Change desktop wallpapers"),
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
@@ -134,7 +143,7 @@ keys = [
Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer set Master 5%+"), desc="Increase volume"), Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer set Master 5%+"), desc="Increase volume"),
Key([mod], "s", lazy.screen.next_group(skip_managed=True), desc="Switch to Next Group"), Key([mod], "s", lazy.screen.next_group(skip_managed=True), desc="Switch to Next Group"),
Key([mod], "w", lazy.screen.prev_group(skip_managed=True), desc="Switch to Previous Group"), Key([mod], "w", lazy.screen.prev_group(skip_managed=True), desc="Switch to Previous Group"),
Key([mod, "mod1"], "l", lazy.spawn("light-locker-command -l"), desc="Switch to Previous Group"), Key([mod, "mod1"], "l", lazy.spawn("light-locker-command -l"), desc="Lock Screen"),
] ]
groups = [Group(i) for i in "123456789"] groups = [Group(i) for i in "123456789"]
@@ -165,15 +174,15 @@ for i in groups:
layout_defaults = { layout_defaults = {
"border_width": 2, "border_width": 2,
"margin": 8, "margin": [0, 4, 4, 4],
"border_focus": colors["red"], "border_focus": "#ffffff",
} }
layouts = [ layouts = [
layout.Columns(border_focus_stack=["#3333cc", "#3366ff"], **layout_defaults), layout.Columns(border_focus_stack=["#3333cc", "#3366ff"], **layout_defaults),
layout.Max(), layout.Max(),
# Try more layouts by unleashing below layouts. # Try more layouts by unleashing below layouts.
# layout.Stack(num_stacks=2), layout.Stack(num_stacks=1, **layout_defaults),
# layout.Bsp(), # layout.Bsp(),
# layout.Matrix(), # layout.Matrix(),
layout.MonadTall(ratio=0.75, **layout_defaults), layout.MonadTall(ratio=0.75, **layout_defaults),
@@ -186,8 +195,10 @@ layouts = [
# layout.Zoomy(), # layout.Zoomy(),
] ]
# defaults for groups # default layouts for groups
groups[0].layout = "monadthreecol" groups[1].layout = "monadthreecol"
groups[2].layout = "stack"
# groups[1].spawn = "flatpak run com.microsoft.Edge" # groups[1].spawn = "flatpak run com.microsoft.Edge"
powerline = { powerline = {
@@ -221,6 +232,8 @@ app_launcher = widget.WidgetBox(
shutdown_progs = [ shutdown_progs = [
("Reboot", "systemctl reboot", "Reboot"), ("Reboot", "systemctl reboot", "Reboot"),
("Shutdown", "systemctl halt", "Shutdown"), ("Shutdown", "systemctl halt", "Shutdown"),
("Logout", "qtile cmd-obj -o cmd -f shutdown", "Logout"),
("Lock", "light-locker-command -l", "Lock"),
] ]
widget_defaults = dict( widget_defaults = dict(
@@ -228,17 +241,27 @@ widget_defaults = dict(
fontsize=14, fontsize=14,
padding=3, padding=3,
) )
extension_defaults = widget_defaults.copy() extension_defaults = widget_defaults.copy()
groupbox_colors = {
"highlight_method": "block",
"block_highlight_text_color": "000000",
"this_current_screen_border": "ffffff",
"this_screen_border": "ffffff",
"other_screen_border": "777777",
"other_current_screen_border": "777777",
"inactive": "777777",
}
screens = [ screens = [
Screen( Screen(
top=bar.Bar( top=bar.Bar(
[ [
widget.CurrentLayoutIcon(scale=0.7, padding=14, background=colors["teal"], **powerline), widget.CurrentLayoutIcon(scale=0.7, padding=14),
widget.GroupBox(background=colors["purple"], this_current_screen_border="ffffff", this_screen_border="ffffff", **powerline), widget.GroupBox(**groupbox_colors),
# widget.Prompt(background="333333", **powerline), # widget.Prompt(background="333333", **powerline),
widget.WindowName(background=colors["blue"], **powerline), widget.WindowTabs(),
widget.Chord( widget.Chord(
chords_colors={ chords_colors={
"launch": ("#ff0000", "#ffffff"), "launch": ("#ff0000", "#ffffff"),
@@ -251,78 +274,84 @@ screens = [
# widget.StatusNotifier(), # widget.StatusNotifier(),
# app_launcher, # app_launcher,
widget.WidgetBox( widget.WidgetBox(
widgets=[widget.LaunchBar(progs=lb_progs, padding=12, background=colors["red"]),], widgets=[widget.LaunchBar(progs=lb_progs, padding=12),],
background=colors["red"],
text_closed="", text_closed="",
text_open="", text_open="",
**powerline
), ),
# widget.Systray(background=colors["red"], **powerline), widget.Spacer(length=8),
# widget.Spacer(background=colors["red"], length=2, **powerline),
# widget.pulse_volume(), # widget.pulse_volume(),
# widget.PulseVolume(background=colors["purple"], **powerline), # widget.PulseVolume(background=colors["purple"], **powerline),
widget.UPowerWidget(background=colors["purple"], **powerline), widget.UPowerWidget(),
widget.CPUGraph(background=colors["purple"], border_width=0, **powerline), widget.CapsNumLockIndicator(),
widget.NvidiaSensors(background=colors["purple"], threshold=85, **powerline), widget.CPUGraph(border_width=0),
widget.Clock(format="%a %d %b %Y %I:%M %p", background=colors["orange"], **powerline), widget.ThermalSensor(tag_sensor='Package id 0', format='CPU: {temp}{unit}', threshold=85),
widget.NvidiaSensors(threshold=85, format='GPU: {temp}°C'),
widget.Wttr(location={'Adelaide, Australia':"Home"}),
widget.Systray(),
widget.Clock(format="%a %d %b %Y %I:%M %p"),
# widget.Wallpaper(directory='/home/shared/Pictures/wallpapers/', random_selection=True, label="🖼️"),
# widget.QuickExit(), # widget.QuickExit(),
widget.WidgetBox( widget.WidgetBox(
widgets=[ widgets=[
widget.LaunchBar(padding=12, background=colors["teal"], progs=shutdown_progs), widget.LaunchBar(padding=12, progs=shutdown_progs),
], ],
background=colors["teal"],
text_closed=" ⏻ ▶ ", text_closed=" ⏻ ▶ ",
text_open=" ⏻ ◀ ", text_open=" ⏻ ◀ ",
), ),
], ],
32, 32,
margin=4,
background=["#00000099"],
# border_width=[2, 0, 2, 0], # Draw top and bottom borders # border_width=[2, 0, 2, 0], # Draw top and bottom borders
# border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta # border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
), ),
wallpaper="/home/shared/Pictures/wallhaven-39exm3.jpg", wallpaper=get_random_wallpaper(),
wallpaper_mode="fill" wallpaper_mode="fill"
), ),
Screen( Screen(
top=bar.Bar( top=bar.Bar(
[ [
widget.CurrentLayoutIcon(scale=0.7,padding=14, background=colors["teal"], **powerline), widget.CurrentLayoutIcon(scale=0.7,padding=14), # , background=colors["teal"], **powerline),
widget.GroupBox(background=colors["purple"], this_current_screen_border="ffffff", this_screen_border="ffffff", **powerline), widget.GroupBox(**groupbox_colors),
widget.Prompt(background=colors["purple"], **powerline), widget.Prompt(), # background=colors["purple"], **powerline),
widget.WindowName(background=colors["blue"], **powerline), widget.WindowTabs(), # background=colors["blue"], **powerline),
widget.Chord( widget.Spacer(), # background=colors["blue"], **powerline),
chords_colors={ widget.Clock(format="%a %d %b %Y %I:%M %p",), # background=colors["orange"]),
"launch": ("#ff0000", "#ffffff"),
},
name_transform=lambda name: name.upper(),
),
# widget.TextBox("default config", name="default"),
# widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"),
# NB Systray is incompatible with Wayland, consider using StatusNotifier instead
# widget.StatusNotifier(background="999999"),
# app_launcher,
widget.WidgetBox(
widgets=[widget.LaunchBar(progs=lb_progs, padding=12, background=colors["red"]),],
background=colors["red"],
text_closed="",
text_open="",
**powerline
),
widget.Systray(background=colors["red"], **powerline),
# widget.Systray(background=colors["red"]),
# widget.ALSAWidget(background="999999", mode="both"),
# widget.Spacer(length=2, background=colors["red"], **powerline),
widget.Clock(format="%a %d %b %Y %I:%M %p", background=colors["orange"]),
], ],
32, 32,
margin=4,
background=["#00000099"],
# border_width=[2, 0, 2, 0], # Draw top and bottom borders # border_width=[2, 0, 2, 0], # Draw top and bottom borders
# border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta # border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
), ),
wallpaper="/home/shared/Pictures/wallhaven-39exm3.jpg", wallpaper=get_random_wallpaper(),
wallpaper_mode="fill"
),
Screen(
top=bar.Bar(
[
widget.CurrentLayoutIcon(scale=0.7,padding=14),
widget.GroupBox(**groupbox_colors),
widget.Prompt(),
widget.WindowTabs(),
widget.Spacer(),
widget.Clock(format="%a %d %b %Y %I:%M %p"),
],
32,
margin=4,
background=["#00000099"],
# border_width=[2, 0, 2, 0], # Draw top and bottom borders
# border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
),
wallpaper=get_random_wallpaper(),
wallpaper_mode="fill" wallpaper_mode="fill"
), ),
] ]
# Drag floating layouts. # Drag floating layouts.
mouse = [ mouse = [
Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
@@ -332,7 +361,7 @@ mouse = [
dgroups_key_binder = None dgroups_key_binder = None
dgroups_app_rules = [] # type: list dgroups_app_rules = [] # type: list
follow_mouse_focus = True follow_mouse_focus = False
bring_front_click = True bring_front_click = True
cursor_warp = False cursor_warp = False
floating_layout = layout.Floating( floating_layout = layout.Floating(