Advertisement
Guest User

config.py

a guest
Mar 24th, 2022
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.46 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, widget, hook, extension
  28. from libqtile.config import Click, Drag, Group, Key, Match, Screen
  29. from libqtile.lazy import lazy
  30. from libqtile.utils import guess_terminal
  31. import os
  32. import subprocess
  33.  
  34. @hook.subscribe.startup_once
  35. def autostart():
  36. home = os.path.expanduser('~')
  37. subprocess.call([home + '/.config/qtile/autostart.sh'])
  38.  
  39. mod = "mod4"
  40. terminal = guess_terminal()
  41.  
  42. keys = [
  43. # A list of available commands that can be bound to keys can be found
  44. # at https://docs.qtile.org/en/latest/manual/config/lazy.html
  45. # Switch between windows
  46. Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
  47. Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
  48. Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
  49. Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
  50. Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
  51. # Move windows between left/right columns or move up/down in current stack.
  52. # Moving out of range in Columns layout will create new column.
  53. Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"),
  54. Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
  55. Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"),
  56. Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"),
  57. # Grow windows. If current window is on the edge of screen and direction
  58. # will be to screen edge - window would shrink.
  59. Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"),
  60. Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
  61. Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"),
  62. Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
  63. Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
  64. # Toggle between split and unsplit sides of stack.
  65. # Split = all windows displayed
  66. # Unsplit = 1 window displayed, like Max layout, but still with
  67. # multiple stack panes
  68. Key(
  69. [mod, "shift"],
  70. "Return",
  71. lazy.layout.toggle_split(),
  72. desc="Toggle between split and unsplit sides of stack",
  73. ),
  74. Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
  75. # Toggle between different layouts as defined below
  76. Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
  77. Key([mod, "shift"], "q", lazy.window.kill(), desc="Kill focused window"),
  78. Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
  79. Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
  80. Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"),
  81. Key([mod], "d", lazy.run_extension(extension.DmenuRun()))
  82. ]
  83.  
  84. groups = [Group(i) for i in "123456789"]
  85.  
  86. for i in groups:
  87. keys.extend(
  88. [
  89. # mod1 + letter of group = switch to group
  90. Key(
  91. [mod],
  92. i.name,
  93. lazy.group[i.name].toscreen(),
  94. desc="Switch to group {}".format(i.name),
  95. ),
  96. # mod1 + shift + letter of group = switch to & move focused window to group
  97. Key(
  98. [mod, "shift"],
  99. i.name,
  100. lazy.window.togroup(i.name, switch_group=True),
  101. desc="Switch to & move focused window to group {}".format(i.name),
  102. ),
  103. # Or, use below if you prefer not to switch to that group.
  104. # # mod1 + shift + letter of group = move focused window to group
  105. # Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
  106. # desc="move focused window to group {}".format(i.name)),
  107. ]
  108. )
  109.  
  110. #layouts = [
  111. # layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4),
  112. # layout.Max(),
  113. # Try more layouts by unleashing below layouts.
  114. # layout.Stack(num_stacks=2),
  115. # layout.Bsp(),
  116. # layout.Matrix(),
  117. # layout.MonadTall(),
  118. # layout.MonadWide(),
  119. # layout.RatioTile(),
  120. # layout.Tile(),
  121. # layout.TreeTab(),
  122. # layout.VerticalTile(),
  123. # layout.Zoomy(),
  124. #]
  125.  
  126. layout_theme = {"border_width": 2,
  127. "border_focus": "#1793d1",
  128. "margin": 10,
  129. "border_normal": "#312e30",
  130. }
  131.  
  132. layouts = [
  133. layout.Columns(**layout_theme, insert_position = 1, fair = True, margin_on_single = -1),
  134. layout.MonadTall(**layout_theme, single_border_width=0, single_margin=0, new_client_position='bottom'),
  135. ]
  136.  
  137. widget_defaults = dict(
  138. font="sans",
  139. fontsize=12,
  140. padding=3,
  141. )
  142. extension_defaults = widget_defaults.copy()
  143.  
  144. screens = [
  145. Screen(
  146. top=bar.Bar(
  147. [
  148. widget.Spacer(),
  149. widget.TextBox(text="<", foreground="#9E9E9E", padding=18),
  150. widget.Volume(fmt="Vol: {}"),
  151. widget.TextBox(text="<", foreground="#9E9E9E", padding=18),
  152. widget.Clock(format='%A, %B %d'),
  153. widget.TextBox(text="<", foreground="#9E9E9E", padding=18),
  154. widget.Clock(format='%I:%M:%S %p '),
  155. ],
  156. 30, background = "#FFFFFF00", opacity=1,
  157. ),
  158. right=bar.Gap(10),
  159. left=bar.Gap(10),
  160. bottom=bar.Gap(10)
  161. ),
  162. ]
  163.  
  164. # Drag floating layouts.
  165. mouse = [
  166. Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
  167. Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
  168. Click([mod], "Button2", lazy.window.bring_to_front()),
  169. ]
  170.  
  171. dgroups_key_binder = None
  172. dgroups_app_rules = [] # type: list
  173. follow_mouse_focus = True
  174. bring_front_click = False
  175. cursor_warp = False
  176. floating_layout = layout.Floating(
  177. float_rules=[
  178. # Run the utility of `xprop` to see the wm class and name of an X client.
  179. *layout.Floating.default_float_rules,
  180. Match(wm_class="confirmreset"), # gitk
  181. Match(wm_class="makebranch"), # gitk
  182. Match(wm_class="maketag"), # gitk
  183. Match(wm_class="ssh-askpass"), # ssh-askpass
  184. Match(title="branchdialog"), # gitk
  185. Match(title="pinentry"), # GPG key password entry
  186. ]
  187. )
  188. auto_fullscreen = True
  189. focus_on_window_activation = "smart"
  190. reconfigure_screens = True
  191.  
  192. # If things like steam games want to auto-minimize themselves when losing
  193. # focus, should we respect this or not?
  194. auto_minimize = True
  195.  
  196. # When using the Wayland backend, this can be used to configure input devices.
  197. wl_input_rules = None
  198.  
  199. # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
  200. # string besides java UI toolkits; you can see several discussions on the
  201. # mailing lists, GitHub issues, and other WM documentation that suggest setting
  202. # this string if your java app doesn't work correctly. We may as well just lie
  203. # and say that we're a working one by default.
  204. #
  205. # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
  206. # java that happens to be on java's whitelist.
  207. wmname = "LG3D"
  208.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement