config.py 43 KB

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