mirror of
https://github.com/sahinakkaya/dotfiles.git
synced 2025-07-05 03:29:41 +03:00
Add qtile config
This commit is contained in:
@ -1,21 +1,42 @@
|
||||
from libqtile.config import Group, Key, Match
|
||||
from libqtile.config import Group, Key, Match, ScratchPad, DropDown
|
||||
from libqtile.lazy import lazy
|
||||
|
||||
from .keys import keys, mod
|
||||
|
||||
groups = [Group(i) for i in "123456789"]
|
||||
groups = [Group(i) for i in "1234567890"]
|
||||
|
||||
symbols = ['semicolon', 'comma', 'period', 'p', 'y', 'equal', 'g', 'c', 'r', 'percent']
|
||||
browsers = [
|
||||
Match(wm_class="firefox"),
|
||||
Match(wm_class="Google-chrome")]
|
||||
file_managers = [Match(wm_class="Thunar")]
|
||||
video_players = [
|
||||
Match(wm_class="streamlink-twitch-gui"),
|
||||
Match(wm_class="mpv")]
|
||||
groups = [
|
||||
Group('1'),
|
||||
Group('2', matches=[Match(wm_class="VirtualBox Manager")]),
|
||||
Group('3', matches=[Match(wm_class="Thunderbird")]),
|
||||
Group('4', matches=[Match(wm_class="st-256color")]),
|
||||
Group('5', matches=file_managers),
|
||||
Group('6'),
|
||||
Group('7', matches=browsers),
|
||||
Group('8', matches=video_players),
|
||||
Group('9'),
|
||||
Group('0', matches=[Match(wm_class="TelegramDesktop")]),
|
||||
]
|
||||
groups.append(ScratchPad("scratchpad", [
|
||||
# define a drop down terminal.
|
||||
# it is placed in the upper third of screen by default.
|
||||
DropDown("term", "st", opacity=1.0)
|
||||
]))
|
||||
|
||||
symbols = 'arstgmneio'
|
||||
|
||||
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"], j, 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)),
|
||||
Key([mod, "shift"], j, lazy.window.togroup(i.name, switch_group=True),
|
||||
desc="Switch to & move focused window to group {}".format(i.name)),
|
||||
])
|
||||
|
@ -1,9 +1,20 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from libqtile import hook
|
||||
from libqtile.command.client import InteractiveCommandClient
|
||||
|
||||
|
||||
@hook.subscribe.startup
|
||||
def autostart():
|
||||
subprocess.call([os.path.expanduser('~/.config/qtile/autostart.sh')])
|
||||
subprocess.call(['autostart.sh'])
|
||||
|
||||
|
||||
@hook.subscribe.startup_complete
|
||||
def focus_group():
|
||||
c = InteractiveCommandClient()
|
||||
c.group['4'].toscreen()
|
||||
|
||||
|
||||
@hook.subscribe.client_managed
|
||||
def show_window(window):
|
||||
window.group.cmd_toscreen()
|
||||
|
@ -2,127 +2,147 @@ import os
|
||||
|
||||
from libqtile.config import Key, KeyChord
|
||||
from libqtile.lazy import lazy
|
||||
from libqtile.utils import guess_terminal
|
||||
|
||||
mod = "mod1"
|
||||
terminal = guess_terminal()
|
||||
mod = "mod4"
|
||||
terminal = "st"
|
||||
# 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"),
|
||||
# '`': 'grave',
|
||||
# '-': 'minus',
|
||||
# '=': 'equal',
|
||||
# '[': 'bracketleft',
|
||||
# ']': 'bracketright',
|
||||
# '\\': 'backslash',
|
||||
# ';': 'semicolon',
|
||||
# '\'': 'quote',
|
||||
# ',': 'comma',
|
||||
# '.': 'dot',
|
||||
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"),
|
||||
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"),
|
||||
# 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'),
|
||||
# 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 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], "s", lazy.spawn("passmenu"), desc="Spawn passmenu"),
|
||||
# Toggle between different layouts as defined below
|
||||
Key([mod], "space", lazy.next_layout(), desc="Toggle between layouts"),
|
||||
Key([mod, 'shift'], "space",
|
||||
lazy.spawn("chlayout"), desc="Next keyboard layout."),
|
||||
Key([mod], "comma",
|
||||
lazy.screen.prev_group(), desc="Move to the group on the left"),
|
||||
Key([mod], "period",
|
||||
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, "control"], "n",
|
||||
lazy.spawn("lock-screen"), desc="Lock screen"),
|
||||
Key([mod, "control"], "s",
|
||||
lazy.spawn("toggle-screenkey"), desc="Show keys on screen"),
|
||||
Key([mod, "shift"], "d",
|
||||
lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
|
||||
Key([mod], "p", lazy.spawn("passmenu"), desc="Spawn passmenu"),
|
||||
|
||||
# Key([mod, "shift"], "e", lazy.spawn("menu_powermenu"), desc="Spawn powermenu using rofi"),
|
||||
# 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], "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], "b", lazy.spawn('rofi-bluetooth'),
|
||||
desc="Manage bluetooth devices"),
|
||||
|
||||
# Key([mod], "x", lazy.spawn(home("~/scripts/kill-process.sh")),
|
||||
# desc="Kill processes using rofi"),
|
||||
Key([mod], "v", lazy.spawn('polybar-wireguard --toggle'),
|
||||
desc="Manage VPN connections"),
|
||||
|
||||
# == audio
|
||||
# Key([mod], "x", lazy.spawn(home("~/scripts/kill-process.sh")),
|
||||
# desc="Kill processes using rofi"),
|
||||
|
||||
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")),
|
||||
# == 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")),
|
||||
# == 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([], "Print",
|
||||
lazy.spawn("flameshot gui")),
|
||||
|
||||
Key(["shift"], "Print",
|
||||
lazy.spawn("flameshot full")),
|
||||
|
||||
Key(["control"], "Print",
|
||||
lazy.spawn("flameshot full")),
|
||||
|
||||
Key([], 'F12', lazy.group['scratchpad'].dropdown_toggle('term')),
|
||||
|
||||
Key([], "XF86KbdBrightnessUp",
|
||||
lazy.spawn("keyboard_backlight.sh inc")),
|
||||
Key([], "XF86KbdBrightnessDown",
|
||||
lazy.spawn("keyboard_backlight.sh dec")),
|
||||
|
||||
|
||||
# Key([], "XF86TouchpadToggle",
|
||||
# lazy.spawn(home("~/scripts/toggle-touchpad.sh"))),
|
||||
Key([], "XF86TouchpadToggle",
|
||||
lazy.spawn("toggle-touchpad.sh")),
|
||||
]
|
||||
|
@ -7,9 +7,9 @@ from libqtile.config import Match
|
||||
# "border_focus": "#5294e2",
|
||||
# "border_normal": "#2c5380"}
|
||||
layouts = [
|
||||
layout.MonadTall(margin=8, border_focus='#5294e2',
|
||||
border_normal='#2c5380'),
|
||||
#layout.Columns(border_focus_stack='#d75f5f'),
|
||||
# layout.MonadTall(margin=8, border_focus='#5294e2',
|
||||
# border_normal='#2c5380'),
|
||||
layout.Columns(margin=8, border_focus_stack='#d75f5f'),
|
||||
layout.Max(),
|
||||
# Try more layouts by unleashing below layouts.
|
||||
# layout.Stack(num_stacks=2),
|
||||
@ -31,6 +31,10 @@ floating_layout = layout.Floating(float_rules=[
|
||||
Match(wm_class='makebranch'), # gitk
|
||||
Match(wm_class='maketag'), # gitk
|
||||
Match(wm_class='ssh-askpass'), # ssh-askpass
|
||||
Match(wm_class='sxiv'),
|
||||
Match(wm_class='telegram-desktop'),
|
||||
Match(wm_class='streamlink-twitch-gui'),
|
||||
Match(wm_class='pinentry-gtk-2'),
|
||||
Match(title='branchdialog'), # gitk
|
||||
Match(title='pinentry'), # GPG key password entry
|
||||
])
|
||||
|
@ -1,5 +1,3 @@
|
||||
from libqtile.config import Screen
|
||||
|
||||
from .widgets import *
|
||||
|
||||
screens = [Screen()]
|
||||
|
@ -1,57 +0,0 @@
|
||||
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")}
|
||||
)
|
Reference in New Issue
Block a user