Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copyright (c) 2010 Aldo Cortesi
- # Copyright (c) 2010, 2014 dequis
- # Copyright (c) 2012 Randall Ma
- # Copyright (c) 2012-2014 Tycho Andersen
- # Copyright (c) 2012 Craig Barnes
- # Copyright (c) 2013 horsik
- # Copyright (c) 2013 Tao Sauvage
- #
- # Permission is hereby granted, free of charge, to any person obtaining a copy
- # of this software and associated documentation files (the "Software"), to deal
- # in the Software without restriction, including without limitation the rights
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- # copies of the Software, and to permit persons to whom the Software is
- # furnished to do so, subject to the following conditions:
- #
- # The above copyright notice and this permission notice shall be included in
- # all copies or substantial portions of the Software.
- #
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- # SOFTWARE.
- import os
- import subprocess
- from libqtile import bar, layout, hook, command
- from libqtile.config import Click, Drag, Group, Key, Match, Screen
- from libqtile.lazy import lazy
- import fontawesome as fa
- from qtile_extras import widget
- from qtile_extras.widget.decorations import PowerLineDecoration
- # my functions
- def window_title_parser(text):
- # for parsing window title
- app_list=("Brave", "Chromium", "Opera", "Kitty",
- "nvim", "zsh", "fish", "bash", "Sublime Text",
- "QuteBrowser", "MPV", "Zathura", "tilda")
- for string in app_list:
- if string.lower() in text.lower():
- return string
- if "kunal@Manjaro".lower() in text.lower():
- return "Terminal"
- return text
- @hook.subscribe.startup_once
- def autostart():
- home = os.path.expanduser('~/.config/qtile/autostart.sh')
- subprocess.Popen([home])
- @lazy.window.function
- def window_to_next_group(window):
- index = window.qtile.groups.index(window.group)
- if index < len(window.qtile.groups) - 1:
- index = index + 1
- # index = (index + 1) % len(window.qtile.groups)
- window.cmd_togroup(window.qtile.groups[index].name, switch_group = True)
- @lazy.window.function
- def window_to_prev_group(window):
- index = window.qtile.groups.index(window.group)
- if index > 0:
- index = index - 1
- # index = (index - 1) % len(window.qtile.groups)
- window.cmd_togroup(window.qtile.groups[index].name, switch_group = True)
- # from libqtile.utils import guess_terminal # cbm
- mod = "mod4"
- alt = "mod1"
- # terminal = guess_terminal() #cbm
- terminal = "kitty"
- wallpaper_details = ("/home/kunal/Pictures/Wallpapers/wall44_1.jpg", 'fill')
- keys = [
- # j -> a, k -> s, h -> z, l -> x
- # A list of available commands that can be bound to keys can be found
- # at https://docs.qtile.org/en/latest/manual/config/lazy.html
- # Switch between windows
- Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
- Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
- Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
- Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
- Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),
- # Move windows between left/right columns or move up/down in current stack.
- # Moving out of range in Columns layout will create new column.
- Key([mod, "shift"], "z", lazy.layout.shuffle_left(), desc="Move window to the left"),
- Key([mod, "shift"], "x", lazy.layout.shuffle_right(), desc="Move window to the right"),
- Key([mod, "shift"], "a", lazy.layout.shuffle_down(), desc="Move window down"),
- Key([mod, "shift"], "s", lazy.layout.shuffle_up(), desc="Move window up"),
- # Grow windows. If current window is on the edge of screen and direction
- # will be to screen edge - window would shrink.
- Key([mod, "control"], "z", lazy.layout.grow_left(), desc="Grow window to the left"),
- Key([mod, "control"], "x", lazy.layout.grow_right(), desc="Grow window to the right"),
- Key([mod, "control"], "a", lazy.layout.grow_down(), desc="Grow window down"),
- Key([mod, "control"], "s", lazy.layout.grow_up(), desc="Grow window up"),
- Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
- # Toggle between split and unsplit sides of stack.
- # Split = all windows displayed
- # Unsplit = 1 window displayed, like Max layout, but still with
- # multiple stack panes
- Key([mod, "control"], "j", lazy.screen.next_group(), desc = "Move to next Group"),
- Key([mod, "control"], "k", lazy.screen.prev_group(), desc = "Move to previous Group"),
- Key([mod, "shift"], "j", window_to_next_group(), desc = "Move window to next Group"),
- Key([mod, "shift"], "k", window_to_prev_group(), desc = "Move window to previous Group"),
- Key(
- [mod, "shift"],
- "Return",
- lazy.layout.toggle_split(),
- desc="Toggle between split and unsplit sides of stack",
- ),
- Key([mod], "t", lazy.spawn(terminal), desc="Launch terminal"), #cbm
- # Toggle between different layouts as defined below
- Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
- Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), # cbm
- # Key([mod], "w", lazy.window.kill(), desc="Kill focused window"), # cbm
- # Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), # cbm
- Key([mod], "r", lazy.reload_config(), desc="Reload the config"), # cbm
- Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), #cbm
- # Key([mod, "control"], "q", lazy.spawn("/home/kunal/.config/rofi/scripts/powermenu_t3")), # cmb
- # Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), #cmb
- Key([mod], "slash", lazy.spawn("/home/kunal/.config/rofi/scripts/launcher_t2")), # cmb
- # my keybindings
- Key([], "XF86AudioLowerVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%"), desc='Volume Down'),
- Key([], "XF86AudioRaiseVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%"), desc='Volume Up'),
- Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle"), desc='Volume Mute'),
- Key([], "XF86MonBrightnessUp", lazy.spawn("light -A 5")),
- Key([], "XF86MonBrightnessDown", lazy.spawn("light -U 5")),
- # Key([], "3270_PrintScreen", lazy.spawn('gnome-screenshot -i')),
- Key([], "Print", lazy.spawn('flameshot gui')),
- Key([mod], "b", lazy.spawn('qutebrowser')),
- Key([mod, "shift"], "b", lazy.spawn('brave')),
- # Key([mod], "s", lazy.spawn('spotify')),
- Key([mod], "f", lazy.spawn('nemo')),
- Key([mod, "control"], "c", lazy.spawn("subl ~/.config/qtile/config.py")),
- Key([mod], "c", lazy.spawn("subl")),
- ]
- # groups = [Group(i) for i in "123456789"]
- # groups = [Group(i) for i in "asdfuiop"]
- groups = [Group(i) for i in "12345P"]
- # groups.append(Group("www"))
- for i in groups:
- keys.extend(
- [
- # mod1 + letter of group = switch to group
- Key(
- [mod],
- i.name,
- lazy.group[i.name].toscreen(),
- desc="Switch to group {}".format(i.name),
- ),
- # mod1 + shift + letter of group = switch to & move focused window to group
- Key(
- [mod, "shift"],
- i.name,
- lazy.window.togroup(i.name, switch_group=True),
- desc="Switch to & move focused window to group {}".format(i.name),
- ),
- Key(
- [mod],
- i.name.lower()[0],
- lazy.group[i.name].toscreen(),
- desc="Switch to group {}".format(i.name),
- ),
- # Or, use below if you prefer not to switch to that group.
- # # mod1 + shift + letter of group = move focused window to group
- # Key([mod, "shift"], i.name, lazy.window.togroup(i.name),
- # desc="move focused window to group {}".format(i.name)),
- ]
- )
- keys.extend(
- [
- Key(
- ["control"],
- "space",
- # lazy.screen.next_group(),
- lazy.group["1"].toscreen()
- ),
- ]
- )
- layouts = [
- layout.Columns(border_focus_stack=["#d75f5f", "#8f3d3d"], border_width=4),
- layout.Max(),
- # Try more layouts by unleashing below layouts.
- layout.Stack(num_stacks=2),
- # layout.Bsp(),
- # layout.Matrix(),
- # layout.MonadTall(),
- # layout.MonadWide(),
- # layout.RatioTile(),
- layout.Tile(),
- # layout.TreeTab(),
- # layout.VerticalTile(),
- # layout.Zoomy(),
- layout.Floating(),
- ]
- widget_defaults = dict(
- font="Monofur Nerd Font Bold",
- fontsize=15,
- padding=1,
- foreground = "#f4a9f5",
- )
- extension_defaults = widget_defaults.copy()
- powerline_right_arrow = {
- "decorations": [
- PowerLineDecoration(path = "arrow_right")
- ]
- }
- powerline_left_arrow = {
- "decorations": [
- PowerLineDecoration(path = "arrow_left")
- ],
- }
- powerline_back_slash = {
- "decorations": [
- PowerLineDecoration(path = "back_slash")
- ]
- }
- powerline_forward_slash = {
- "decorations": [
- PowerLineDecoration(path = "forward_slash")
- ]
- }
- screens = [
- Screen(
- top=bar.Bar(
- [
- # widget.CurrentLayout(),
- widget.CurrentLayoutIcon(
- fontsize=3,
- background="3c3744",
- **powerline_back_slash
- ),
- widget.CurrentLayout(
- background="0D2D6B",
- **powerline_back_slash
- ),
- widget.GroupBox(
- highlight_method="block",
- # background="21262E",
- background="00000000",
- **powerline_back_slash
- ),
- widget.TaskList(
- highlight_method="block",
- margin_y = 0,
- margin_x = 3,
- width = 250,
- icon_size = 0,
- padding_x = 3,
- rounded = False,
- txt_floating = "🗗 ",
- txt_maximized = "🗖 ",
- txt_minimized = "🗕 ",
- # font = "VictorMono Nerd Font",
- font = "Cascadiya Code Bold",
- fontsize = 12,
- parse_text=window_title_parser,
- foreground = "#b1c1fc",
- # background="293241",
- background="#00000000",
- border = "047d5d",
- **powerline_back_slash
- ),
- widget.CPU(
- mouse_callbacks = {"Button1": lazy.spawn("kitty -e htop")},
- format = "CPU {load_percent}%",
- # background = "d8315b",
- background = "#5c0424",
- # foreground = "1e1b18"
- ),
- widget.Memory(
- mouse_callbacks = {"Button1": lazy.spawn("kitty -e htop")},
- format = "|{MemUsed: .2f}{mm} of {MemTotal:.02}{mm}",
- measure_mem = "G",
- # foreground = "1e1b18",
- background = "#5c0424",
- **powerline_forward_slash
- ),
- widget.Spacer(
- # background="293241",
- background="#00000000",
- **powerline_forward_slash,
- ),
- # widget.Prompt(background="888888", **powerline),
- # widget.Chord(
- # chords_colors={
- # "launch": ("#ff0000", "#ffffff"),
- # },
- # name_transform=lambda name: name.upper(),
- # ),
- # widget.TextBox("default config", name="default"),
- # widget.TextBox("Press <M-r> to spawn", foreground="#d75f5f"),
- # NB Systray is incompatible with Wayland, consider using StatusNotifier instead
- # widget.StatusNotifier(),
- widget.Notify(
- action = True,
- audiofile = "/home/kunal/Music/notification.wav",
- background = "45394d",
- defualt_timout = 10,
- max_chars = 60,
- **powerline_forward_slash
- ),
- widget.WidgetBox(
- widgets = [
- widget.PulseVolume(
- fmt=fa.icons["volume-up"]+" {}",
- volume_down_command="pactl set-sink-volume @DEFAULT_SINK@ -5%",
- volume_up_command="pactl set-sink-volume @DEFAULT_SINK@ +5%",
- update_interval=0.01,
- limit_max_volume=True,
- background = "228636",
- **powerline_forward_slash,
- ),
- widget.Backlight(
- backlight_name="amdgpu_bl0",
- change_command="light -S {0}",
- fmt=fa.icons["lightbulb"] + " {}",
- step = 1,
- background="693E00",
- **powerline_forward_slash,
- ),
- widget.Wlan(
- mouse_callbacks = {"Button1": lazy.spawn("kitty -e nmtui")},
- interface="wlo1",
- fmt=fa.icons["wifi"] + " {}",
- # format="{essid} {percent:2.0%}",
- format = "{essid}",
- background="6E40C9",
- **powerline_forward_slash,
- ),
- widget.Net(
- format = fa.icons["caret-down"] + "{down}",
- prefix = "k",
- # update_interval = 0.1,
- background="2f6473",
- **powerline_forward_slash,
- ),
- widget.Net(
- format = fa.icons["caret-up"] + "{up}",
- prefix = "k",
- # update_interval = 0.1,
- background="803651",
- **powerline_forward_slash,
- ),
- ],
- close_button_location = 'right',
- # text_closed = fa.icons["arrow-left"],
- text_closed = fa.icons["arrow-left"],
- text_open = " ",
- # background="293241",
- background="#00000000",
- **powerline_forward_slash,
- ),
- widget.Battery(
- battery = 0,
- format = "{percent:0.1%} {char}",
- update_interval = 5,
- low_percentage = 0.05,
- full_char = "",
- # charge_char = fa.icons["arrow-circle-up"],
- charge_char = fa.icons["angle-double-up"],
- # discharge_char = fa.icons["arrow-circle-down"],
- discharge_char = fa.icons["angle-double-down"],
- empty_char = "",
- fmt = fa.icons["battery-full"]+" {}",
- background="80041a",
- **powerline_forward_slash,
- notify_below = 20,
- ),
- # widget.Systray(),
- # widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
- # widget.Clock(format="%a %I:%M %p, %d/%m/%y", fmt="{}", background="45394d",**powerline_forward_slash,),
- widget.Clock(
- mouse_callbacks = {"Button1": lazy.spawn("gnome-calendar")},
- format="%a %I:%M %p",
- fmt="{}",
- background="45394d",
- **powerline_forward_slash,),
- widget.WidgetBox(
- widgets = [
- widget.Clock(
- mouse_callbacks = {"Button1": lazy.spawn("gnome-calendar")},
- format="%d %B-%m", fmt="{}",
- background="463a6d",
- **powerline_forward_slash,
- ),
- ],
- text_closed = fa.icons["arrow-right"],
- text_open = " ",
- # background="45394d",
- background="#00000000",
- **powerline_forward_slash,
- ),
- widget.QuickExit(
- default_text=fa.icons["power-off"] + " ",
- background="047d5d",
- countdown_format = "[{}] ",
- countdown_start = 8,
- )
- # widget.QuickExit(default_text='[sayonara]')
- ],
- 18,
- # background = "#292d3e",
- # foreground = "#A8A8A8",
- background="#00000000",
- opacity = 0.87,
- # border_width=[2, 0,j2, 0], # Draw top and bottom borders
- # border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
- ),
- wallpaper=wallpaper_details[0],
- wallpaper_mode=wallpaper_details[1],
- ),
- ]
- # Drag floating layouts.
- mouse = [
- Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
- Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
- Click([mod], "Button2", lazy.window.bring_to_front()),
- Click([alt], "Button3", lazy.spawn("/home/kunal/.config/rofi/scripts/launcher_t2")),
- Click(["control"], "Button3", lazy.group["5"].toscreen()),
- Click([mod], "Button4", lazy.screen.prev_group()),
- Click([mod], "Button5", lazy.screen.next_group()),
- ]
- Group
- dgroups_key_binder = None
- dgroups_app_rules = [] # type: list
- # follow_mouse_focus = True # cbm
- follow_mouse_focus = False # cbm
- bring_front_click = False
- cursor_warp = False
- floating_layout = layout.Floating(
- float_rules=[
- # Run the utility of `xprop` to see the wm class and name of an X client.
- *layout.Floating.default_float_rules,
- Match(wm_class="confirmreset"), # gitk
- Match(wm_class="makebranch"), # gitk
- Match(wm_class="maketag"), # gitk
- Match(wm_class="ssh-askpass"), # ssh-askpass
- Match(title="branchdialog"), # gitk
- Match(title="pinentry"), # GPG key password entry
- Match(title="tilda"),
- Match(title="Tilda"),
- Match(title="Spotify"),
- Match(wm_class="conky")
- ]
- )
- auto_fullscreen = True
- focus_on_window_activation = "smart"
- reconfigure_screens = True
- # If things like steam games want to auto-minimize themselves when losing
- # focus, should we respect this or not?
- auto_minimize = True
- # When using the Wayland backend, this can be used to configure input devices.
- wl_input_rules = None
- # XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
- # string besides java UI toolkits; you can see several discussions on the
- # mailing lists, GitHub issues, and other WM documentation that suggest setting
- # this string if your java app doesn't work correctly. We may as well just lie
- # and say that we're a working one by default.
- # We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
- # java that happens to be on java's whitelist.
- wmname = "LG3D"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement