import os import subprocess from libqtile import layout, bar, widget, hook from libqtile.config import Group, Screen from libqtile.dgroups import simple_key_binder from libqtile.config import Key from libqtile.command import lazy from libqtile.config import Click, Drag from colors import dracula # autostart_commands = ["picom", # "feh --bg-scale ~/wallpapers/wtf.jpeg", # "setxkbmap us -option ctrl:swapcaps"] # autostart_path = os.path.expanduser('~/.config/autostart/autostart.sh') # subprocess.run([autostart_path]) # for command in autostart_commands: # subprocess.run(command) # Groups and layouts groups = [] group_names = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ] group_labels = ["Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", "Ⅶ", "Ⅷ", "Ⅸ", "Ⅹ", ] group_layouts = ["monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", "monadtall", ] for i in range(len(group_names)): groups.append( Group(name=group_names[i], layout=group_layouts[i].lower(), label=group_labels[i],)) def init_layout_theme(): """Layout default theme.""" return {"margin": 5, "border_width": 2, "border_focus": dracula["cyan"], "border_normal": dracula["bg"], } layout_theme = init_layout_theme() layouts = [ layout.MonadTall(**layout_theme), # layout.MonadWide(**layout_theme), # layout.Matrix(**layout_theme), # layout.Bsp(**layout_theme), layout.Floating(**layout_theme), # layout.RatioTile(**layout_theme), # layout.Max(**layout_theme), # layout.Spiral(**layout_theme), layout.TreeTab(bg_color=dracula["bg"], active_bg=dracula["purple"], active_fg=dracula["fg"], inactive_fg=dracula["fg"], inactive_bg=dracula["bg"], font="JetBrains Mono", fontshadow=None, section_fontsize=14, panel_width=135,), # layout.Zoomy(**layout_theme), ] # Widgets def init_widgets_defaults(): """Set widget default settings.""" return dict(font="JetBrains Mono", fontsize=12, padding=2, foreground=dracula["fg"], background=dracula["bg"] ) widget_defaults = init_widgets_defaults() def init_widgets_list(): """My widget list.""" widgets_list = [ widget.Spacer( length=7, ), widget.Image( filename="~/.config/qtile/rms.png", scale="True", margin=2, ), widget.Spacer( length=7, ), widget.GroupBox( font="FontAwesome", fontsize=20, padding=3, margin=4, borderwidth=1, active=dracula["cyan"], inactive=dracula["curr"], rounded=False, highlight_method="line", this_current_screen_border=dracula["red"], other_current_screen_border=dracula["curr"], ), widget.CurrentLayout( font="Noto Sans Bold", foreground=dracula["fg"], background="#5B4B8A", ), widget.Spacer( length=5 ), widget.WindowName( font="JetBrains Mono Bold", fontsize=12, foreground=dracula["green"], background=dracula["bg"], ), # widget.Image( # filename = "~/.config/qtile/spotify2.png", # scale = True, # ), # Spotify( # fontsize = 12, # background = dracula["bg"], # color = dracula["green"], # fmt = '{}', # font = "JetBrains Mono Bold" # ), # widget.Moc( # font = "JetBrains Mono", # fontsize= 13, # play_color=dracula["green"], # paddig = 10, # ), widget.Pomodoro( color_active=dracula["cyan"], color_break=dracula["orange"], color_inactive=dracula["curr"], lenghth_pomodori=30, fontsize=17, ), widget.Spacer( length=10, ), widget.Image( filename="~/.config/qtile/volume1.png", scale=True, ), widget.Spacer( length=7, padding=10, ), widget.Volume( fontsize=15, fmt='{} ', background=dracula["bg"], foreground=dracula['orange'], font="JetBrains Mono", margin=10, get_volume_command="pamixer --get-volume-human", volume_app = "pamixer" ), # widget.Mpris2( # fontsize= 16, # background = my_colors["red"], # objname="org.mpris.MediaPlayer2.spotify" # ), widget.Spacer( length=7, padding=10, ), widget.Image( filename="~/.config/qtile/ram2.png", scale=True, ), widget.Memory( measure_mem="G", fontsize=15, foreground=dracula["cyan"], background=dracula["bg"], font='JetBrains Mono Bold', ), widget.MemoryGraph( type='box', graph_color=dracula["cyan"], foreground=dracula["fg"], background=dracula["bg"], ), widget.Spacer( length=7 ), widget.Image( filename="~/.config/qtile/cpu1.png", scale=True, ), widget.ThermalSensor( threshold=50, fontsize=15, font='JetBrains Mono Bold', foreground=dracula["cyan"], background=dracula["bg"], ), widget.CPUGraph( type='box', graph_color=dracula["cyan"], background=dracula["bg"], ), widget.Spacer( length=5 ), widget.TextBox( font="FontAwesome", text="  ", foreground=dracula["orange"], background=dracula["bg"], padding=2, fontsize=18 ), widget.Clock( font='JetBrains Mono Bold', foreground=dracula["cyan"], background=dracula["bg"], fontsize=18, format="%d-%m-%Y | %H:%M" ), widget.Spacer( length=6 ), widget.Systray( background=dracula["bg"], icon_size=20, padding=10, margin=10, ), widget.Spacer( length=5 ), ] return widgets_list widgets_list = init_widgets_list() def init_widgets_screen1(): """Init every widget for primary screen.""" widgets_screen1 = init_widgets_list() return widgets_screen1 def init_widgets_screen2(): """Remove systray and spacer for second screen.""" widgets_screen2 = init_widgets_list() return widgets_screen2[:-2] widgets_screen1 = init_widgets_screen1() widgets_screen2 = init_widgets_screen2() def init_screens(): """Panel settings.""" return [Screen(top=bar.Bar(widgets=init_widgets_screen1(), size=33, margin=11),), Screen(top=bar.Bar(widgets=init_widgets_screen2(), size=28, margin=7))] screens = init_screens() follow_mouse_focus = True bring_front_click = False cursor_warp = True auto_fullscreen = True focus_on_window_activation = "smart" # or focus wmname = "Qtile-Apo11o" ## Keys # Use this to change between workspaces dgroups_key_binder = simple_key_binder("mod4") mod = "mod4" browser = "firefox" keys = [ Key([mod], "Return", lazy.spawn("emacsclient -c"), ), Key([mod, "shift"], "a", lazy.spawn('anki'), ), Key([mod, "shift"], "m", lazy.spawn("emacsclient -e '(thanos/pass-launcher)'"), ), Key([mod], "Tab", lazy.spawn("rofi -show drun"), ), Key([mod], "r", lazy.spawn("rofi -show run"), ), Key([mod], "w", lazy.spawn("rofi -show window"), ), Key([mod], "p", lazy.spawn("passmenu -p 'Password for: '"), ), Key([mod], "b", lazy.spawn(browser), ), Key([mod, "shift"], "c", lazy.next_layout(), ), Key([mod], "q", lazy.window.kill(), ), Key([mod, "shift"], "r", lazy.restart(), ), Key([mod, "shift"], "0", lazy.shutdown(), ), Key([mod, "shift"], "e", lazy.spawn("emacs"), ), # Switch focus of monitors Key([mod], "period", lazy.next_screen(), ), # Treetab controls Key([mod, "shift"], "h", lazy.layout.move_left(), ), Key([mod, "shift"], "l", lazy.layout.move_right(), ), # Window controls Key([mod], "n", lazy.layout.down(), ), Key([mod], "p", lazy.layout.up(), ), Key([mod, "shift"], "n", lazy.layout.shuffle_down(), lazy.layout.section_down(), ), Key([mod, "shift"], "p", lazy.layout.shuffle_up(), lazy.layout.section_up(), ), Key([mod], "s", lazy.layout.shrink(), lazy.layout.decrease_nmaster(), ), Key([mod], "l", lazy.layout.grow(), lazy.layout.increase_nmaster(), ), Key([mod], "o", lazy.layout.normalize(), ), Key([mod], "m", lazy.layout.maximize(), ), Key([mod, "shift"], "f", lazy.window.toggle_floating(), ), Key([mod], "f", lazy.window.toggle_fullscreen(), ), # Stack controls Key([mod, "shift"], "Tab", lazy.layout.rotate(), lazy.layout.flip(), ), Key([mod, "shift"], "space", lazy.layout.toggle_split(), ), # Volume controls Key([], "XF86AudioLowerVolume", lazy.spawn("pamixer -d 5") ), Key([], "XF86AudioRaiseVolume", lazy.spawn("pamixer -i 5") ), # I use mod+F[key] to change volume in my thinkpad, # as I dislike using "fn" key in laptops Key([mod], "F11", lazy.spawn('amixer sset Master 5%-'), ), Key([mod], "F12", lazy.spawn('amixer sset Master 5%+'), ), ] 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()), ]