update qtile

This commit is contained in:
Daniel Mevec 2024-02-17 11:14:58 +01:00
parent d8641d3fbd
commit 19094d087c

View file

@ -1,16 +1,17 @@
# -*- coding: utf-8 -*-
import os
import re
# import re
import socket
import subprocess
from libqtile import qtile
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.command import lazy
from libqtile import layout, bar, hook #,widget
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 libqtile.utils import guess_terminal
from libqtile.dgroups import simple_key_binder
# from typing import List
from qtile_extras import widget
from qtile_extras.widget import UPowerWidget
from qtile_extras.widget.decorations import PowerLineDecoration
@ -23,10 +24,12 @@ myBrowser = "firefox"
myExplorer = "thunar"
sound_ctrl = "pavucontrol"
update_distro_key = "Arch"
bt_ctrl = "blueman-manager"
{{ else }}
myExplorer = "nemo"
sound_ctrl = "cinnamon-settings sound"
update_distro_key = "Ubuntu"
bt_ctrl = "blueberry"
{{ end }}
@ -107,7 +110,6 @@ groups = [Group("CHT", matches=[Match(wm_class=('microsoft teams - preview'))]),
# 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")
groups.append(ScratchPad('scratch', [
@ -115,6 +117,7 @@ groups.append(ScratchPad('scratch', [
DropDown('qalc', myTerm+' -e qalc', height=0.66, width=0.33, x=0.33, y=0.166),
DropDown('file', myExplorer, height=0.66, width=0.66, x=0.166, y=0.166),
DropDown('sound', sound_ctrl, height=0.66, width=0.50, x=0.25, y=0.166),
DropDown('bluetooth', bt_ctrl, height=0.66, width=0.50, x=0.25, y=0.166),
]),
)
@ -123,6 +126,7 @@ keys.extend([
Key([mod], 'w', lazy.group['scratch'].dropdown_toggle('term')),
Key([mod], 'e', lazy.group['scratch'].dropdown_toggle('file')),
Key([mod], 's', lazy.group['scratch'].dropdown_toggle('sound')),
Key([mod], 'd', lazy.group['scratch'].dropdown_toggle('bluetooth')),
])
layout_theme = {"border_width": 2,
@ -238,19 +242,6 @@ def init_widgets_list():
padding=5,
**powerline,
),
# 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,
# **powerline,
# ),
widget.ThermalSensor(
foreground=Colors.bg,
background=Colors.orange,
@ -323,40 +314,35 @@ def init_widgets_list():
return widgets_list
def init_widgets_screen1():
def init_widgets_screen_aux():
widgets_screen1 = init_widgets_list()
del widgets_screen1[7:8] # Slicing removes (systray) on Monitors 1,3
del widgets_screen1[4:5] # Slicing removes (prompt) on Monitors 1,3
return widgets_screen1
def init_widgets_screen2():
def init_widgets_screen_main():
widgets_screen2 = init_widgets_list()
return widgets_screen2 # display all widgets in widgets_list
def init_screens():
num_screens = get_num_screens()
main = Screen(top=bar.Bar(widgets=init_widgets_screen_main(), opacity=1.0, size=20))
aux = Screen(top=bar.Bar(widgets=init_widgets_screen_aux(), opacity=1.0, size=20))
if num_screens <= 1:
return [Screen(top=bar.Bar(widgets=init_widgets_screen2(), opacity=1.0, size=20))]
elif num_screens == 2:
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)),
]
screens = [main]
else:
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)),
]
screens = [aux]*(num_screens-1)
screens.insert(1, main)
return screens
if __name__ in ["config", "__main__"]:
screens = init_screens()
widgets_list = init_widgets_list()
widgets_screen1 = init_widgets_screen1()
widgets_screen2 = init_widgets_screen2()
widgets_screen1 = init_widgets_screen_aux()
widgets_screen2 = init_widgets_screen_main()
def window_to_prev_group(qtile):