qtile: adjust default config with light and dark themes
This commit is contained in:
parent
dda7f6aa40
commit
5c93edc211
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
bspwm/.config/bspwm/themes/theme.sh
|
bspwm/.config/bspwm/themes/theme.sh
|
||||||
shell/.config/zsh/plugins/zsh-autosuggestions
|
shell/.config/zsh/plugins/zsh-autosuggestions
|
||||||
shell/.config/zsh/plugins/zsh-syntax-highlighting
|
shell/.config/zsh/plugins/zsh-syntax-highlighting
|
||||||
|
qtile/.config/qtile/theme.txt
|
||||||
*~
|
*~
|
||||||
__pycache__
|
__pycache__
|
||||||
|
@ -6,7 +6,7 @@ fi
|
|||||||
|
|
||||||
xrandr --auto
|
xrandr --auto
|
||||||
xrandr --output HDMI1 --right-of DP1
|
xrandr --output HDMI1 --right-of DP1
|
||||||
xsetroot -solid '#224242'
|
xsetroot -solid '#94a3b8'
|
||||||
xrdb -merge ~/.Xresources
|
xrdb -merge ~/.Xresources
|
||||||
setxkbmap pl -option ctrl:nocaps
|
setxkbmap pl -option ctrl:nocaps
|
||||||
xmodmap ~/.xmodmaprc
|
xmodmap ~/.xmodmaprc
|
||||||
@ -21,9 +21,12 @@ fi
|
|||||||
# run emacs daemon if not running
|
# run emacs daemon if not running
|
||||||
emacsclient --eval nil -a '' &
|
emacsclient --eval nil -a '' &
|
||||||
|
|
||||||
|
xsettingsd &
|
||||||
|
|
||||||
|
exec qtile start
|
||||||
|
|
||||||
if which bspwm > /dev/null; then
|
if which bspwm > /dev/null; then
|
||||||
sxhkd &
|
sxhkd &
|
||||||
xsettingsd &
|
|
||||||
xsetroot -cursor_name left_ptr
|
xsetroot -cursor_name left_ptr
|
||||||
exec bspwm
|
exec bspwm
|
||||||
fi
|
fi
|
||||||
|
26
qtile/.config/qtile/colors.py
Normal file
26
qtile/.config/qtile/colors.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
colors = {
|
||||||
|
"indigo": {
|
||||||
|
50: "#eef2ff",
|
||||||
|
100: "#e0e7ff",
|
||||||
|
200: "#c7d2fe",
|
||||||
|
300: "#a5b4fc",
|
||||||
|
400: "#818cf8",
|
||||||
|
500: "#6366f1",
|
||||||
|
600: "#4f46e5",
|
||||||
|
700: "#4338ca",
|
||||||
|
800: "#3730a3",
|
||||||
|
900: "#312e81",
|
||||||
|
},
|
||||||
|
"blue-gray": {
|
||||||
|
50: "#f8fafc",
|
||||||
|
100: "#f1f5f9",
|
||||||
|
200: "#e2e8f0",
|
||||||
|
300: "#cbd5e1",
|
||||||
|
400: "#94a3b8",
|
||||||
|
500: "#64748b",
|
||||||
|
600: "#475569",
|
||||||
|
700: "#334155",
|
||||||
|
800: "#1e293b",
|
||||||
|
900: "#0f172a",
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
# Copyright (c) 2012 Craig Barnes
|
# Copyright (c) 2012 Craig Barnes
|
||||||
# Copyright (c) 2013 horsik
|
# Copyright (c) 2013 horsik
|
||||||
# Copyright (c) 2013 Tao Sauvage
|
# Copyright (c) 2013 Tao Sauvage
|
||||||
|
# Copyright (c) 2021 Łukasz Pankowski (adapted default config to my needs)
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -26,22 +27,26 @@
|
|||||||
|
|
||||||
from typing import List # noqa: F401
|
from typing import List # noqa: F401
|
||||||
|
|
||||||
from libqtile import bar, layout, widget
|
from libqtile import bar, layout, qtile, widget
|
||||||
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
from libqtile.config import Click, Drag, Group, Key, KeyChord, Match, Screen
|
||||||
from libqtile.lazy import lazy
|
from libqtile.lazy import lazy
|
||||||
from libqtile.utils import guess_terminal
|
from libqtile.utils import guess_terminal
|
||||||
|
|
||||||
|
from themes import theme, init_theme, toggle_theme
|
||||||
|
|
||||||
mod = "mod4"
|
mod = "mod4"
|
||||||
terminal = guess_terminal()
|
terminal = guess_terminal()
|
||||||
|
|
||||||
|
init_theme(qtile)
|
||||||
|
|
||||||
keys = [
|
keys = [
|
||||||
# Switch between windows
|
# Switch between windows
|
||||||
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
|
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
|
||||||
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
|
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
|
||||||
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
|
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
|
||||||
Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
|
Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
|
||||||
Key([mod], "space", lazy.layout.next(),
|
# Key([mod], "space", lazy.layout.next(),
|
||||||
desc="Move window focus to other window"),
|
# desc="Move window focus to other window"),
|
||||||
|
|
||||||
# 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.
|
||||||
# Moving out of range in Columns layout will create new column.
|
# Moving out of range in Columns layout will create new column.
|
||||||
@ -73,16 +78,28 @@ keys = [
|
|||||||
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
|
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
|
||||||
|
|
||||||
# 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], "m", lazy.next_layout(), desc="Toggle between layouts"),
|
||||||
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
|
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
|
||||||
|
|
||||||
|
Key([mod], "Tab", lazy.screen.toggle_group(), desc="Toggle between groups"),
|
||||||
|
|
||||||
|
Key([mod], "e", lazy.spawn("emacsclient -n -c")),
|
||||||
|
Key([mod], "s", lazy.window.toggle_floating()),
|
||||||
|
|
||||||
|
KeyChord([mod], "semicolon", [
|
||||||
|
Key([], "h", lazy.spawn("systemctl hibernate")),
|
||||||
|
Key([], "l", lazy.spawn("slock")),
|
||||||
|
Key([], "s", lazy.spawn("systemctl suspend")),
|
||||||
|
]),
|
||||||
|
|
||||||
|
Key([mod, "shift"], "F6", lazy.function(toggle_theme), lazy.restart()),
|
||||||
Key([mod, "control"], "r", lazy.restart(), desc="Restart Qtile"),
|
Key([mod, "control"], "r", lazy.restart(), desc="Restart Qtile"),
|
||||||
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
||||||
Key([mod], "r", lazy.spawncmd(),
|
Key([mod], "space", lazy.spawncmd(),
|
||||||
desc="Spawn a command using a prompt widget"),
|
desc="Spawn a command using a prompt widget"),
|
||||||
]
|
]
|
||||||
|
|
||||||
groups = [Group(i) for i in "123456789"]
|
groups = [Group(i) for i in "1234567890"]
|
||||||
|
|
||||||
for i in groups:
|
for i in groups:
|
||||||
keys.extend([
|
keys.extend([
|
||||||
@ -91,16 +108,19 @@ for i in groups:
|
|||||||
desc="Switch to group {}".format(i.name)),
|
desc="Switch to group {}".format(i.name)),
|
||||||
|
|
||||||
# mod1 + shift + letter of group = switch to & move focused window to group
|
# mod1 + shift + letter of group = switch to & move focused window to group
|
||||||
Key([mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True),
|
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True),
|
||||||
desc="Switch to & move focused window to group {}".format(i.name)),
|
# desc="Switch to & move focused window to group {}".format(i.name)),
|
||||||
# Or, use below if you prefer not to switch to that group.
|
# Or, use below if you prefer not to switch to that group.
|
||||||
# # mod1 + shift + letter of group = move focused window to group
|
# # mod1 + shift + letter of group = move focused window to group
|
||||||
# Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
|
Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
|
||||||
# desc="move focused window to group {}".format(i.name)),
|
desc="move focused window to group {}".format(i.name)),
|
||||||
])
|
])
|
||||||
|
|
||||||
layouts = [
|
layouts = [
|
||||||
layout.Columns(border_focus_stack=['#d75f5f', '#8f3d3d'], border_width=4),
|
layout.Columns(border_focus_stack=['#d75f5f', '#8f3d3d'],
|
||||||
|
border_focus=theme["border_focus"],
|
||||||
|
border_normal=theme["border_normal"],
|
||||||
|
border_width=4, margin=2),
|
||||||
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=2),
|
||||||
@ -116,19 +136,31 @@ layouts = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
widget_defaults = dict(
|
widget_defaults = dict(
|
||||||
font='sans',
|
font="Iosevka Slab Light",
|
||||||
fontsize=12,
|
fontsize=28,
|
||||||
padding=3,
|
padding=3,
|
||||||
|
foreground = theme["widget_foreground"],
|
||||||
)
|
)
|
||||||
extension_defaults = widget_defaults.copy()
|
extension_defaults = widget_defaults.copy()
|
||||||
|
|
||||||
screens = [
|
screens = [
|
||||||
Screen(
|
Screen(
|
||||||
bottom=bar.Bar(
|
top=bar.Bar(
|
||||||
[
|
[
|
||||||
widget.CurrentLayout(),
|
widget.Spacer(10),
|
||||||
widget.GroupBox(),
|
widget.CurrentLayout(120, foreground=theme["inactive"]),
|
||||||
widget.Prompt(),
|
widget.Spacer(10),
|
||||||
|
widget.GroupBox(
|
||||||
|
borderwidth=2,
|
||||||
|
margin_x=1,
|
||||||
|
padding_x=7,
|
||||||
|
active=widget_defaults["foreground"],
|
||||||
|
inactive=theme["inactive"],
|
||||||
|
highlight_method="block",
|
||||||
|
this_current_screen_border=theme["this_current_screen_border"]),
|
||||||
|
widget.Spacer(10),
|
||||||
|
widget.Prompt(cursor_color=theme["widget_foreground"]),
|
||||||
|
widget.Spacer(10),
|
||||||
widget.WindowName(),
|
widget.WindowName(),
|
||||||
widget.Chord(
|
widget.Chord(
|
||||||
chords_colors={
|
chords_colors={
|
||||||
@ -136,13 +168,12 @@ screens = [
|
|||||||
},
|
},
|
||||||
name_transform=lambda name: name.upper(),
|
name_transform=lambda name: name.upper(),
|
||||||
),
|
),
|
||||||
widget.TextBox("default config", name="default"),
|
|
||||||
widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"),
|
|
||||||
widget.Systray(),
|
widget.Systray(),
|
||||||
widget.Clock(format='%Y-%m-%d %a %I:%M %p'),
|
widget.Clock(format=f"<span foreground=\"{theme['inactive']}\">%Y-%m-%d %a</span> %H:%M"),
|
||||||
widget.QuickExit(),
|
widget.Spacer(10),
|
||||||
],
|
],
|
||||||
24,
|
42,
|
||||||
|
background=theme["bar_background"],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@ -161,16 +192,21 @@ dgroups_app_rules = [] # type: List
|
|||||||
follow_mouse_focus = True
|
follow_mouse_focus = True
|
||||||
bring_front_click = False
|
bring_front_click = False
|
||||||
cursor_warp = False
|
cursor_warp = False
|
||||||
floating_layout = layout.Floating(float_rules=[
|
floating_layout = layout.Floating(
|
||||||
# Run the utility of `xprop` to see the wm class and name of an X client.
|
float_rules=[
|
||||||
*layout.Floating.default_float_rules,
|
# Run the utility of `xprop` to see the wm class and name of an X client.
|
||||||
Match(wm_class='confirmreset'), # gitk
|
*layout.Floating.default_float_rules,
|
||||||
Match(wm_class='makebranch'), # gitk
|
Match(wm_class='confirmreset'), # gitk
|
||||||
Match(wm_class='maketag'), # gitk
|
Match(wm_class='makebranch'), # gitk
|
||||||
Match(wm_class='ssh-askpass'), # ssh-askpass
|
Match(wm_class='maketag'), # gitk
|
||||||
Match(title='branchdialog'), # gitk
|
Match(wm_class='ssh-askpass'), # ssh-askpass
|
||||||
Match(title='pinentry'), # GPG key password entry
|
Match(title='branchdialog'), # gitk
|
||||||
])
|
Match(title='pinentry'), # GPG key password entry
|
||||||
|
],
|
||||||
|
border_focus=theme["border_focus"],
|
||||||
|
border_normal=theme["border_normal"],
|
||||||
|
border_width=4)
|
||||||
|
|
||||||
auto_fullscreen = True
|
auto_fullscreen = True
|
||||||
focus_on_window_activation = "smart"
|
focus_on_window_activation = "smart"
|
||||||
reconfigure_screens = True
|
reconfigure_screens = True
|
||||||
|
48
qtile/.config/qtile/themes.py
Normal file
48
qtile/.config/qtile/themes.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from colors import colors
|
||||||
|
|
||||||
|
theme_file = os.path.join(os.path.dirname(__file__), "theme.txt")
|
||||||
|
|
||||||
|
def write_theme(name):
|
||||||
|
with open(theme_file, "w") as f:
|
||||||
|
f.write(name)
|
||||||
|
|
||||||
|
def read_theme(file_name):
|
||||||
|
try:
|
||||||
|
with open(file_name) as f:
|
||||||
|
return f.read().strip()
|
||||||
|
except FileNotFoundError:
|
||||||
|
return "dark"
|
||||||
|
|
||||||
|
is_dark = read_theme(theme_file) == "dark"
|
||||||
|
|
||||||
|
def light_dark(light, dark):
|
||||||
|
return dark if is_dark else light
|
||||||
|
|
||||||
|
def toggle_theme(qtile):
|
||||||
|
write_theme(light_dark("dark", "light"))
|
||||||
|
|
||||||
|
theme = dict(
|
||||||
|
background=light_dark(colors["blue-gray"][200], colors["blue-gray"][700]),
|
||||||
|
bar_background=light_dark([colors["blue-gray"][200], colors["blue-gray"][300]],
|
||||||
|
[colors["blue-gray"][600], colors["blue-gray"][900]]),
|
||||||
|
widget_foreground=light_dark(colors["blue-gray"][600], colors["blue-gray"][400]),
|
||||||
|
inactive=light_dark(colors["blue-gray"][400], colors["blue-gray"][500]),
|
||||||
|
this_current_screen_border=light_dark([colors["blue-gray"][200], colors["blue-gray"][50]],
|
||||||
|
[colors["blue-gray"][900], colors["blue-gray"][800]]),
|
||||||
|
border_focus=light_dark(colors["indigo"][400], colors["blue-gray"][500]),
|
||||||
|
border_normal=light_dark(colors["indigo"][900], colors["blue-gray"][900]),
|
||||||
|
alacritty_theme=light_dark("lupan-material-light", "lupan-dark-gray"),
|
||||||
|
emacs_theme=light_dark("lupan-material-light", "lupan-dark-gray"),
|
||||||
|
gtk_theme=light_dark("Materia-light", "Materia-dark"),
|
||||||
|
)
|
||||||
|
|
||||||
|
def init_theme(qtile):
|
||||||
|
qtile.cmd_spawn(["xsetroot", "-solid", theme["background"]])
|
||||||
|
qtile.cmd_spawn(["sed", "-i", f"s/^colors: [*].*/colors: *{theme['alacritty_theme']}/",
|
||||||
|
os.path.expanduser("~/.config/alacritty/alacritty.yml")])
|
||||||
|
qtile.cmd_spawn(["emacsclient", "--eval", f"(my-select-theme '{theme['emacs_theme']})"])
|
||||||
|
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"])
|
Loading…
x
Reference in New Issue
Block a user