config.py 43 KB

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