From e0db5c846ae5f0461a9000dd9c7f26f1be221c82 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Wed, 17 Nov 2021 00:48:08 +1100 Subject: Improved look of qtile and added some bindings --- .config/qtile/config.py | 59 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/.config/qtile/config.py b/.config/qtile/config.py index bc1a7f2..39153be 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -39,6 +39,15 @@ selector = "rofi -show drun -show-icons -theme 'Arc-Dark'" weather_location = "Melbourne" slimeshot = "/home/yui/Scripts/slimeshot.sh/slimeshot.sh" +colors = { + "active": "#7069b8", + "passive": "#888888", + "inactive": "#404040", + "text": "#ffffff", + "background": "#000000" +} + + @hook.subscribe.startup_complete def fix_screen_groups(): lazy.group['1'].toscreen(1) @@ -75,6 +84,12 @@ keys = [ Key([mod, "control"], "Up", lazy.layout.grow_up(), desc="Grow window up"), Key([mod, "control"], "n", lazy.layout.normalize(), desc="Reset all window sizes"), + Key([mod], "Page_Up", lazy.layout.grow()), + Key([mod], "Page_Down", lazy.layout.shrink()), + Key([mod], "n", lazy.layout.normalize()), + Key([mod], "m", lazy.layout.maximize()), + Key([mod, "shift"], "space", lazy.layout.flip()), + Key([mod, "control"], "1", lazy.to_screen(1), @@ -104,19 +119,21 @@ keys = [ Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), Key([mod], "q", lazy.window.kill(), desc="Kill focused window"), + # Power settings Key([mod, "control"], "r", lazy.restart(), desc="Restart Qtile"), Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), + # Custom launchers Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), Key([mod], "d", lazy.spawn(selector), desc="Launch rofi"), Key([mod], "f", lazy.spawn("firefox"), desc="Launch firefox"), - Key([mod], "e", lazy.spawn("/home/yui/Scripts/emoji.sh"), desc="Launch a emoji rofi"), - + Key([mod], "e", lazy.spawn("/home/yui/Scripts/emoji.sh"), desc="Launch an emoji rofi"), Key([mod], "b", lazy.hide_show_bar("top")), + # Slimeshot bindings Key(["control"], "Print", lazy.spawn(f"{slimeshot}")), Key([mod, "control"], "Print", lazy.spawn(f"{slimeshot} l")), Key(["control", "shift"], "Print", lazy.spawn(f"{slimeshot} c")), @@ -142,9 +159,9 @@ layouts = [ layout.Max(**layout_theme, name="全"), # Try more layouts by unleashing below layouts. # layout.Stack(num_stacks=2), - # layout.Bsp(), + # layout.Bsp(**layout_theme), # layout.Matrix(), - layout.MonadTall(**layout_theme, name=">>="), + layout.MonadTall(**layout_theme, name=">>=", ratio=0.6), # layout.MonadWide(), # layout.RatioTile(), # layout.Tile(), @@ -161,31 +178,33 @@ widget_defaults = dict( extension_defaults = widget_defaults.copy() -def generate_widgets(side=False): - main_widgets = [ +def generate_widgets(main_monitor=False): + + clock = [widget.Clock(format='%m月%d日 %a %H:%M')] + + base_widgets = [ widget.CurrentLayout(), - widget.GroupBox(highlight_method="border", this_current_screen_border="8981e1", this_screen_border="888888"), - widget.Prompt(), - widget.WindowTabs(), + widget.GroupBox(highlight_method="block", rounded=False, spacing=0, this_current_screen_border=colors["active"], this_screen_border=colors["passive"], foreground=colors["text"]), + #widget.WindowTabs(max_chars=60, selected=('', "")), + widget.TaskList(highlight_method="block", border=colors["active"], unfocused_border=colors["inactive"], fontsize=14, rounded=False, txt_floating="🗗 ", max_title_width=800), + ] + + extra_widgets = [ widget.GenPollUrl(url=f"https://wttr.in/{weather_location}?format=1", json=False, update_interval=600, parse=lambda x: x.replace("+", "").strip()), widget.GenPollUrl(url="https://hirasawa.moe/vax.txt", json=False, update_interval=3600, parse=lambda x: x.decode("UTF-8").split("\t")[1]), - #widget.GenPollUrl(url=f"https://hirasawa.moe/vax.txt", json=False, update_interval=3600, parse=lambda x: x.split("\t")[1]), widget.Systray(), - widget.Clock(format='%m月%d日 %a %H:%M'), - ] - side_widgets = [ - widget.CurrentLayout(), - widget.GroupBox(highlight_method="border", this_current_screen_border="8981e1", this_screen_border="888888"), - widget.WindowTabs(), - widget.Clock(format='%m月%d日 %a %H:%M'), ] - return side_widgets if side else main_widgets + + if main_monitor: + return base_widgets + extra_widgets + clock + + return base_widgets + clock screens = [ + Screen(top=bar.Bar(generate_widgets(main_monitor=True), 30)), + Screen(top=bar.Bar(generate_widgets(), 30)), Screen(top=bar.Bar(generate_widgets(), 30)), - Screen(top=bar.Bar(generate_widgets(side=True), 30)), - Screen(top=bar.Bar(generate_widgets(side=True), 30)), ] -- cgit v1.2.3