initial commit: alacritty, qtile

This commit is contained in:
Daniel Mevec 2022-07-03 07:29:38 +02:00
commit 02b0eb2e0c
3 changed files with 2168 additions and 0 deletions

File diff suppressed because it is too large Load diff

486
dot_config/qtile/config.py Normal file
View file

@ -0,0 +1,486 @@
# -*- coding: utf-8 -*-
import os
import re
import socket
import subprocess
from libqtile import qtile
from libqtile.config import Click, Drag, Group, KeyChord, Key, Match, Screen
from libqtile.command import lazy
from libqtile import layout, bar, widget, hook
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
from typing import List # noqa: F401from typing import List # noqa: F401
mod = "mod4" # Sets mod key to SUPER/WINDOWS
myTerm = "alacritty" # My terminal of choice
myBrowser = "qutebrowser" # My browser of choice
class Colors:
bg = ["#282828", "#3c3836"] #background
fg = ["#ebdbb2", "#fbf1c7"] #foreground
red = ["#cc241d", "#fb4934"]
green = ["#98971a", "#b8bb26"]
yellow = ["#d79921", "#fabd2f"]
blue = ["#458588", "#83a598"]
purple = ["#b16286", "#d3869b"]
aqua = ["#689d6a", "#8ec07c"]
orange = ["#d65d0e", "#fe8019"]
gray = ["#928374", "#a89984"]
grey = gray
def _init_(self ):
pass
keys = [
### The essentials
Key([mod], "Return", lazy.spawn(myTerm), desc='Launches My Terminal'),
# Key([mod, "shift"], "Return", lazy.spawn("dm-run"), desc='Run Launcher'),
Key([mod, "shift"], "Return", lazy.spawn("ulauncher"), desc='Run Launcher'),
# Key([mod, "shift"], "Return", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
Key([mod], "b", lazy.spawn(myBrowser),desc='Qutebrowser'),
# Key([mod], "/", lazy.spawn("dtos-help"), desc='DTOS Help'),
Key([mod], "Tab", lazy.next_layout(), desc='Toggle through layouts'),
Key([mod, "shift"], "c",lazy.window.kill(), desc='Kill active window'),
Key([mod, "shift"], "r", lazy.restart(), desc='Restart Qtile'),
Key([mod, "shift"], "q", lazy.shutdown(), desc='Shutdown Qtile'),
# Key(["control", "shift"], "e", lazy.spawn("emacsclient -c -a emacs"),desc='Doom Emacs'),
### Switch focus to specific monitor (out of three)
Key([mod], "w", lazy.to_screen(0), desc='Keyboard focus to monitor 1' ),
Key([mod], "e", lazy.to_screen(1), desc='Keyboard focus to monitor 2' ),
Key([mod], "r", lazy.to_screen(2), desc='Keyboard focus to monitor 3' ),
### Switch focus of monitors
Key([mod], "period", lazy.next_screen(), desc='Move focus to next monitor'),
Key([mod], "comma", lazy.prev_screen(), desc='Move focus to prev monitor'),
### Treetab controls
Key([mod, "shift"], "h", lazy.layout.move_left(), desc='Move up a section in treetab'),
Key([mod, "shift"], "l", lazy.layout.move_right(), desc='Move down a section in treetab'),
### Window controls
Key([mod], "j", lazy.layout.down(), desc='Move focus down in current stack pane' ),
Key([mod], "k", lazy.layout.up(), desc='Move focus up in current stack pane' ),
Key([mod, "shift"], "j", lazy.layout.shuffle_down(), lazy.layout.section_down(),
desc='Move windows down in current stack' ),
Key([mod, "shift"], "k", lazy.layout.shuffle_up(), lazy.layout.section_up(),
desc='Move windows up in current stack'),
Key([mod], "h", lazy.layout.shrink(), lazy.layout.decrease_nmaster(),
desc='Shrink window (MonadTall), decrease number in master pane (Tile)'),
Key([mod], "l", lazy.layout.grow(), lazy.layout.increase_nmaster(),
desc='Expand window (MonadTall), increase number in master pane (Tile)'),
Key([mod], "n", lazy.layout.normalize(), desc='normalize window size ratios'),
Key([mod], "m", lazy.layout.maximize(), desc='toggle window between minimum and maximum sizes'),
Key([mod, "shift"], "f", lazy.window.toggle_floating(), desc='toggle floating'),
Key([mod], "f", lazy.window.toggle_fullscreen(), desc='toggle fullscreen' ),
### Stack controls
Key([mod, "shift"], "Tab", lazy.layout.rotate(), lazy.layout.flip(),
desc='Switch which side main pane occupies (XmonadTall)'),
Key([mod], "space", lazy.layout.next(), desc='Switch window focus to other pane(s) of stack'),
Key([mod, "shift"], "space", lazy.layout.toggle_split(),
desc='Toggle between split and unsplit sides of stack' ),
# Dmenu scripts launched using the key chord SUPER+p followed by 'key'
KeyChord([mod], "p", [
Key([], "h", lazy.spawn("dm-hub"), desc='List all dmscripts'),
Key([], "a", lazy.spawn("dm-sounds"), desc='Choose ambient sound'),
Key([], "b", lazy.spawn("dm-setbg"), desc='Set background'),
Key([], "c", lazy.spawn("dtos-colorscheme"), desc='Choose color scheme'),
Key([], "e", lazy.spawn("dm-confedit"), desc='Choose a config file to edit'),
Key([], "i", lazy.spawn("dm-maim"), desc='Take a screenshot'),
Key([], "k", lazy.spawn("dm-kill"), desc='Kill processes '),
Key([], "m", lazy.spawn("dm-man"), desc='View manpages'),
Key([], "n", lazy.spawn("dm-note"), desc='Store and copy notes'),
Key([], "o", lazy.spawn("dm-bookman"), desc='Browser bookmarks'),
Key([], "p", lazy.spawn("passmenu -p \"Pass: \""), desc='Logout menu'),
Key([], "q", lazy.spawn("dm-logout"), desc='Logout menu' ),
Key([], "r", lazy.spawn("dm-radio"), desc='Listen to online radio'),
Key([], "s", lazy.spawn("dm-websearch"), desc='Search various engines'),
Key([], "t", lazy.spawn("dm-translate"), desc='Translate text'),
]),
]
groups = [Group("DEV", layout='monadtall'),
Group("WWW", layout='monadtall'),
Group("SYS", layout='monadtall'),
Group("DOC", layout='monadtall'),
Group("VBOX", layout='monadtall'),
Group("CHAT", layout='ratiotile'),
Group("MUS", layout='monadtall'),
Group("VID", layout='monadtall'),
Group("GFX", layout='monadtall')]
# Allow MODKEY+[0 through 9] to bind to groups, see https://docs.qtile.org/en/stable/manual/config/groups.html
# MOD4 + index Number : Switch to Group[index]
# MOD4 + shift + index Number : Send active window to another Group
from libqtile.dgroups import simple_key_binder
dgroups_key_binder = simple_key_binder("mod4")
layout_theme = {"border_width": 2,
"margin": 8,
"border_focus": Colors.green,
"border_normal": Colors.grey
}
layouts = [
#layout.MonadWide(**layout_theme),
#layout.Bsp(**layout_theme),
#layout.Stack(stacks=2, **layout_theme),
#layout.Columns(**layout_theme),
#layout.RatioTile(**layout_theme),
# layout.Tile(shift_windows=True, **layout_theme),
#layout.VerticalTile(**layout_theme),
layout.Matrix(**layout_theme),
#layout.Zoomy(**layout_theme),
layout.MonadTall(**layout_theme),
# layout.Max(**layout_theme),
layout.RatioTile(**layout_theme),
layout.TreeTab(
font = "Ubuntu",
fontsize = 10,
# sections = ["FIRST", "SECOND", "THIRD", "FOURTH"],
section_fontsize = 10,
border_width = 2,
bg_color = Colors.bg,
active_bg = Colors.green,
active_fg = Colors.bg,
inactive_bg = Colors.grey,
inactive_fg = Colors.bg,
padding_left = 0,
padding_x = 0,
padding_y = 5,
section_top = 10,
section_bottom = 20,
level_shift = 8,
vspace = 3,
panel_width = 200
),
# layout.Floating(**layout_theme)
]
prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
##### DEFAULT WIDGET SETTINGS #####
widget_defaults = dict(
font="FiraCode Nerd Font Bold",
fontsize = 11,
padding = 0,
background=Colors.bg
)
extension_defaults = widget_defaults.copy()
def init_widgets_list():
widgets_list = [
# widget.Image(
# filename = "~/.config/qtile/icons/python-white.png",
# scale = "False",
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)}
# ),
widget.TextBox(
text = u'\ue73c',
foreground = Colors.fg,
fontsize = 22,
padding = 12,
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)}
),
widget.GroupBox(
font = "Ubuntu Bold",
fontsize = 9,
margin_y = 3,
margin_x = 0,
padding_y = 5,
padding_x = 3,
borderwidth = 3,
active = Colors.fg,
inactive = Colors.grey,
# rounded = False,
highlight_color = Colors.orange,
highlight_method = "line",
this_current_screen_border = Colors.blue,
other_screen_border = Colors.grey,
this_screen_border = Colors.blue,
other_current_screen_border = Colors.grey,
foreground = Colors.fg,
background = Colors.bg
),
widget.Sep(
foreground = Colors.red,
padding = 8
),
widget.CurrentLayoutIcon(
# custom_icon_paths = [os.path.expanduser("~/.config/qtile/icons")],
foreground = Colors.red,
background = Colors.bg,
padding = 0,
scale = 0.7
),
widget.Prompt(),
widget.Sep(
foreground = Colors.red,
padding = 8
),
widget.WindowName(
fontsize = 10,
foreground = Colors.yellow,
background = Colors.bg,
padding = 0
),
widget.Systray(
background = Colors.bg,
padding = 5
),
widget.Spacer(length=6),
widget.TextBox(
text = u'\ue0be',
background = Colors.bg,
foreground = Colors.yellow,
padding = 0,
fontsize = 26
),
widget.TextBox(
text = u"\uf8c7",
foreground = Colors.bg,
background = Colors.yellow,
fontsize = 14
),
# widget.Battery(
# battery = 0,
# fmt = ' {}',
# charge_char = u'\uf583',
# discharge_char = u'\uf57d',
# empty_char = u'\uf582',
# full_char = u'\uf578',
# unknown_char = u'\uf590',
# format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
# background = Colors.yellow,
# foreground = Colors.bg,
# ),
# widget.Battery(
# battery = 0,
# fmt = ' {}',
# charge_char = u'\uf583',
# discharge_char = u'\uf57d',
# empty_char = u'\uf582',
# full_char = u'\uf578',
# unknown_char = u'\uf590',
# format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
# background = Colors.yellow,
# foreground = Colors.bg,
# ),
widget.Net(
interface = "enp0s31f6",
format = '{down} ↓↑ {up}',
prefix='M',
foreground = Colors.bg,
background = Colors.yellow,
),
widget.TextBox(
text = u'\ue0be',
background = Colors.yellow,
foreground = Colors.orange,
padding = 0,
fontsize = 26
),
widget.TextBox(
text = u"\uf8c7",
foreground = Colors.bg,
background = Colors.orange,
fontsize = 14
),
widget.ThermalSensor(
foreground = Colors.bg,
background = Colors.orange,
threshold = 90,
fmt = ' {}',
),
widget.TextBox(
text = u'\ue0be',
background = Colors.orange,
foreground = Colors.red,
padding = 0,
fontsize = 26
),
widget.TextBox(
text = u"\uf546",
foreground = Colors.bg,
background = Colors.red,
fontsize = 16
),
widget.CheckUpdates(
update_interval = 1800,
distro = "Ubuntu",
display_format = " {updates}",
foreground = Colors.bg,
colour_have_updates = Colors.bg,
colour_no_updates = Colors.bg,
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e sudo apt upgrade')},
background = Colors.red
),
widget.TextBox(
text = u'\ue0be',
background = Colors.red,
foreground = Colors.purple,
padding = 0,
fontsize = 26
),
widget.TextBox(
text = u"\uf85a",
foreground = Colors.bg,
background = Colors.purple,
fontsize = 20
),
widget.Memory(
foreground = Colors.bg,
background = Colors.purple,
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm + ' -e htop')},
fmt = '{}',
format = '{MemPercent:5.1f} %',
),
widget.TextBox(
text = u'\ue0be',
background = Colors.purple,
foreground = Colors.blue,
padding = 0,
fontsize = 26
),
widget.TextBox(
text = u"\ufb19",
foreground = Colors.bg,
background = Colors.blue,
fontsize = 18
),
widget.CPU(
foreground = Colors.bg,
background = Colors.blue,
fmt = '{}',
format = '{load_percent:5.1f}%',
),
widget.TextBox(
text = u'\ue0be',
background = Colors.blue,
foreground = Colors.aqua,
padding = 0,
fontsize = 26
),
widget.TextBox(
text = u"\uf026",
foreground = Colors.bg,
background = Colors.aqua,
fontsize = 20
),
widget.Volume(
foreground = Colors.bg,
background = Colors.aqua,
fmt = '{}',
),
widget.TextBox(
text = u'\ue0be',
background = Colors.aqua,
foreground = Colors.green,
padding = 0,
fontsize = 26
),
widget.Clock(
foreground = Colors.bg,
background = Colors.green,
format = "%Y-%m-%d %a %H:%M ",
padding = 5
),
]
return widgets_list
def init_widgets_screen1():
widgets_screen1 = init_widgets_list()
del widgets_screen1[7:9] # Slicing removes unwanted widgets (systray) on Monitors 1,3
del widgets_screen1[4:5] # Slicing removes unwanted widgets (systray) on Monitors 1,3
return widgets_screen1
def init_widgets_screen2():
widgets_screen2 = init_widgets_list()
return widgets_screen2 # Monitor 2 will display all widgets in widgets_list
def init_screens():
return [
Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20)),
Screen(top=bar.Bar(widgets=init_widgets_screen2(), opacity=1.0, size=20)),
# Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=20))
]
if __name__ in ["config", "__main__"]:
screens = init_screens()
widgets_list = init_widgets_list()
widgets_screen1 = init_widgets_screen1()
widgets_screen2 = init_widgets_screen2()
def window_to_prev_group(qtile):
if qtile.currentWindow is not None:
i = qtile.groups.index(qtile.currentGroup)
qtile.currentWindow.togroup(qtile.groups[i - 1].name)
def window_to_next_group(qtile):
if qtile.currentWindow is not None:
i = qtile.groups.index(qtile.currentGroup)
qtile.currentWindow.togroup(qtile.groups[i + 1].name)
def window_to_previous_screen(qtile):
i = qtile.screens.index(qtile.current_screen)
if i != 0:
group = qtile.screens[i - 1].group.name
qtile.current_window.togroup(group)
def window_to_next_screen(qtile):
i = qtile.screens.index(qtile.current_screen)
if i + 1 != len(qtile.screens):
group = qtile.screens[i + 1].group.name
qtile.current_window.togroup(group)
def switch_screens(qtile):
i = qtile.screens.index(qtile.current_screen)
group = qtile.screens[i - 1].group
qtile.current_screen.set_group(group)
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())
]
dgroups_app_rules = [] # type: List
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout = layout.Floating(float_rules=[
# Run the utility of `xprop` to see the wm class and name of an X client.
# default_float_rules include: utility, notification, toolbar, splash, dialog,
# file_progress, confirm, download and error.
*layout.Floating.default_float_rules,
Match(title='Confirmation'), # tastyworks exit box
Match(title='Qalculate!'), # qalculate-gtk
Match(wm_class='kdenlive'), # kdenlive
Match(wm_class='pinentry-gtk-2'), # GPG key password entry
])
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True
# If things like steam games want to auto-minimize themselves when losing
# focus, should we respect this or not?
auto_minimize = True
@hook.subscribe.startup_once
def start_once():
home = os.path.expanduser('~')
subprocess.call([home + '/.config/qtile/up.sh'])
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, GitHub issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"

View file

@ -0,0 +1,7 @@
#!/bin/bash
picom --xrender-sync-fence & # option for nvidia driver to avoid error
volumeicon & # Systray volume Icon
nm-applet & # Systray Network Icon
nitrogen --restore & #wallpaper