mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2024-12-22 23:29:36 +01:00
Add qtile config
This commit is contained in:
parent
44ee0f6985
commit
a4496765e2
20
.config/qtile/autostart.sh
Executable file
20
.config/qtile/autostart.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
function run {
|
||||
if ! pgrep $1 > /dev/null ;
|
||||
then
|
||||
$@&
|
||||
fi
|
||||
}
|
||||
|
||||
feh --bg-scale /usr/share/endeavouros/backgrounds/endeavouros-wallpaper.png
|
||||
run picom & disown # --experimental-backends --vsync should prevent screen tearing on most setups if needed
|
||||
|
||||
# Low battery notifier
|
||||
#~/.config/qtile/scripts/check_battery.sh & disown
|
||||
|
||||
# Start welcome
|
||||
#run eos-welcome & disown
|
||||
run /home/sahin/.config/openbox/polybar/default/launch.sh & disown
|
||||
|
||||
run /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & disown # start polkit agent from GNOME
|
21
.config/qtile/config.py
Normal file
21
.config/qtile/config.py
Normal file
@ -0,0 +1,21 @@
|
||||
from modules.keys import keys, mod
|
||||
from modules.groups import groups
|
||||
from modules.layouts import layouts, floating_layout
|
||||
from modules.mouse import mouse
|
||||
from modules.hooks import *
|
||||
import os
|
||||
from modules.screens import screens
|
||||
dgroups_key_binder = None
|
||||
dgroups_app_rules = [] # type: List
|
||||
main = None # WARNING: this is deprecated and will be removed soon
|
||||
follow_mouse_focus = True
|
||||
bring_front_click = False
|
||||
cursor_warp = False
|
||||
auto_fullscreen = True
|
||||
focus_on_window_activation = "smart"
|
||||
wmname = "Qtile"
|
||||
widget_defaults = dict(
|
||||
font='Cascadia Code',
|
||||
fontsize=13,
|
||||
padding=3
|
||||
)
|
21
.config/qtile/modules/groups.py
Normal file
21
.config/qtile/modules/groups.py
Normal file
@ -0,0 +1,21 @@
|
||||
from libqtile.config import Group, Key, Match
|
||||
from libqtile.lazy import lazy
|
||||
|
||||
from .keys import keys, mod
|
||||
|
||||
groups = [Group(i) for i in "123456789"]
|
||||
|
||||
symbols = ['semicolon', 'comma', 'period', 'p', 'y', 'equal', 'g', 'c', 'r', 'percent']
|
||||
|
||||
for i, j in zip(groups, symbols):
|
||||
keys.extend([
|
||||
Key([mod], j, lazy.group[i.name].toscreen(),
|
||||
desc="Switch to group {}".format(i.name)),
|
||||
|
||||
Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
|
||||
desc="move focused window to group {}".format(i.name)),
|
||||
|
||||
# Use below if you prefer to switch to that group.
|
||||
# Key([mod, "shift"], j, lazy.window.togroup(i.name, switch_group=True),
|
||||
# desc="Switch to & move focused window to group {}".format(i.name)),
|
||||
])
|
9
.config/qtile/modules/hooks.py
Normal file
9
.config/qtile/modules/hooks.py
Normal file
@ -0,0 +1,9 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from libqtile import hook
|
||||
|
||||
|
||||
@hook.subscribe.startup
|
||||
def autostart():
|
||||
subprocess.call([os.path.expanduser('~/.config/qtile/autostart.sh')])
|
127
.config/qtile/modules/keys.py
Normal file
127
.config/qtile/modules/keys.py
Normal file
@ -0,0 +1,127 @@
|
||||
import os
|
||||
|
||||
from libqtile.config import Key, KeyChord
|
||||
from libqtile.lazy import lazy
|
||||
from libqtile.utils import guess_terminal
|
||||
|
||||
mod = "mod1"
|
||||
terminal = guess_terminal()
|
||||
# terminal = "xfce4-terminal"
|
||||
home = os.path.expanduser
|
||||
|
||||
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], "Tab", lazy.screen.toggle_group(),
|
||||
desc="Toggle back and forth between latest groups"),
|
||||
Key([mod], "d", lazy.spawn("rofi -show combi"), desc="spawn rofi"),
|
||||
|
||||
# Move windows between left/right columns or move up/down in current stack.
|
||||
# Moving out of range in Columns layout will create new column.
|
||||
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"),
|
||||
|
||||
# Grow windows. If current window is on the edge of screen and direction
|
||||
# will be to screen edge - window would shrink.
|
||||
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"),
|
||||
KeyChord([mod], "w", [
|
||||
Key([], "g", lazy.layout.grow()),
|
||||
Key([], "s", lazy.layout.shrink()),
|
||||
Key([], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
|
||||
Key([], "m", lazy.layout.maximize())],
|
||||
mode="Windows"
|
||||
),
|
||||
Key([mod], "f", lazy.window.toggle_fullscreen(), desc='Toggle fullscreen'),
|
||||
Key([mod, "shift"], "f", lazy.window.toggle_floating(),
|
||||
desc='Toggle floating'),
|
||||
|
||||
# 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"),
|
||||
|
||||
# Toggle between different layouts as defined below
|
||||
Key([mod], "space", lazy.next_layout(), desc="Toggle between layouts"),
|
||||
Key([mod, 'shift'], "space", lazy.widget["keyboardlayout"].next_keyboard(), desc="Next keyboard layout."),
|
||||
Key([mod], "e", lazy.screen.prev_group(), desc="Move to the group on the left"),
|
||||
Key([mod], "u", lazy.screen.next_group(), desc="Move to the group on the right"),
|
||||
Key([mod], "q", lazy.window.kill(), desc="Kill focused window"),
|
||||
Key([mod, "shift", "control"], "h", lazy.layout.swap_column_left()),
|
||||
Key([mod, "shift", "control"], "l", lazy.layout.swap_column_right()),
|
||||
Key([mod, "shift"], "space", lazy.layout.flip()),
|
||||
Key([mod, "control"], "r", lazy.restart(), desc="Restart Qtile"),
|
||||
Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
|
||||
Key([mod, "shift"],
|
||||
"d",
|
||||
lazy.spawncmd(),
|
||||
desc="Spawn a command using a prompt widget"),
|
||||
|
||||
# Key([mod, "shift"], "e", lazy.spawn("menu_powermenu"), desc="Spawn powermenu using rofi"),
|
||||
|
||||
# Key([mod], "n", lazy.spawn(home("~/Desktop/GitRepositories/networkmanager-dmenu/networkmanager_dmenu")), desc="Launch network manager"),
|
||||
# Key([mod], "i", lazy.spawn("sxiv " + home("~/Pictures/keyboard-layout.jpg")), desc="Show current keyboard layout"),
|
||||
|
||||
# Key([mod], "b", lazy.spawn(home("~/Desktop/GitRepositories/rofi-bluetooth/rofi-bluetooth")),
|
||||
# desc="Control bluetooth devices"),
|
||||
|
||||
# Key([mod], "x", lazy.spawn(home("~/scripts/kill-process.sh")),
|
||||
# desc="Kill processes using rofi"),
|
||||
|
||||
# == audio
|
||||
|
||||
Key([], "XF86AudioRaiseVolume",
|
||||
lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%")),
|
||||
Key([], "XF86AudioLowerVolume",
|
||||
lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%")),
|
||||
Key([], "XF86AudioMute",
|
||||
lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")),
|
||||
Key([], "XF86AudioMicMute",
|
||||
lazy.spawn("pactl set-source-mute @DEFAULT_SOURCE@ toggle")),
|
||||
|
||||
|
||||
# == backlight
|
||||
Key([], "XF86MonBrightnessUp",
|
||||
lazy.spawn("xbacklight -inc 5")),
|
||||
Key([], "XF86MonBrightnessDown",
|
||||
lazy.spawn("xbacklight -dec 5")),
|
||||
|
||||
# Key([], "XF86KbdBrightnessUp",
|
||||
# lazy.spawn(home("~/scripts/keyboard_backlight.sh inc"))),
|
||||
# Key([], "XF86KbdBrightnessDown",
|
||||
# lazy.spawn(home("~/scripts/keyboard_backlight.sh dec"))),
|
||||
|
||||
|
||||
# Key([], "XF86TouchpadToggle",
|
||||
# lazy.spawn(home("~/scripts/toggle-touchpad.sh"))),
|
||||
]
|
36
.config/qtile/modules/layouts.py
Normal file
36
.config/qtile/modules/layouts.py
Normal file
@ -0,0 +1,36 @@
|
||||
from libqtile import layout
|
||||
from libqtile.config import Match
|
||||
|
||||
# default = {
|
||||
# "border_width": 2,
|
||||
# "margin": 8,
|
||||
# "border_focus": "#5294e2",
|
||||
# "border_normal": "#2c5380"}
|
||||
layouts = [
|
||||
layout.MonadTall(margin=8, border_focus='#5294e2',
|
||||
border_normal='#2c5380'),
|
||||
#layout.Columns(border_focus_stack='#d75f5f'),
|
||||
layout.Max(),
|
||||
# Try more layouts by unleashing below layouts.
|
||||
# layout.Stack(num_stacks=2),
|
||||
# layout.Bsp(),
|
||||
# layout.Matrix(),
|
||||
# layout.MonadTall(),
|
||||
# layout.MonadWide(),
|
||||
# layout.RatioTile(),
|
||||
# layout.Tile(),
|
||||
# layout.TreeTab(),
|
||||
# layout.VerticalTile(),
|
||||
# layout.Zoomy(),
|
||||
]
|
||||
|
||||
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
|
||||
])
|
12
.config/qtile/modules/mouse.py
Normal file
12
.config/qtile/modules/mouse.py
Normal file
@ -0,0 +1,12 @@
|
||||
from libqtile.config import Click, Drag
|
||||
from libqtile.lazy import lazy
|
||||
from .keys import mod
|
||||
|
||||
# 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())
|
||||
]
|
5
.config/qtile/modules/screens.py
Normal file
5
.config/qtile/modules/screens.py
Normal file
@ -0,0 +1,5 @@
|
||||
from libqtile.config import Screen
|
||||
|
||||
from .widgets import *
|
||||
|
||||
screens = [Screen()]
|
57
.config/qtile/modules/widgets.py
Normal file
57
.config/qtile/modules/widgets.py
Normal file
@ -0,0 +1,57 @@
|
||||
from libqtile import widget
|
||||
from libqtile import qtile
|
||||
|
||||
colors = [
|
||||
["#282c34", "#282c34"], # panel background
|
||||
["#3d3f4b", "#434758"], # background for current screen tab
|
||||
["#ffffff", "#ffffff"], # font color for group names
|
||||
["#ff5555", "#ff5555"], # border line color for current tab
|
||||
["#74438f", "#74438f"], # border line color for 'other tabs' and color for 'odd widgets'
|
||||
["#4f76c7", "#4f76c7"], # color for the 'even widgets'
|
||||
["#e1acff", "#e1acff"], # window name
|
||||
["#ecbbfb", "#ecbbfb"] # backbround for inactive screens
|
||||
]
|
||||
|
||||
|
||||
widget_defaults = dict(
|
||||
font='Cantarell',
|
||||
fontsize=12,
|
||||
padding=3,
|
||||
)
|
||||
extension_defaults = widget_defaults.copy()
|
||||
class MyVolume(widget.Volume):
|
||||
def _configure(self, qtile, bar):
|
||||
widget.Volume._configure(self, qtile, bar)
|
||||
self.volume = self.get_volume()
|
||||
if self.volume <= 0:
|
||||
self.text = ''
|
||||
elif self.volume <= 15:
|
||||
self.text = ''
|
||||
elif self.volume < 50:
|
||||
self.text = ''
|
||||
else:
|
||||
self.text = ''
|
||||
# drawing here crashes Wayland
|
||||
|
||||
def _update_drawer(self, wob=False):
|
||||
if self.volume <= 0:
|
||||
self.text = ''
|
||||
elif self.volume <= 15:
|
||||
self.text = ''
|
||||
elif self.volume < 50:
|
||||
self.text = ''
|
||||
else:
|
||||
self.text = ''
|
||||
self.draw()
|
||||
|
||||
if wob:
|
||||
with open(self.wob, 'a') as f:
|
||||
f.write(str(self.volume) + "\n")
|
||||
|
||||
volume = MyVolume(
|
||||
fontsize=18,
|
||||
font='Font Awesome 5 Free',
|
||||
foreground=colors[4],
|
||||
background='#2f343f',
|
||||
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn("pavucontrol")}
|
||||
)
|
Loading…
Reference in New Issue
Block a user