use qtile_etras
This commit is contained in:
parent
14a62b39ce
commit
d6eebd5c10
1 changed files with 103 additions and 158 deletions
|
|
@ -4,22 +4,33 @@ import re
|
|||
import socket
|
||||
import subprocess
|
||||
from libqtile import qtile
|
||||
from libqtile.config import Click, Drag, Group, KeyChord, Key, Match, Screen
|
||||
from libqtile.config import Click, Drag, Group, KeyChord, Key, Match, Screen, ScratchPad, DropDown
|
||||
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
|
||||
from qtile_extras import widget
|
||||
from qtile_extras.widget.decorations import PowerLineDecoration
|
||||
|
||||
|
||||
from qutils import get_num_screens
|
||||
|
||||
mod = "mod4" # Sets mod key to SUPER/WINDOWS
|
||||
myTerm = "alacritty" # My terminal of choice
|
||||
myBrowser = "qutebrowser" # My browser of choice
|
||||
myBrowser = "firefox" # My browser of choice
|
||||
|
||||
class Colors:
|
||||
bg = ["#282828", "#3c3836"] #background
|
||||
bg1 = ["#3c3836", "#504945"]
|
||||
bg2 = ["#504945", "#665c54"]
|
||||
bg3 = ["#665c54", "#7c6f64"]
|
||||
|
||||
fg = ["#ebdbb2", "#fbf1c7"] #foreground
|
||||
fg1 = ["#d5c4a1", "#ebdbb2"]
|
||||
fg2 = ["#bdae93", "#d5c4a1"]
|
||||
fg3 = ["#a89984", "#bdae93"]
|
||||
|
||||
red = ["#cc241d", "#fb4934"]
|
||||
green = ["#98971a", "#b8bb26"]
|
||||
yellow = ["#d79921", "#fabd2f"]
|
||||
|
|
@ -29,6 +40,7 @@ class Colors:
|
|||
orange = ["#d65d0e", "#fe8019"]
|
||||
gray = ["#928374", "#a89984"]
|
||||
grey = gray
|
||||
|
||||
def _init_(self ):
|
||||
pass
|
||||
|
||||
|
|
@ -36,21 +48,12 @@ keys = [
|
|||
### The essentials
|
||||
Key([mod], "Return", lazy.spawn(myTerm), desc='Launches My Terminal'),
|
||||
Key([mod, "shift"], "Return", lazy.spawn("rofi -show 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], "l", lazy.spawn("cinnamon-screensaver-command -a"), 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'),
|
||||
|
|
@ -90,19 +93,16 @@ keys = [
|
|||
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' ),
|
||||
|
||||
desc='Toggle between split and unsplit sides of stack'),
|
||||
]
|
||||
|
||||
groups = [Group("DEV", layout='monadtall'),
|
||||
Group("WWW", layout='monadtall'),
|
||||
groups = [Group("CHT", layout='max', matches=[Match(wm_class=('microsoft teams - preview'))]),
|
||||
Group("WWW", layout='monadtall', matches=[Match(wm_class=['Firefox','firefox','firefox-bin','Chromium','Google-chrome','google-chrome'])]),
|
||||
Group("DEV", layout='max'),
|
||||
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')]
|
||||
Group("REF", layout='monadtall'),
|
||||
Group("DOC", layout='monadtall', matches=[Match(wm_class=['obsidian'])]),
|
||||
Group("DMP", 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]
|
||||
|
|
@ -110,6 +110,22 @@ groups = [Group("DEV", layout='monadtall'),
|
|||
from libqtile.dgroups import simple_key_binder
|
||||
dgroups_key_binder = simple_key_binder("mod4")
|
||||
|
||||
groups.append(ScratchPad('scratch',
|
||||
[
|
||||
DropDown('term', myTerm, height=0.66, width=0.66, x=0.166, y=0.166),
|
||||
DropDown('qalc', myTerm+' -e qalc', height=0.66, width=0.33, x=0.33, y=0.166),
|
||||
DropDown('nnn', myTerm+' -e nnn -d', height=0.66, width=0.66, x=0.166, y=0.166),
|
||||
DropDown('sound', 'cinnamon-settings sound', height=0.66, width=0.50, x=0.25, y=0.166),
|
||||
]),
|
||||
)
|
||||
|
||||
keys.extend([
|
||||
Key([mod], 'q', lazy.group['scratch'].dropdown_toggle('qalc')),
|
||||
Key([mod], 'w', lazy.group['scratch'].dropdown_toggle('term')),
|
||||
Key([mod], 'e', lazy.group['scratch'].dropdown_toggle('nnn')),
|
||||
Key([mod], 's', lazy.group['scratch'].dropdown_toggle('sound')),
|
||||
])
|
||||
|
||||
layout_theme = {"border_width": 2,
|
||||
"margin": 8,
|
||||
"border_focus": Colors.green,
|
||||
|
|
@ -117,38 +133,30 @@ layout_theme = {"border_width": 2,
|
|||
}
|
||||
|
||||
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.MonadWide(**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.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 = 150
|
||||
# ),
|
||||
# layout.Floating(**layout_theme)
|
||||
]
|
||||
|
||||
|
|
@ -164,6 +172,19 @@ widget_defaults = dict(
|
|||
extension_defaults = widget_defaults.copy()
|
||||
|
||||
def init_widgets_list():
|
||||
|
||||
def get_network_interface():
|
||||
proc_ip = subprocess.Popen(['ip', 'route', 'get', '8.8.8.8'], stdout=subprocess.PIPE)
|
||||
proc_awk = subprocess.check_output(['awk', '--', "{printf $5}"], stdin=proc_ip.stdout)
|
||||
proc_ip.stdout.close()
|
||||
return proc_awk.decode('utf-8')
|
||||
|
||||
powerline = {
|
||||
"decorations": [
|
||||
PowerLineDecoration(path='back_slash')
|
||||
]
|
||||
}
|
||||
|
||||
widgets_list = [
|
||||
# widget.Image(
|
||||
# filename = "~/.config/qtile/icons/python-white.png",
|
||||
|
|
@ -175,7 +196,7 @@ def init_widgets_list():
|
|||
foreground = Colors.fg,
|
||||
fontsize = 22,
|
||||
padding = 12,
|
||||
mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)}
|
||||
# mouse_callbacks = {'Button1': lambda: qtile.cmd_spawn(myTerm)}
|
||||
),
|
||||
widget.GroupBox(
|
||||
font = "Ubuntu Bold",
|
||||
|
|
@ -217,21 +238,19 @@ def init_widgets_list():
|
|||
fontsize = 10,
|
||||
foreground = Colors.yellow,
|
||||
background = Colors.bg,
|
||||
padding = 0
|
||||
padding = 0,
|
||||
**powerline,
|
||||
),
|
||||
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,
|
||||
width = 24
|
||||
background = Colors.bg1,
|
||||
padding = 5,
|
||||
**powerline,
|
||||
),
|
||||
# UPowerWidget(
|
||||
# background = Colors.yellow,
|
||||
# foreground = Colors.fg,
|
||||
# **powerline,
|
||||
# ),
|
||||
widget.Battery(
|
||||
battery = 0,
|
||||
fmt = ' {}',
|
||||
|
|
@ -243,6 +262,7 @@ def init_widgets_list():
|
|||
format = '{char} {percent:2.0%} {hour:d}:{min:02d}',
|
||||
background = Colors.yellow,
|
||||
foreground = Colors.bg,
|
||||
**powerline,
|
||||
),
|
||||
# widget.Battery(
|
||||
# battery = 1,
|
||||
|
|
@ -256,124 +276,49 @@ def init_widgets_list():
|
|||
# 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,
|
||||
width = 24
|
||||
),
|
||||
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,
|
||||
width = 24
|
||||
),
|
||||
widget.TextBox(
|
||||
text = u"\uf546",
|
||||
foreground = Colors.bg,
|
||||
background = Colors.red,
|
||||
fontsize = 16
|
||||
fmt = '\uf8c7 {}',
|
||||
**powerline,
|
||||
),
|
||||
widget.CheckUpdates(
|
||||
update_interval = 1800,
|
||||
distro = "Ubuntu",
|
||||
display_format = " {updates}",
|
||||
distro = "Mint",
|
||||
custom_command = "aptitude search '~U'",
|
||||
markup = False,
|
||||
display_format = "\uf546 {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,
|
||||
width = 24
|
||||
),
|
||||
widget.TextBox(
|
||||
text = u"\uf85a",
|
||||
foreground = Colors.bg,
|
||||
background = Colors.purple,
|
||||
fontsize = 20
|
||||
**powerline,
|
||||
),
|
||||
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,
|
||||
width = 24
|
||||
),
|
||||
widget.TextBox(
|
||||
text = u"\ufb19",
|
||||
foreground = Colors.bg,
|
||||
background = Colors.blue,
|
||||
fontsize = 18
|
||||
format = '\uf85a{MemPercent:5.1f} %',
|
||||
**powerline,
|
||||
),
|
||||
widget.CPU(
|
||||
foreground = Colors.bg,
|
||||
background = Colors.blue,
|
||||
fmt = '{}',
|
||||
format = '{load_percent:5.1f}%',
|
||||
format = '\ufb19{load_percent:5.1f}%',
|
||||
**powerline,
|
||||
),
|
||||
widget.TextBox(
|
||||
text = u'\ue0be',
|
||||
background = Colors.blue,
|
||||
foreground = Colors.aqua,
|
||||
padding = 0,
|
||||
fontsize = 26,
|
||||
width = 24
|
||||
),
|
||||
widget.TextBox(
|
||||
text = u"\uf026",
|
||||
widget.Net(
|
||||
# bash script to get the active network interface: ip
|
||||
interface = get_network_interface(),
|
||||
format = '{down} ↓↑ {up}',
|
||||
prefix='M',
|
||||
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,
|
||||
width = 24
|
||||
**powerline,
|
||||
),
|
||||
widget.Clock(
|
||||
foreground = Colors.bg,
|
||||
|
|
@ -386,8 +331,8 @@ def init_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
|
||||
del widgets_screen1[7:8] # Slicing removes unwanted widgets (systray) on Monitors 1,3
|
||||
del widgets_screen1[4:5] # Slicing removes unwanted widgets (prompt) on Monitors 1,3
|
||||
return widgets_screen1
|
||||
|
||||
def init_widgets_screen2():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue