import json import subprocess from libqtile import layout, bar, widget, hook from libqtile.command import lazy from libqtile.config import Key, Screen, Group, Drag, Click @hook.subscribe.startup_once def start_once(): subprocess.call(['/home/eeleater/.config/qtile/scripts/autostart.sh']) terminal = "kitty" mod = ["mod4"] modshift = ["mod4", "shift"] modctrl = ["mod4", "control"] keys = [ # Standard Controls Key(modshift, "d", lazy.window.kill(), desc='kill active window'), Key(modctrl, "r", lazy.restart(), desc='reload qtile config'), Key(modctrl, "l", lazy.spawn("xdg-screensaver lock"), desc='lock screen'), Key(modshift, "q", lazy.spawn("rofi -show p -modi p:rofi-power-menu"), desc="shutdown menu"), Key(mod, "Tab", lazy.spawn("rofi -show window"), desc='window menu'), # Treetab controls Key(modctrl, "Up", lazy.layout.section_up(), desc='Move up a section in treetab'), Key(modctrl, "Down", lazy.layout.section_down(), desc='Move down a section in treetab'), # Window controls Key(mod, "Up", lazy.layout.up(), desc='Move focus up in current stack pane'), Key(mod, "Down", lazy.layout.down(), desc='Move focus down in current stack pane'), Key(mod, "Left", lazy.layout.shrink(), lazy.layout.decrease_nmaster(), desc='Shrink window (MonadTall), decrease number in master pane (Tile)'), Key(mod, "Right", lazy.layout.grow(), lazy.layout.increase_nmaster(), desc='Expand window (MonadTall), increase number in master pane (Tile)'), Key(modshift, "Down", lazy.layout.shuffle_down(), desc='Move windows down in current stack'), Key(modshift, "Up", lazy.layout.shuffle_up(), desc='Move windows up in current stack'), Key(modctrl, "f", lazy.window.toggle_floating(), desc='toggle floating'), Key(mod, "n", lazy.layout.normalize(), desc='normalize window size ratios'), Key(mod, "m", lazy.layout.maximize(), desc='toggle window between minimum and maximum sizes'), # Stack controls Key(modshift, "space", lazy.layout.rotate(), lazy.layout.flip(), desc='Switch which side main pane occupies (XmonadTall)'), Key(mod, "space", lazy.layout.next(), desc='Switch window focus to other pane(s) of stack'), Key(modctrl, "Return", lazy.layout.toggle_split(), desc='Toggle between split and unsplit sides of stack'), # run programs Key(mod, "Return", lazy.spawn(terminal + ' --single-instance'), desc='terminal'), Key(modshift, "Return", lazy.spawn("rofi -show drun"), desc='launcher'), Key(modshift, "r", lazy.spawn("pcmanfm"), desc='filebrowser'), Key(modshift, "p", lazy.spawn("bwmenu"), desc='passwordmenu'), # sound + brightness Key([], "XF86AudioMute", lazy.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")), Key([], "XF86AudioMicMute", lazy.spawn("pactl set-source-mute @DEFAULT_SOURCE@ toggle")), Key([], "XF86AudioLowerVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%")), Key([], "XF86AudioRaiseVolume", lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%")), Key([], "XF86MonBrightnessUp", lazy.spawn("brightnessctl set +10%")), Key([], "XF86MonBrightnessDown", lazy.spawn("brightnessctl set 10%-")) ] 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()) ] # GROUPS group_names = [ ("WWW", {'layout': 'treetab', 'label': ''}), ("DEV", {'layout': 'monadtall', 'label': ''}), ("SYS", {'layout': 'monadtall', 'label': ''}), ("VMS", {'layout': 'monadtall', 'label': ''}), ("DOC", {'layout': 'monadtall', 'label': ''}), ("IRC", {'layout': 'monadtall', 'label': ''}), ("MUS", {'layout': 'monadtall', 'label': ''}), ("VID", {'layout': 'monadtall', 'label': ''}), ("GFX", {'layout': 'floating', 'label': ''}) ] groups = [Group(name, **kwargs) for name, kwargs in group_names] for i, (name, kwargs) in enumerate(group_names, 1): keys.append(Key(mod, str(i), lazy.group[name].toscreen())) keys.append(Key(modshift, str(i), lazy.window.togroup(name))) # LAYOUTS layout_theme = {"border_width": 1, "margin": 5, "border_focus": "53bdfa", "border_normal": "01060e"} treetab_layout = { "font": "FiraCode Nerd Font", "fontsize": 10, "sections": [""], "section_fontsize": 8, "bg_color": "141414", "active_bg": "90C435", "active_fg": "000000", "inactive_bg": "384323", "inactive_fg": "a0a0a0", "padding_y": 5, "section_top": 10, "panel_width": 100 } layouts = [ # layout.MonadWide(**layout_theme), # layout.Bsp(**layout_theme), # layout.Stack(num_stacks=2, **layout_theme), # layout.Columns(**layout_theme), # layout.RatioTile(**layout_theme), # layout.VerticalTile(**layout_theme), # layout.Matrix(**layout_theme), layout.MonadTall(**layout_theme), # layout.Max(**layout_theme), # layout.Tile(shift_windows=True, **layout_theme), layout.TreeTab(**treetab_layout), layout.Floating(**layout_theme) ] # COLORS theme = 'hopscotch' with open("/home/eeleater/.config/qtile/themes/" + theme + ".json") as theme_json: colors = json.load(theme_json) def base(fg='foreground', bg='background'): return {'foreground': colors[fg], 'background': colors[bg]} # DEFAULTS widget_defaults = {'font': 'FiraCode Mono Nerd Font', 'fontsize': 12, 'padding': 5, 'foreground': colors['black'], 'background': colors['background']} extension_defaults = widget_defaults.copy() group_box = { 'fontsize': 25, 'active': colors['purple'], 'inactive': colors['purple'], 'highlight_method': 'line', 'this_current_screen_border': colors['green'] } pacman = { 'update_interval': 1800 } clock = { 'format': '%A, %B %d (%T)' } wid_bg_one = { 'background': colors['green'] } wid_bg_two = { 'background': colors['yellow'] } widgets_list = [ widget.GroupBox(**group_box), widget.WindowName(**base(fg='yellow')), widget.Pacman(**pacman, **wid_bg_one), widget.TextBox(text="Updates", **wid_bg_one), widget.Memory(**wid_bg_two), widget.Battery(**wid_bg_one), widget.Volume(**wid_bg_two), widget.CapsNumLockIndicator(**wid_bg_one), widget.CurrentLayout(**wid_bg_two), widget.Clock(**wid_bg_one, **clock), widget.Systray() ] screens = [Screen(top=bar.Bar(widgets_list, 25))] floating_layout = layout.Floating(float_rules=[ {'wmclass': 'confirm'}, {'wmclass': 'dialog'}, {'wmclass': 'download'}, {'wmclass': 'error'}, {'wmclass': 'file_progress'}, {'wmclass': 'notification'}, {'wmclass': 'splash'}, {'wmclass': 'toolbar'}, {'wmclass': 'confirmreset'}, {'wmclass': 'makebranch'}, {'wmclass': 'maketag'}, {'wmclass': 'ssh-askpass'}, {'wmclass': 'microsoft teams - preview'}, {'wname': 'branchdialog'}, {'wname': 'pinentry-gtk-2'}, {'wname': 'pinentry'}, {'wname': 'Welcome to PyCharm'}, {'wname': 'Kali'} ])