Moved to Qtile

This commit is contained in:
Michał Gdula 2022-08-24 21:04:18 +01:00
parent d5081812ae
commit 51c7cd4a0c
71 changed files with 542 additions and 47 deletions

7
qtile/autostart.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
nitrogen --restore &
picom --experimental-backends -b &
xrandr --output HDMI-0 --mode 1920x1080 --rate 144 &
polybar -r fluffy &
flameshot &
dunst &

24
qtile/config.py Normal file
View file

@ -0,0 +1,24 @@
# Original script made by https://github.com/Icy-Thought
# Ajusted by Fluffy for his use
from typing import List
from modules.workspaces import floating_layout, groups, layouts, screens
from modules.keybinds import keys, mouse
import modules.autostart
auto_fullscreen = True
auto_minimize = False
bring_front_click = True
cursor_warp = False
dgroups_app_rules = []
dgroups_key_binder = None
dpi_scale = 1.0
focus_on_window_activation = "smart"
follow_mouse_focus = False
reconfigure_screens = True
wmname = "Qtile"

View file

@ -0,0 +1,9 @@
import os
import subprocess
from libqtile import hook
@hook.subscribe.startup_once
def autostart():
home = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([home])

139
qtile/modules/keybinds.py Normal file
View file

@ -0,0 +1,139 @@
# ----------------------------------------
# Importing
# ----------------------------------------
# Used to control windows and window
# placement
from libqtile.command import lazy
from libqtile.config import EzKey, EzDrag, EzClick
@lazy.window.function
def float_to_front(window):
if window.floating:
window.cmd_bring_to_front()
# ----------------------------------------
# Default apps
# ----------------------------------------
# I mostly use Rofi to launch apps so not
# too important to me
TERMINAL = "alacritty"
SCREENSHOT = "flameshot gui"
LAUNCHER = "rofi -show"
BROWSER = "firefox"
# ----------------------------------------
# Modifier keys
# ----------------------------------------
# Used to move and control window
# placement within Qtile
EzKey.modifier_keys = {
"M": "mod4", # Windows
"A": "mod1", # Alt
"S": "shift", # Shift
"C": "control", # Ctrl
}
# ----------------------------------------
# Mouse
# ----------------------------------------
# Controling floating windows with a
# mouse
mouse = [
EzDrag(
"M-<Button1>",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
EzDrag(
"M-<Button3>", lazy.window.set_size_floating(), start=lazy.window.get_size()
),
EzClick("M-<Button2>", lazy.window.bring_to_front()),
]
# ----------------------------------------
# Window
# ----------------------------------------
# Different lists of window controls for
# Qtile
window_navigation = [
EzKey("M-<Tab>", lazy.group.next_window(), float_to_front()),
EzKey("M-<Left>", lazy.layout.left()),
EzKey("M-<Down>", lazy.layout.down()),
EzKey("M-<Up>", lazy.layout.up()),
EzKey("M-<Right>", lazy.layout.right()),
]
window_displacement = [
EzKey("M-C-<Left>", lazy.layout.swap_left(), lazy.layout.shuffle_left()),
EzKey("M-C-<Down>", lazy.layout.swap_down(), lazy.layout.shuffle_down()),
EzKey("M-C-<Up>", lazy.layout.swap_up(), lazy.layout.shuffle_up()),
EzKey("M-C-<Right>", lazy.layout.swap_right(), lazy.layout.shuffle_right()),
]
window_dimension = [
#EzKey("M-S-<Left>", lazy.layout.grow_left()),
#EzKey("M-S-<Down>", lazy.layout.grow_down()),
#EzKey("M-S-<Up>", lazy.layout.grow_up()),
#EzKey("M-S-<Right>", lazy.layout.grow_right()),
EzKey("M-S-<Left>", lazy.layout.grow()),
EzKey("M-S-<Right>", lazy.layout.shrink()),
EzKey("M-S-<Tab>", lazy.layout.reset()),
]
window_toggles = [
EzKey("M-y", lazy.next_layout()),
EzKey("M-q", lazy.window.kill()),
EzKey("M-g", lazy.window.toggle_floating()),
EzKey("M-m", lazy.window.toggle_fullscreen()),
]
# ----------------------------------------
# Qtile and App
# ----------------------------------------
# Launching apps and qtile settings
qtilectl = [
EzKey("M-S-r", lazy.restart()),
EzKey("M-S-q", lazy.shutdown()),
]
rofi = [
EzKey("M-r", lazy.spawn(LAUNCHER)),
]
application_spawns = [
EzKey("M-t", lazy.spawn(TERMINAL)),
EzKey("M-b", lazy.spawn(BROWSER)),
]
mediactl = [
EzKey("<XF86AudioPlay>", lazy.spawn("playerctl play-pause")),
EzKey("<XF86AudioNext>", lazy.spawn("playerctl next")),
EzKey("<XF86AudioPrev>", lazy.spawn("playerctl previous")),
]
scrcap = [
EzKey("<Print>", lazy.spawn(SCREENSHOT)),
]
# ----------------------------------------
# Keybinds
# ----------------------------------------
# Putting all keybinds into one list to
# use in other scripts
keys = [
*window_navigation,
*window_displacement,
*window_dimension,
*window_toggles,
*qtilectl,
*rofi,
*application_spawns,
*mediactl,
*scrcap,
]

17
qtile/modules/themes.py Normal file
View file

@ -0,0 +1,17 @@
paradise = [
"#151515", # bg
"#E8E3E3", # fg
"#8C977D", # accent
"#151515", # black
"#E8E3E3", # white
"#B66467", # red
"#D9BC8C", # orange
"#D9BC8C", # yellow
"#8C977D", # green
"#8DA3B9", # blue
"#A988B0", # purple
]
theme = paradise

View file

@ -0,0 +1,81 @@
# ----------------------------------------
# Importing
# ----------------------------------------
# Used to move workspaces and windows
from libqtile import layout
from libqtile.command import lazy
from libqtile.config import EzKey, Group, Match, Screen
from modules.keybinds import keys
from modules.themes import theme
# ----------------------------------------
# Groups
# ----------------------------------------
# Listing usable groups/workspaces
groups = [
Group("1", label="1"),
Group("2", label="2"),
Group("3", label="3"),
Group("4", label="4"),
Group("5", label="5"),
Group("6", label="6"),
Group("7", label="7"),
Group("8", label="8"),
Group("9", label="9"),
]
# ----------------------------------------
# Keybinds
# ----------------------------------------
# Used to move view/application to
# different workspace/group
for i in groups:
keys.extend(
[
# mod1 + letter of group = switch to group
EzKey("M-%s" % i.name, lazy.group[i.name].toscreen()),
# mod1 + shift + letter of group => move focused window to group
EzKey("M-S-%s" % i.name, lazy.window.togroup(i.name)),
]
)
border = dict(
border_focus=theme[2],
border_normal=theme[0],
border_width=3,
margin=8,
)
layouts = [
layout.MonadTall(**border, ratio=0.5),
layout.MonadThreeCol(**border),
layout.MonadWide(**border, ratio=0.69),
layout.Spiral(**border),
layout.Max(**border),
]
floating_layout = layout.Floating(
**border,
float_rules=[
*layout.Floating.default_float_rules,
Match(wm_class="confirm"),
Match(wm_class="dialog"),
Match(wm_class="download"),
Match(wm_class="error"),
Match(wm_class="file_progress"),
Match(wm_class="notification"),
Match(wm_class="splash"),
Match(wm_class="toolbar"),
Match(wm_class="confirmreset"), # gitk
Match(wm_class="makebranch"), # gitk
Match(wm_class="maketag"), # gitk
Match(title="branchdialog"), # gitk
Match(wm_class="pinentry"), # GPG key password entry
Match(title="Picture-in-Picture"), # FireFox
Match(wm_class="ssh-askpass"), # ssh-askpass
],
)
screens = [ Screen() ]