Advertisement
Guest User

Untitled

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