qtile: update to make similar to herbstluft

This commit is contained in:
mequidis
2023-04-15 20:52:19 +03:00
parent 7a86da2cd9
commit 90000c4cf8
2 changed files with 45 additions and 91 deletions

View File

@ -1,10 +1,10 @@
import os
import subprocess
from typing import List # noqa: F401
from libqtile import bar, layout, widget
from libqtile.config import Click, Drag, Group, Match, Screen
from libqtile import layout
from libqtile.config import Click, Drag, Group, Match
from libqtile.lazy import lazy
from libqtile.config import EzKey
from libqtile.config import EzKey as Keybind
from libqtile import hook
#
@ -13,12 +13,11 @@ from libqtile import hook
mod = "mod4"
terminal = "kitty"
launcher = "dmenu_run"
launcher = "rofi -show run"
file_manager = "thunar"
browser = "firefox"
calculator = "dcalc"
calculator = "rofi -show calc"
music_player = f"{terminal} -e ncmpcpp"
feed_reader = f"{terminal} -e newsboat"
screen_locker = "i3lock -c 000000"
scripts = os.path.expanduser('~/.config/qtile/scripts')
@ -29,59 +28,58 @@ scripts = os.path.expanduser('~/.config/qtile/scripts')
keys = [
# basics
EzKey("M-w", lazy.window.kill()),
EzKey("M-t", lazy.restart()),
EzKey("M-q", lazy.spawn(os.path.join(scripts, "exitmenu"))),
Keybind("M-w", lazy.window.kill()),
Keybind("M-t", lazy.restart()),
Keybind("M-q", lazy.spawn(os.path.join(scripts, "exitmenu"))),
# focus
EzKey("M-h", lazy.layout.left()),
EzKey("M-j", lazy.layout.down()),
EzKey("M-k", lazy.layout.up()),
EzKey("M-l", lazy.layout.right()),
Keybind("M-h", lazy.layout.left()),
Keybind("M-j", lazy.layout.down()),
Keybind("M-k", lazy.layout.up()),
Keybind("M-l", lazy.layout.right()),
# shift
EzKey("M-S-h", lazy.layout.shuffle_left()),
EzKey("M-S-j", lazy.layout.shuffle_down()),
EzKey("M-S-k", lazy.layout.shuffle_up()),
EzKey("M-S-l", lazy.layout.shuffle_right()),
Keybind("M-S-h", lazy.layout.shuffle_left()),
Keybind("M-S-j", lazy.layout.shuffle_down()),
Keybind("M-S-k", lazy.layout.shuffle_up()),
Keybind("M-S-l", lazy.layout.shuffle_right()),
# resize
EzKey("M-C-h", lazy.layout.grow_left()),
EzKey("M-C-j", lazy.layout.grow_down()),
EzKey("M-C-k", lazy.layout.grow_up()),
EzKey("M-C-l", lazy.layout.grow_right()),
Keybind("M-C-h", lazy.layout.grow_left()),
Keybind("M-C-j", lazy.layout.grow_down()),
Keybind("M-C-k", lazy.layout.grow_up()),
Keybind("M-C-l", lazy.layout.grow_right()),
# cycle
EzKey("M-n", lazy.group.next_window()),
Keybind("M-n", lazy.group.next_window()),
# window attributes
EzKey("M-C-q", lazy.window.toggle_floating()),
EzKey("M-C-w", lazy.window.toggle_fullscreen()),
Keybind("M-C-q", lazy.window.toggle_floating()),
Keybind("M-C-w", lazy.window.toggle_fullscreen()),
# cycle layouts
EzKey("M-<Tab>", lazy.next_layout()),
Keybind("M-<Tab>", lazy.next_layout()),
# toggles
EzKey("M-S-w", lazy.spawn(os.path.join(scripts, "togglemaster"))),
Keybind("M-S-w", lazy.spawn(os.path.join(scripts, "togglemaster"))),
# # media
# EzKey("XF86AudioMute", lazy.spawn("pulsemixer --toggle-mute")),
# EzKey("XF86AudioLowerVolume", lazy.spawn("pulsemixer --change-volume -5")),
# EzKey("XF86AudioRaiseVolume", lazy.spawn("pulsemixer --change-volume +5")),
# EzKey("XF86MonBrightnessDown", lazy.spawn("light -U 5")),
# EzKey("XF86MonBrightnessUp", lazy.spawn("light -A 5")),
# Keybind("XF86AudioMute", lazy.spawn("pulsemixer --toggle-mute")),
# Keybind("XF86AudioLowerVolume", lazy.spawn("pulsemixer --change-volume -5")),
# Keybind("XF86AudioRaiseVolume", lazy.spawn("pulsemixer --change-volume +5")),
# Keybind("XF86MonBrightnessDown", lazy.spawn("light -U 5")),
# Keybind("XF86MonBrightnessUp", lazy.spawn("light -A 5")),
# app launchers
EzKey("M-<Return>", lazy.spawn(terminal)),
EzKey("M-<space>", lazy.spawn(launcher)),
EzKey("M-<grave>", lazy.spawn("flameshot gui")),
EzKey("M-1", lazy.spawn(file_manager)),
EzKey("M-2", lazy.spawn(browser)),
EzKey("M-3", lazy.spawn(calculator)),
EzKey("M-4", lazy.spawn(music_player)),
EzKey("M-5", lazy.spawn(feed_reader)),
EzKey("M-6", lazy.spawn("virt-manager")),
EzKey("M-0", lazy.spawn(screen_locker)),
Keybind("M-<Return>", lazy.spawn(terminal)),
Keybind("M-<space>", lazy.spawn(launcher)),
Keybind("M-<grave>", lazy.spawn("flameshot gui")),
Keybind("M-1", lazy.spawn(file_manager)),
Keybind("M-2", lazy.spawn(browser)),
Keybind("M-3", lazy.spawn(calculator)),
Keybind("M-4", lazy.spawn(music_player)),
Keybind("M-6", lazy.spawn("virt-manager")),
Keybind("M-0", lazy.spawn(screen_locker)),
]
#
@ -92,8 +90,8 @@ groups = [Group(i) for i in "asdfgzxcvb"]
for i in groups:
keys.extend([
EzKey(f"M-{i.name}", lazy.group[i.name].toscreen()),
EzKey(f"M-S-{i.name}", lazy.window.togroup(i.name)),
Keybind(f"M-{i.name}", lazy.group[i.name].toscreen()),
Keybind(f"M-S-{i.name}", lazy.window.togroup(i.name)),
])
#
@ -131,49 +129,6 @@ layouts = [
# bar
#
widget_defaults = dict(
font='mononoki',
fontsize=15,
padding=6,
)
extension_defaults = widget_defaults.copy()
group_box_settings = dict(
disable_drag=True,
highlight_method="block",
borderwidth=0,
# group is focused
this_current_screen_border=colors[2],
other_current_screen_border=colors[2],
block_highlight_text_color="ffffff",
active="ffffff",
# tag containts an urgent window
urgent_border=colors[6],
# tag is viewed on a non-focused monitor
this_screen_border=colors[1],
other_screen_border=colors[1],
# tag is empty
inactive="817f7f",
)
screens = []
for _ in range(2):
screens.append(
Screen(top=bar.Bar(
[
widget.GroupBox(**group_box_settings),
widget.Sep(),
widget.WindowName(),
widget.Spacer(),
widget.PulseVolume(),
widget.Sep(),
widget.Clock(format='%a %b %d %H:%M'),
],
29,
background='#0e0e0e',
margin=[6, 6, 6, 6],
), ), )
# Drag floating layouts.
mouse = [
Drag([mod],