restructured qtile config

This commit is contained in:
paul-loedige
2020-11-20 11:26:38 +01:00
parent 95c2da69b5
commit 396ed858ec
+46 -71
View File
@@ -1,3 +1,5 @@
#region Copyright Notice
# Copyright (c) 2010 Aldo Cortesi # Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis # Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma # Copyright (c) 2012 Randall Ma
@@ -24,51 +26,35 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
#endregion
from typing import List # noqa: F401 from typing import List # noqa: F401
from libqtile import bar, layout, widget from libqtile import bar, layout, widget
from libqtile.config import Click, Drag, Group, Key, Screen from libqtile.config import Click, Drag, Group, Key, Screen
from libqtile.lazy import lazy from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
mod = "mod4" mod = "mod4"
terminal = "termite" terminal = "termite"
#region key and mouse bindings
keys = [ keys = [
# Switch between windows with vim keybinding #moving windows around
Key([mod], "k", lazy.layout.down(), Key([mod], "h", lazy.layout.left()),
desc="Move focus down"), Key([mod], "l", lazy.layout.right()),
Key([mod], "j", lazy.layout.up(), Key([mod], "j", lazy.layout.down()),
desc="Move focus up"), Key([mod], "k", lazy.layout.up()),
Key([mod], "h", lazy.layout.left(), Key([mod, "shift"], "h", lazy.layout.swap_left()),
desc="Move focus left"), Key([mod, "shift"], "l", lazy.layout.swap_right()),
Key([mod], "l", lazy.layout.right(), Key([mod, "shift"], "j", lazy.layout.shuffle_down()),
desc="Move focus right"), Key([mod, "shift"], "k", lazy.layout.shuffle_up()),
Key([mod], "i", lazy.layout.grow()),
Key([mod], "m", lazy.layout.shrink()),
Key([mod], "n", lazy.layout.normalize()),
Key([mod], "o", lazy.layout.maximize()),
Key([mod], "space", lazy.layout.next()),
# Move windows around with vim keybindings
Key([mod, "control"], "k", lazy.layout.shuffle_down(),
desc="Move window down "),
Key([mod, "control"], "j", lazy.layout.shuffle_up(),
desc="Move window up "),
Key([mod, "control"], "h", lazy.layout.shuffle_left(),
desc="Move window left"),
Key([mod, "control"], "l", lazy.layout.shuffle_right(),
desc="Move window right"),
# Switch window focus to other pane(s)
Key([mod], "space", lazy.layout.next(),
desc="Switch window focus to other pane(s) of stack"),
# Swap panes
Key([mod, "control"], "space", lazy.layout.shuffle_next(),
desc="Swap panes of split stack"),
# Toggle between split and unsplit sides of stack.
# Split = all windows displayed
# Unsplit = 1 window displayed, like Max layout, but still with
# multiple stack panes
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], "Return", lazy.spawn(terminal), desc="Launch terminal"),
# Toggle between different layouts as defined below # Toggle between different layouts as defined below
@@ -77,34 +63,53 @@ keys = [
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], "r", lazy.spawncmd(),desc="Spawn a command using a prompt widget"),
desc="Spawn a command using a prompt widget"),
] ]
# 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())
]
#endregion
#region groups
groups = [Group(i) for i in "asdfuiop"] groups = [Group(i) for i in "asdfuiop"]
for i in groups: for i in groups:
keys.extend([ keys.extend([
# mod1 + letter of group = switch to group # mod1 + letter of group = switch to group
Key([mod], i.name, lazy.group[i.name].toscreen(), Key(["mod1","control"], i.name, lazy.group[i.name].toscreen(),
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(["mod1","control", "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)),
]) ])
#endregion
#region layouts
layouts = [ layouts = [
layout.MonadTall(), layout.MonadTall(
border_focus = '#0000ff',
border_width = 1,
new_at_current = True,
),
layout.Floating(), layout.Floating(),
layout.Max(), layout.Max(),
layout.MonadWide(), layout.MonadWide(),
] ]
#endregion
#region widgets and screens
widget_defaults = dict( widget_defaults = dict(
font='sans', font='sans',
fontsize=12, fontsize=12,
@@ -129,44 +134,14 @@ screens = [
widget.TextBox("default config", name="default"), widget.TextBox("default config", name="default"),
widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"), 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='%Y-%m-%d %a %H:%M'),
widget.QuickExit(),
],
24,
),
),
Screen(
top=bar.Bar(
[
widget.CurrentLayout(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
widget.Chord(
chords_colors={
'launch': ("#ff0000", "#ffffff"),
},
name_transform=lambda name: name.upper(),
),
widget.TextBox("default config", name="default"),
widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"),
widget.Systray(),
widget.Clock(format='%Y-%m-%d %a %I:%M %p'),
widget.QuickExit(), widget.QuickExit(),
], ],
24, 24,
), ),
), ),
] ]
#endregions
# 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_key_binder = None
dgroups_app_rules = [] # type: List dgroups_app_rules = [] # type: List