aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.config/qtile/bar.py194
-rw-r--r--.config/qtile/config.py36
-rw-r--r--.config/qtile/defaults.py98
-rw-r--r--.config/qtile/keybindings.py85
4 files changed, 413 insertions, 0 deletions
diff --git a/.config/qtile/bar.py b/.config/qtile/bar.py
new file mode 100644
index 0000000..e6701d5
--- /dev/null
+++ b/.config/qtile/bar.py
@@ -0,0 +1,194 @@
+from libqtile import bar
+
+from qtile_extras import widget
+from qtile_extras.widget.groupbox2 import GroupBoxRule
+
+from defaults import colors, powerline_0, powerline_1, powerline_2
+
+class CapsLockWidget(widget.CapsNumLockIndicator):
+ def poll(self):
+ for lock, state in self.get_indicators():
+ if lock == "Caps" and state == "on":
+ return "CAPS LOCK"
+
+ return ""
+
+class NumLockWidget(widget.CapsNumLockIndicator):
+ def poll(self):
+ for lock, state in self.get_indicators():
+ if lock == "Num" and state == "on":
+ return "NUM LOCK"
+
+ return ""
+
+def default_bar():
+ return bar.Bar(
+ [
+ widget.Spacer(
+ length=1,
+ **powerline_1
+ ),
+
+ widget.Clock(
+ format="󰔚 %-I:%M%p",
+ padding=8,
+ background=colors[-1][0],
+ foreground=colors[-1][1],
+ **powerline_1
+ ),
+
+ widget.Clock(
+ format="󰃭 %d %B %Y (%A)",
+ padding=8,
+ background=colors[-2][0],
+ foreground=colors[-2][1],
+ **powerline_0
+ ),
+
+ widget.Battery(
+ format="󱐋{percent:2.0%}",
+ padding=8,
+ show_short_text=False,
+ update_interval=30,
+ low_background=colors[-3][0],
+ low_foreground=colors[-3][1],
+ background=colors[-4][0],
+ foreground=colors[-4][1],
+ charging_background=colors[-5][0],
+ charging_foreground=colors[-5][1],
+ **powerline_1
+ ),
+
+ widget.Backlight(
+ backlight_name = "amdgpu_bl1",
+ padding=8,
+ format=" {percent:2.0%}",
+ background=colors[-6][0],
+ foreground=colors[-6][1],
+ **powerline_0
+ ),
+
+ widget.PulseVolume(
+ padding=8,
+ mute_format="󰖁",
+ unmute_format="󰕾 {volume}%",
+ emoji=False,
+ emoji_list=["󰝟", "󰕿", "󰖀", "󰕾"],
+ background=colors[-7][0],
+ foreground=colors[-7][1],
+ **powerline_2
+ ),
+
+ widget.WindowName(
+ padding=10,
+ max_chars=60,
+ background=colors[11][0],
+ foreground=colors[11][1],
+ **powerline_0
+ ),
+
+ widget.Memory(
+ format=" {MemPercent}%",
+ padding=8,
+ background=colors[-10][0],
+ foreground=colors[-10][1],
+ **powerline_0
+ ),
+
+ widget.CPU(
+ format=" {load_percent}%",
+ padding=8,
+ background=colors[-9][0],
+ foreground=colors[-9][1],
+ **powerline_0
+ ),
+
+ widget.ThermalSensor(
+ format="󰏈 {temp:.1f}{unit}",
+ padding=8,
+ background=colors[-8][0],
+ foreground=colors[-8][1],
+ **powerline_0
+ ),
+
+ widget.WindowCount(
+ show_zero=True,
+ text_format=" {num}",
+ padding=6,
+ background=colors[10][0],
+ foreground=colors[10][1],
+ **powerline_0
+ ),
+
+ NumLockWidget(
+ fmt="󰌾 {}",
+ background=colors[9][0],
+ foreground=colors[9][1],
+ **powerline_0
+ ),
+
+ CapsLockWidget(
+ fmt="󰪛 {}",
+ background=colors[8][0],
+ foreground=colors[8][1],
+ **powerline_0
+ ),
+
+ widget.CurrentLayout(
+ fmt=" {}",
+ background=colors[7][0],
+ foreground=colors[7][1],
+ padding=10,
+ **powerline_2
+ ),
+
+ widget.Spacer(length=5),
+
+ widget.Systray(),
+
+ widget.Spacer(length=15),
+
+ widget.GroupBox2(
+ font = "Source Han Sans JP",
+ highlight_method="block",
+ rounded=False,
+ borderwidth=4,
+ padding_y=6,
+ padding_x=10,
+
+ rules = [
+ GroupBoxRule(
+ line_width=3,
+ ).when(),
+
+ GroupBoxRule(
+ line_colour=colors[5][0],
+ #text_colour=colors[5][1],
+ ).when(screen=GroupBoxRule.SCREEN_THIS),
+
+ GroupBoxRule(
+ line_colour=colors[6][0],
+ #text_colour=colors[6][1],
+ ).when(screen=GroupBoxRule.SCREEN_OTHER),
+
+ GroupBoxRule(
+ text_colour=colors[2][1],
+ ).when(occupied=False),
+
+ GroupBoxRule(
+ text_colour=colors[3][1],
+ ).when(occupied=True),
+
+ #doesn't work. just marks ALL groups as urgent
+ # GroupBoxRule(
+ # line_colour=colors[4][0],
+ # text_colour=colors[4][1],
+ # ).when(urgent=True),
+ ],
+ )
+ ],
+ 32,
+ background = colors[1][0],
+ border_width=[0, 0, 1, 0],
+ border_color=[colors[0][0], colors[0][0], colors[0][1], colors[0][0]]
+ )
diff --git a/.config/qtile/config.py b/.config/qtile/config.py
new file mode 100644
index 0000000..4f47e11
--- /dev/null
+++ b/.config/qtile/config.py
@@ -0,0 +1,36 @@
+from libqtile import layout, qtile, widget
+from libqtile.config import Click, Drag, Group, Key, Match, Screen
+from libqtile.lazy import lazy
+
+from qtile_extras import widget
+from qtile_extras.widget.decorations import PowerLineDecoration
+
+import defaults
+import keybindings
+import bar
+
+groups = defaults.groups
+keys = keybindings.keybindings(defaults.mod, defaults._mod, groups)
+mouse = keybindings.mousebindings(defaults.mod, defaults._mod)
+layouts = defaults.layouts
+floating_layout = defaults.floating_layout
+widget_defaults = defaults.widget_defaults
+extension_defaults = defaults.extension_defaults
+
+screens = [
+ Screen(
+ top=bar.default_bar(),
+ ),
+]
+
+dgroups_key_binder = None
+dgroups_app_rules = []
+follow_mouse_focus = True
+bring_front_click = False
+floats_kept_above = True
+cursor_warp = False
+auto_fullscreen = True
+focus_on_window_activation = "smart"
+reconfigure_screens = True
+auto_minimize = True
+wmname = "LG3D"
diff --git a/.config/qtile/defaults.py b/.config/qtile/defaults.py
new file mode 100644
index 0000000..a4cb388
--- /dev/null
+++ b/.config/qtile/defaults.py
@@ -0,0 +1,98 @@
+from libqtile import layout
+from libqtile.config import Group, Match
+
+from qtile_extras.widget.decorations import PowerLineDecoration
+
+mod = "mod4"
+_mod = "mod1"
+
+colors = [
+ ["#14161b", "#a272a4", # tiled border (in/active)
+ "#14161b", "#cd69d1", # stack border (in/active)
+ "#14161b", "#cd69d1"] # floating border (in/active)
+
+ # [bg, fg]
+ , ["#1e1e2e", "#cdd6f4"] # bar color
+ , [None, "#6c7086"] # empty group
+ , [None, "#cdd6f4"] # non empty group
+ , ["#f38ba8", "#f2cdcd"] # urgent group
+ , ["#cba6f7", "#cdd6f4"] # active group (active monitor)
+ , ["#a6e3a1", "#a6e3a1"] # active group (inactive monitor)
+
+ , ["#94e2d5", "#11111b"] # layout indicator
+ , ["#f38ba8", "#11111b"] # caps lock indicator
+ , ["#eba0ac", "#11111b"] # num lock indicator
+ , ["#f5e0dc", "#11111b"] # window count
+ , ["#24273a", "#cdd6f4"] # window name
+
+ , ["#b4befe", "#11111b"] # mem usage
+ , ["#74c7ec", "#11111b"] # cpu usage
+ , ["#f38ba8", "#11111b"] # cpu temp
+ , ["#a6e3a1", "#11111b"] # volume
+ , ["#89b4fa", "#11111b"] # backlight
+ , ["#fab387", "#11111b"] # battery (plugged in)
+ , ["#f38ba8", "#11111b"] # battery (discharging)
+ , ["#f38ba8", "#11111b"] # battery (low)
+ , ["#f5c2e7", "#11111b"] # date
+ , ["#cba6f7", "#11111b"] # time
+]
+
+groups = [Group(i) for i in "一二三四五六七八九十"]
+# groups = [Group(i) for i in "󰮫󰈹󰣀"]
+
+layouts = [
+ layout.Columns(
+ insert_position=1,
+ border_width=3,
+ align=layout.Columns._left,
+ margin=[4, 4, 4, 4],
+ margin_on_single=[0, 0, 0, 0],
+ border_normal=colors[0][0],
+ border_focus=colors[0][1],
+ border_normal_stack=colors[0][2],
+ border_focus_stack=colors[0][3],
+ ),
+ layout.Max(),
+ layout.Matrix(),
+ layout.MonadWide(),
+ layout.VerticalTile(),
+]
+
+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
+ ]
+)
+
+widget_defaults = dict(
+ font = "NotoSans NF:style=Regular",
+ fontsize = 14,
+ padding = 3,
+)
+
+extension_defaults = widget_defaults.copy()
+
+powerline_0 = {
+ "decorations": [
+ PowerLineDecoration(path="forward_slash")
+ ]
+}
+
+powerline_1 = {
+ "decorations": [
+ PowerLineDecoration(path="arrow_left")
+ ]
+}
+
+powerline_2 = {
+ "decorations": [
+ PowerLineDecoration(path="arrow_right")
+ ]
+}
diff --git a/.config/qtile/keybindings.py b/.config/qtile/keybindings.py
new file mode 100644
index 0000000..3a5d953
--- /dev/null
+++ b/.config/qtile/keybindings.py
@@ -0,0 +1,85 @@
+from libqtile.config import Click, Drag, Key
+from libqtile.lazy import lazy
+
+def mousebindings(mod, _mod):
+ return [
+ 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()),
+ ]
+
+def keybindings(mod, _mod, groups):
+ keys = [
+ # 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"),
+ Key([mod, "shift"], "space", lazy.layout.previous(), 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"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"),
+ Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
+ Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"),
+ Key([mod, "shift"], "k", 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"], "h", lazy.layout.grow_left(), desc="Grow window to the left"),
+ Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
+ Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"),
+ Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),
+ Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),
+
+ Key([_mod], "h", lazy.screen.prev_group(), desc="Switch to previous group."),
+ Key([_mod], "l", lazy.screen.next_group(), desc="Switch to next group."),
+
+ # 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, "shift"],
+ "Return",
+ lazy.layout.toggle_split(),
+ desc="Toggle between split and unsplit sides of stack",
+ ),
+ # Toggle between different layouts as defined below
+ Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
+ Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
+ Key(
+ [mod],
+ "f",
+ lazy.window.toggle_fullscreen(),
+ desc="Toggle fullscreen on the focused window",
+ ),
+ Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
+ Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
+ Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),
+ ]
+
+ for i in range(len(groups)):
+ key = str(i + 1)
+ if key == "10":
+ key = "0"
+
+ keys.extend(
+ [
+ Key(
+ [mod],
+ key,
+ lazy.group[groups[i].name].toscreen(),
+ desc=f"Switch to group {groups[i].name}",
+ ),
+ Key(
+ [mod, "shift"],
+ key,
+ lazy.window.togroup(groups[i].name, switch_group=True),
+ desc=f"Switch to & move focused window to group {groups[i].name}",
+ ),
+ ]
+ )
+
+ return keys