qtile: change key bindings, colors, more layouts
This commit is contained in:
parent
382f6b0cab
commit
64d5eae2c3
@ -48,8 +48,8 @@ schemas:
|
||||
bright: *bright-colors
|
||||
dark: &dark
|
||||
primary:
|
||||
background: '#002b36' #3f3f3f'
|
||||
foreground: '#839496' #dcdccc'
|
||||
background: '#1E293B'
|
||||
foreground: '#839496'
|
||||
normal:
|
||||
black: '#3f3f3f'
|
||||
red: '#ac7373'
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Selected colors from https://windicss.org/utilities/colors.html
|
||||
|
||||
colors = {
|
||||
"light-blue": {
|
||||
"sky": {
|
||||
50: "#f0f9ff",
|
||||
100: "#e0f2fe",
|
||||
200: "#bae6fd",
|
||||
|
@ -1,5 +1,5 @@
|
||||
from libqtile import bar, layout, qtile, widget
|
||||
from libqtile.config import Group, Key, KeyChord, Screen
|
||||
from libqtile.config import DropDown, Group, Key, KeyChord, ScratchPad, Screen
|
||||
from libqtile.lazy import lazy
|
||||
|
||||
from monitors import list_monitors
|
||||
@ -29,9 +29,28 @@ groups = [Group(name) for name in group_names]
|
||||
keys.extend([Key([mod], name, lazy.group[name].toscreen(toggle=False), desc=f"Switch to group {name}") for name in group_names])
|
||||
keys.extend([Key([mod, "shift"], name, lazy.window.togroup(name), desc=f"Move window to group {name}") for name in group_names])
|
||||
|
||||
groups.append(
|
||||
ScratchPad("scratchpad", [
|
||||
DropDown("term", terminal),
|
||||
DropDown("thunar", "thunar"),
|
||||
])
|
||||
)
|
||||
|
||||
keys.extend([
|
||||
Key([mod], "F1", lazy.group["scratchpad"].dropdown_toggle("term")),
|
||||
Key([mod], "F2", lazy.group["scratchpad"].dropdown_toggle("thunar")),
|
||||
])
|
||||
|
||||
floating_layout = layout.Floating(float_rules=[*layout.Floating.default_float_rules],
|
||||
**subtheme("border_width", "margin", "border_focus", "border_normal"))
|
||||
|
||||
layouts = [
|
||||
layout.Max(),
|
||||
layout.Columns(border_width=4, margin=4, **subtheme("border_focus", "border_normal")),
|
||||
layout.Columns(**subtheme("border_width", "margin", "border_focus", "border_normal")),
|
||||
layout.MonadTall(**subtheme("border_width", "margin", "border_focus", "border_normal")),
|
||||
layout.MonadWide(**subtheme("border_width", "margin", "border_focus", "border_normal")),
|
||||
layout.Matrix(**subtheme("border_width", "margin", "border_focus", "border_normal")),
|
||||
layout.Zoomy(columnwidth=200, **subtheme("border_width", "margin", "border_focus", "border_normal")),
|
||||
]
|
||||
|
||||
monitors = {i: m for i, m in enumerate(list_monitors())}
|
||||
@ -51,6 +70,10 @@ def createBar(monitor=None):
|
||||
widget.Spacer(15),
|
||||
widget.WindowName(fontsize=s["fontsize"]),
|
||||
widget.Spacer(),
|
||||
widget.CPUGraph(border_color=theme["inactive"], graph_color=theme["inactive"]),
|
||||
widget.Spacer(10),
|
||||
widget.PulseVolume(),
|
||||
widget.Spacer(10),
|
||||
widget.Clock(fontsize=s["fontsize"]),
|
||||
widget.Spacer(10),
|
||||
], s["size"], background=theme["background"])
|
||||
@ -60,12 +83,22 @@ screens = [Screen(top=createBar(monitors.get(i))) for i in range(4)]
|
||||
#fake_screens = [Screen(top=createBar(), x=x, y=y, width=1920, height=1080) for x, y in [(0, 0), (1920, 0), (0, 1080), (1920, 1080)]]
|
||||
|
||||
keys.extend([
|
||||
Key([mod], "Return", lazy.spawn(terminal), desc="Run terminal "),
|
||||
Key([mod], "e", lazy.spawn("emacsclient -n -c"), desc="Open new Emacs frame"),
|
||||
Key([mod], "space", lazy.spawn(["rofi", "-theme", theme["rofi_theme"], "-kb-row-select", "Tab", "-kb-row-tab", "", "-show", "run"]),
|
||||
Key([mod, "shift"], "Return", lazy.spawn(terminal), desc="Run terminal "),
|
||||
Key([mod, "control"], "n", lazy.spawn("emacsclient -n -c"), desc="Open new Emacs frame"),
|
||||
Key([mod], "p", lazy.spawn(["rofi", "-theme", theme["rofi_theme"], "-kb-row-tab", "", "-show", "run"]),
|
||||
desc="Run command"),
|
||||
Key([mod, "shift"], "p", lazy.spawn(["rofi", "-theme", theme["rofi_theme"], "-kb-row-tab", "", "-show", "combi"]),
|
||||
desc="Run rofi combi"),
|
||||
|
||||
Key([mod], "Tab", lazy.screen.toggle_group(), desc="Toggle between current and previous group"),
|
||||
Key([mod], "Tab", lazy.next_layout(), desc="Next layout"),
|
||||
Key([mod, "shift"], "m", lazy.to_layout_index(0), desc="Switch to Max layout"),
|
||||
Key([mod, "shift"], "c", lazy.to_layout_index(1), desc="Switch to Columns layout"),
|
||||
Key([mod, "shift"], "t", lazy.to_layout_index(2), desc="Switch to MonadTall layout"),
|
||||
Key([mod, "shift"], "w", lazy.to_layout_index(3), desc="Switch to MonadWide layout"),
|
||||
Key([mod, "shift"], "r", lazy.to_layout_index(4), desc="Switch to Matrix layout"),
|
||||
Key([mod, "shift"], "z", lazy.to_layout_index(5), desc="Switch to Zoomy layout"),
|
||||
|
||||
Key([mod], "a", lazy.screen.toggle_group(), desc="Toggle between current and previous group"),
|
||||
Key([mod], "h", lazy.layout.left(), desc="Focus window on the left of current one"),
|
||||
Key([mod], "j", lazy.layout.down(), desc="Focus window below of current one"),
|
||||
Key([mod], "k", lazy.layout.up(), desc="Focus window above of current one"),
|
||||
@ -78,11 +111,27 @@ keys.extend([
|
||||
Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow current window on its bottom"),
|
||||
Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow current window on its top"),
|
||||
Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow current window on its right"),
|
||||
Key([mod], "Return", lazy.layout.toggle_split(), desc="Toggle split"),
|
||||
Key([mod, "shift", "control"], "h", lazy.layout.swap_column_left(), desc="Swap column left"),
|
||||
Key([mod, "shift", "control"], "l", lazy.layout.swap_column_right(), desc="Swap column right"),
|
||||
|
||||
Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
|
||||
Key([mod], "s", lazy.window.toggle_floating(), desc="Toggle window floating"),
|
||||
Key([mod], "m", lazy.next_layout(), desc="Next layout"),
|
||||
Key([mod, "shift"], "F6", lazy.function(toggle_theme), lazy.restart(), desc="Kill focused window"),
|
||||
Key([mod], "g", lazy.layout.grow(), desc="Grow focused window in monad mode"),
|
||||
Key([mod], "s", lazy.layout.shrink(), desc="Shrink focused window in monad mode"),
|
||||
Key([mod], "r", lazy.layout.reset(), desc="Reset main area size"),
|
||||
Key([mod], "f", lazy.layout.flip(), desc="Flip side of secondary windows"),
|
||||
Key([mod], "m", lazy.layout.maximize(), desc="Maximize/minimize focused window in monad mode"),
|
||||
|
||||
Key([mod], "i", lazy.screen.prev_group(), desc="Switch to prev group"),
|
||||
Key([mod], "o", lazy.screen.next_group(), desc="Switch to next group"),
|
||||
Key([mod, "control"], "i", lazy.prev_screen(), desc="Switch to prev screen"),
|
||||
Key([mod, "control"], "o", lazy.next_screen(), desc="Switch to next screen"),
|
||||
|
||||
Key([mod], "x", lazy.window.kill(), desc="Kill focused window"),
|
||||
Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle window floating"),
|
||||
Key([mod], "e", lazy.window.toggle_maximize(), desc="Toggle window maximize"),
|
||||
Key([mod], "n", lazy.layout.normalize(), desc="Normalize layout"),
|
||||
Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle window fullscreen"),
|
||||
Key([mod, "shift"], "F6", toggle_theme, desc="Kill focused window"),
|
||||
|
||||
KeyChord([mod], "semicolon", [
|
||||
Key(["shift"], "h", lazy.spawn("systemctl hibernate")),
|
||||
@ -90,8 +139,8 @@ keys.extend([
|
||||
Key(["shift"], "s", lazy.spawn("systemctl suspend")),
|
||||
]),
|
||||
|
||||
Key([mod, "control"], "q", lazy.shutdown(), desc="Quit qtile"),
|
||||
Key([mod, "control"], "r", lazy.restart(), desc="Restart qtile"),
|
||||
Key([mod, "shift"], "q", lazy.shutdown(), desc="Quit qtile"),
|
||||
Key([mod], "q", lazy.reload_config(), desc="Reload qtile config"),
|
||||
])
|
||||
|
||||
keys.extend([Key([mod, "control"], str(i + 1), lazy.to_screen(i), desc=f"Switch to screen {i}") for i in range(len(screens))])
|
||||
|
@ -2,6 +2,8 @@ import os
|
||||
|
||||
from colors import colors
|
||||
|
||||
from libqtile.lazy import lazy
|
||||
|
||||
theme_file = os.path.join(os.path.dirname(__file__), "theme.txt")
|
||||
|
||||
def write_theme(name):
|
||||
@ -20,29 +22,38 @@ is_dark = read_theme(theme_file) == "dark"
|
||||
def light_dark(light, dark):
|
||||
return dark if is_dark else light
|
||||
|
||||
@lazy.function
|
||||
def toggle_theme(qtile):
|
||||
write_theme(light_dark("dark", "light"))
|
||||
global is_dark, theme
|
||||
name = light_dark("dark", "light")
|
||||
write_theme(name)
|
||||
is_dark = name == "dark"
|
||||
theme = get_theme()
|
||||
apply_theme(qtile)
|
||||
|
||||
background = light_dark([colors["blue-gray"][200], colors["blue-gray"][300]],
|
||||
[colors["blue-gray"][700], colors["blue-gray"][800]])
|
||||
theme = dict(
|
||||
root_background=light_dark(colors["blue-gray"][300], colors["blue-gray"][700]),
|
||||
background=background,
|
||||
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["light-blue"][200], colors["light-blue"][300]],
|
||||
[colors["light-blue"][800], colors["light-blue"][900]]),
|
||||
this_screen_border=light_dark([colors["blue-gray"][300], colors["blue-gray"][400]],
|
||||
[colors["blue-gray"][600], colors["blue-gray"][700]]),
|
||||
other_current_screen_border=background,
|
||||
other_screen_border=background,
|
||||
border_focus=light_dark(colors["indigo"][400], colors["blue-gray"][500]),
|
||||
border_normal=light_dark(colors["indigo"][900], colors["blue-gray"][800]),
|
||||
alacritty_theme=light_dark("lupan-material-light", "lupan-material-dark"),
|
||||
emacs_theme=light_dark("material-light", "material"),
|
||||
gtk_theme=light_dark("Materia-light", "Materia-dark"),
|
||||
rofi_theme=light_dark("Arc", "Arc-Dark"),
|
||||
)
|
||||
background = [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]),
|
||||
background=background,
|
||||
foreground=colors["blue-gray"][400],
|
||||
inactive=colors["blue-gray"][900],
|
||||
this_current_screen_border=colors["sky"][700],
|
||||
this_screen_border=colors["blue-gray"][600],
|
||||
other_current_screen_border=background,
|
||||
other_screen_border=background,
|
||||
border_focus=colors["indigo"][500],
|
||||
border_normal=colors["blue-gray"][800],
|
||||
alacritty_theme=light_dark("light", "dark"),
|
||||
emacs_theme=light_dark("solarized-light", "solarized-dark"),
|
||||
gtk_theme=light_dark("Materia-light", "Materia-dark"),
|
||||
rofi_theme=light_dark("Arc", "Arc-Dark"),
|
||||
)
|
||||
|
||||
theme = get_theme()
|
||||
|
||||
def subtheme(*names):
|
||||
return {name: theme[name] for name in names}
|
||||
|
@ -29,7 +29,11 @@ emacsclient --eval nil -a '' &
|
||||
|
||||
xsettingsd &
|
||||
|
||||
if which spectrwm > /dev/null; then
|
||||
if which qtile > /dev/null && test -f ~/.config/qtile/config.py; then
|
||||
exec qtile start
|
||||
fi
|
||||
|
||||
if which spectrwm > /dev/null && test -f ~/.spectrwm.conf; then
|
||||
exec spectrwm
|
||||
fi
|
||||
|
||||
@ -41,10 +45,6 @@ fi
|
||||
|
||||
xsetroot -solid '#94a3b8' -cursor_name left_ptr
|
||||
|
||||
if which qtile > /dev/null; then
|
||||
exec qtile start
|
||||
fi
|
||||
|
||||
if which bspwm > /dev/null; then
|
||||
sxhkd &
|
||||
exec bspwm
|
||||
|
Loading…
x
Reference in New Issue
Block a user