qtile: restart, bar: highlight method line, change colors

- back to restart, also on theme change
- back to different bar colors for light and dark theme
This commit is contained in:
Łukasz Pankowski 2022-10-11 23:58:06 +02:00
parent b5e558a058
commit f2bd8915a3
2 changed files with 23 additions and 20 deletions

View File

@ -63,14 +63,16 @@ def createBar(monitor=None):
widget.Spacer(10),
widget.CurrentLayout(fmt="[{:3.3}]", fontsize=s["fontsize"]),
widget.Spacer(10),
widget.GroupBox(highlight_method='block',
widget.GroupBox(highlight_method='line',
fontsize=s["fontsize"],
padding_y=10,
margin_y=6,
borderwidth=5,
active=theme["foreground"],
highlight_color=theme["background"],
**subtheme("inactive", "this_current_screen_border", "this_screen_border",
"other_current_screen_border", "other_screen_border")),
widget.Spacer(5),
widget.WindowCount(text_format="({num})", foreground=theme["inactive"]),
widget.WindowCount(text_format="({num})", fontsize=s["fontsize"], foreground=theme["inactive"]),
widget.Spacer(10),
widget.WindowName(fontsize=s["fontsize"]),
widget.Spacer(),
@ -85,7 +87,7 @@ def createBar(monitor=None):
widget.Spacer(10),
widget.CPUGraph(border_color=theme["inactive"], graph_color=theme["foreground"]),
widget.Spacer(10),
widget.ThermalSensor(fontsize=s["fontsize"]),
widget.ThermalSensor(foreground=theme["foreground"], fontsize=s["fontsize"]),
]),
widget.Spacer(10),
widget.PulseVolume(fontsize=s["fontsize"]),
@ -160,11 +162,9 @@ keys.extend([
]),
Key([mod, "shift"], "q", lazy.shutdown(), desc="Quit qtile"),
Key([mod], "q", lazy.reload_config(), desc="Reload qtile config"),
Key([mod], "q", lazy.restart(), desc="Restart qtile"),
])
keys.extend([Key([mod, "control"], str(i + 1), lazy.to_screen(i), desc=f"Switch to screen {i}") for i in range(len(screens))])
cursor_warp = True
apply_theme(qtile)

View File

@ -3,6 +3,7 @@ import os
from colors import colors
from libqtile.lazy import lazy
from libqtile import hook, qtile
theme_file = os.path.join(os.path.dirname(__file__), "theme.txt")
@ -24,29 +25,27 @@ def light_dark(light, dark):
@lazy.function
def toggle_theme(qtile):
global is_dark, theme
name = light_dark("dark", "light")
write_theme(name)
is_dark = name == "dark"
write_theme(light_dark("dark", "light"))
theme = get_theme()
apply_theme(qtile)
qtile.restart()
background = [colors["sky"][800], colors["sky"][900]]
background = light_dark([colors["sky"][600], colors["sky"][700]],
[colors["sky"][800], colors["sky"][900]])
def get_theme():
return dict(
border_width=4,
margin=4,
root_background=light_dark(colors["blue-gray"][300], colors["blue-gray"][700]),
root_background=light_dark(colors["blue-gray"][300], colors["blue-gray"][800]),
background=background,
foreground=colors["blue-gray"][300],
inactive=colors["blue-gray"][400],
this_current_screen_border=colors["sky"][700],
this_screen_border=colors["blue-gray"][600],
foreground=light_dark(colors["blue-gray"][100], colors["blue-gray"][400]),
inactive=light_dark(colors["blue-gray"][400], colors["blue-gray"][500]),
this_current_screen_border=light_dark(colors["blue-gray"][100], colors["blue-gray"][400]),
this_screen_border=light_dark(colors["blue-gray"][400], colors["blue-gray"][500]),
other_current_screen_border=background,
other_screen_border=background,
border_focus=colors["indigo"][500],
border_normal=colors["blue-gray"][800],
border_focus=light_dark(colors["sky"][400], colors["indigo"][600]),
border_normal=light_dark(colors["blue-gray"][600], colors["blue-gray"][700]),
alacritty_theme=light_dark("gogh-nord-light", "gogh-tin"),
emacs_theme=light_dark("solarized-light", "solarized-dark"),
gtk_theme=light_dark("Materia-light", "Materia-dark"),
@ -66,3 +65,7 @@ def apply_theme(qtile):
qtile.cmd_spawn(["sed", "-i", "-E", f"s#(Net/ThemeName) .*#\\1 \"{theme['gtk_theme']}\"#",
os.path.expanduser("~/.config/xsettingsd/xsettingsd.conf")])
qtile.cmd_spawn(["pkill", "-HUP", "-x", "xsettingsd"])
@hook.subscribe.startup
def func():
apply_theme(qtile)