config.py 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. # -*- coding: utf-8 -*-
  2. import os
  3. import re
  4. import socket
  5. import subprocess
  6. from typing import List
  7. from libqtile import qtile, bar, layout, widget, hook
  8. from libqtile.config import (
  9. Click,
  10. Drag,
  11. Group,
  12. Key,
  13. Screen,
  14. KeyChord,
  15. Match,
  16. )
  17. from libqtile.lazy import lazy
  18. from libqtile.backend.base import Internal
  19. ##### IMPORTs from my modules #####
  20. from modules import (
  21. colors,
  22. memory,
  23. all_windows_count,
  24. syncthing,
  25. show_updates,
  26. )
  27. def get_all_netifaces(path_to_state="/sys/class/net/"):
  28. """
  29. Get all netifaces in the /sys/class/net/ and
  30. add all to the list except 'lo'.
  31. """
  32. netifaces_list = []
  33. for dir in os.listdir(path_to_state):
  34. if os.path.isdir(f"{path_to_state}{dir}"):
  35. if dir != "lo":
  36. netifaces_list.append(dir)
  37. return netifaces_list
  38. def get_upped_netiface(netifaces=[]):
  39. """
  40. Check which interface is upped for widget.Net.
  41. Returns the first upped netiface.
  42. """
  43. if netifaces:
  44. for netiface in netifaces:
  45. state = subprocess.check_output(["cat", f"{path_to_state}{netiface}/operstate"]).decode("utf-8").rstrip()
  46. if state == "up":
  47. return netiface
  48. return None
  49. def parse_windowname(text):
  50. """Return parsed window name for WindowName widget."""
  51. text_lst = text.split()
  52. if len(text_lst) > 2:
  53. # text = text_lst[-1] + " : " + " ".join(text_lst[:-2])
  54. text = f"{text_lst[-1]} : {' '.join(text_lst[:-2])}"
  55. return text.replace("—", "-")
  56. ##### VARIABLES #####
  57. mod = "mod4"
  58. alt = "mod1"
  59. my_term = "alacritty"
  60. # my_term_extra = "xfce4-terminal"
  61. my_term_extra = "kitty"
  62. my_font = "Ubuntu"
  63. my_nerd_font = "Ubuntu Nerd Font"
  64. my_nerd_font_extra = "Sarasa Mono SC Nerd"
  65. my_mono_font = "Ubuntu Mono"
  66. my_mono_bold_font = "Ubuntu Mono Bold"
  67. SHELL = os.getenv("SHELL")
  68. HOME = os.path.expanduser("~")
  69. USER = os.getenv("USER")
  70. # my_config = f"{HOME}/.config/qtile/config.py"
  71. colors = colors.everforest
  72. # colors = colors.materia_manjaro
  73. # Check which network iface is upped.
  74. path_to_state = "/sys/class/net/" # enp2s0/operstate"
  75. # default_upped_netiface = "wlo1"
  76. netifaces = get_all_netifaces(path_to_state)
  77. upped_netiface = get_upped_netiface(netifaces)
  78. ##### COLORS #####
  79. # All color schemes are in dir colors. This theme is for example.
  80. # # Materia Manjaro
  81. # colors = {
  82. # "bg_panel": "#263238", # background
  83. # "bg_current_screentab": "#585E72", # 00
  84. # "fg_group_names": "#dbdcd5", # 00 (08)
  85. # "bg_current_tab": "#009185", # 00 (foreground)
  86. # "bg_other_tabs_and_odd_widgets": "#6182b8", # 5
  87. # "bg_even_widgets": "#82aaff", # 13
  88. # "fg_windowname": "#24d2af", # 00 (06)
  89. # "fg_cpu": "#89ddff", # 15
  90. # "fg_memory": "#ffcb6b", # 12
  91. # "fg_netspeed": "#c3e88d", # 11
  92. # "fg_layout": "#eeffff", # foreground (08)
  93. # "fg_keyboard": "#39adb5", # 7
  94. # "fg_date": "#39adb5", # 7
  95. # "bg_systray": "#263238", # background
  96. # "fg_updates": "#e2e0a5", # 00
  97. # "fg_weather": "#eb7bef", # 00 (14)
  98. # "bg_chord_dmenu": "#ffcb6b", # 12
  99. # "fg_chord_dmenu": "#000000", # 1
  100. # "fg_syncthing_active": "#91b859", # 3
  101. # "fg_syncthing_inactive": "#ff5370", # 10
  102. # "fg_active_group": "#e4c962", # 00 (04)
  103. # "border_focus": "#2eb398", # 00 (foreground)
  104. # "border_normal": "#1d2330", # 00
  105. # "fg_textbox": "#89ddff" # 15
  106. # }
  107. ##### KEYBINDINGS #####
  108. keys = [
  109. # <SUPER> + <ALT> + KEYS
  110. Key([mod, alt], "space", lazy.spawn(f"{HOME}/.myScripts/touchpadONOFF.sh"), desc="Touchpad On/Off"),
  111. # # FLIP LAYOUT FOR BSP LAYOUT
  112. # Key([mod], "k", lazy.layout.flip_up(), desc=""),
  113. # Key([mod], "j", lazy.layout.flip_down(), desc=""),
  114. # Key([mod], "h", lazy.layout.flip_left(), desc=""),
  115. # Key([mod], "l", lazy.layout.flip_right(), desc=""),
  116. # Key([mod], "Return", lazy.spawn(f"{HOME}/.myScripts/runAlacrittyDiscreteGr.sh"), desc="Launch terminal"),
  117. Key([mod], "Return", lazy.spawn(my_term), desc="Launch terminal"),
  118. Key([mod, alt], "Return", lazy.spawn(my_term_extra), desc="Launch extra terminal"),
  119. Key([mod, alt], "r", lazy.spawn("rofi run -show drun -show-icons"), desc="Run App Lancher"),
  120. Key([mod, alt], "d", lazy.spawn(f"dmenu_run -i -l 10 -nb '#2d353b' -nf '#d3c6aa' -sb '#475258' -sf '#a7c080' -p 'Run: ' -fn 'Iosevka-18:normal'"), desc="Run dmenu"), # Everforest
  121. # Key([mod, alt], "d", lazy.spawn(f"dmenu_run -i -l 10 -nb '#263238' -nf '#24d2af' -sb '#009185' -p 'Run: ' -fn 'Iosevka-18:normal'"), desc="Run dmenu"), # Materia Manjaro
  122. # Key([mod, alt], "d", lazy.spawn("dmenu_run -nb #282828 -nf #e3a84e -sb #665c54 -p 'Run: ' -fn 'Ubuntu-18:normal'"), desc="Run dmenu"), # Gruvbox
  123. Key([mod, alt], "Print", lazy.spawn("flameshot gui"), desc="Launch flameshot (take screenshot)"),
  124. Key([mod, alt], "w", lazy.spawn("/usr/bin/firefox"), desc="Launch Firefox"),
  125. Key([mod, alt], "u", lazy.spawn("qutebrowser"), desc="Launch qutebrowser"),
  126. Key([mod, alt], "e", lazy.spawn("dolphin"), desc="Launch File Manager"),
  127. Key([mod, alt], "n", lazy.spawn("thunar"), desc="Launch File Manager"),
  128. Key([mod, alt], "i", lazy.spawn("/usr/bin/octopi"), desc="Launch Octopi"),
  129. Key([mod, alt], "a", lazy.spawn(f"{my_term} -e {SHELL} -c ranger"), desc="Launch ranger"),
  130. Key([mod, alt], "y", lazy.spawn(f"{my_term_extra} -e {SHELL} -c 'yazi --cwd-file ~/.config/yazi/cwd (cat ~/.config/yazi/cwd)'"), desc="Launch yazi"),
  131. Key([mod, alt], "t", lazy.spawn(f"{HOME}/Programs/Telegram/Telegram -workdir {HOME}/.local/share/TelegramDesktop/ -- %u"), desc="Launch Telegram"),
  132. Key([mod, alt], "v", lazy.spawn(f"{my_term} -e {HOME}/.config/vifm/scripts/vifmrun"), desc="Launch vifm"),
  133. Key([mod, alt], "p", lazy.spawn(f"{HOME}/Programs/PyCharm-Community/bin/pycharm.sh"), desc="Launch PyCharm"),
  134. Key([mod, alt], "c", lazy.spawn("code"), desc="Launch VSCodium"),
  135. Key([mod, alt], "g", lazy.spawn("goldendict"), desc="Launch GoldenDict"),
  136. Key([mod, alt], "m", lazy.spawn("gvim"), desc="Launch GVim"),
  137. Key([mod, alt], "s", lazy.spawn(f"{HOME}/Programs/SublimeText/sublime_text"), desc="Run Sublime Text"),
  138. Key([mod, alt], "b", lazy.spawn("brave"), desc="Run Brave"),
  139. # Key([mod, alt], "m", lazy.spawn("/usr/bin/emacsclient -c -a 'emacs'"), desc="Launch Emacsclient"),
  140. # Key([mod, alt], "w", lazy.spawn(f"{HOME}/.myScripts/runFirefoxDiscreteGr.sh"), desc="Launch Firefox"),
  141. # Key([mod, alt], "g", lazy.spawn(f"{HOME}/.myScripts/runGimpDiscreteGr.sh"), desc="Run GIMP DiscreteGraphics"),
  142. # Key([mod, alt], "a", lazy.spawn(f"{my_term} -e {SHELL} -c {HOME}/.myScripts/runRangerDiscreteGr.sh"), desc="Run ranger DiscreteGraphics"),
  143. # Key([mod, alt], "x", lazy.spawn("xterm"), desc="Run XTerm"),
  144. # <SUPER> + <ALT> + <SHIFT> + KEYS
  145. # Key([mod, alt, "shift"], "a", lazy.spawn(f"{my_term} -e pkexec ranger"), desc="Launch ranger as root"),
  146. # Key([mod, alt, "shift"], "a", lazy.spawn(f"{my_term} -e sudo ranger"), desc="Launch ranger as root"),
  147. Key([mod, alt, "shift"], "v", lazy.spawn(f"{HOME}/.myScripts/runVifmAsRoot.sh"), desc="Launch Vifm as root"),
  148. Key([mod, alt, "shift"], "a", lazy.spawn(f"{HOME}/.myScripts/runRangerAsRoot.sh"), desc="Launch ranger as root"),
  149. Key([mod, alt, "shift"], "y", lazy.spawn(f"{HOME}/.myScripts/runYaziAsRoot.sh"), desc="Launch yazi as root"),
  150. Key([mod, alt, "shift"], "n", lazy.spawn(f"{HOME}/.myScripts/runThunarAsRoot.sh"), desc="Launch Thunar as root"),
  151. # Key([mod, alt, "shift"], "p", lazy.spawn(f"{HOME}/.myScripts/runThunarAsRoot.sh"), desc="Launch Thunar as root"),
  152. Key([mod, alt, "shift"], "w", lazy.spawn("google-chrome-stable"), desc="Launch Chrome"),
  153. # Key([mod, alt, "shift"], "y", lazy.spawn(f"{HOME}/.config/qtile/scripts/start-stop_syncthing.sh"), desc="Start-Stop Syncthing (for Dropbox sync)"),
  154. # <SUPER> + <SHIFT> + KEYS
  155. # QTILE: reload_config, restart, quit WINDOW: kill, xkill
  156. Key([mod, "shift"], "c", lazy.window.kill(), desc="Kill focused window"),
  157. Key([mod, "shift"], "x", lazy.spawn("xkill"), desc="Kill not answered window"),
  158. Key([mod, "shift", "control"], "r", lazy.restart(), desc="Restart qtile"),
  159. Key([mod, "shift"], "r", lazy.reload_config(), desc="Reload qtile config"),
  160. Key([mod, "shift"], "q", lazy.shutdown(), desc="Shutdown qtile"),
  161. # TOGGLE FLOATING LAYOUT
  162. Key([mod, "shift"], "f", lazy.window.toggle_floating(), lazy.window.center(), desc="Toggle floating"),
  163. # MOVE WINDOWS UP OR DOWN IN CURRENT STACK
  164. Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up in current stack "),
  165. Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down in current stack "),
  166. # Key([mod, "shift"], "h", lazy.layout.swap_left(), desc="Move window left in current stack "),
  167. # Key([mod, "shift"], "l", lazy.layout.swap_right(), desc="Move window right in current stack "),
  168. Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window left in current stack "),
  169. Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window right in current stack "),
  170. # Key([mod, "shift"], "Up", lazy.layout.shuffle_up(), desc="Move window up in current stack "),
  171. # Key([mod, "shift"], "Down", lazy.layout.shuffle_down(), desc="Move window down in current stack "),
  172. # Key([mod, "shift"], "Left", lazy.layout.shuffle_left(), desc="Move window left in current stack "),
  173. # Key([mod, "shift"], "Right", lazy.layout.shuffle_right(), desc="Move window right in current stack "),
  174. # FLIP LAYOUT FOR MONADTALL/WIDE
  175. Key([mod, "shift"], "space", lazy.layout.flip(), desc="Flip main (left) panel with others"),
  176. # <SUPER> + FUNCTION KEYS
  177. # TOGGLE FULLSCREEN
  178. Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen"),
  179. # SWITCH BETWEEN GROUPS (DESKTOPS)
  180. Key([mod], "Right", lazy.screen.next_group(), desc="Switch to the right group"),
  181. Key([mod], "Left", lazy.screen.prev_group(), desc="Switch to the left group"),
  182. # SWITCH BETWEEN LAYOUTS
  183. Key([mod], "Tab", lazy.next_layout(), desc="Switch to the next layout"),
  184. Key([mod, "shift"], "Tab", lazy.prev_layout(), desc="Switch to the previous layout"),
  185. # CHANGE FOCUS
  186. Key([mod], "k", lazy.layout.up(), desc="Move focus up in stack pane"),
  187. Key([mod], "j", lazy.layout.down(), desc="Move focus down in stack pane"),
  188. Key([mod], "h", lazy.layout.left(), desc="Move focus left in stack pane"),
  189. Key([mod], "l", lazy.layout.right(), desc="Move focus right in stack pane"),
  190. # Key([mod], "Up", lazy.layout.up(), desc="Move focus up in stack pane"),
  191. # Key([mod], "Down", lazy.layout.down(), desc="Move focus down in stack pane"),
  192. # Key([mod], "Left", lazy.layout.left(), desc="Move focus left in stack pane"),
  193. # Key([mod], "Right", lazy.layout.right(), desc="Move focus right in stack pane"),
  194. Key([mod], "space", lazy.layout.next(), desc="Switch window focus to other pane(s) of stack"),
  195. # NORMALIZE, MINIMIZE, MAXIMIZE
  196. Key([alt], "n", lazy.window.toggle_minimize(), desc="Toggle window between minimumize and normal sizes"),
  197. Key([mod], "n", lazy.layout.normalize(), desc="Normalize window size ratios"),
  198. Key([mod], "m", lazy.layout.maximize(), desc="Toggle window between minimum and maximum sizes (for MonadTall/MonadWide)"),
  199. Key([mod], "r", lazy.layout.reset()),
  200. Key([mod], "Escape", lazy.group.toscreen(toggle=True)),
  201. # <SUPER> + <CTRL> + KEYS
  202. Key([mod, "control"], "Return", lazy.spawn("xfce4-terminal"), desc="Launch xfce4-terminal"),
  203. # RESIZE UP, DOWN, LEFT, RIGHT
  204. Key([mod, "control"], "i",
  205. lazy.layout.shrink_main(),
  206. ),
  207. Key([mod, "control"], "u",
  208. lazy.layout.grow_main(),
  209. ),
  210. Key([mod, "control"], "l",
  211. lazy.layout.grow_right(),
  212. lazy.layout.grow(),
  213. lazy.layout.increase_ratio(),
  214. lazy.layout.delete()
  215. ),
  216. # Key([mod, "control"], "Right",
  217. # lazy.layout.grow_right(),
  218. # lazy.layout.grow(),
  219. # lazy.layout.increase_ratio(),
  220. # lazy.layout.delete()
  221. # ),
  222. Key([mod, "control"], "h",
  223. lazy.layout.grow_left(),
  224. lazy.layout.shrink(),
  225. lazy.layout.decrease_ratio(),
  226. lazy.layout.add(),
  227. ),
  228. # Key([mod, "control"], "Left",
  229. # lazy.layout.grow_left(),
  230. # lazy.layout.shrink(),
  231. # lazy.layout.decrease_ratio(),
  232. # lazy.layout.add(),
  233. # ),
  234. Key([mod, "control"], "k",
  235. lazy.layout.grow_up(),
  236. lazy.layout.grow(),
  237. lazy.layout.decrease_nmaster(),
  238. ),
  239. # Key([mod, "control"], "Up",
  240. # lazy.layout.grow_up(),
  241. # lazy.layout.grow(),
  242. # lazy.layout.decrease_nmaster(),
  243. # ),
  244. Key([mod, "control"], "j",
  245. lazy.layout.grow_down(),
  246. lazy.layout.shrink(),
  247. lazy.layout.increase_nmaster(),
  248. ),
  249. # Key([mod, "control"], "Down",
  250. # lazy.layout.grow_down(),
  251. # lazy.layout.shrink(),
  252. # lazy.layout.increase_nmaster(),
  253. # ),
  254. Key([mod, "control"], "w", lazy.spawn(f"{HOME}/Programs/Tor/Browser/start-tor-browser --detach"), desc="Launch Tor"),
  255. # <SUPER> + <SHIFT> + <CTRL> + KEYS
  256. # <ALT> + KEYS
  257. # KeyChords
  258. # Dmenu
  259. KeyChord([alt], "m", [
  260. Key([], "c", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-edit-configs.sh"), desc="Run dmenu script for editing config files"),
  261. Key([], "l", lazy.spawn(f"{HOME}/.myScripts/system_exit/lock.sh"), desc="Lock screen"),
  262. Key([], "r", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-programs.sh"), desc="Run choice of most used utils"),
  263. Key([], "s", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-scripts.sh"), desc="Run chosen search engine"),
  264. Key([], "x", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-system-exit.sh"), desc="System exit menu")],
  265. mode=False,
  266. name="Dmenu"
  267. ),
  268. Key([alt], "w", lazy.spawn("rofi run -show window -show-icons"), desc="Switch between opened windows"),
  269. Key([alt], "F4", lazy.spawn(f"{HOME}/Programs/ByeBye/ByeBye"), desc="Launch logout app 'ByeBye'"),
  270. Key([alt], "Tab", lazy.group.next_window(), desc="Switch to the next window"),
  271. # <ALT> + <SHIFT> + KEYS
  272. Key([alt, "shift"], "Tab", lazy.group.prev_window(), desc="Switch to the previous window"),
  273. # <CONTROL> + <ALT> + KEYS
  274. Key(["control", alt], "c", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-edit-configs.sh"), desc="Run dmenu script for editing config files"),
  275. Key(["control", alt], "l", lazy.spawn(f"{HOME}/.myScripts/system_exit/lock.sh"), desc="Lock screen"),
  276. Key(["control", alt], "r", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-programs.sh"), desc="Run choice of most used utils"),
  277. Key(["control", alt], "s", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-scripts.sh"), desc="Run chosen search engine"),
  278. Key(["control", alt], "x", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-system-exit.sh"), desc="System exit menu"),
  279. # TREETAB CONTROLS
  280. Key(["control", alt], "j", lazy.layout.section_down(), desc="Move up a section in TreeTab"),
  281. Key(["control", alt], "k", lazy.layout.section_up(), desc="Move down a section in TreeTab"),
  282. # <CONTROL> + <SHIFT> + KEYS
  283. Key(["control", "shift"], "Escape", lazy.spawn(f"{my_term} -e htop"), desc="Run htop"),
  284. # MULTIMEDIA KEYS
  285. # <Fn> + <F1-F12>
  286. Key([], "XF86Display", lazy.spawn("lxrandr"), desc="Run lxrandr (choose monitor)"),
  287. Key([], "XF86ScreenSaver", lazy.spawn(f"{HOME}/.myScripts/system_exit/lock.sh"), desc="Lock screen"),
  288. Key([], "XF86Battery", lazy.spawn("xfce4-power-manager-settings"), desc="Power manager settings"),
  289. Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle"), desc="Toggle audio mute"),
  290. Key([mod], "F7", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle"), desc="Toggle audio mute"),
  291. # <SUPER> + <F1-F12>
  292. # Brightness & Volume (extra step 5)
  293. Key([mod], "F2", lazy.spawn(f"{HOME}/.myScripts/brightness_down.sh"), desc="Brightness Down (5-)"),
  294. # lazy.spawn("brightnessctl set 5-"),
  295. Key([mod], "F3", lazy.spawn(f"{HOME}/.myScripts/brightness_up.sh"), desc="Brightness Up (+5)"),
  296. # lazy.spawn("brightnessctl set +5"),
  297. Key([mod], "F8", lazy.spawn(f"{HOME}/.myScripts/volume_down.sh"), desc="Volume Down"),
  298. Key([mod], "F9", lazy.spawn(f"{HOME}/.myScripts/volume_up.sh"), desc="Volume Up more than 100%"),
  299. ]
  300. # MOVE/RESIZE FLOATING WINDOW
  301. for key, x, y in [
  302. ("Left", -10, 0),
  303. ("Right", 10, 0),
  304. ("Up", 0, -10),
  305. ("Down", 0, 10)]:
  306. keys.append(Key([mod, "control"], key, lazy.window.move_floating(x, y)))
  307. keys.append(Key([mod, "shift"], key, lazy.window.resize_floating(x, y)))
  308. ##### GROUPS #####
  309. #       v                
  310. #     🌐♬ 🌡 🖬  ⟳ ₿  ⮋⮉🡇 🡅 ⇓⇑      
  311. group_names = [
  312. (" ", {"layout": "columns"}), # WWW
  313. (" ", {"layout": "columns"}), # DEV
  314. # (" ", {"layout": "monadtall"}), # DEV
  315. (" ", {"layout": "max"}), # FM
  316. (" ", {"layout": "columns"}), # SYS
  317. (" ", {"layout": "columns"}), # VIRT
  318. (" ", {"layout": "max"}), # CHAT
  319. (" ", {"layout": "columns"}), # GFX
  320. (" ", {"layout": "max"}), # VID
  321. (" ", {"layout": "columns"}) # MULT
  322. ]
  323. # groups = [Group(name, **kwargs, label="{}{}".format(name, i)) for i, (name, kwargs) in enumerate(group_names, 1)]
  324. groups = [Group(name, **kwargs, label=f"{i} {name}") for i, (name, kwargs) in enumerate(group_names, 1)]
  325. # groups = [Group(name, **kwargs, label=f"{name}{i}") for i, (name, kwargs) in enumerate(group_names, 1)]
  326. for i, group_name in enumerate(group_names, 1):
  327. keys.extend([
  328. Key([mod], str(i),
  329. lazy.group[group_name[0]].toscreen(toggle=True),
  330. desc="Switch to another group"), # (toggle=True) to toggle groups since Qtile 0.19.0
  331. Key([mod, "shift"], str(i),
  332. lazy.window.togroup(group_name[0], switch_group=True),
  333. # lazy.group[group_name[0]].toscreen(toggle=True), # follow the
  334. # window when it moves to another group DOESN'T NEED ANY MORE
  335. # BECAUSE OF switch_group=True
  336. desc="Send current window to another group")
  337. ])
  338. # A dict: {1: " ", 2: " ", ... } for simple access and if group_names will be
  339. # renamed.
  340. group_names_indexes = {i: group_names[0][0] for (i, group_names[0]) in enumerate(group_names, start=1)}
  341. ##### LAYOUTS #####
  342. layout_theme = {
  343. "border_width": 3,
  344. "margin": 4,
  345. "border_focus": colors.get("border_focus", "#535d6c"),
  346. "border_normal": colors.get("border_normal", "#000000"),
  347. }
  348. layouts = [
  349. # layout.Columns(**layout_theme, border_on_single=False, margin_on_single=False),
  350. layout.Columns(**layout_theme, border_on_single=True),
  351. layout.TreeTab(
  352. # font=my_font,
  353. font=my_nerd_font,
  354. fontsize=14,
  355. bg_color=colors.get("bg_panel", "#222222"),
  356. active_bg=colors.get("bg_current_tab", "#535d6c"),
  357. active_fg=colors.get("fg_active_group", "#ffffff"),
  358. inactive_bg=colors.get("bg_systray", "#222222"),
  359. inactive_fg=colors.get("fg_group_names", "#aaaaaa"),
  360. border_width=2,
  361. padding_y=5,
  362. sections=["FIRST", "SECOND"],
  363. section_fontsize=12,
  364. section_fg=colors.get("fg_group_names", "#aaaaaa"),
  365. section_top=10,
  366. panel_width=320
  367. ),
  368. # layout.Max(**layout_theme),
  369. layout.Max(
  370. margin=0,
  371. border_width=0,
  372. border_focus=colors.get("border_focus", "#535d6c"),
  373. border_normal=colors.get("border_normal", "#000000")
  374. ),
  375. # layout.MonadTall(**layout_theme, single_border_width=False, single_margin=False),
  376. # layout.MonadWide(**layout_theme, single_border_width=False, single_margin=False),
  377. layout.MonadTall(**layout_theme),
  378. layout.MonadWide(**layout_theme),
  379. # layout.Bsp(**layout_theme),
  380. # layout.Tile(shift_windows=True, **layout_theme),
  381. # layout.Stack(stacks=2, **layout_theme),
  382. # layout.Stack(num_stacks=2),
  383. # layout.RatioTile(**layout_theme),
  384. # layout.VerticalTile(**layout_theme),
  385. # layout.Matrix(**layout_theme),
  386. # layout.Zoomy(**layout_theme),
  387. # layout.Floating(**layout_theme)
  388. ]
  389. ##### DEFAULT WIDGET SETTINGS #####
  390. widget_defaults = {
  391. # "font": my_font,
  392. "font": my_nerd_font,
  393. "fontsize": 14,
  394. "padding": 2,
  395. "background": colors.get("bg_panel", "#222222"),
  396. "foreground": colors.get("fg_group_names", "#ffffff")
  397. }
  398. def init_widgets_list():
  399. prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
  400. widgets_list = [
  401. widget.GroupBox(
  402. font=my_nerd_font,
  403. fontsize=16,
  404. margin_y=3,
  405. margin_x=0,
  406. padding_y=7,
  407. padding_x=3,
  408. borderwidth=3,
  409. active=colors.get("fg_active_group", "#ffffff"),
  410. inactive=colors.get("fg_group_names", "#aaaaaa"),
  411. rounded=False,
  412. highlight_color=colors.get("bg_panel", "#222222"),
  413. highlight_method="block",
  414. urgent_alert_method="block",
  415. this_current_screen_border=colors.get("bg_current_tab", "#535d6c"),
  416. this_screen_border=colors.get("bg_other_tabs_and_odd_widgets", "#6182b8"),
  417. other_current_screen_border=colors.get("bg_panel", "#222222"),
  418. other_screen_border=colors.get("bg_panel", "#222222"),
  419. ),
  420. widget.Chord(
  421. fontsize=14,
  422. padding = 10,
  423. background=colors.get("bg_chord_dmenu", "#ffcb6b"),
  424. foreground=colors.get("fg_chord_dmenu", "#000000")
  425. ),
  426. # widget.WindowName(
  427. # # # font=my_mono_bold_font,
  428. # fontsize=14,
  429. # foreground=colors["fg_windowname"],
  430. # padding=0,
  431. # # parse_text=parse_windowname
  432. # ),
  433. widget.TaskList(
  434. fontsize=17,
  435. font=my_nerd_font_extra,
  436. # foreground=colors["fg_windowname"],
  437. foreground=colors.get("fg_tasklist", "#ffffff"),
  438. border=colors.get("bg_current_tab", "#222222"),
  439. borderwidth=0,
  440. highlight_method="block",
  441. # txt_floating=" ",
  442. txt_maximized="🗖 ",
  443. txt_minimized="🗕 ",
  444. txt_floating="🗗 ",
  445. icon_size=20,
  446. padding_y=4,
  447. ),
  448. widget.CheckUpdates(
  449. foreground=colors.get("fg_updates", "#ffffff"),
  450. colour_have_updates=colors.get("fg_updates", "#ffffff"),
  451. # no_update_string="No updates",
  452. font=my_nerd_font,
  453. fontsize=14,
  454. # distro="Arch_checkupdates",
  455. # custom_command="checkupdates-with-aur",
  456. custom_command="xbps-install -nuMS",
  457. display_format=" {updates}", # ⟳ 
  458. mouse_callbacks={
  459. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/show_updates.sh"),
  460. "Button2": lambda: qtile.spawn(f"{my_term} --hold -e sudo xbps-install -Su"),
  461. # "Button2": lambda: qtile.spawn(f"{my_term} --hold -e yay -Syu"),
  462. # "Button3": lambda: show_updates.show_updates_arch()
  463. },
  464. update_interval=10800 # 3 hours (60*60*3)
  465. ),
  466. widget.Sep(
  467. linewidth=1,
  468. padding=10
  469. ),
  470. # widget.TextBox(
  471. # # text="⇆ ",
  472. # text="🗘",
  473. # font=my_nerd_font,
  474. # fontsize=16,
  475. # foreground=colors["fg_textbox"],
  476. # padding=0
  477. # ),
  478. # syncthing.Syncthing(
  479. # path_to_script=f"{HOME}/.config/qtile/scripts/get_syncthing_status.sh",
  480. # font=my_nerd_font,
  481. # label="Syncthing\n ",
  482. # update_interval=60,
  483. # active_color=colors["fg_syncthing_active"],
  484. # inactive_color=colors["fg_syncthing_inactive"],
  485. # padding=0
  486. # ),
  487. # widget.Sep(
  488. # linewidth=1,
  489. # padding=10
  490. # ),
  491. widget.OpenWeather(
  492. foreground=colors.get("fg_weather", "#ffffff"),
  493. coordinates={"longitude": "30.9754", "latitude": "52.4345"},
  494. fontsize=20,
  495. format="{icon}",
  496. update_interval=1800,
  497. mouse_callbacks={
  498. "Button3": lambda: qtile.spawn("xdg-open https://openweathermap.org/city/627907"),
  499. }
  500. ),
  501. # widget.TextBox(
  502. # # text="⛅",
  503. # text="🌡",
  504. # fontsize=16,
  505. # foreground=colors["fg_weather"],
  506. # padding=0
  507. # ),
  508. widget.OpenWeather(
  509. foreground=colors.get("fg_weather", "#ffffff"),
  510. coordinates={"longitude": "30.9754", "latitude": "52.4345"},
  511. format="{location_city}: {temp}°{units_temperature}\n{weather_details}",
  512. update_interval=1800,
  513. mouse_callbacks={
  514. "Button3": lambda: qtile.spawn("xdg-open https://openweathermap.org/city/627907"),
  515. }
  516. ),
  517. widget.Sep(
  518. linewidth=1,
  519. padding=10
  520. ),
  521. widget.TextBox(
  522. text="",
  523. # text=" ",
  524. font=my_nerd_font,
  525. fontsize=16,
  526. foreground=colors.get("fg_cpu", "#ffffff"),
  527. padding=0,
  528. mouse_callbacks={
  529. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_cpu_usage.sh"),
  530. # "Button3": lambda: qtile.spawn(f"{my_term} -e htop")
  531. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  532. }
  533. ),
  534. widget.CPU(
  535. foreground=colors.get("fg_cpu", "#ffffff"),
  536. padding=0,
  537. format="{freq_current}GHz\n{load_percent: .0f}%",
  538. mouse_callbacks={
  539. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_cpu_usage.sh"),
  540. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  541. }
  542. ),
  543. widget.Sep(
  544. linewidth=1,
  545. padding=10
  546. ),
  547. widget.TextBox(
  548. text="",
  549. font=my_nerd_font,
  550. fontsize=16,
  551. foreground=colors.get("fg_memory", "#ffffff"),
  552. padding=0,
  553. mouse_callbacks={
  554. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_mem_usage.sh"),
  555. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  556. }
  557. ),
  558. memory.Memory(
  559. foreground=colors.get("fg_memory", "#ffffff"),
  560. padding=0,
  561. format="{MemUsed: .1f}{mm}\n{MemPercent: .0f}%",
  562. measure_mem="G",
  563. mouse_callbacks={
  564. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_mem_usage.sh"),
  565. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  566. }
  567. ),
  568. widget.Sep(
  569. linewidth=1,
  570. padding=10
  571. ),
  572. # widget.Net(
  573. # interface=upped_netiface,
  574. # # format=upped_netiface + ":{down} ↓↑{up}",
  575. # # format="{down} ⇓⇑{up}",
  576. # # format="{down} ⤋⤊{up}",
  577. # # format="{down} ⬇⬆{up}",
  578. # # format="{down} 🡇🡅{up}",
  579. # # format="{down}  {up}",
  580. # font=my_nerd_font,
  581. # format="{up} \n{down} ",
  582. # foreground=colors["fg_netspeed"],
  583. # padding=0
  584. # ),
  585. # widget.Sep(
  586. # linewidth=1,
  587. # padding=10
  588. # ),
  589. widget.KeyboardKbdd(
  590. configured_keyboards=["🇺🇸 ", "🇷🇺 "],
  591. # configured_keyboards=["US", "RU"],
  592. # display_map={"us": "🇺🇸", "ru": "🇷🇺"},
  593. # option="grp:alt_shift_toggle",
  594. # option="grp:caps_toggle",
  595. foreground=colors.get("fg_keyboard", "#ffffff"),
  596. fontsize=16,
  597. padding=0,
  598. ),
  599. widget.Systray(
  600. padding=1,
  601. icon_size=24,
  602. ),
  603. widget.TextBox(
  604. text=" ",
  605. padding=1,
  606. ),
  607. widget.CurrentLayoutIcon(
  608. # custom_icon_paths=[f"{HOME}/.config/qtile/icons/layouts"],
  609. foreground=colors.get("fg_layout", "#ffffff"),
  610. padding=0,
  611. scale=0.6,
  612. mouse_callbacks={
  613. "Button1": qtile.next_layout,
  614. "Button3": qtile.prev_layout,
  615. }
  616. ),
  617. widget.WindowCount(
  618. text_format=" {num} /",
  619. fontsize=14,
  620. padding=0,
  621. foreground=colors.get("fg_layout", "#ffffff"),
  622. ),
  623. all_windows_count.WindowCount(
  624. text_format=" {num}",
  625. fontsize=14,
  626. padding=0,
  627. foreground=colors.get("fg_layout", "#ffffff"),
  628. ),
  629. widget.Sep(
  630. linewidth=1,
  631. padding=10
  632. ),
  633. widget.TextBox(
  634. text="",
  635. font=my_nerd_font,
  636. fontsize=16,
  637. foreground=colors.get("fg_date", "#ffffff"),
  638. padding=0,
  639. mouse_callbacks={"Button1": lambda: qtile.spawn("gsimplecal")}
  640. ),
  641. widget.Clock(
  642. foreground=colors.get("fg_date", "#ffffff"),
  643. padding=3,
  644. # mouse_callbacks={"Button1": lambda qtile: qtile.spawn("gsimplecal")},
  645. mouse_callbacks={"Button1": lambda: qtile.spawn("gsimplecal")},
  646. format="%a, %d %b\n%H:%M:%S"
  647. )
  648. ]
  649. return widgets_list
  650. def init_widgets_screen1():
  651. """Returns widgets_list for Monitor 1."""
  652. widgets_screen1 = init_widgets_list()
  653. return widgets_screen1 # Slicing removes unwanted widgets on Monitors 1,3
  654. def init_widgets_screen2():
  655. """Returns widgets_list for Monitor 2."""
  656. widgets_screen2 = init_widgets_list()
  657. return widgets_screen2 # Monitor 2 will display all widgets in widgets_list
  658. def init_screens():
  659. return [
  660. Screen(
  661. # wallpaper=f"{HOME}/Picturies/Wallpapers/NewWallpapers/0314_1280x1024.jpg",
  662. # wallpaper_mode="fill",
  663. top=bar.Bar(
  664. widgets=init_widgets_screen1(),
  665. opacity=1.0,
  666. size=32)),
  667. # Screen(
  668. # top=bar.Bar(
  669. # widgets=init_widgets_screen2(),
  670. # opacity=1.0,
  671. # size=32)),
  672. # Screen(
  673. # top=bar.Bar(
  674. # widgets=init_widgets_screen1(),
  675. # opacity=1.0,
  676. # size=32))
  677. ]
  678. # return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=32))]
  679. # For several Monitors.
  680. # return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=30)),
  681. # Screen(top=bar.Bar(widgets=init_widgets_screen2(), opacity=1.0, size=30)),
  682. # Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=30))]
  683. # lazy functions can be bound to keybindings.
  684. @lazy.function
  685. def window_to_prev_group(qtile):
  686. if qtile.currentWindow is not None:
  687. i = qtile.groups.index(qtile.currentGroup)
  688. qtile.currentWindow.togroup(qtile.groups[i - 1].name)
  689. @lazy.function
  690. def window_to_next_group(qtile):
  691. if qtile.currentWindow is not None:
  692. i = qtile.groups.index(qtile.currentGroup)
  693. qtile.currentWindow.togroup(qtile.groups[i + 1].name)
  694. @lazy.function
  695. def window_to_previous_screen(qtile):
  696. i = qtile.screens.index(qtile.current_screen)
  697. if i != 0:
  698. group = qtile.screens[i - 1].group.name
  699. qtile.current_window.togroup(group)
  700. @lazy.function
  701. def window_to_next_screen(qtile):
  702. i = qtile.screens.index(qtile.current_screen)
  703. if i + 1 != len(qtile.screens):
  704. group = qtile.screens[i + 1].group.name
  705. qtile.current_window.togroup(group)
  706. @lazy.function
  707. def switch_screens(qtile):
  708. i = qtile.screens.index(qtile.current_screen)
  709. group = qtile.screens[i - 1].group
  710. qtile.current_screen.set_group(group)
  711. ##### DRAG AND RESIZE FLOATING LAYOUTS BY MOUSE #####
  712. mouse = [
  713. Drag([mod], "Button1", lazy.window.set_position_floating(),
  714. start=lazy.window.get_position()),
  715. Drag([mod], "Button3", lazy.window.set_size_floating(),
  716. start=lazy.window.get_size()),
  717. # Click([mod], "Button2", lazy.window.bring_to_front())
  718. ]
  719. ##### MY FLOATING APPS #####
  720. floating_layout = layout.Floating(float_rules=[
  721. # Run the utility of `xprop` to see the wm class and name of an X client.
  722. # from libqtile.layout.floating class Floating
  723. # add (unpack *) default_float_rules
  724. *layout.Floating.default_float_rules,
  725. Match(wm_class="BreakTimer"),
  726. Match(title="Tor Browser", wm_class="Tor Browser"),
  727. Match(title="О Tor Browser", wm_class="Tor Browser"),
  728. Match(title="About Mozilla Firefox", wm_class="Browser"),
  729. Match(title="Execute File", wm_class="pcmanfm"),
  730. Match(title="Close Button Action", wm_class="tixati"), # Tixati
  731. Match(title="Confirm File Replacing", wm_class="pcmanfm"),
  732. Match(title="Terminator Preferences", wm_class="terminator"),
  733. Match(title="Терминатор Параметры", wm_class="terminator"),
  734. Match(title="File Operation Progress", wm_class="Thunar"),
  735. Match(title="Действия над файлами", wm_class="Thunar"),
  736. Match(title="Create Snapshot", wm_class="Timeshift-gtk"),
  737. Match(title="Delete Snapshots", wm_class="Timeshift-gtk"),
  738. Match(title="Создать снимок", wm_class="Timeshift-gtk"),
  739. Match(title="Удалить снимки", wm_class="Timeshift-gtk"),
  740. # Match(title="win0", wm_class="jetbrains-webstorm"), # WebStorm
  741. # Match(title="Import WebStorm Settings", wm_class="jetbrains-webstorm"),
  742. Match(title="splash"), # PyCharm
  743. Match(title="Update"), # PyCharm
  744. # Match(title="win0", wm_class="jetbrains-pycharm-ce"), # PyCharm
  745. # Match(title="Welcome to PyCharm", wm_class="jetbrains-pycharm-ce"),
  746. # Match(title="License Activation", wm_class="jetbrains-pycharm-ce"), # PyCharm
  747. # Match(title="Settings", wm_class="jetbrains-pycharm-ce"), # PyCharm
  748. # Match(title="Python Interpreters", wm_class="jetbrains-pycharm-ce"), # PyCharm
  749. # Match(title="Open Project", wm_class="jetbrains-pycharm-ce"), # PyCharm
  750. # Match(title="Update", wm_class="com-intellij-updater-Runner"), # PyCharm's updates
  751. Match(wm_class="nm-connection-editor"),
  752. Match(wm_class="megasync"),
  753. Match(wm_class="minitube"),
  754. Match(wm_class="CheckEmail"),
  755. # Match(wm_class="GParted"),
  756. # Match(wm_class="keepass2"),
  757. Match(wm_class="pinentry-gtk-2"),
  758. Match(title="Pinentry"), # GPG key password entry
  759. # Match(wm_class="vlc"),
  760. # Match(wm_class="smplayer"),
  761. Match(wm_class="deadbeef"),
  762. Match(wm_class="galculator"),
  763. # {"wmclass": "VirtualBox Manager"},
  764. Match(title="branchdialog"), # gitk
  765. Match(title="Open File"),
  766. Match(wm_class="gnome-font-viewer"),
  767. Match(wm_class="fluxgui"),
  768. Match(wm_class="xfce4-power-manager-settings"),
  769. Match(wm_class="pavucontrol"),
  770. Match(wm_class="gdebi-gtk"),
  771. Match(wm_class="volumeicon"),
  772. Match(wm_class="gcolor3"),
  773. Match(wm_class="gcolor2"),
  774. # Match(wm_class="gvim"),
  775. Match(wm_class="qt5ct"),
  776. Match(wm_class="lxappearance"),
  777. Match(wm_class="confirmreset"), # gitk
  778. Match(wm_class="makebranch"), # gitk
  779. Match(wm_class="maketag"), # gitk
  780. Match(wm_class="ssh-askpass") # ssh-askpass
  781. ], border_focus=colors.get("border_focus", "#535d6c"),
  782. border_normal=colors.get("border_normal", "#000000"),
  783. border_width=1,)
  784. dgroups_key_binder = None
  785. dgroups_app_rules = [] # type: List
  786. main = None # WARNING: this is deprecated and will be removed soon
  787. follow_mouse_focus = True
  788. cursor_warp = False
  789. bring_front_click = False
  790. # bring_front_click = "floating_only"
  791. auto_fullscreen = True
  792. focus_on_window_activation = "focus"
  793. # focus_on_window_activation = "urgent"
  794. # focus_on_window_activation = "smart"
  795. # focus_on_window_activation = "never"
  796. @hook.subscribe.client_new
  797. def move_new_window_to_certain_group(c):
  798. """Moves a new window to certain grop and switchs (if you want) to that group."""
  799. if (c.name == f"{USER} - Thunar" or
  800. c.name == "thunar" or
  801. c.name == f"{USER} - Dolphin" or
  802. c.name == "dolphin"):
  803. c.togroup(group_names_indexes[3])
  804. qtile.groups_map[group_names_indexes[3]].cmd_toscreen()
  805. if (c.name == "Oracle VM VirtualBox Менеджер" or
  806. c.name == "Oracle VM VirtualBox Manager"):
  807. c.togroup(group_names_indexes[5])
  808. qtile.groups_map[group_names_indexes[5]].cmd_toscreen()
  809. if c.name == "Telegram":
  810. c.togroup(group_names_indexes[6])
  811. qtile.groups_map[group_names_indexes[6]].cmd_toscreen()
  812. if c.name == "Rakuten Viber":
  813. c.togroup(group_names_indexes[6])
  814. qtile.groups_map[group_names_indexes[6]].cmd_toscreen()
  815. if c.name == "GNU Image Manipulation Program":
  816. c.togroup(group_names_indexes[7])
  817. qtile.groups_map[group_names_indexes[7]].cmd_toscreen()
  818. if c.name == "Mozilla Thunderbird":
  819. # c.togroup(" ")
  820. c.togroup(group_names_indexes[9])
  821. ##### AUTOSTART #####
  822. @hook.subscribe.startup_once
  823. def start_once():
  824. subprocess.call([f"{HOME}/.config/qtile/scripts/autostart.sh"])
  825. # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
  826. # string besides java UI toolkits; you can see several discussions on the
  827. # mailing lists, GitHub issues, and other WM documentation that suggest setting
  828. # this string if your java app doesn't work correctly. We may as well just lie
  829. # and say that we're a working one by default.
  830. #
  831. # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
  832. # java that happens to be on java's whitelist.
  833. wmname = "LG3D"
  834. if __name__ in ("config", "__main__"):
  835. screens = init_screens()
  836. widgets_list = init_widgets_list()
  837. # widgets_screen1 = init_widgets_screen1()
  838. # widgets_screen2 = init_widgets_screen2()
  839. ##### SOME WHAT I DID BEFORE BUT DON'T NEED ANY MORE. BUT SAVED FOR SOME REASONS #####
  840. # # @hook.subscribe.float_change
  841. # # @hook.subscribe.client_new
  842. # @hook.subscribe.client_focus
  843. # def set_hint(window):
  844. # window.window.set_property("IS_FLOATING", str(window.floating), type="STRING", format=8)
  845. # # subprocess.check_output(["notify-send", "-i", "dialog-information", "{} {}".format(window.name, window.floating)])
  846. # # window.window.set_property("IS_FLOATING", int(window.floating))
  847. # # # Does what I wanted perfectly!!!
  848. # # # @hook.subscribe.client_mouse_enter
  849. # @hook.subscribe.client_focus
  850. # @hook.subscribe.client_new
  851. # def focus_new_floating_window(window):
  852. # """ Bring a new floating window to the front. """
  853. # # subprocess.check_output(["notify-send", "-i", "dialog-information", "{}".format(window.name)])
  854. # if window.floating:
  855. # window.bring_to_front()
  856. # TODO: show amount of opened windows (DONE!!!)
  857. # @hook.subscribe.client_new
  858. # def increase_opened_windows_counter(window):
  859. # """ Increase counter of opened windows. """
  860. # global opened_windows_counter
  861. # opened_windows_counter += 1
  862. # subprocess.check_output(["notify-send", "-i", "dialog-information", "{}\nOpened windows: {}".format(window.name, opened_windows_counter)])
  863. #
  864. #
  865. # @hook.subscribe.client_killed
  866. # def decrease_opened_windows_counter(window):
  867. # """ Decrease counter of opened windows. """
  868. # global opened_windows_counter
  869. # opened_windows_counter -= 1
  870. # subprocess.check_output(["notify-send", "-i", "dialog-information", "{}\nOpened windows: {}".format(window.name, opened_windows_counter)])
  871. # TODO: delete later if these below two functions don't need any more!!!
  872. # @lazy.function
  873. # def float_to_front(qtile):
  874. # """
  875. # Bring all floating windows of the group to front
  876. # """
  877. # global floating_windows
  878. # floating_windows = []
  879. # for window in qtile.currentGroup.windows:
  880. # if window.floating:
  881. # window.bring_to_front()
  882. # floating_windows.append(window)
  883. # floating_windows[-1].focus()
  884. # @hook.subscribe.client_new
  885. # def floating_dialogs(window):
  886. # dialog = window.window.get_wm_type() == "dialog"
  887. # transient = window.window.get_wm_transient_for()
  888. # if dialog or transient:
  889. # window.floating = True
  890. ###############################################################################
  891. # New EXAMPLE from qtile 0.17.0 for float_rules[]!!!
  892. #
  893. # rules specified in `layout.Floating`'s `float_rules` are now evaluated with
  894. # AND-semantics instead of OR-semantics, i.e. if you specify 2 different
  895. # property rules, both have to match
  896. #
  897. # from libqtile.config import Match
  898. # Match(title=WM_NAME, wm_class=WM_CLASS, role=WM_WINDOW_ROLE)
  899. #
  900. #
  901. # Match(wm_type="utility"),
  902. # Match(wm_type="notification"),
  903. # Match(wm_type="toolbar"),
  904. # Match(wm_type="splash"),
  905. # Match(wm_type="dialog"),
  906. # Match(wm_class="file_progress"),
  907. # Match(wm_class="confirm"),
  908. # Match(wm_class="dialog"),
  909. # Match(wm_class="download"),
  910. # Match(wm_class="error"),
  911. # Match(wm_class="notification"),
  912. # Match(wm_class="splash"),
  913. # Match(wm_class="toolbar"),
  914. # Match(func=lambda c: c.has_fixed_size()),
  915. ###############################################################################
  916. # float_rules for qtile version < 0.17.0
  917. # floating_layout = layout.Floating(float_rules=[
  918. # # Run the utility of `xprop` to see the wm class and name of an X client.
  919. # {"wname": "synaptic"}, # Synaptic (Preinstall dialog)
  920. # {"wname": "Summary"}, # Synaptic (Summary dialog)
  921. # {"wmclass": "Polkit-gnome-authentication-agent-1"}, # Polkit-gnome-authentication-agent-1
  922. # {"wname": "Properties for *"}, # Dolphin (properties dialog)
  923. # {"wname": "Delete Permanently"}, # Dolphin (delete dialog)
  924. # {"wname": "Preference"}, # Haroopad (md editor)
  925. # {"wname": "Terminator Preferences"},
  926. # {"wname": "Close Button Action"}, # Tixati
  927. # {"wmclass": "com-intellij-updater-Runner"},
  928. # {"wmclass": "minitube"},
  929. # {"wmclass": "CheckEmail"},
  930. # {"wmclass": "GParted"},
  931. # {"wmclass": "keepass2"},
  932. # {"wmclass": "vlc"},
  933. # {"wmclass": "smplayer"},
  934. # {"wmclass": "deadbeef"},
  935. # {"wmclass": "galculator"},
  936. # # {"wmclass": "VirtualBox Manager"},
  937. # {"wname": "win0"}, # PyCharm
  938. # {"wmclass": "gnome-font-viewer"},
  939. # {"wmclass": "fluxgui"},
  940. # {"wmclass": "xfce4-power-manager-settings"},
  941. # {"wmclass": "pavucontrol"},
  942. # {"wmclass": "gdebi-gtk"},
  943. # {"wmclass": "volumeicon"},
  944. # {"wmclass": "gcolor3"},
  945. # {"wmclass": "gvim"},
  946. # {"wmclass": "qt5ct"},
  947. # {"wmclass": "lxappearance"},
  948. # {"wmclass": "confirm"},
  949. # {"wmclass": "dialog"},
  950. # {"wmclass": "download"},
  951. # {"wmclass": "error"},
  952. # {"wmclass": "file_progress"},
  953. # {"wmclass": "notification"},
  954. # {"wmclass": "splash"},
  955. # {"wmclass": "toolbar"},
  956. # {"wmclass": "confirmreset"}, # gitk
  957. # {"wmclass": "makebranch"}, # gitk
  958. # {"wmclass": "maketag"}, # gitk
  959. # {"wname": "branchdialog"}, # gitk
  960. # {'wname': 'Open File'},
  961. # {"wname": "pinentry"}, # GPG key password entry
  962. # {"wmclass": "ssh-askpass"}, # ssh-askpass
  963. # ])