tos/packages/tos-desktop-wm/config.py
2023-02-21 16:29:59 +01:00

115 lines
4 KiB
Python

# Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from libqtile import bar, layout, widget
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
# ============== #
# === GROUPS === #
# ============== #
group_names = ["zic", "dev", "web"]
groups = [Group(name) for name in group_names]
# ============ #
# === KEYS === #
# ============ #
MOD = "mod4"
SHIFT = "shift"
CTRL = "control"
keys = [
# Actions
Key([MOD, SHIFT], "r", lazy.reload_config(), desc="Reload the config"),
Key([MOD, SHIFT], "a", lazy.window.kill(), desc="Kill focused window"),
# Switch between windows
Key([MOD], "n", lazy.layout.left(), desc="Move focus left"),
Key([MOD], "o", lazy.layout.right(), desc="Move focus right"),
Key([MOD], "e", lazy.layout.down(), desc="Move focus down"),
Key([MOD], "i", lazy.layout.up(), desc="Move focus up"),
# Move windows
Key([MOD, SHIFT], "n", lazy.layout.shuffle_left(), desc="Move window left"),
Key([MOD, SHIFT], "o", lazy.layout.shuffle_right(), desc="Move window right"),
Key([MOD, SHIFT], "e", lazy.layout.shuffle_down(), desc="Move window down"),
Key([MOD, SHIFT], "i", lazy.layout.shuffle_up(), desc="Move window up"),
# Grow windows
Key([MOD, CTRL], "n", lazy.layout.grow_left(), desc="Grow window left"),
Key([MOD, CTRL], "o", lazy.layout.grow_right(), desc="Grow window right"),
Key([MOD, CTRL], "e", lazy.layout.grow_down(), desc="Grow window down"),
Key([MOD, CTRL], "i", lazy.layout.grow_up(), desc="Grow window up"),
Key([MOD, CTRL], "m", lazy.layout.normalize(), desc="Reset all window sizes"),
# Launch applications
Key([MOD], "Return", lazy.spawn("alacritty"), desc="Launch terminal"),
]
# Group keys
for i, name in enumerate(group_names):
keys.extend(
[
Key([MOD], str(i), lazy.group[name].toscreen(), desc=f"Switch to group {name}"),
Key([MOD, SHIFT], str(i), lazy.window.togroup(name, switch_group=True), desc=f"Switch to & move focused window to group {name}"),
]
)
# ============= #
# === MOUSE === #
# ============= #
# 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()),
]
# =============== #
# === LAYOUTS === #
# =============== #
layouts = [
layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4),
layout.Max(),
]
# =============== #
# === SCREENS === #
# =============== #
screens = [Screen()]
# ================ #
# === SETTINGS === #
# ================ #
auto_minimize = False