164 lines
6.6 KiB
Python
164 lines
6.6 KiB
Python
from libqtile import bar, layout, qtile
|
|
from libqtile.config import Click, Drag, Group, Key, Match, Screen
|
|
from libqtile.lazy import lazy
|
|
from libqtile.utils import guess_terminal
|
|
|
|
from qtile_extras import widget
|
|
from qtile_extras.widget.decorations import PowerLineDecoration
|
|
|
|
mod = "mod4"
|
|
terminal = guess_terminal("ghostty")
|
|
|
|
keys = [
|
|
Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
|
|
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
|
|
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
|
|
Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
|
|
Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
|
|
Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"),
|
|
Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
|
|
Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"),
|
|
Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
|
|
Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"),
|
|
Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
|
|
Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"),
|
|
Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
|
|
Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
|
|
Key([mod, "shift"], "Return",lazy.layout.toggle_split(),desc="Toggle between split and unsplit sides of stack",),
|
|
Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
|
|
Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
|
|
Key([mod, "shift"], "q", lazy.window.kill(), desc="Kill focused window"),
|
|
Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window",),
|
|
Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
|
|
Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
|
|
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
|
Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
|
|
Key([mod], "d", lazy.spawn("rofi -show drun"), desc="Spawn rofi"),
|
|
]
|
|
|
|
# Add key bindings to switch VTs in Wayland.
|
|
for vt in range(1, 8):
|
|
keys.append(
|
|
Key(
|
|
["control", "mod1"],
|
|
f"f{vt}",
|
|
lazy.core.change_vt(vt).when(func=lambda: qtile.core.name == "wayland"),
|
|
desc=f"Switch to VT{vt}",
|
|
)
|
|
)
|
|
|
|
# Add groups
|
|
group_names = "abcdefghij"
|
|
group_keys = "1234567890"
|
|
groups = [Group(name) for name in group_names]
|
|
|
|
for key, group in zip(group_keys, groups):
|
|
keys.extend([
|
|
# mod + group number = switch desktop
|
|
Key([mod], key, lazy.group[group.name].toscreen(),
|
|
desc=f"Switch to group {group.name}"),
|
|
# mod + shift + group number = switch to & move focused window to group
|
|
Key([mod, "shift"], key, lazy.window.togroup(group.name, switch_group=True),
|
|
desc=f"Switch to & move focused window to group {group.name}")
|
|
])
|
|
|
|
# Add layouts
|
|
layouts = [
|
|
layout.Spiral(margin=10, main_pane="left", new_client_position="after_current"),
|
|
layout.Bsp(margin=10, lower_right=True),
|
|
layout.MonadTall(margin=10),
|
|
# layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4), layout.Max(),
|
|
# layout.Stack(num_stacks=2),
|
|
# layout.Matrix(),
|
|
# layout.MonadWide(),
|
|
# layout.RatioTile(),
|
|
# layout.Tile(),
|
|
# layout.TreeTab(),
|
|
# layout.VerticalTile(),
|
|
# layout.Zoomy(),
|
|
]
|
|
|
|
widget_defaults = dict(
|
|
font="Source Code Pro for Powerline",
|
|
fontsize=16,
|
|
padding=3,
|
|
)
|
|
extension_defaults = widget_defaults.copy()
|
|
|
|
powerline = {
|
|
"decorations": [
|
|
PowerLineDecoration(path="arrow_right")
|
|
]
|
|
}
|
|
|
|
screens = [
|
|
Screen(
|
|
# wallpaper
|
|
wallpaper="~/.local/share/wallpaper/wp.png",
|
|
wallpaper_mode="fill",
|
|
# top bar
|
|
top=bar.Bar(
|
|
[
|
|
widget.GroupBox(background="111111", **powerline),
|
|
widget.WindowName(background="000000", **powerline),
|
|
widget.HDD(background="111111", device="/dev/nvme0n1p4", **powerline),
|
|
widget.Clock(background="333333", format=" %a", **powerline),
|
|
widget.Clock(background="444444", format="%H:%M:%S", **powerline),
|
|
widget.QuickExit(background="666666", default_text=" x ", countdown_format=" {} ", **powerline),
|
|
widget.CurrentLayoutIcon(background="000000", **powerline),
|
|
],
|
|
24,
|
|
# border_width=[2, 0, 2, 0], # Draw top and bottom borders
|
|
# border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
|
|
),
|
|
),
|
|
]
|
|
|
|
# Drag floating layouts.
|
|
mouse = [
|
|
Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
|
|
Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
|
|
Click([mod], "Button2", lazy.window.bring_to_front()),
|
|
]
|
|
|
|
dgroups_key_binder = None
|
|
dgroups_app_rules = [] # type: list
|
|
follow_mouse_focus = True
|
|
bring_front_click = False
|
|
floats_kept_above = True
|
|
cursor_warp = False
|
|
floating_layout = layout.Floating(
|
|
float_rules=[
|
|
# Run the utility of `xprop` to see the wm class and name of an X client.
|
|
*layout.Floating.default_float_rules,
|
|
Match(wm_class="confirmreset"), # gitk
|
|
Match(wm_class="makebranch"), # gitk
|
|
Match(wm_class="maketag"), # gitk
|
|
Match(wm_class="ssh-askpass"), # ssh-askpass
|
|
Match(title="branchdialog"), # gitk
|
|
Match(title="pinentry"), # GPG key password entry
|
|
]
|
|
)
|
|
auto_fullscreen = True
|
|
focus_on_window_activation = "smart"
|
|
reconfigure_screens = True
|
|
|
|
# If things like steam games want to auto-minimize themselves when losing
|
|
# focus, should we respect this or not?
|
|
auto_minimize = True
|
|
# When using the Wayland backend, this can be used to configure input devices.
|
|
wl_input_rules = None
|
|
# xcursor theme (string or None) and size (integer) for Wayland backend
|
|
wl_xcursor_theme = None
|
|
wl_xcursor_size = 24
|
|
|
|
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
|
|
# string besides java UI toolkits; you can see several discussions on the
|
|
# mailing lists, GitHub issues, and other WM documentation that suggest setting
|
|
# this string if your java app doesn't work correctly. We may as well just lie
|
|
# and say that we're a working one by default.
|
|
#
|
|
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
|
|
# java that happens to be on java's whitelist.
|
|
wmname = "qtile"
|