Guest User

B3CTOR's config.py

a guest
Jul 11th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.64 KB | None | 0 0
  1. # Copyright (c) 2010 Aldo Cortesi
  2. # Copyright (c) 2010, 2014 dequis
  3. # Copyright (c) 2012 Randall Ma
  4. # Copyright (c) 2012-2014 Tycho Andersen
  5. # Copyright (c) 2012 Craig Barnes
  6. # Copyright (c) 2013 horsik
  7. # Copyright (c) 2013 Tao Sauvage
  8. #
  9. # Permission is hereby granted, free of charge, to any person obtaining a copy
  10. # of this software and associated documentation files (the "Software"), to deal
  11. # in the Software without restriction, including without limitation the rights
  12. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. # copies of the Software, and to permit persons to whom the Software is
  14. # furnished to do so, subject to the following conditions:
  15. #
  16. # The above copyright notice and this permission notice shall be included in
  17. # all copies or substantial portions of the Software.
  18. #
  19. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  25. # SOFTWARE.
  26.  
  27. from libqtile import bar, layout, qtile, widget, extension, hook
  28. from libqtile.config import Click, Drag, Group, Key, Match, Screen
  29. from libqtile.lazy import lazy
  30. from libqtile.utils import guess_terminal, send_notification
  31. from qtile_extras.widget import CPUGraph, ContinuousPoll
  32. from qtile_extras.widget.decorations import PowerLineDecoration, RectDecoration
  33.  
  34. mod = "mod4"
  35. terminal = guess_terminal()
  36.  
  37. @hook.subscribe.client_killed
  38. def client_killed(client):
  39. send_notification("qtile", f"{client.name} has been killed.")
  40.  
  41. @hook.subscribe.client_new
  42. def client_new(client):
  43. send_notification("qtile", f"{client.name} has been created.")
  44.  
  45. keys = [
  46. # A list of available commands that can be bound to keys can be found
  47. # at https://docs.qtile.org/en/latest/manual/config/lazy.html
  48. # Switch between windows
  49. Key([mod], "j", lazy.layout.left(), desc="Move focus to left"),
  50. Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
  51. Key([mod], "k", lazy.layout.down(), desc="Move focus down"),
  52. Key([mod], "i", lazy.layout.up(), desc="Move focus up"),
  53. Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
  54. # Move windows between left/right columns or move up/down in current stack.
  55. # Moving out of range in Columns layout will create new column.
  56. Key([mod, "shift"], "j", lazy.layout.shuffle_left(), desc="Move window to the left"),
  57. Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
  58. Key([mod, "shift"], "k", lazy.layout.shuffle_down(), desc="Move window down"),
  59. Key([mod, "shift"], "i", lazy.layout.shuffle_up(), desc="Move window up"),
  60. # Grow windows. If current window is on the edge of screen and direction
  61. # will be to screen edge - window would shrink.
  62. Key([mod, "control"], "j", lazy.layout.grow_left(), desc="Grow window to the left"),
  63. Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
  64. Key([mod, "control"], "k", lazy.layout.grow_down(), desc="Grow window down"),
  65. Key([mod, "control"], "i", lazy.layout.grow_up(), desc="Grow window up"),
  66. Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
  67. # Toggle between split and unsplit sides of stack.
  68. # Split = all windows displayed
  69. # Unsplit = 1 window displayed, like Max layout, but still with
  70. # multiple stack panes
  71. Key(
  72. [mod, "shift"],
  73. "Return",
  74. lazy.layout.toggle_split(),
  75. desc="Toggle between split and unsplit sides of stack",
  76. ),
  77. Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
  78. # Toggle between different layouts as defined below
  79. Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
  80. Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
  81. Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window"),
  82. Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
  83. Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
  84. Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
  85. Key([mod], "r", lazy.run_extension(extension.DmenuRun()), desc="Spawn a command using a prompt widget"),
  86. Key([mod], "F3", lazy.spawn("sudo /home/b3ctor/brightness_up.sh")),
  87. Key([mod], "F2", lazy.spawn("sudo /home/b3ctor/brightness_down.sh")),
  88. Key([mod], "F9", lazy.spawn("amixer sset Master 2-")),
  89. Key([mod], "F10", lazy.spawn("amixer sset Master 2+")),
  90. Key([mod],"F11", lazy.spawn("sudo python3 /home/b3ctor/audio_mute.py"))
  91. ]
  92.  
  93. groups = [
  94. Group("DEV"),
  95. Group("TERM"),
  96. Group("NET", matches=[Match(wm_class="Firefox")]),
  97. Group("FILE"),
  98. Group("ETC")
  99. ]
  100.  
  101. k=0
  102. for i in groups:
  103. keys.append(
  104. Key([mod], f"{k+1}", lazy.group[groups[k].name].toscreen()),
  105. )
  106. k+=1
  107.  
  108. # Add key bindings to switch VTs in Wayland.
  109. # We can't check qtile.core.name in default config as it is loaded before qtile is started
  110. # We therefore defer the check until the key binding is run by using .when(func=...)
  111. for vt in range(1, 8):
  112. keys.append(
  113. Key(
  114. ["control", "mod1"],
  115. f"f{vt}",
  116. lazy.core.change_vt(vt).when(func=lambda: qtile.core.name == "wayland"),
  117. desc=f"Switch to VT{vt}",
  118. )
  119. )
  120.  
  121.  
  122. # groups = [Group(i) for i in "123456789"]
  123.  
  124. # for i in groups:
  125. # keys.extend(
  126. # [
  127. # # mod + group number = switch to group
  128. # Key(
  129. # [mod],
  130. # i.name,
  131. # lazy.group[i.name].toscreen(),
  132. # desc="Switch to group {}".format(i.name),
  133. # ),
  134. # # mod + shift + group number = switch to & move focused window to group
  135. # Key(
  136. # [mod, "shift"],
  137. # i.name,
  138. # lazy.window.togroup(i.name, switch_group=False),
  139. # desc="Switch to & move focused window to group {}".format(i.name),
  140. # ),
  141. # # Or, use below if you prefer not to switch to that group.
  142. # # # mod + shift + group number = move focused window to group
  143. # # Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
  144. # # desc="move focused window to group {}".format(i.name)),
  145. # ]
  146. # )
  147.  
  148. layout_theme = {
  149. "border_width": 3,
  150. "margin": 15,
  151. "border_focus": "FFFFFF",
  152. "border_normal": "CCCCCC"
  153. }
  154.  
  155. layouts = [
  156. layout.Columns(**layout_theme),
  157. layout.Max(),
  158. # Try more layouts by unleashing below layouts.
  159. # layout.Stack(num_stacks=2),
  160. # layout.Bsp(),
  161. layout.Matrix(),
  162. # layout.MonadTall(),
  163. # layout.MonadWide(),
  164. # layout.RatioTile(),
  165. # layout.Tile(),
  166. # layout.TreeTab(),
  167. # layout.VerticalTile(),
  168. # layout.Zoomy(),
  169. ]
  170.  
  171. widget_defaults = dict(
  172. font="Caskaydia Mono",
  173. fontsize=12,
  174. padding=5,
  175. )
  176. extension_defaults = widget_defaults.copy()
  177.  
  178. powerline = {
  179. "decorations": [
  180. RectDecoration(use_widget_background=True, padding_y=5, filled=True, radius=0),
  181. PowerLineDecoration(path="arrow_right", padding_y=5)
  182. ]
  183. }
  184.  
  185. screens = [
  186. Screen(
  187. top=bar.Bar(
  188. [
  189. ALSAWidget(
  190. mode='both',
  191. theme_path='/home/b3ctor/.config/qtile/audio.png',
  192. padding=5,
  193. icon_size=5
  194.  
  195. ),
  196. widget.QuickExit(
  197. default_text="⏻",
  198. padding = 50,
  199. background = "#f72020",
  200. ),
  201. widget.GroupBox(
  202. highlight_method='line',
  203. borderwidth = 2,
  204. disable_drag = True,
  205. highlight_color = "#ff4b2b",
  206. padding = 6,
  207. active = "#ffffff",
  208. inactive = "#ffffff",
  209. ),
  210. widget.WindowName(**powerline),
  211. widget.Volume(background='444444', **powerline),
  212. widget.Chord(
  213. chords_colors={
  214. "launch": ("#ff0000", "#ffffff"),
  215. },
  216. name_transform=lambda name: name.upper(),
  217. ),
  218. # NB Systray is incompatible with Wayland, consider using StatusNotifier instead
  219. widget.CPUGraph(background='444444', **powerline),
  220. widget.Notify(
  221. audiofile="",
  222. background="#edab40",
  223. mouse_callbacks={
  224. "test":lazy.spawn(terminal)
  225. }, **powerline
  226. ),
  227. widget.Clock(format="%d-%m-%Y %a %I:%M %p"),
  228. ],
  229. 30,
  230. background = "#bf3621",
  231. margin = 5
  232. # border_width=[2, 0, 2, 0], # Draw top and bottom borders
  233. # border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
  234. ),
  235. # You can uncomment this variable if you see that on X11 floating resize/moving is laggy
  236. # By default we handle these events delayed to already improve performance, however your system might still be struggling
  237. # This variable is set to None (no cap) by default, but you can set it to 60 to indicate that you limit it to 60 events per second
  238. # x11_drag_polling_rate = 60,
  239. ),
  240. ]
  241.  
  242. # Drag floating layouts.
  243. mouse = [
  244. Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
  245. Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
  246. Click([mod], "Button2", lazy.window.bring_to_front()),
  247. ]
  248.  
  249. dgroups_key_binder = None
  250. dgroups_app_rules = [] # type: list
  251. follow_mouse_focus = True
  252. bring_front_click = False
  253. floats_kept_above = True
  254. cursor_warp = False
  255. floating_layout = layout.Floating(
  256. float_rules=[
  257. # Run the utility of `xprop` to see the wm class and name of an X client.
  258. *layout.Floating.default_float_rules,
  259. Match(wm_class="confirmreset"), # gitk
  260. Match(wm_class="makebranch"), # gitk
  261. Match(wm_class="maketag"), # gitk
  262. Match(wm_class="ssh-askpass"), # ssh-askpass
  263. Match(title="branchdialog"), # gitk
  264. Match(title="pinentry"), # GPG key password entry
  265. ]
  266. )
  267. auto_fullscreen = True
  268. focus_on_window_activation = "smart"
  269. reconfigure_screens = True
  270.  
  271. # If things like steam games want to auto-minimize themselves when losing
  272. # focus, should we respect this or not?
  273. auto_minimize = True
  274.  
  275. # When using the Wayland backend, this can be used to configure input devices.
  276. wl_input_rules = None
  277.  
  278. # xcursor theme (string or None) and size (integer) for Wayland backend
  279. wl_xcursor_theme = None
  280. wl_xcursor_size = 24
  281.  
  282. # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
  283. # string besides java UI toolkits; you can see several discussions on the
  284. # mailing lists, GitHub issues, and other WM documentation that suggest setting
  285. # this string if your java app doesn't work correctly. We may as well just lie
  286. # and say that we're a working one by default.
  287. #
  288. # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
  289. # java that happens to be on java's whitelist.
  290. wmname = "LG3D"
  291.  
Advertisement
Add Comment
Please, Sign In to add comment