config.py 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  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. Key([mod, "shift"], "Return", lazy.spawn("terminator"), desc="Launch terminator"),
  204. # RESIZE UP, DOWN, LEFT, RIGHT
  205. Key([mod, "control"], "i",
  206. lazy.layout.shrink_main(),
  207. ),
  208. Key([mod, "control"], "u",
  209. lazy.layout.grow_main(),
  210. ),
  211. Key([mod, "control"], "l",
  212. lazy.layout.grow_right(),
  213. lazy.layout.grow(),
  214. lazy.layout.increase_ratio(),
  215. lazy.layout.delete()
  216. ),
  217. # Key([mod, "control"], "Right",
  218. # lazy.layout.grow_right(),
  219. # lazy.layout.grow(),
  220. # lazy.layout.increase_ratio(),
  221. # lazy.layout.delete()
  222. # ),
  223. Key([mod, "control"], "h",
  224. lazy.layout.grow_left(),
  225. lazy.layout.shrink(),
  226. lazy.layout.decrease_ratio(),
  227. lazy.layout.add(),
  228. ),
  229. # Key([mod, "control"], "Left",
  230. # lazy.layout.grow_left(),
  231. # lazy.layout.shrink(),
  232. # lazy.layout.decrease_ratio(),
  233. # lazy.layout.add(),
  234. # ),
  235. Key([mod, "control"], "k",
  236. lazy.layout.grow_up(),
  237. lazy.layout.grow(),
  238. lazy.layout.decrease_nmaster(),
  239. ),
  240. # Key([mod, "control"], "Up",
  241. # lazy.layout.grow_up(),
  242. # lazy.layout.grow(),
  243. # lazy.layout.decrease_nmaster(),
  244. # ),
  245. Key([mod, "control"], "j",
  246. lazy.layout.grow_down(),
  247. lazy.layout.shrink(),
  248. lazy.layout.increase_nmaster(),
  249. ),
  250. # Key([mod, "control"], "Down",
  251. # lazy.layout.grow_down(),
  252. # lazy.layout.shrink(),
  253. # lazy.layout.increase_nmaster(),
  254. # ),
  255. Key([mod, "control"], "w", lazy.spawn(f"{HOME}/Programs/Tor/Browser/start-tor-browser --detach"), desc="Launch Tor"),
  256. # <SUPER> + <SHIFT> + <CTRL> + KEYS
  257. # <ALT> + KEYS
  258. # KeyChords
  259. # Dmenu
  260. KeyChord([alt], "m", [
  261. Key([], "c", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-edit-configs.sh"), desc="Run dmenu script for editing config files"),
  262. Key([], "l", lazy.spawn(f"{HOME}/.myScripts/system_exit/lock.sh"), desc="Lock screen"),
  263. Key([], "r", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-programs.sh"), desc="Run choice of most used utils"),
  264. Key([], "s", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-scripts.sh"), desc="Run chosen search engine"),
  265. Key([], "x", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-system-exit.sh"), desc="System exit menu")],
  266. mode=False,
  267. name="Dmenu"
  268. ),
  269. Key([alt], "w", lazy.spawn("rofi run -show window -show-icons"), desc="Switch between opened windows"),
  270. Key([alt], "F4", lazy.spawn(f"{HOME}/Programs/ByeBye/ByeBye"), desc="Launch logout app 'ByeBye'"),
  271. Key([alt], "Tab", lazy.group.next_window(), desc="Switch to the next window"),
  272. # <ALT> + <SHIFT> + KEYS
  273. Key([alt, "shift"], "Tab", lazy.group.prev_window(), desc="Switch to the previous window"),
  274. # <CONTROL> + <ALT> + KEYS
  275. Key(["control", alt], "c", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-edit-configs.sh"), desc="Run dmenu script for editing config files"),
  276. Key(["control", alt], "l", lazy.spawn(f"{HOME}/.myScripts/system_exit/lock.sh"), desc="Lock screen"),
  277. Key(["control", alt], "r", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-programs.sh"), desc="Run choice of most used utils"),
  278. Key(["control", alt], "s", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-run-scripts.sh"), desc="Run chosen search engine"),
  279. Key(["control", alt], "x", lazy.spawn(f"{HOME}/.myScripts/dmscripts/dm-system-exit.sh"), desc="System exit menu"),
  280. # TREETAB CONTROLS
  281. Key(["control", alt], "j", lazy.layout.section_down(), desc="Move up a section in TreeTab"),
  282. Key(["control", alt], "k", lazy.layout.section_up(), desc="Move down a section in TreeTab"),
  283. # <CONTROL> + <SHIFT> + KEYS
  284. Key(["control", "shift"], "Escape", lazy.spawn(f"{my_term} -e htop"), desc="Run htop"),
  285. # MULTIMEDIA KEYS
  286. # <Fn> + <F1-F12>
  287. Key([], "XF86Display", lazy.spawn("lxrandr"), desc="Run lxrandr (choose monitor)"),
  288. Key([], "XF86ScreenSaver", lazy.spawn(f"{HOME}/.myScripts/system_exit/lock.sh"), desc="Lock screen"),
  289. Key([], "XF86Battery", lazy.spawn("xfce4-power-manager-settings"), desc="Power manager settings"),
  290. Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle"), desc="Toggle audio mute"),
  291. Key([mod], "F7", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle"), desc="Toggle audio mute"),
  292. # <SUPER> + <F1-F12>
  293. # Brightness & Volume (extra step 5)
  294. Key([mod], "F2", lazy.spawn(f"{HOME}/.myScripts/brightness_down.sh"), desc="Brightness Down (5-)"),
  295. # lazy.spawn("brightnessctl set 5-"),
  296. Key([mod], "F3", lazy.spawn(f"{HOME}/.myScripts/brightness_up.sh"), desc="Brightness Up (+5)"),
  297. # lazy.spawn("brightnessctl set +5"),
  298. Key([mod], "F8", lazy.spawn(f"{HOME}/.myScripts/volume_down.sh"), desc="Volume Down"),
  299. Key([mod], "F9", lazy.spawn(f"{HOME}/.myScripts/volume_up.sh"), desc="Volume Up more than 100%"),
  300. ]
  301. # MOVE/RESIZE FLOATING WINDOW
  302. for key, x, y in [
  303. ("Left", -10, 0),
  304. ("Right", 10, 0),
  305. ("Up", 0, -10),
  306. ("Down", 0, 10)]:
  307. keys.append(Key([mod, "control"], key, lazy.window.move_floating(x, y)))
  308. keys.append(Key([mod, "shift"], key, lazy.window.resize_floating(x, y)))
  309. ##### GROUPS #####
  310. #       v                
  311. #     🌐♬ 🌡 🖬  ⟳ ₿  ⮋⮉🡇 🡅 ⇓⇑      
  312. group_names = [
  313. (" ", {"layout": "columns"}), # WWW
  314. (" ", {"layout": "columns"}), # DEV
  315. # (" ", {"layout": "monadtall"}), # DEV
  316. (" ", {"layout": "max"}), # FM
  317. (" ", {"layout": "columns"}), # SYS
  318. (" ", {"layout": "columns"}), # VIRT
  319. (" ", {"layout": "max"}), # CHAT
  320. (" ", {"layout": "columns"}), # GFX
  321. (" ", {"layout": "max"}), # VID
  322. (" ", {"layout": "columns"}) # MULT
  323. ]
  324. # groups = [Group(name, **kwargs, label="{}{}".format(name, i)) for i, (name, kwargs) in enumerate(group_names, 1)]
  325. groups = [Group(name, **kwargs, label=f"{i} {name}") for i, (name, kwargs) in enumerate(group_names, 1)]
  326. # groups = [Group(name, **kwargs, label=f"{name}{i}") for i, (name, kwargs) in enumerate(group_names, 1)]
  327. for i, group_name in enumerate(group_names, 1):
  328. keys.extend([
  329. Key([mod], str(i),
  330. lazy.group[group_name[0]].toscreen(toggle=True),
  331. desc="Switch to another group"), # (toggle=True) to toggle groups since Qtile 0.19.0
  332. Key([mod, "shift"], str(i),
  333. lazy.window.togroup(group_name[0], switch_group=True),
  334. # lazy.group[group_name[0]].toscreen(toggle=True), # follow the
  335. # window when it moves to another group DOESN'T NEED ANY MORE
  336. # BECAUSE OF switch_group=True
  337. desc="Send current window to another group")
  338. ])
  339. # A dict: {1: " ", 2: " ", ... } for simple access and if group_names will be
  340. # renamed.
  341. group_names_indexes = {i: group_names[0][0] for (i, group_names[0]) in enumerate(group_names, start=1)}
  342. ##### LAYOUTS #####
  343. layout_theme = {
  344. "border_width": 3,
  345. "margin": 4,
  346. "border_focus": colors.get("border_focus", "#535d6c"),
  347. "border_normal": colors.get("border_normal", "#000000"),
  348. }
  349. layouts = [
  350. # layout.Columns(**layout_theme, border_on_single=False, margin_on_single=False),
  351. layout.Columns(**layout_theme, border_on_single=True),
  352. layout.TreeTab(
  353. # font=my_font,
  354. font=my_nerd_font,
  355. fontsize=14,
  356. bg_color=colors.get("bg_panel", "#222222"),
  357. active_bg=colors.get("bg_current_tab", "#535d6c"),
  358. active_fg=colors.get("fg_active_group", "#ffffff"),
  359. inactive_bg=colors.get("bg_systray", "#222222"),
  360. inactive_fg=colors.get("fg_group_names", "#aaaaaa"),
  361. border_width=2,
  362. padding_y=5,
  363. sections=["FIRST", "SECOND"],
  364. section_fontsize=12,
  365. section_fg=colors.get("fg_group_names", "#aaaaaa"),
  366. section_top=10,
  367. panel_width=320
  368. ),
  369. # layout.Max(**layout_theme),
  370. layout.Max(
  371. margin=0,
  372. border_width=0,
  373. border_focus=colors.get("border_focus", "#535d6c"),
  374. border_normal=colors.get("border_normal", "#000000")
  375. ),
  376. # layout.MonadTall(**layout_theme, single_border_width=False, single_margin=False),
  377. # layout.MonadWide(**layout_theme, single_border_width=False, single_margin=False),
  378. layout.MonadTall(**layout_theme),
  379. layout.MonadWide(**layout_theme),
  380. # layout.Bsp(**layout_theme),
  381. # layout.Tile(shift_windows=True, **layout_theme),
  382. # layout.Stack(stacks=2, **layout_theme),
  383. # layout.Stack(num_stacks=2),
  384. # layout.RatioTile(**layout_theme),
  385. # layout.VerticalTile(**layout_theme),
  386. # layout.Matrix(**layout_theme),
  387. # layout.Zoomy(**layout_theme),
  388. # layout.Floating(**layout_theme)
  389. ]
  390. ##### DEFAULT WIDGET SETTINGS #####
  391. widget_defaults = {
  392. # "font": my_font,
  393. "font": my_nerd_font,
  394. "fontsize": 14,
  395. "padding": 2,
  396. "background": colors.get("bg_panel", "#222222"),
  397. "foreground": colors.get("fg_group_names", "#ffffff")
  398. }
  399. def init_widgets_list():
  400. prompt = "{0}@{1}: ".format(os.environ["USER"], socket.gethostname())
  401. widgets_list = [
  402. widget.GroupBox(
  403. font=my_nerd_font,
  404. fontsize=16,
  405. margin_y=3,
  406. margin_x=0,
  407. padding_y=7,
  408. padding_x=3,
  409. borderwidth=3,
  410. active=colors.get("fg_active_group", "#ffffff"),
  411. inactive=colors.get("fg_group_names", "#aaaaaa"),
  412. rounded=False,
  413. highlight_color=colors.get("bg_panel", "#222222"),
  414. highlight_method="block",
  415. urgent_alert_method="block",
  416. this_current_screen_border=colors.get("bg_current_tab", "#535d6c"),
  417. this_screen_border=colors.get("bg_other_tabs_and_odd_widgets", "#6182b8"),
  418. other_current_screen_border=colors.get("bg_panel", "#222222"),
  419. other_screen_border=colors.get("bg_panel", "#222222"),
  420. ),
  421. widget.Chord(
  422. fontsize=14,
  423. padding = 10,
  424. background=colors.get("bg_chord_dmenu", "#ffcb6b"),
  425. foreground=colors.get("fg_chord_dmenu", "#000000")
  426. ),
  427. # widget.WindowName(
  428. # # # font=my_mono_bold_font,
  429. # fontsize=14,
  430. # foreground=colors["fg_windowname"],
  431. # padding=0,
  432. # # parse_text=parse_windowname
  433. # ),
  434. widget.TaskList(
  435. fontsize=17,
  436. font=my_nerd_font_extra,
  437. # foreground=colors["fg_windowname"],
  438. foreground=colors.get("fg_tasklist", "#ffffff"),
  439. border=colors.get("bg_current_tab", "#222222"),
  440. borderwidth=0,
  441. highlight_method="block",
  442. # txt_floating=" ",
  443. txt_maximized="🗖 ",
  444. txt_minimized="🗕 ",
  445. txt_floating="🗗 ",
  446. icon_size=20,
  447. padding_y=4,
  448. ),
  449. widget.CheckUpdates(
  450. foreground=colors.get("fg_updates", "#ffffff"),
  451. colour_have_updates=colors.get("fg_updates", "#ffffff"),
  452. # no_update_string="No updates",
  453. font=my_nerd_font,
  454. fontsize=14,
  455. # distro="Arch_checkupdates",
  456. # custom_command="checkupdates-with-aur",
  457. custom_command="xbps-install -nuMS",
  458. display_format=" {updates}", # ⟳ 
  459. mouse_callbacks={
  460. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/show_updates.sh"),
  461. "Button2": lambda: qtile.spawn(f"{my_term} --hold -e sudo xbps-install -Su"),
  462. # "Button2": lambda: qtile.spawn(f"{my_term} --hold -e yay -Syu"),
  463. # "Button3": lambda: show_updates.show_updates_arch()
  464. },
  465. update_interval=10800 # 3 hours (60*60*3)
  466. ),
  467. widget.Sep(
  468. linewidth=1,
  469. padding=10
  470. ),
  471. # widget.TextBox(
  472. # # text="⇆ ",
  473. # text="🗘",
  474. # font=my_nerd_font,
  475. # fontsize=16,
  476. # foreground=colors["fg_textbox"],
  477. # padding=0
  478. # ),
  479. # syncthing.Syncthing(
  480. # path_to_script=f"{HOME}/.config/qtile/scripts/get_syncthing_status.sh",
  481. # font=my_nerd_font,
  482. # label="Syncthing\n ",
  483. # update_interval=60,
  484. # active_color=colors["fg_syncthing_active"],
  485. # inactive_color=colors["fg_syncthing_inactive"],
  486. # padding=0
  487. # ),
  488. # widget.Sep(
  489. # linewidth=1,
  490. # padding=10
  491. # ),
  492. widget.OpenWeather(
  493. foreground=colors.get("fg_weather", "#ffffff"),
  494. coordinates={"longitude": "30.9754", "latitude": "52.4345"},
  495. fontsize=20,
  496. format="{icon}",
  497. update_interval=1800,
  498. mouse_callbacks={
  499. "Button3": lambda: qtile.spawn("xdg-open https://openweathermap.org/city/627907"),
  500. }
  501. ),
  502. # widget.TextBox(
  503. # # text="⛅",
  504. # text="🌡",
  505. # fontsize=16,
  506. # foreground=colors["fg_weather"],
  507. # padding=0
  508. # ),
  509. widget.OpenWeather(
  510. foreground=colors.get("fg_weather", "#ffffff"),
  511. coordinates={"longitude": "30.9754", "latitude": "52.4345"},
  512. format="{location_city}: {temp}°{units_temperature}\n{weather_details}",
  513. update_interval=1800,
  514. mouse_callbacks={
  515. "Button3": lambda: qtile.spawn("xdg-open https://openweathermap.org/city/627907"),
  516. }
  517. ),
  518. widget.Sep(
  519. linewidth=1,
  520. padding=10
  521. ),
  522. widget.TextBox(
  523. text="",
  524. # text=" ",
  525. font=my_nerd_font,
  526. fontsize=16,
  527. foreground=colors.get("fg_cpu", "#ffffff"),
  528. padding=0,
  529. mouse_callbacks={
  530. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_cpu_usage.sh"),
  531. # "Button3": lambda: qtile.spawn(f"{my_term} -e htop")
  532. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  533. }
  534. ),
  535. widget.CPU(
  536. foreground=colors.get("fg_cpu", "#ffffff"),
  537. padding=0,
  538. format="{freq_current}GHz\n{load_percent: .0f}%",
  539. mouse_callbacks={
  540. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_cpu_usage.sh"),
  541. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  542. }
  543. ),
  544. widget.Sep(
  545. linewidth=1,
  546. padding=10
  547. ),
  548. widget.TextBox(
  549. text="",
  550. font=my_nerd_font,
  551. fontsize=16,
  552. foreground=colors.get("fg_memory", "#ffffff"),
  553. padding=0,
  554. mouse_callbacks={
  555. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_mem_usage.sh"),
  556. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  557. }
  558. ),
  559. memory.Memory(
  560. foreground=colors.get("fg_memory", "#ffffff"),
  561. padding=0,
  562. format="{MemUsed: .1f}{mm}\n{MemPercent: .0f}%",
  563. measure_mem="G",
  564. mouse_callbacks={
  565. "Button1": lambda: qtile.spawn(f"{HOME}/.config/qtile/scripts/top5_mem_usage.sh"),
  566. "Button3": lambda: qtile.spawn(f"{my_term} -e {SHELL} -c htop")
  567. }
  568. ),
  569. widget.Sep(
  570. linewidth=1,
  571. padding=10
  572. ),
  573. # widget.Net(
  574. # interface=upped_netiface,
  575. # # format=upped_netiface + ":{down} ↓↑{up}",
  576. # # format="{down} ⇓⇑{up}",
  577. # # format="{down} ⤋⤊{up}",
  578. # # format="{down} ⬇⬆{up}",
  579. # # format="{down} 🡇🡅{up}",
  580. # # format="{down}  {up}",
  581. # font=my_nerd_font,
  582. # format="{up} \n{down} ",
  583. # foreground=colors["fg_netspeed"],
  584. # padding=0
  585. # ),
  586. # widget.Sep(
  587. # linewidth=1,
  588. # padding=10
  589. # ),
  590. widget.KeyboardKbdd(
  591. configured_keyboards=["🇺🇸 ", "🇷🇺 "],
  592. # configured_keyboards=["US", "RU"],
  593. # display_map={"us": "🇺🇸", "ru": "🇷🇺"},
  594. # option="grp:alt_shift_toggle",
  595. # option="grp:caps_toggle",
  596. foreground=colors.get("fg_keyboard", "#ffffff"),
  597. fontsize=16,
  598. padding=0,
  599. ),
  600. widget.Systray(
  601. padding=1,
  602. icon_size=24,
  603. ),
  604. widget.TextBox(
  605. text=" ",
  606. padding=1,
  607. ),
  608. widget.CurrentLayoutIcon(
  609. # custom_icon_paths=[f"{HOME}/.config/qtile/icons/layouts"],
  610. foreground=colors.get("fg_layout", "#ffffff"),
  611. padding=0,
  612. scale=0.6,
  613. mouse_callbacks={
  614. "Button1": qtile.next_layout,
  615. "Button3": qtile.prev_layout,
  616. }
  617. ),
  618. widget.WindowCount(
  619. text_format=" {num} /",
  620. fontsize=14,
  621. padding=0,
  622. foreground=colors.get("fg_layout", "#ffffff"),
  623. ),
  624. all_windows_count.WindowCount(
  625. text_format=" {num}",
  626. fontsize=14,
  627. padding=0,
  628. foreground=colors.get("fg_layout", "#ffffff"),
  629. ),
  630. widget.Sep(
  631. linewidth=1,
  632. padding=10
  633. ),
  634. widget.TextBox(
  635. text="",
  636. font=my_nerd_font,
  637. fontsize=16,
  638. foreground=colors.get("fg_date", "#ffffff"),
  639. padding=0,
  640. mouse_callbacks={"Button1": lambda: qtile.spawn("gsimplecal")}
  641. ),
  642. widget.Clock(
  643. foreground=colors.get("fg_date", "#ffffff"),
  644. padding=3,
  645. # mouse_callbacks={"Button1": lambda qtile: qtile.spawn("gsimplecal")},
  646. mouse_callbacks={"Button1": lambda: qtile.spawn("gsimplecal")},
  647. format="%a, %d %b\n%H:%M:%S"
  648. )
  649. ]
  650. return widgets_list
  651. def init_widgets_screen1():
  652. """Returns widgets_list for Monitor 1."""
  653. widgets_screen1 = init_widgets_list()
  654. return widgets_screen1 # Slicing removes unwanted widgets on Monitors 1,3
  655. def init_widgets_screen2():
  656. """Returns widgets_list for Monitor 2."""
  657. widgets_screen2 = init_widgets_list()
  658. return widgets_screen2 # Monitor 2 will display all widgets in widgets_list
  659. def init_screens():
  660. return [
  661. Screen(
  662. # wallpaper=f"{HOME}/Picturies/Wallpapers/NewWallpapers/0314_1280x1024.jpg",
  663. # wallpaper_mode="fill",
  664. top=bar.Bar(
  665. widgets=init_widgets_screen1(),
  666. opacity=1.0,
  667. size=32)),
  668. # Screen(
  669. # top=bar.Bar(
  670. # widgets=init_widgets_screen2(),
  671. # opacity=1.0,
  672. # size=32)),
  673. # Screen(
  674. # top=bar.Bar(
  675. # widgets=init_widgets_screen1(),
  676. # opacity=1.0,
  677. # size=32))
  678. ]
  679. # return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=32))]
  680. # For several Monitors.
  681. # return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=30)),
  682. # Screen(top=bar.Bar(widgets=init_widgets_screen2(), opacity=1.0, size=30)),
  683. # Screen(top=bar.Bar(widgets=init_widgets_screen1(), opacity=1.0, size=30))]
  684. # lazy functions can be bound to keybindings.
  685. @lazy.function
  686. def window_to_prev_group(qtile):
  687. if qtile.currentWindow is not None:
  688. i = qtile.groups.index(qtile.currentGroup)
  689. qtile.currentWindow.togroup(qtile.groups[i - 1].name)
  690. @lazy.function
  691. def window_to_next_group(qtile):
  692. if qtile.currentWindow is not None:
  693. i = qtile.groups.index(qtile.currentGroup)
  694. qtile.currentWindow.togroup(qtile.groups[i + 1].name)
  695. @lazy.function
  696. def window_to_previous_screen(qtile):
  697. i = qtile.screens.index(qtile.current_screen)
  698. if i != 0:
  699. group = qtile.screens[i - 1].group.name
  700. qtile.current_window.togroup(group)
  701. @lazy.function
  702. def window_to_next_screen(qtile):
  703. i = qtile.screens.index(qtile.current_screen)
  704. if i + 1 != len(qtile.screens):
  705. group = qtile.screens[i + 1].group.name
  706. qtile.current_window.togroup(group)
  707. @lazy.function
  708. def switch_screens(qtile):
  709. i = qtile.screens.index(qtile.current_screen)
  710. group = qtile.screens[i - 1].group
  711. qtile.current_screen.set_group(group)
  712. ##### DRAG AND RESIZE FLOATING LAYOUTS BY MOUSE #####
  713. mouse = [
  714. Drag([mod], "Button1", lazy.window.set_position_floating(),
  715. start=lazy.window.get_position()),
  716. Drag([mod], "Button3", lazy.window.set_size_floating(),
  717. start=lazy.window.get_size()),
  718. # Click([mod], "Button2", lazy.window.bring_to_front())
  719. ]
  720. ##### MY FLOATING APPS #####
  721. floating_layout = layout.Floating(float_rules=[
  722. # Run the utility of `xprop` to see the wm class and name of an X client.
  723. # from libqtile.layout.floating class Floating
  724. # add (unpack *) default_float_rules
  725. *layout.Floating.default_float_rules,
  726. Match(wm_class="BreakTimer"),
  727. Match(title="Tor Browser", wm_class="Tor Browser"),
  728. Match(title="О Tor Browser", wm_class="Tor Browser"),
  729. Match(title="About Mozilla Firefox", wm_class="Browser"),
  730. Match(title="Execute File", wm_class="pcmanfm"),
  731. Match(title="Close Button Action", wm_class="tixati"), # Tixati
  732. Match(title="Confirm File Replacing", wm_class="pcmanfm"),
  733. Match(title="Terminator Preferences", wm_class="terminator"),
  734. Match(title="Терминатор Параметры", wm_class="terminator"),
  735. Match(title="File Operation Progress", wm_class="Thunar"),
  736. Match(title="Действия над файлами", wm_class="Thunar"),
  737. Match(title="Create Snapshot", wm_class="Timeshift-gtk"),
  738. Match(title="Delete Snapshots", wm_class="Timeshift-gtk"),
  739. Match(title="Создать снимок", wm_class="Timeshift-gtk"),
  740. Match(title="Удалить снимки", wm_class="Timeshift-gtk"),
  741. # Match(title="win0", wm_class="jetbrains-webstorm"), # WebStorm
  742. # Match(title="Import WebStorm Settings", wm_class="jetbrains-webstorm"),
  743. Match(title="splash"), # PyCharm
  744. Match(title="Update"), # PyCharm
  745. Match(title="Compress"), # Engrampa create archive dialog
  746. Match(title="Сжать"), # Engrampa create archive dialog
  747. # Match(title="win0", wm_class="jetbrains-pycharm-ce"), # PyCharm
  748. # Match(title="Welcome to PyCharm", wm_class="jetbrains-pycharm-ce"),
  749. # Match(title="License Activation", wm_class="jetbrains-pycharm-ce"), # PyCharm
  750. # Match(title="Settings", wm_class="jetbrains-pycharm-ce"), # PyCharm
  751. # Match(title="Python Interpreters", wm_class="jetbrains-pycharm-ce"), # PyCharm
  752. # Match(title="Open Project", wm_class="jetbrains-pycharm-ce"), # PyCharm
  753. # Match(title="Update", wm_class="com-intellij-updater-Runner"), # PyCharm's updates
  754. Match(wm_class="nm-connection-editor"),
  755. Match(wm_class="megasync"),
  756. Match(wm_class="minitube"),
  757. Match(wm_class="CheckEmail"),
  758. # Match(wm_class="GParted"),
  759. # Match(wm_class="keepass2"),
  760. Match(wm_class="pinentry-gtk-2"),
  761. Match(title="Pinentry"), # GPG key password entry
  762. # Match(wm_class="vlc"),
  763. # Match(wm_class="smplayer"),
  764. Match(wm_class="deadbeef"),
  765. Match(wm_class="galculator"),
  766. # {"wmclass": "VirtualBox Manager"},
  767. Match(title="branchdialog"), # gitk
  768. Match(title="Open File"),
  769. Match(wm_class="gnome-font-viewer"),
  770. Match(wm_class="fluxgui"),
  771. Match(wm_class="xfce4-power-manager-settings"),
  772. Match(wm_class="pavucontrol"),
  773. Match(wm_class="gdebi-gtk"),
  774. Match(wm_class="volumeicon"),
  775. Match(wm_class="gcolor3"),
  776. Match(wm_class="gcolor2"),
  777. # Match(wm_class="gvim"),
  778. Match(wm_class="qt5ct"),
  779. Match(wm_class="lxappearance"),
  780. Match(wm_class="confirmreset"), # gitk
  781. Match(wm_class="makebranch"), # gitk
  782. Match(wm_class="maketag"), # gitk
  783. Match(wm_class="ssh-askpass") # ssh-askpass
  784. ], border_focus=colors.get("border_focus", "#535d6c"),
  785. border_normal=colors.get("border_normal", "#000000"),
  786. border_width=1,)
  787. dgroups_key_binder = None
  788. dgroups_app_rules = [] # type: List
  789. main = None # WARNING: this is deprecated and will be removed soon
  790. follow_mouse_focus = True
  791. cursor_warp = False
  792. bring_front_click = False
  793. # bring_front_click = "floating_only"
  794. auto_fullscreen = True
  795. focus_on_window_activation = "focus"
  796. # focus_on_window_activation = "urgent"
  797. # focus_on_window_activation = "smart"
  798. # focus_on_window_activation = "never"
  799. @hook.subscribe.client_new
  800. def move_new_window_to_certain_group(c):
  801. """Moves a new window to certain grop and switchs (if you want) to that group."""
  802. if (c.name == f"{USER} - Thunar" or
  803. c.name == "thunar" or
  804. c.name == f"{USER} - Dolphin" or
  805. c.name == "dolphin"):
  806. c.togroup(group_names_indexes[3])
  807. qtile.groups_map[group_names_indexes[3]].cmd_toscreen()
  808. if (c.name == "Oracle VM VirtualBox Менеджер" or
  809. c.name == "Oracle VM VirtualBox Manager"):
  810. c.togroup(group_names_indexes[5])
  811. qtile.groups_map[group_names_indexes[5]].cmd_toscreen()
  812. if c.name == "Telegram":
  813. c.togroup(group_names_indexes[6])
  814. qtile.groups_map[group_names_indexes[6]].cmd_toscreen()
  815. if c.name == "Rakuten Viber":
  816. c.togroup(group_names_indexes[6])
  817. qtile.groups_map[group_names_indexes[6]].cmd_toscreen()
  818. if c.name == "GNU Image Manipulation Program":
  819. c.togroup(group_names_indexes[7])
  820. qtile.groups_map[group_names_indexes[7]].cmd_toscreen()
  821. if c.name == "Mozilla Thunderbird":
  822. # c.togroup(" ")
  823. c.togroup(group_names_indexes[9])
  824. ##### AUTOSTART #####
  825. @hook.subscribe.startup_once
  826. def start_once():
  827. subprocess.call([f"{HOME}/.config/qtile/scripts/autostart.sh"])
  828. # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
  829. # string besides java UI toolkits; you can see several discussions on the
  830. # mailing lists, GitHub issues, and other WM documentation that suggest setting
  831. # this string if your java app doesn't work correctly. We may as well just lie
  832. # and say that we're a working one by default.
  833. #
  834. # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
  835. # java that happens to be on java's whitelist.
  836. wmname = "LG3D"
  837. if __name__ in ("config", "__main__"):
  838. screens = init_screens()
  839. widgets_list = init_widgets_list()
  840. # widgets_screen1 = init_widgets_screen1()
  841. # widgets_screen2 = init_widgets_screen2()
  842. ##### SOME WHAT I DID BEFORE BUT DON'T NEED ANY MORE. BUT SAVED FOR SOME REASONS #####
  843. # # @hook.subscribe.float_change
  844. # # @hook.subscribe.client_new
  845. # @hook.subscribe.client_focus
  846. # def set_hint(window):
  847. # window.window.set_property("IS_FLOATING", str(window.floating), type="STRING", format=8)
  848. # # subprocess.check_output(["notify-send", "-i", "dialog-information", "{} {}".format(window.name, window.floating)])
  849. # # window.window.set_property("IS_FLOATING", int(window.floating))
  850. # # # Does what I wanted perfectly!!!
  851. # # # @hook.subscribe.client_mouse_enter
  852. # @hook.subscribe.client_focus
  853. # @hook.subscribe.client_new
  854. # def focus_new_floating_window(window):
  855. # """ Bring a new floating window to the front. """
  856. # # subprocess.check_output(["notify-send", "-i", "dialog-information", "{}".format(window.name)])
  857. # if window.floating:
  858. # window.bring_to_front()
  859. # TODO: show amount of opened windows (DONE!!!)
  860. # @hook.subscribe.client_new
  861. # def increase_opened_windows_counter(window):
  862. # """ Increase counter of opened windows. """
  863. # global opened_windows_counter
  864. # opened_windows_counter += 1
  865. # subprocess.check_output(["notify-send", "-i", "dialog-information", "{}\nOpened windows: {}".format(window.name, opened_windows_counter)])
  866. #
  867. #
  868. # @hook.subscribe.client_killed
  869. # def decrease_opened_windows_counter(window):
  870. # """ Decrease counter of opened windows. """
  871. # global opened_windows_counter
  872. # opened_windows_counter -= 1
  873. # subprocess.check_output(["notify-send", "-i", "dialog-information", "{}\nOpened windows: {}".format(window.name, opened_windows_counter)])
  874. # TODO: delete later if these below two functions don't need any more!!!
  875. # @lazy.function
  876. # def float_to_front(qtile):
  877. # """
  878. # Bring all floating windows of the group to front
  879. # """
  880. # global floating_windows
  881. # floating_windows = []
  882. # for window in qtile.currentGroup.windows:
  883. # if window.floating:
  884. # window.bring_to_front()
  885. # floating_windows.append(window)
  886. # floating_windows[-1].focus()
  887. # @hook.subscribe.client_new
  888. # def floating_dialogs(window):
  889. # dialog = window.window.get_wm_type() == "dialog"
  890. # transient = window.window.get_wm_transient_for()
  891. # if dialog or transient:
  892. # window.floating = True
  893. ###############################################################################
  894. # New EXAMPLE from qtile 0.17.0 for float_rules[]!!!
  895. #
  896. # rules specified in `layout.Floating`'s `float_rules` are now evaluated with
  897. # AND-semantics instead of OR-semantics, i.e. if you specify 2 different
  898. # property rules, both have to match
  899. #
  900. # from libqtile.config import Match
  901. # Match(title=WM_NAME, wm_class=WM_CLASS, role=WM_WINDOW_ROLE)
  902. #
  903. #
  904. # Match(wm_type="utility"),
  905. # Match(wm_type="notification"),
  906. # Match(wm_type="toolbar"),
  907. # Match(wm_type="splash"),
  908. # Match(wm_type="dialog"),
  909. # Match(wm_class="file_progress"),
  910. # Match(wm_class="confirm"),
  911. # Match(wm_class="dialog"),
  912. # Match(wm_class="download"),
  913. # Match(wm_class="error"),
  914. # Match(wm_class="notification"),
  915. # Match(wm_class="splash"),
  916. # Match(wm_class="toolbar"),
  917. # Match(func=lambda c: c.has_fixed_size()),
  918. ###############################################################################
  919. # float_rules for qtile version < 0.17.0
  920. # floating_layout = layout.Floating(float_rules=[
  921. # # Run the utility of `xprop` to see the wm class and name of an X client.
  922. # {"wname": "synaptic"}, # Synaptic (Preinstall dialog)
  923. # {"wname": "Summary"}, # Synaptic (Summary dialog)
  924. # {"wmclass": "Polkit-gnome-authentication-agent-1"}, # Polkit-gnome-authentication-agent-1
  925. # {"wname": "Properties for *"}, # Dolphin (properties dialog)
  926. # {"wname": "Delete Permanently"}, # Dolphin (delete dialog)
  927. # {"wname": "Preference"}, # Haroopad (md editor)
  928. # {"wname": "Terminator Preferences"},
  929. # {"wname": "Close Button Action"}, # Tixati
  930. # {"wmclass": "com-intellij-updater-Runner"},
  931. # {"wmclass": "minitube"},
  932. # {"wmclass": "CheckEmail"},
  933. # {"wmclass": "GParted"},
  934. # {"wmclass": "keepass2"},
  935. # {"wmclass": "vlc"},
  936. # {"wmclass": "smplayer"},
  937. # {"wmclass": "deadbeef"},
  938. # {"wmclass": "galculator"},
  939. # # {"wmclass": "VirtualBox Manager"},
  940. # {"wname": "win0"}, # PyCharm
  941. # {"wmclass": "gnome-font-viewer"},
  942. # {"wmclass": "fluxgui"},
  943. # {"wmclass": "xfce4-power-manager-settings"},
  944. # {"wmclass": "pavucontrol"},
  945. # {"wmclass": "gdebi-gtk"},
  946. # {"wmclass": "volumeicon"},
  947. # {"wmclass": "gcolor3"},
  948. # {"wmclass": "gvim"},
  949. # {"wmclass": "qt5ct"},
  950. # {"wmclass": "lxappearance"},
  951. # {"wmclass": "confirm"},
  952. # {"wmclass": "dialog"},
  953. # {"wmclass": "download"},
  954. # {"wmclass": "error"},
  955. # {"wmclass": "file_progress"},
  956. # {"wmclass": "notification"},
  957. # {"wmclass": "splash"},
  958. # {"wmclass": "toolbar"},
  959. # {"wmclass": "confirmreset"}, # gitk
  960. # {"wmclass": "makebranch"}, # gitk
  961. # {"wmclass": "maketag"}, # gitk
  962. # {"wname": "branchdialog"}, # gitk
  963. # {'wname': 'Open File'},
  964. # {"wname": "pinentry"}, # GPG key password entry
  965. # {"wmclass": "ssh-askpass"}, # ssh-askpass
  966. # ])