summaryrefslogtreecommitdiff
path: root/.config/qtile/config.py
diff options
context:
space:
mode:
Diffstat (limited to '.config/qtile/config.py')
-rw-r--r--.config/qtile/config.py116
1 files changed, 80 insertions, 36 deletions
diff --git a/.config/qtile/config.py b/.config/qtile/config.py
index 39153be..8cec341 100644
--- a/.config/qtile/config.py
+++ b/.config/qtile/config.py
@@ -27,32 +27,62 @@ import os
import subprocess
from typing import List # noqa: F401
-from libqtile import bar, layout, widget, hook
+from libqtile import bar, layout, widget, hook
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy
+from libqtile.log_utils import logger
+from libqtile.command.client import CommandClient
#from libqtile.utils import guess_terminal
mod = "mod4"
#terminal = guess_terminal()
terminal = "alacritty"
-selector = "rofi -show drun -show-icons -theme 'Arc-Dark'"
+selector = "rofi -show drun -show-icons -theme 'Arc-Dark'"
weather_location = "Melbourne"
slimeshot = "/home/yui/Scripts/slimeshot.sh/slimeshot.sh"
+global_font = "IBM Plex Sans"
colors = {
"active": "#7069b8",
- "passive": "#888888",
- "inactive": "#404040",
+ "passive": "#999999",
+ "inactive": "#666666",
"text": "#ffffff",
"background": "#000000"
}
+widget_settings_1k = dict(
+ font=global_font,
+ fontsize=16,
+ padding=4,
+)
+
+widget_settings_2k = dict(
+ font=global_font,
+ fontsize=16,
+ padding=4,
+)
+
+widget_settings_4k = dict(
+ font=global_font,
+ fontsize=20,
+ padding=6,
+)
-@hook.subscribe.startup_complete
-def fix_screen_groups():
- lazy.group['1'].toscreen(1)
- lazy.group['2'].toscreen(0)
- lazy.group['3'].toscreen(2)
+def fix_screen_groups(qtile=None):
+ global screens
+ screens[1].cmd_toggle_group("1")
+ screens[0].cmd_toggle_group("2")
+ screens[2].cmd_toggle_group("3")
+ #screens[1].set_group(qtile.groups_map.get("1"))
+ #screens[0].set_group(qtile.groups_map.get("2"))
+ #screens[2].set_group(qtile.groups_map.get("3"))
+
+
+# fix_screen_groups = [
+# lazy.group['1'].toscreen(1),
+# lazy.group['2'].toscreen(0),
+# lazy.group['3'].toscreen(2)
+# ]
keys = [
# Switch between windows
@@ -82,7 +112,8 @@ keys = [
Key([mod, "control"], "Down", lazy.layout.grow_down(),
desc="Grow window down"),
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, "control"], "n", lazy.layout.normalize(),
+ desc="Reset all window sizes"),
Key([mod], "Page_Up", lazy.layout.grow()),
Key([mod], "Page_Down", lazy.layout.shrink()),
@@ -129,7 +160,8 @@ keys = [
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 an 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")),
@@ -137,7 +169,9 @@ keys = [
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")),
- Key([mod], "j", lazy.group['1'].toscreen(1), lazy.group['2'].toscreen(0), lazy.group['3'].toscreen(2)),
+ #Key([mod], "j", lazy.group['1'].toscreen(1),
+ # lazy.group['2'].toscreen(0), lazy.group['3'].toscreen(2)),
+ Key([mod], "j", lazy.function(fix_screen_groups)),
]
@@ -145,8 +179,10 @@ group_labels = "零壱弐参四伍六七八九"
groups = [Group(i, label=group_labels[int(i)]) for i in "123456789"]
for i in groups:
- keys.append(Key([mod], i.name, lazy.group[i.name].toscreen())) # Switch to another group
- keys.append(Key([mod, "shift"], i.name, lazy.window.togroup(i.name))) # Send current window to another group
+ # Switch to another group
+ keys.append(Key([mod], i.name, lazy.group[i.name].toscreen()))
+ # Send current window to another group
+ keys.append(Key([mod, "shift"], i.name, lazy.window.togroup(i.name)))
layout_theme = {"border_width": 2,
"margin": 8,
@@ -155,13 +191,13 @@ layout_theme = {"border_width": 2,
}
layouts = [
- #layout.Columns(border_focus_stack='#d75f5f'),
+ # layout.Columns(border_focus_stack='#d75f5f'),
layout.Max(**layout_theme, name="全"),
# Try more layouts by unleashing below layouts.
# layout.Stack(num_stacks=2),
# layout.Bsp(**layout_theme),
# layout.Matrix(),
- layout.MonadTall(**layout_theme, name=">>=", ratio=0.6),
+ layout.MonadTall(**layout_theme, name=">>=", ratio=0.6),
# layout.MonadWide(),
# layout.RatioTile(),
# layout.Tile(),
@@ -170,29 +206,28 @@ layouts = [
# layout.Zoomy(),
]
-widget_defaults = dict(
- font='IBM Plex Sans',
- fontsize=16,
- padding=4,
-)
-extension_defaults = widget_defaults.copy()
+# widget_defaults = widget_settings_2k.copy()
+# extension_defaults = widget_defaults.copy()
-def generate_widgets(main_monitor=False):
+def generate_widgets(main_monitor=False, settings=None):
- clock = [widget.Clock(format='%m月%d日 %a %H:%M')]
+ clock = [widget.Clock(format='%m月%d日 %a %H:%M', **settings)]
base_widgets = [
- widget.CurrentLayout(),
- widget.GroupBox(highlight_method="block", rounded=False, spacing=0, this_current_screen_border=colors["active"], this_screen_border=colors["passive"], foreground=colors["text"]),
+ widget.CurrentLayout(**settings),
+ widget.GroupBox(highlight_method="block", rounded=False, spacing=0, this_current_screen_border=colors[
+ "active"], this_screen_border=colors["passive"], inactive=colors["inactive"], block_highlight_text_color=colors["text"], **settings),
#widget.WindowTabs(max_chars=60, selected=('<span color="red">', "</span>")),
- widget.TaskList(highlight_method="block", border=colors["active"], unfocused_border=colors["inactive"], fontsize=14, rounded=False, txt_floating="🗗 ", max_title_width=800),
+ widget.TaskList(highlight_method="block", border=colors["active"], unfocused_border=colors[
+ "inactive"], rounded=False, txt_floating="🗗 ", max_title_width=800, **settings),
]
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.Systray(),
+ widget.GenPollUrl(url=f"https://wttr.in/{weather_location}?format=1", json=False, update_interval=600,
+ parse=lambda x: x.replace("+", "").strip(), **settings),
+ #widget.GenPollUrl(url="https://hirasawa.moe/vax.txt", json=False, update_interval=3600, parse=lambda x: x.decode("UTF-8").split("\t")[1]),
+ widget.Systray(**settings),
]
if main_monitor:
@@ -201,10 +236,18 @@ def generate_widgets(main_monitor=False):
return base_widgets + clock
+def open_weather():
+ global terminal
+ global weather_location
+ home = os.path.expanduser('~')
+ subprocess.call(
+ [terminal, "-e", home + '/.config/qtile/weather.sh', weather_location])
+
+
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(main_monitor=True, settings=widget_settings_2k), 30)),
+ Screen(top=bar.Bar(generate_widgets(settings=widget_settings_1k), 30)),
+ Screen(top=bar.Bar(generate_widgets(settings=widget_settings_4k), 45)),
]
@@ -244,9 +287,10 @@ auto_minimize = False
@hook.subscribe.startup_once
def start_once():
- home = os.path.expanduser('~')
- subprocess.call([home + '/.config/qtile/autostart.sh'])
-
+ home = os.path.expanduser('~')
+ subprocess.call([home + '/.config/qtile/autostart.sh'])
+ fix_screen_groups()
+
# 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