Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f3a44f82d | ||
|
|
51dc5e80c4 | ||
|
|
35048ae283 | ||
|
|
9e73c1338f | ||
|
|
9cf510e93b | ||
|
|
86e90b0213 |
No files matched your search
@@ -12,7 +12,6 @@
|
|||||||
!waybar/
|
!waybar/
|
||||||
!zathura/
|
!zathura/
|
||||||
!mimeapps.list
|
!mimeapps.list
|
||||||
!fuzzel/
|
|
||||||
!fish/
|
!fish/
|
||||||
!packages
|
!packages
|
||||||
!brave-flags.conf
|
!brave-flags.conf
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
[submodule "btop/catppuccin-btop"]
|
[submodule "btop/catppuccin-btop"]
|
||||||
path = btop/catppuccin-btop
|
path = btop/catppuccin-btop
|
||||||
url = https://github.com/catppuccin/btop.git
|
url = https://github.com/catppuccin/btop.git
|
||||||
[submodule "fuzzel/catppuccin-fuzzel"]
|
|
||||||
path = fuzzel/catppuccin-fuzzel
|
|
||||||
url = https://github.com/catppuccin/fuzzel.git
|
|
||||||
[submodule "nvim"]
|
[submodule "nvim"]
|
||||||
path = nvim
|
path = nvim
|
||||||
url = https://git.narl.io/nvrl/nvim-config.git
|
url = https://git.narl.io/nvrl/nvim-config.git
|
||||||
+1
-1
@@ -68,7 +68,7 @@ update_ms = 1000
|
|||||||
|
|
||||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||||
proc_sorting = "memory"
|
proc_sorting = "cpu direct"
|
||||||
|
|
||||||
#* Reverse sorting order, True or False.
|
#* Reverse sorting order, True or False.
|
||||||
proc_reversed = false
|
proc_reversed = false
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
complete --keep-order --exclusive --command enqs-guard --arguments "(COMPLETE=fish enqs-guard -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
complete --keep-order --exclusive --command enqs-headroom --arguments "(COMPLETE=fish enqs-headroom -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
complete --keep-order --exclusive --command enqs-jail --arguments "(COMPLETE=fish enqs-jail -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||||
+26
-4
@@ -5,9 +5,16 @@
|
|||||||
# strings. The Quickshell config (~/.config/quickshell/services/Sys.qml) parses
|
# strings. The Quickshell config (~/.config/quickshell/services/Sys.qml) parses
|
||||||
# them and does its own formatting. The previous human-readable Waybar formats
|
# them and does its own formatting. The previous human-readable Waybar formats
|
||||||
# are preserved in config.toml.waybar-bak.
|
# are preserved in config.toml.waybar-bak.
|
||||||
|
#
|
||||||
|
# Quickshell only consumes cpu, mem, gpu, disk, net, sys and power from fluxo.
|
||||||
|
# Everything else it gets natively — Quickshell.Services.Mpris, .Pipewire,
|
||||||
|
# .UPower, .Notifications, Quickshell.Bluetooth — and Brightness.qml reads
|
||||||
|
# sysfs directly. Those fluxo modules are therefore switched off below: left on,
|
||||||
|
# they held a libpulse context, a BlueZ D-Bus poll every 2 s and an MPRIS
|
||||||
|
# marquee ticker firing twice a second, all feeding a bar that does not exist.
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
menu_command = "fuzzel --dmenu --prompt \"$FLUXO_PROMPT\""
|
menu_command = "takemi-dmenu --prompt \"$FLUXO_PROMPT\""
|
||||||
|
|
||||||
[signals]
|
[signals]
|
||||||
network = 1
|
network = 1
|
||||||
@@ -44,12 +51,18 @@ format = "{mount}|{used:.1}|{total:.1}"
|
|||||||
format = "{percentage}"
|
format = "{percentage}"
|
||||||
|
|
||||||
[audio]
|
[audio]
|
||||||
|
# Quickshell.Services.Pipewire drives Audio.qml; leaving this on kept a
|
||||||
|
# libpulse context and its callbacks alive for nothing.
|
||||||
|
enabled = false
|
||||||
format_sink_unmuted = "{name} {volume:>3}% <span size='large'>{icon}</span>"
|
format_sink_unmuted = "{name} {volume:>3}% <span size='large'>{icon}</span>"
|
||||||
format_sink_muted = "{name} <span size='large'> {icon}</span>"
|
format_sink_muted = "{name} <span size='large'> {icon}</span>"
|
||||||
format_source_unmuted = "{name} {volume:>3}% <span size='large'>{icon}</span>"
|
format_source_unmuted = "{name} {volume:>3}% <span size='large'>{icon}</span>"
|
||||||
format_source_muted = "{name} <span size='large'>{icon}</span>"
|
format_source_muted = "{name} <span size='large'>{icon}</span>"
|
||||||
|
|
||||||
[bt]
|
[bt]
|
||||||
|
# Quickshell.Bluetooth drives Bt.qml. This module polled BlueZ over D-Bus every
|
||||||
|
# 2 seconds regardless.
|
||||||
|
enabled = false
|
||||||
format_plugin = "{alias} [{left}|{right}] {anc} <span size='large'></span>"
|
format_plugin = "{alias} [{left}|{right}] {anc} <span size='large'></span>"
|
||||||
format_connected = "{alias} <span size='large'></span>"
|
format_connected = "{alias} <span size='large'></span>"
|
||||||
format_disconnected = "Disconnected <span size='large'></span>"
|
format_disconnected = "Disconnected <span size='large'></span>"
|
||||||
@@ -60,9 +73,14 @@ format_active = "<span size='large'></span>"
|
|||||||
format_inactive = "<span size='large'></span>"
|
format_inactive = "<span size='large'></span>"
|
||||||
|
|
||||||
[mpris]
|
[mpris]
|
||||||
|
# Quickshell.Services.Mpris drives Media.qml, and MediaPill/MediaPopout do their
|
||||||
|
# own eliding and scrolling. This module was the single most expensive thing in
|
||||||
|
# the daemon: `scroll` woke a ticker every `scroll_speed` ms to advance a marquee
|
||||||
|
# offset for a Waybar that is not running, and each tick drove the signaler.
|
||||||
|
enabled = false
|
||||||
format = "{artist} - {title}"
|
format = "{artist} - {title}"
|
||||||
max_length = 20
|
max_length = 20
|
||||||
scroll = true
|
scroll = true
|
||||||
scroll_speed = 500
|
scroll_speed = 500
|
||||||
scroll_separator = " /// "
|
scroll_separator = " /// "
|
||||||
|
|
||||||
@@ -81,10 +99,14 @@ enabled = false
|
|||||||
format = "{layout}"
|
format = "{layout}"
|
||||||
|
|
||||||
[backlight]
|
[backlight]
|
||||||
enable = true
|
# Was `enable = true` — not a key fluxo reads, so this section was silently
|
||||||
|
# running on its default of enabled. Brightness.qml reads
|
||||||
|
# /sys/class/backlight directly, so the D-Bus watcher here is redundant.
|
||||||
|
enabled = false
|
||||||
format = "{percentage}"
|
format = "{percentage}"
|
||||||
|
|
||||||
[dnd]
|
[dnd]
|
||||||
enabled = true
|
# Notifs.qml owns do-not-disturb via Quickshell.Services.Notifications.
|
||||||
|
enabled = false
|
||||||
format_dnd = "<span size='large'></span>"
|
format_dnd = "<span size='large'></span>"
|
||||||
format_normal = "<span size='large'></span>"
|
format_normal = "<span size='large'></span>"
|
||||||
Submodule fuzzel/catppuccin-fuzzel deleted from 0af0e26901.
@@ -1,19 +0,0 @@
|
|||||||
include=~/.config/fuzzel/takemi.ini
|
|
||||||
|
|
||||||
[main]
|
|
||||||
# JetBrainsMono to match Theme.fontMono, so the launcher and the bar are
|
|
||||||
# visibly the same typeface.
|
|
||||||
font=JetBrainsMono Nerd Font:size=14
|
|
||||||
terminal=alacritty
|
|
||||||
dpi-aware=no
|
|
||||||
|
|
||||||
width=45
|
|
||||||
lines=8
|
|
||||||
horizontal-pad=20
|
|
||||||
vertical-pad=20
|
|
||||||
inner-pad=10
|
|
||||||
|
|
||||||
prompt=" "
|
|
||||||
|
|
||||||
show-actions=no
|
|
||||||
layer=overlay
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
# Takemi — matched to ~/.config/quickshell/config/Theme.qml,
|
|
||||||
# ~/.config/alacritty/takemi.toml and ~/.config/nvim/lua/takemi.lua.
|
|
||||||
#
|
|
||||||
# Near-black ground, white text, crimson as the only saturated colour. The
|
|
||||||
# selection is a solid crimson block with the text punched out of it in black,
|
|
||||||
# which is the same "active" signal the bar and the terminal use.
|
|
||||||
|
|
||||||
[colors]
|
|
||||||
# Flat and fully opaque. The Persona surfaces are ink on ground — translucency
|
|
||||||
# and blur read as a different design language, so the alpha stays at ff.
|
|
||||||
background=0a0a0cff
|
|
||||||
text=c8c8ceff
|
|
||||||
input=ffffffff
|
|
||||||
placeholder=6b6b70ff
|
|
||||||
prompt=ff2d40ff
|
|
||||||
|
|
||||||
# Fuzzy-match characters in an unselected row: crimson, since they are the
|
|
||||||
# reason the row is on screen at all.
|
|
||||||
match=ff2d40ff
|
|
||||||
|
|
||||||
selection=ff2d40ff
|
|
||||||
selection-text=000000ff
|
|
||||||
# White rather than black, so the matched characters still read as marked once
|
|
||||||
# the row is already crimson.
|
|
||||||
selection-match=ffffffff
|
|
||||||
|
|
||||||
# Deliberately the same as the background — hides the match counter.
|
|
||||||
counter=0a0a0cff
|
|
||||||
|
|
||||||
border=ff2d40ff
|
|
||||||
|
|
||||||
[border]
|
|
||||||
# Square. Every corner in this style is either a right angle or a hard chamfer;
|
|
||||||
# nothing in the shell is rounded.
|
|
||||||
radius=0
|
|
||||||
# Theme.stroke.
|
|
||||||
width=2
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||||
|
"runtime.version": "Lua 5.4",
|
||||||
|
"workspace.library": [
|
||||||
|
"/usr/share/hypr/stubs"
|
||||||
|
],
|
||||||
|
"diagnostics.globals": [
|
||||||
|
"hl"
|
||||||
|
]
|
||||||
|
}
|
||||||
Submodule hypr/catppuccin-hyprland deleted from c388ac5556.
Submodule hypr/catppuccin-hyprlock deleted from f650895064.
@@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
# narls hyprland dotfiles
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/monitors.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/programs.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/autostart.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/env.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/theme.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/input.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/keybinds.conf
|
|
||||||
|
|
||||||
source = ~/.config/hypr/modules/window_rules.conf
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
-- narls hyprland dotfiles
|
||||||
|
--
|
||||||
|
-- Hyprland 0.55+ reads this file instead of hyprland.conf. Every part lives in
|
||||||
|
-- lua/, and each require() is its own scope: an error in one file does not stop
|
||||||
|
-- the others from loading.
|
||||||
|
--
|
||||||
|
-- Order matters only in two places: palette must exist before anything paints
|
||||||
|
-- with it, and monitors must exist before the lid handler binds to them. Both
|
||||||
|
-- are handled by the requires below, top to bottom.
|
||||||
|
|
||||||
|
-- what the desktop looks like
|
||||||
|
require("lua/palette")
|
||||||
|
require("lua/look")
|
||||||
|
require("lua/animations")
|
||||||
|
|
||||||
|
-- what it runs on
|
||||||
|
require("lua/env")
|
||||||
|
require("lua/monitors")
|
||||||
|
require("lua/lid")
|
||||||
|
require("lua/input")
|
||||||
|
|
||||||
|
-- what it runs
|
||||||
|
require("lua/apps")
|
||||||
|
require("lua/autostart")
|
||||||
|
|
||||||
|
-- how windows behave
|
||||||
|
require("lua/rules/windows")
|
||||||
|
require("lua/rules/layers")
|
||||||
|
|
||||||
|
-- how it is driven
|
||||||
|
require("lua/binds/apps")
|
||||||
|
require("lua/binds/windows")
|
||||||
|
require("lua/binds/workspaces")
|
||||||
|
require("lua/binds/shell")
|
||||||
|
require("lua/binds/media")
|
||||||
|
require("lua/binds/capture")
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
wallpaper {
|
wallpaper {
|
||||||
monitor =
|
monitor =
|
||||||
path = ~/.wallpapers/takemi_1.jpg
|
path = ~/.wallpapers/takemi_3.jpg
|
||||||
fit_mode = cover
|
fit_mode = cover
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/
|
||||||
|
--
|
||||||
|
-- Quick and clean. Motion should get out of the way, not perform.
|
||||||
|
--
|
||||||
|
-- An earlier pass overdid it: a 1.56 overshoot on every window, an 88% popin
|
||||||
|
-- scale, and a borderangle looping forever so the focused border was in
|
||||||
|
-- constant motion. The bounce is dialled back to a hint, the popin barely
|
||||||
|
-- scales, and the border angle does not animate at all.
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
animations = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------------- curves
|
||||||
|
hl.curve("snap", { type = "bezier", points = { { 0.16, 1.00 }, { 0.30, 1.00 } } })
|
||||||
|
hl.curve("overshoot", { type = "bezier", points = { { 0.34, 1.12 }, { 0.64, 1.00 } } })
|
||||||
|
hl.curve("hard", { type = "bezier", points = { { 0.55, 0.00 }, { 0.90, 0.35 } } })
|
||||||
|
hl.curve("linear", { type = "bezier", points = { { 0, 0 }, { 1, 1 } } })
|
||||||
|
|
||||||
|
-- --------------------------------------------------------------------- tree
|
||||||
|
-- speed is in ds (1ds = 100ms). Unset leaves inherit their parent.
|
||||||
|
hl.animation({ leaf = "global", enabled = true, speed = 4, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "border", enabled = true, speed = 5, bezier = "snap" })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "windows", enabled = true, speed = 4, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "windowsIn", enabled = true, speed = 4, bezier = "overshoot", style = "popin 96%" })
|
||||||
|
hl.animation({ leaf = "windowsOut", enabled = true, speed = 2.6, bezier = "hard", style = "popin 97%" })
|
||||||
|
hl.animation({ leaf = "windowsMove", enabled = true, speed = 3.6, bezier = "snap" })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "fadeIn", enabled = true, speed = 2.4, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.8, bezier = "hard" })
|
||||||
|
hl.animation({ leaf = "fadeSwitch", enabled = true, speed = 2, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "fadeShadow", enabled = true, speed = 3, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "fadeDim", enabled = true, speed = 2.4, bezier = "snap" })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "layers", enabled = true, speed = 3, bezier = "snap" })
|
||||||
|
hl.animation({ leaf = "layersIn", enabled = true, speed = 3, bezier = "snap", style = "slide" })
|
||||||
|
hl.animation({ leaf = "layersOut", enabled = true, speed = 2, bezier = "hard", style = "slide" })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "workspaces", enabled = true, speed = 3, bezier = "snap", style = "slidevert" })
|
||||||
|
hl.animation({ leaf = "workspacesIn", enabled = true, speed = 3, bezier = "snap", style = "slidevert" })
|
||||||
|
hl.animation({ leaf = "workspacesOut", enabled = true, speed = 2.4, bezier = "hard", style = "slidevert" })
|
||||||
|
|
||||||
|
hl.animation({ leaf = "specialWorkspace", enabled = true, speed = 3, bezier = "snap", style = "slidevert" })
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
-- The programs the binds reach for. Exported so lua/binds/* name them once.
|
||||||
|
|
||||||
|
return {
|
||||||
|
terminal = "alacritty",
|
||||||
|
fileManager = "nautilus",
|
||||||
|
-- The launcher lives in the Quickshell process (quickshell/launcher/), so
|
||||||
|
-- the bind toggles it over IPC instead of spawning anything. Nothing to
|
||||||
|
-- start up means it is on screen on the same frame as the keypress.
|
||||||
|
menu = "qs ipc call shell launcher",
|
||||||
|
|
||||||
|
-- Clipboard history. Opens the launcher already in its ":" mode, which
|
||||||
|
-- reads cliphist itself and copies the chosen entry back — so the picker is
|
||||||
|
-- the same window, with the same keys, as everything else.
|
||||||
|
clipboard = "qs ipc call shell prompt :",
|
||||||
|
|
||||||
|
-- Proton Drive search. --fzf re-queries the daemon on every keystroke, so
|
||||||
|
-- results appear as you type; a dmenu could only filter a list it was
|
||||||
|
-- handed once, which made searching a two-step. It spawns its own terminal
|
||||||
|
-- (class pdfs-prompt, floated in lua/rules/windows.lua).
|
||||||
|
pdfs = "pdfs-prompt --fzf",
|
||||||
|
|
||||||
|
-- bluetooth menu
|
||||||
|
bluetooth = "fluxo bt menu",
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Autostart/
|
||||||
|
--
|
||||||
|
-- Everything that used to be exec-once now runs off the start event.
|
||||||
|
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
-- Takemi shell — bar, popouts, notifications, OSD, power menu and lock
|
||||||
|
-- screen. Config lives in ~/.config/quickshell. It owns
|
||||||
|
-- org.freedesktop.Notifications, so dunst must stay masked
|
||||||
|
-- (systemctl --user mask dunst.service).
|
||||||
|
hl.exec_cmd("uwsm app -- qs")
|
||||||
|
|
||||||
|
hl.exec_cmd("uwsm app -- nm-applet --indicator")
|
||||||
|
hl.exec_cmd("uwsm app -- hyprpaper")
|
||||||
|
|
||||||
|
-- clipboard history, text and images
|
||||||
|
hl.exec_cmd("wl-paste --type text --watch cliphist store")
|
||||||
|
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
||||||
|
|
||||||
|
-- hl.exec_cmd("uwsm app -- nextcloud --background")
|
||||||
|
-- hl.exec_cmd("uwsm app -- rclone mount google_drive: ~/gdrive")
|
||||||
|
-- hl.exec_cmd("uwsm app -- protonvpn-app")
|
||||||
|
-- hl.exec_cmd("uwsm app -- /usr/bin/discord --enable-features=UseOzonePlatform --ozone-platform=wayland --start-minimized")
|
||||||
|
-- hl.exec_cmd("uwsm app -- /usr/lib/xdg-desktop-portal-hyprland")
|
||||||
|
-- hl.exec_cmd("sleep 5 && ~/.config/hypr/scripts/replay-ctrl.sh start")
|
||||||
|
end)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
-- Launching things.
|
||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Binds/
|
||||||
|
|
||||||
|
local apps = require("lua/apps")
|
||||||
|
local mod = "SUPER" -- Sets "Windows" key as main modifier
|
||||||
|
|
||||||
|
hl.bind(mod .. " + RETURN", hl.dsp.exec_cmd(apps.terminal), { description = "terminal" })
|
||||||
|
hl.bind(mod .. " + E", hl.dsp.exec_cmd(apps.fileManager), { description = "file manager" })
|
||||||
|
hl.bind(mod .. " + SPACE", hl.dsp.exec_cmd(apps.menu), { description = "app launcher" })
|
||||||
|
hl.bind(mod .. " + M", hl.dsp.exec_cmd(apps.pdfs), { description = "pdf picker" })
|
||||||
|
hl.bind(mod .. " + B", hl.dsp.exec_cmd(apps.bluetooth), { description = "bluetooth menu" })
|
||||||
|
|
||||||
|
-- Clipboard history. On release so the picker does not inherit the held ALT.
|
||||||
|
hl.bind("ALT + m", hl.dsp.exec_cmd(apps.clipboard), { release = true, description = "clipboard history" })
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
-- Screenshots, replay buffer, webcam. Everything that records something.
|
||||||
|
|
||||||
|
local scripts = os.getenv("HOME") .. "/.config/hypr/scripts/"
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------- screenshots
|
||||||
|
-- PRINT selects a region, CTRL grabs the focused window, SHIFT saves to disk
|
||||||
|
-- instead of the clipboard.
|
||||||
|
hl.bind("PRINT", hl.dsp.exec_cmd('grim -g "$(slurp)" - | wl-copy'))
|
||||||
|
hl.bind("SHIFT + PRINT", hl.dsp.exec_cmd('grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +\'%Y-%m-%d_%H-%M-%S\').png'))
|
||||||
|
hl.bind("CTRL + PRINT", hl.dsp.exec_cmd(scripts .. "screenshot_window.sh copy"))
|
||||||
|
hl.bind("CTRL + SHIFT + PRINT", hl.dsp.exec_cmd(scripts .. "screenshot_window.sh save"))
|
||||||
|
|
||||||
|
-- ------------------------------------------------------- replay and camera
|
||||||
|
-- On release, so the shortcut is not caught mid-chord.
|
||||||
|
local on_release = { release = true }
|
||||||
|
|
||||||
|
hl.bind("ALT + z", hl.dsp.exec_cmd(scripts .. "replay-ctrl.sh toggle"), on_release)
|
||||||
|
hl.bind("ALT + SHIFT + z", hl.dsp.exec_cmd(scripts .. "replay-ctrl.sh save"), on_release)
|
||||||
|
hl.bind("ALT + SHIFT + c", hl.dsp.exec_cmd(scripts .. "droidcam-ctrl.sh toggle"), on_release)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
-- Laptop multimedia keys: volume, mic, brightness, transport.
|
||||||
|
-- `locked` keeps them working over the lock screen.
|
||||||
|
|
||||||
|
-- Volume and brightness repeat when held.
|
||||||
|
local held = { locked = true, repeating = true }
|
||||||
|
|
||||||
|
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("fluxo vol up 5"), held)
|
||||||
|
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("fluxo vol down 5"), held)
|
||||||
|
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("fluxo vol mute"), held)
|
||||||
|
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("fluxo mic mute"), held)
|
||||||
|
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s +10%"), held)
|
||||||
|
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 10%-"), held)
|
||||||
|
|
||||||
|
-- Transport. Requires playerctl.
|
||||||
|
local locked = { locked = true }
|
||||||
|
|
||||||
|
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), locked)
|
||||||
|
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), locked)
|
||||||
|
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), locked)
|
||||||
|
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), locked)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
-- Takemi shell (quickshell) IPC. Config lives in ~/.config/quickshell.
|
||||||
|
|
||||||
|
local mod = "SUPER"
|
||||||
|
|
||||||
|
local function shell(call, opts)
|
||||||
|
hl.bind(opts.key, hl.dsp.exec_cmd("qs ipc call shell " .. call), { description = opts.description })
|
||||||
|
end
|
||||||
|
|
||||||
|
shell("lock", { key = mod .. " + CTRL + L", description = "lock screen" })
|
||||||
|
shell("power", { key = mod .. " + P", description = "power menu" })
|
||||||
|
shell("toggleDnd", { key = mod .. " + SHIFT + N", description = "toggle do not disturb" })
|
||||||
|
shell("clearNotifications", { key = mod .. " + CTRL + SHIFT + N", description = "clear notifications" })
|
||||||
|
shell("reloadConfig", { key = mod .. " + SHIFT + R", description = "reload shell config" })
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
-- Focus, layout and groups — everything that acts on the window under you.
|
||||||
|
|
||||||
|
local mod = "SUPER"
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------------- window
|
||||||
|
hl.bind(mod .. " + SHIFT + Q", hl.dsp.window.close())
|
||||||
|
hl.bind(mod .. " + V", hl.dsp.window.float())
|
||||||
|
hl.bind(mod .. " + F", hl.dsp.window.fullscreen())
|
||||||
|
-- hl.bind(mod .. " + t", hl.dsp.layout("togglesplit")) -- dwindle
|
||||||
|
|
||||||
|
-- -------------------------------------------------------------------- focus
|
||||||
|
local directions = { h = "l", l = "r", k = "u", j = "d" }
|
||||||
|
|
||||||
|
for key, direction in pairs(directions) do
|
||||||
|
hl.bind(mod .. " + " .. key, hl.dsp.focus({ direction = direction }))
|
||||||
|
hl.bind(mod .. " + SHIFT + " .. key:upper(), hl.dsp.window.move({ direction = direction, group_aware = true }))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------------- groups
|
||||||
|
hl.bind(mod .. " + n", hl.dsp.group.toggle())
|
||||||
|
hl.bind("ALT + Tab", hl.dsp.group.next())
|
||||||
|
-- hl.bind("ALT + Tab", hl.dsp.group.prev())
|
||||||
|
|
||||||
|
-- -------------------------------------------------------------------- mouse
|
||||||
|
hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
|
||||||
|
hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------- keyboard
|
||||||
|
-- cycle keyboard layout (dvorak-intl <-> us-intl), see lua/input.lua
|
||||||
|
hl.bind(mod .. " + ALT + SPACE", hl.dsp.exec_cmd("hyprctl switchxkblayout all next"))
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
-- Workspaces, including the two scratchpads.
|
||||||
|
|
||||||
|
local mod = "SUPER"
|
||||||
|
|
||||||
|
-- Switch with mod + [0-9], move the active window with mod + SHIFT + [0-9].
|
||||||
|
for i = 1, 10 do
|
||||||
|
local key = i % 10 -- 10 maps to key 0
|
||||||
|
hl.bind(mod .. " + " .. key, hl.dsp.focus({ workspace = i }))
|
||||||
|
hl.bind(mod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Scroll through existing workspaces with mod + scroll
|
||||||
|
hl.bind(mod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||||
|
hl.bind(mod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
|
||||||
|
|
||||||
|
-- Scratchpads: S holds anything virtual, D holds chat.
|
||||||
|
local special = { S = "virtual", D = "discord" }
|
||||||
|
|
||||||
|
for key, name in pairs(special) do
|
||||||
|
hl.bind(mod .. " + " .. key, hl.dsp.workspace.toggle_special(name))
|
||||||
|
hl.bind(mod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = "special:" .. name }))
|
||||||
|
end
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/
|
||||||
|
--
|
||||||
|
-- Note: this session starts through uwsm, which would rather have these in
|
||||||
|
-- ~/.config/uwsm/env (toolkit, cursor, GPU) and ~/.config/uwsm/env-hyprland
|
||||||
|
-- (HYPR*, AQ_*). They are kept here for now so the config stays self-contained.
|
||||||
|
|
||||||
|
-- cursor
|
||||||
|
hl.env("HYPRCURSOR_THEME", "Bibata-Modern-Classic")
|
||||||
|
hl.env("HYPRCURSOR_SIZE", "24")
|
||||||
|
hl.env("XCURSOR_THEME", "Bibata-Modern-Classic")
|
||||||
|
hl.env("XCURSOR_SIZE", "24")
|
||||||
|
|
||||||
|
-- session
|
||||||
|
hl.env("XDG_CURRENT_DESKTOP", "Hyprland")
|
||||||
|
|
||||||
|
-- toolkits
|
||||||
|
hl.env("QT_QPA_PLATFORMTHEME", "qt6ct")
|
||||||
|
hl.env("MOZ_ENABLE_WAYLAND", "1")
|
||||||
|
hl.env("ELECTRON_OZONE_PLATFORM_HINT", "wayland")
|
||||||
|
|
||||||
|
-- AMD graphics / video acceleration
|
||||||
|
hl.env("LIBVA_DRIVER_NAME", "radeonsi")
|
||||||
|
hl.env("VDPAU_DRIVER", "radeonsi")
|
||||||
|
hl.env("AMD_VULKAN_ICD", "RADV")
|
||||||
|
|
||||||
|
-- misc
|
||||||
|
hl.env("EDITOR", "nvim")
|
||||||
|
|
||||||
|
-- hl.env("INTEL_DEBUG", "noccs")
|
||||||
|
-- hl.env("WLR_DRM_NO_ATOMIC", "1")
|
||||||
|
-- hl.env("debug:full_cm_proto", "true")
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Variables/#input
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
input = {
|
||||||
|
-- index 0 = dvorak-intl (default), index 1 = us-intl
|
||||||
|
-- switch with $mainMod ALT, SPACE (see lua/binds/windows.lua)
|
||||||
|
kb_layout = "us,us",
|
||||||
|
kb_variant = "dvorak-intl,intl",
|
||||||
|
kb_model = "",
|
||||||
|
kb_rules = "",
|
||||||
|
kb_options = "caps:backspace",
|
||||||
|
|
||||||
|
follow_mouse = 0,
|
||||||
|
|
||||||
|
accel_profile = "flat",
|
||||||
|
sensitivity = 0, -- -1.0 - 1.0, 0 means no modification.
|
||||||
|
|
||||||
|
touchpad = {
|
||||||
|
natural_scroll = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Layouts are inherited from the global input block so that layout switching
|
||||||
|
-- applies to these too. Only bind resolution differs here.
|
||||||
|
-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Devices/
|
||||||
|
for _, name in ipairs({
|
||||||
|
"at-translated-set-2-keyboard",
|
||||||
|
"topre-corporation-hhkb-professional",
|
||||||
|
}) do
|
||||||
|
hl.device({ name = name, resolve_binds_by_sym = true })
|
||||||
|
end
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
-- Laptop lid handling.
|
||||||
|
--
|
||||||
|
-- One rule, applied from several triggers:
|
||||||
|
--
|
||||||
|
-- panel off <=> lid is shut AND something else is plugged in
|
||||||
|
--
|
||||||
|
-- Both halves are re-checked every time, so the session can never end up with
|
||||||
|
-- zero outputs. Undocking with the lid shut brings the panel back; booting
|
||||||
|
-- alone after a docked shutdown just works, because nothing about the previous
|
||||||
|
-- session is remembered.
|
||||||
|
--
|
||||||
|
-- That last part is the fix for the old design: scripts/lid_handler.sh wrote a
|
||||||
|
-- lid_state.conf that got sourced on the next start, so a laptop that was shut
|
||||||
|
-- while docked came up believing it still had an external display and blanked
|
||||||
|
-- its own panel. Lid state now comes from the kernel instead, and the external
|
||||||
|
-- check is a live one.
|
||||||
|
|
||||||
|
local monitors = require("lua/monitors")
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------- reading state
|
||||||
|
|
||||||
|
-- The kernel's own view of the hinge. Present on this machine as
|
||||||
|
-- /proc/acpi/button/lid/LID/state; the device name differs per vendor, hence
|
||||||
|
-- the glob. Returns nil if the file is missing or unparseable.
|
||||||
|
local function acpi_lid_closed()
|
||||||
|
local pipe = io.popen("cat /proc/acpi/button/lid/*/state 2>/dev/null")
|
||||||
|
if not pipe then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local out = pipe:read("a") or ""
|
||||||
|
pipe:close()
|
||||||
|
|
||||||
|
if out:find("closed", 1, true) then
|
||||||
|
return true
|
||||||
|
elseif out:find("open", 1, true) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Whatever the last switch event said, used only when ACPI has nothing for us.
|
||||||
|
local last_switch_closed = nil
|
||||||
|
|
||||||
|
local function lid_closed()
|
||||||
|
local acpi = acpi_lid_closed()
|
||||||
|
if acpi ~= nil then
|
||||||
|
return acpi
|
||||||
|
end
|
||||||
|
return last_switch_closed == true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------- reconciling
|
||||||
|
|
||||||
|
-- nil until the first decision, so the first pass always applies.
|
||||||
|
local panel_off = nil
|
||||||
|
|
||||||
|
-- `ignore` is the output being unplugged: during monitor.removed it can still
|
||||||
|
-- be listed, and counting it would keep the panel switched off.
|
||||||
|
local function reconcile(ignore)
|
||||||
|
-- Nothing enumerated yet means we are still parsing the config on a cold
|
||||||
|
-- start. Leave the defaults from lua/monitors.lua alone and wait for the
|
||||||
|
-- start event.
|
||||||
|
local all = hl.get_monitors()
|
||||||
|
if #all == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local externals = 0
|
||||||
|
for _, mon in ipairs(monitors.externals_present()) do
|
||||||
|
if mon.name ~= ignore then
|
||||||
|
externals = externals + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local want_off = lid_closed() and externals > 0
|
||||||
|
|
||||||
|
if want_off == panel_off then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- First decision of the session, and it agrees with what lua/monitors.lua
|
||||||
|
-- already applied: nothing actually moved, so no daemon needs poking.
|
||||||
|
local settled = panel_off == nil and not want_off
|
||||||
|
panel_off = want_off
|
||||||
|
|
||||||
|
if want_off then
|
||||||
|
monitors.disable_builtin()
|
||||||
|
else
|
||||||
|
monitors.enable_builtin()
|
||||||
|
end
|
||||||
|
monitors.apply_external()
|
||||||
|
|
||||||
|
-- Quickshell follows monitor hotplug by itself; only the wallpaper daemon
|
||||||
|
-- needs a kick.
|
||||||
|
if not settled then
|
||||||
|
hl.exec_cmd("systemctl restart --user hyprpaper")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------------ triggers
|
||||||
|
|
||||||
|
hl.bind("switch:on:Lid Switch", function()
|
||||||
|
last_switch_closed = true
|
||||||
|
reconcile()
|
||||||
|
end, { locked = true })
|
||||||
|
|
||||||
|
hl.bind("switch:off:Lid Switch", function()
|
||||||
|
last_switch_closed = false
|
||||||
|
reconcile()
|
||||||
|
end, { locked = true })
|
||||||
|
|
||||||
|
-- Docking and undocking. Removal passes the output that is going away.
|
||||||
|
hl.on("monitor.added", function()
|
||||||
|
reconcile()
|
||||||
|
end)
|
||||||
|
|
||||||
|
hl.on("monitor.removed", function(mon)
|
||||||
|
reconcile(mon and mon.name)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Cold start: outputs are not up yet at this point, so this settles once they
|
||||||
|
-- are. On `hyprctl reload` the start event does not fire again, but the
|
||||||
|
-- monitor list is already populated, so run it inline too.
|
||||||
|
hl.on("hyprland.start", function()
|
||||||
|
reconcile()
|
||||||
|
end)
|
||||||
|
|
||||||
|
reconcile()
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
-- Takemi — Persona 5 flavoured theme, matched to ~/.config/quickshell.
|
||||||
|
--
|
||||||
|
-- Everything static about how the desktop is painted. Motion lives next door
|
||||||
|
-- in lua/animations.lua.
|
||||||
|
|
||||||
|
local c = require("lua/palette")
|
||||||
|
|
||||||
|
hl.config({
|
||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Variables/
|
||||||
|
general = {
|
||||||
|
gaps_in = 5,
|
||||||
|
gaps_out = { top = 6, right = 8, bottom = 8, left = 8 },
|
||||||
|
|
||||||
|
border_size = 2,
|
||||||
|
|
||||||
|
col = {
|
||||||
|
active_border = c.activeBorder,
|
||||||
|
inactive_border = c.outline,
|
||||||
|
},
|
||||||
|
|
||||||
|
resize_on_border = false,
|
||||||
|
|
||||||
|
-- Please see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Tearing/
|
||||||
|
-- before you turn this on
|
||||||
|
allow_tearing = false,
|
||||||
|
|
||||||
|
layout = "dwindle",
|
||||||
|
},
|
||||||
|
|
||||||
|
decoration = {
|
||||||
|
-- Persona 5 has no rounded corners. Neither do we.
|
||||||
|
rounding = 0,
|
||||||
|
|
||||||
|
-- Fully opaque, both states. Flat ink on flat ground.
|
||||||
|
active_opacity = 1.0,
|
||||||
|
inactive_opacity = 1.0,
|
||||||
|
|
||||||
|
shadow = {
|
||||||
|
enabled = true,
|
||||||
|
range = 18,
|
||||||
|
render_power = 3,
|
||||||
|
offset = { 0, 4 },
|
||||||
|
color = "rgba(000000ee)",
|
||||||
|
color_inactive = "rgba(00000088)",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Off. Blur is the signature of the glass-and-frost look, which is the
|
||||||
|
-- opposite of what this theme is doing — every surface here is opaque,
|
||||||
|
-- flat and hard-edged. With nothing translucent left to blur it also
|
||||||
|
-- costs three render passes for no visible result.
|
||||||
|
blur = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
misc = {
|
||||||
|
force_default_wallpaper = 0,
|
||||||
|
disable_hyprland_logo = true,
|
||||||
|
-- 0 = off, 1 = always, 2 = fullscreen only (G7 is a 240Hz VRR panel)
|
||||||
|
vrr = 0,
|
||||||
|
font_family = "FiraCode Nerd Font",
|
||||||
|
background_color = c.base,
|
||||||
|
focus_on_activate = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
group = {
|
||||||
|
col = {
|
||||||
|
border_active = c.activeBorder,
|
||||||
|
border_inactive = c.outline,
|
||||||
|
},
|
||||||
|
|
||||||
|
groupbar = {
|
||||||
|
font_family = "JetBrainsMono Nerd Font",
|
||||||
|
font_size = 11,
|
||||||
|
|
||||||
|
height = 24,
|
||||||
|
gradients = false,
|
||||||
|
|
||||||
|
-- --- Active tab ---
|
||||||
|
col = {
|
||||||
|
active = c.accent,
|
||||||
|
inactive = c.surface,
|
||||||
|
},
|
||||||
|
text_color = c.ink,
|
||||||
|
|
||||||
|
-- --- Inactive tab ---
|
||||||
|
text_color_inactive = c.muted,
|
||||||
|
|
||||||
|
indicator_height = 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/
|
||||||
|
dwindle = {
|
||||||
|
preserve_split = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- https://wiki.hypr.land/Configuring/Layouts/Master-Layout/
|
||||||
|
master = {
|
||||||
|
new_status = "master",
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Monitors/
|
||||||
|
--
|
||||||
|
-- Declares every display once and exports the table, so lua/lid.lua can turn
|
||||||
|
-- the laptop panel on and off without duplicating any of these numbers.
|
||||||
|
--
|
||||||
|
-- Load-time behaviour is deliberately dumb: the built-in panel is always
|
||||||
|
-- enabled here. Deciding to switch it off needs to know whether anything else
|
||||||
|
-- is actually plugged in, and during a cold start the outputs are not
|
||||||
|
-- enumerated yet — so that decision lives in lua/lid.lua, which re-runs it on
|
||||||
|
-- every lid and hotplug event. Worst case the panel flickers on for a moment
|
||||||
|
-- while docked; the alternative failure is a black screen.
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.laptop = "eDP-1"
|
||||||
|
|
||||||
|
M.external = {
|
||||||
|
-- samsung home monitor. Other modes it has run at, if you ever need them:
|
||||||
|
-- "2560x1440@144", "1920x1080@144", "1280x720@240"
|
||||||
|
{ output = "desc:Samsung Electric Company LC27G7xT H4ZRA00734", mode = "2560x1440@240", position = "-2560x0", scale = 1 },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- `disabled = false` is load-bearing, not decoration. hl.monitor() merges into
|
||||||
|
-- whatever rule the output already has, so a spec that simply omits the flag
|
||||||
|
-- leaves an earlier `disabled = true` in place: the panel stays dark and the
|
||||||
|
-- mode/position are applied to a monitor nobody can see. Opening the lid while
|
||||||
|
-- docked hit exactly that.
|
||||||
|
M.builtin = { output = M.laptop, mode = "1920x1080@60", position = "0x0", scale = 1, disabled = false }
|
||||||
|
|
||||||
|
-- Anything not declared above falls back to Hyprland's auto placement, so a
|
||||||
|
-- borrowed projector or a monitor at the office still lights up.
|
||||||
|
|
||||||
|
function M.apply_external()
|
||||||
|
for _, mon in ipairs(M.external) do
|
||||||
|
hl.monitor(mon)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.enable_builtin()
|
||||||
|
hl.monitor(M.builtin)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.disable_builtin()
|
||||||
|
hl.monitor({ output = M.laptop, disabled = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Every connected output except the laptop panel. Empty during early startup,
|
||||||
|
-- which callers have to treat as "do not know yet", never as "nothing here".
|
||||||
|
function M.externals_present()
|
||||||
|
local found = {}
|
||||||
|
for _, mon in ipairs(hl.get_monitors()) do
|
||||||
|
if mon.name ~= M.laptop then
|
||||||
|
table.insert(found, mon)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return found
|
||||||
|
end
|
||||||
|
|
||||||
|
M.enable_builtin()
|
||||||
|
M.apply_external()
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
-- Takemi palette — kept in step with ~/.config/quickshell/config/Theme.qml.
|
||||||
|
--
|
||||||
|
-- Crimson, black, white. Nothing else carries hue.
|
||||||
|
--
|
||||||
|
-- Returned as a table, so every module that paints something does
|
||||||
|
-- local c = require("lua/palette")
|
||||||
|
-- and there is exactly one place the colours are written.
|
||||||
|
|
||||||
|
local c = {}
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------- THE KNOB
|
||||||
|
-- The one colour in this setup. Change this line and the window borders,
|
||||||
|
-- group indicators and focus states all recolour with it.
|
||||||
|
--
|
||||||
|
-- Keep it in step with `readonly property color accent` in
|
||||||
|
-- ~/.config/quickshell/config/Theme.qml, which is what colours the shell.
|
||||||
|
-- Those are the only two places the colour is written.
|
||||||
|
c.accent = "rgb(ff2d40)"
|
||||||
|
|
||||||
|
c.accentDim = "rgb(8f1826)"
|
||||||
|
c.accentSoft = "rgb(ff6b78)"
|
||||||
|
|
||||||
|
-- ------------------------------------------------------------------ neutrals
|
||||||
|
c.ink = "rgb(000000)"
|
||||||
|
|
||||||
|
c.base = "rgb(0a0a0c)"
|
||||||
|
c.mantle = "rgb(0d0d10)"
|
||||||
|
c.surface = "rgb(141418)"
|
||||||
|
c.surfaceAlt = "rgb(1c1c22)"
|
||||||
|
c.overlay = "rgb(26262e)"
|
||||||
|
c.outline = "rgb(3a3a44)"
|
||||||
|
|
||||||
|
c.text = "rgb(ffffff)"
|
||||||
|
c.subtext = "rgb(c8c8ce)"
|
||||||
|
c.muted = "rgb(6b6b70)"
|
||||||
|
|
||||||
|
-- Retired hues, kept as aliases so existing references resolve. The shell has
|
||||||
|
-- no teal any more — the wallpaper is the colour in the composition.
|
||||||
|
c.primary = c.text
|
||||||
|
c.primaryDim = "rgb(9a9aa2)"
|
||||||
|
c.glow = c.accent
|
||||||
|
c.blue = c.primaryDim
|
||||||
|
c.deep = c.surfaceAlt
|
||||||
|
c.warn = c.accentSoft
|
||||||
|
c.ok = c.text
|
||||||
|
|
||||||
|
-- Crimson into its own shadow, on the diagonal. The accent is the only hue
|
||||||
|
-- here — a gradient into a second colour is what put blue in the border.
|
||||||
|
c.activeBorder = { colors = { c.accent, c.accentDim }, angle = 135 }
|
||||||
|
|
||||||
|
return c
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Window-Rules/#layer-rules
|
||||||
|
--
|
||||||
|
-- Quickshell surfaces: the bar, popouts, the OSD and the launcher. Note
|
||||||
|
-- decoration.blur is off in lua/look.lua, so these only take effect if blur is
|
||||||
|
-- switched back on.
|
||||||
|
|
||||||
|
for _, namespace in ipairs({ "bottom", "top", "takemi-launcher" }) do
|
||||||
|
hl.layer_rule({
|
||||||
|
match = { namespace = namespace },
|
||||||
|
blur = true,
|
||||||
|
ignore_alpha = 0.5,
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
-- https://wiki.hypr.land/Configuring/Basics/Window-Rules/
|
||||||
|
--
|
||||||
|
-- Rules are evaluated top to bottom and the last match wins, so order matters.
|
||||||
|
-- Named rules are all evaluated before anonymous ones.
|
||||||
|
|
||||||
|
-- ==========================================
|
||||||
|
-- MATCHERS
|
||||||
|
-- ==========================================
|
||||||
|
-- Dialogs and utility apps that should float in the center
|
||||||
|
local DIALOG_TITLES = "^(Open Form|Open File|Select a File|Choose a file|Open Workspace|Choose Directory.*|Save As.*|Save File.*|branchdialog|pinentry-gtk-2|Confirm to replace files|File Operation Progress|Open Files.*|Anmelden.*|File Upload.*|TRuDI-Export laden)$"
|
||||||
|
-- pdfs-prompt is the Proton Drive search: io.narl.* is its GTK window, plain
|
||||||
|
-- pdfs-prompt the terminal `pdfs-prompt --fzf` spawns for itself. Every
|
||||||
|
-- terminal it knows how to start sets that same class, so this one rule holds
|
||||||
|
-- whichever is installed.
|
||||||
|
local DIALOG_CLASSES = "^(pavucontrol|blueman-manager|nm-connection-editor|org.pulseaudio.pavucontrol|io.narl.proton-drive-linux-prompt|pdfs-prompt)$"
|
||||||
|
|
||||||
|
local STEAM = "^(steam)$"
|
||||||
|
local GAMESCOPE = "^(gamescope)$"
|
||||||
|
|
||||||
|
-- ==========================================
|
||||||
|
-- GENERAL & FIXES
|
||||||
|
-- ==========================================
|
||||||
|
-- Ignore maximize requests from apps. You'll probably like this.
|
||||||
|
-- hl.window_rule({ match = { class = ".*" }, suppress_event = "maximize" })
|
||||||
|
|
||||||
|
-- Fix some dragging issues with XWayland
|
||||||
|
-- hl.window_rule({
|
||||||
|
-- match = { class = "^$", title = "^$", xwayland = true, float = true, fullscreen = false, pin = false },
|
||||||
|
-- no_focus = true,
|
||||||
|
-- })
|
||||||
|
hl.window_rule({ match = { class = "^$", title = "^$" }, no_blur = true })
|
||||||
|
|
||||||
|
-- ==========================================
|
||||||
|
-- FLOATING & CENTERED DIALOGS
|
||||||
|
-- ==========================================
|
||||||
|
-- Float, size, center, no blur — one rule per matcher instead of four.
|
||||||
|
for _, match in ipairs({ { title = DIALOG_TITLES }, { class = DIALOG_CLASSES } }) do
|
||||||
|
hl.window_rule({
|
||||||
|
match = match,
|
||||||
|
float = true,
|
||||||
|
size = { 800, 600 },
|
||||||
|
center = true,
|
||||||
|
no_blur = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ==========================================
|
||||||
|
-- WORKSPACE ASSIGNMENTS
|
||||||
|
-- ==========================================
|
||||||
|
-- hl.window_rule({ match = { class = "^(firefox)$" }, workspace = "1" })
|
||||||
|
-- hl.window_rule({ match = { class = "^(kitty)$" }, workspace = "2" })
|
||||||
|
-- hl.window_rule({ match = { class = "^(Code)$" }, workspace = "3" })
|
||||||
|
hl.window_rule({ match = { class = GAMESCOPE }, workspace = "1" })
|
||||||
|
|
||||||
|
-- Special workspaces
|
||||||
|
hl.window_rule({ match = { class = "^(Spotify|spotify)$" }, workspace = "special:virtual" })
|
||||||
|
hl.window_rule({ match = { class = "^(discord|vesktop)$" }, workspace = "special:discord" })
|
||||||
|
|
||||||
|
-- ==========================================
|
||||||
|
-- STEAM & GAMING
|
||||||
|
-- ==========================================
|
||||||
|
-- hl.window_rule({ match = { class = STEAM, title = "^(Steam)$" }, workspace = "3 silent" })
|
||||||
|
|
||||||
|
-- Fixed sizes for specific Steam windows
|
||||||
|
hl.window_rule({ match = { class = STEAM, title = "^(Friends List)$" }, size = { 400, 800 } })
|
||||||
|
hl.window_rule({ match = { class = STEAM, title = "^(Steam Settings)$" }, size = { 1000, 800 } })
|
||||||
|
hl.window_rule({ match = { class = STEAM, title = "^(Add Non-Steam Game)$" }, size = { 1000, 800 } })
|
||||||
|
|
||||||
|
-- Float and disable blur for Steam windows that aren't the main window
|
||||||
|
hl.window_rule({
|
||||||
|
match = { class = STEAM, title = "negative:^(Steam)$" },
|
||||||
|
float = true,
|
||||||
|
no_blur = true,
|
||||||
|
-- center = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Allow tearing for games started with Gamescope
|
||||||
|
hl.window_rule({ match = { class = GAMESCOPE }, immediate = true })
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
|
|
||||||
# Autostart necessary processes (like notifications daemons, status bars, etc.)
|
|
||||||
# Or execute your favorite apps at launch like this:
|
|
||||||
|
|
||||||
# Takemi shell — bar, popouts, notifications, OSD, power menu and lock screen.
|
|
||||||
# Config lives in ~/.config/quickshell. It owns org.freedesktop.Notifications,
|
|
||||||
# so dunst must stay masked (systemctl --user mask dunst.service).
|
|
||||||
exec-once = uwsm app -- qs
|
|
||||||
|
|
||||||
# exec-once = uwsm app -- waybar
|
|
||||||
# exec-once = uwsm app -- hyprpanel
|
|
||||||
# exec-once = uwsm app -- nextcloud --background
|
|
||||||
exec-once = uwsm app -- nm-applet --indicator
|
|
||||||
# exec-once = uwsm app -- rclone mount google_drive: ~/gdrive
|
|
||||||
# exec-once = uwsm app -- protonvpn-app
|
|
||||||
exec-once = uwsm app -- hyprpaper
|
|
||||||
# exec-once = uwsm app -- /usr/bin/discord --enable-features=UseOzonePlatform --ozone-platform=wayland --start-minimized &> /dev/null
|
|
||||||
# exec-once = sleep 5 && ~/.config/hypr/scripts/replay-ctrl.sh start
|
|
||||||
# exec-once = uwsm app -- /usr/lib/xdg-desktop-portal-hyprland
|
|
||||||
exec-once = wl-paste --type text --watch cliphist store # Stores only text data
|
|
||||||
exec-once = wl-paste --type image --watch cliphist store # Stores only image data
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Environment-variables/
|
|
||||||
|
|
||||||
# env = INTEL_DEBUG,noccs
|
|
||||||
# env = WLR_DRM_NO_ATOMIC,1
|
|
||||||
env = HYPRCURSOR_THEME,Bibata-Modern-Classic
|
|
||||||
env = HYPRCURSOR_SIZE,24
|
|
||||||
env = XCURSOR_SIZE,24
|
|
||||||
env = XCURSOR_THEME,Bibata-Modern-Classic
|
|
||||||
env = XDG_CURRENT_DESKTOP,Hyprland
|
|
||||||
# env = debug:full_cm_proto,true
|
|
||||||
env = QT_QPA_PLATFORMTHEME,qt6ct
|
|
||||||
env = LIBVA_DRIVER_NAME,radeonsi
|
|
||||||
env = VDPAU_DRIVER,radeonsi
|
|
||||||
env = AMD_VULKAN_ICD,RADV
|
|
||||||
env = MOZ_ENABLE_WAYLAND,1
|
|
||||||
env = ELECTRON_OZONE_PLATFORM_HINT,wayland
|
|
||||||
env = EDITOR,nvim
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
|
|
||||||
# https://wiki.hyprland.org/Configuring/Variables/#input
|
|
||||||
input {
|
|
||||||
# index 0 = dvorak-intl (default), index 1 = us-intl
|
|
||||||
# switch with $mainMod ALT, SPACE (see keybinds.conf)
|
|
||||||
kb_layout = us,us
|
|
||||||
kb_variant = dvorak-intl,intl
|
|
||||||
kb_model =
|
|
||||||
kb_rules =
|
|
||||||
kb_options = caps:backspace
|
|
||||||
|
|
||||||
follow_mouse = 0
|
|
||||||
|
|
||||||
accel_profile = flat
|
|
||||||
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
|
|
||||||
|
|
||||||
touchpad {
|
|
||||||
natural_scroll = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Layouts are inherited from the global input block so that layout
|
|
||||||
# switching applies to these too. Only bind resolution differs here.
|
|
||||||
device {
|
|
||||||
name = at-translated-set-2-keyboard
|
|
||||||
resolve_binds_by_sym = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
device {
|
|
||||||
name = topre-corporation-hhkb-professional
|
|
||||||
resolve_binds_by_sym = 1
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
|
|
||||||
$mainMod = SUPER # Sets "Windows" key as main modifier
|
|
||||||
|
|
||||||
bindl=,switch:on:Lid Switch,exec,~/.config/hypr/scripts/lid_handler.sh close
|
|
||||||
bindl=,switch:off:Lid Switch,exec,~/.config/hypr/scripts/lid_handler.sh open
|
|
||||||
|
|
||||||
bindr = ALT, m, exec, cliphist list | fuzzel --dmenu | cliphist decode | wl-copy
|
|
||||||
bind = , PRINT, exec, grim -g "$(slurp)" - | wl-copy
|
|
||||||
bind = SHIFT, PRINT, exec, grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'%Y-%m-%d_%H-%M-%S').png
|
|
||||||
bind = CTRL, PRINT, exec, ~/.config/hypr/scripts/screenshot_window.sh copy
|
|
||||||
bind = CTRL SHIFT, PRINT, exec, ~/.config/hypr/scripts/screenshot_window.sh save
|
|
||||||
bindr = ALT SHIFT, z, exec, ~/.config/hypr/scripts/replay-ctrl.sh save
|
|
||||||
bindr = ALT, z, exec, ~/.config/hypr/scripts/replay-ctrl.sh toggle
|
|
||||||
bindr = ALT SHIFT, c, exec, ~/.config/hypr/scripts/droidcam-ctrl.sh toggle
|
|
||||||
|
|
||||||
# general binds
|
|
||||||
bind = $mainMod, M, exec, pdfs-prompt --dmenu --menu 'fuzzel --dmenu --width 60'
|
|
||||||
bind = $mainMod, B, exec, fluxo bt menu
|
|
||||||
bind = $mainMod, RETURN, exec, $terminal
|
|
||||||
bind = $mainMod SHIFT, Q, killactive,
|
|
||||||
bind = $mainMod CTRL, L, exec, qs ipc call shell lock
|
|
||||||
bind = $mainMod, E, exec, $fileManager
|
|
||||||
bind = $mainMod, V, togglefloating,
|
|
||||||
bind = $mainMod, F, fullscreen,
|
|
||||||
bind = $mainMod, SPACE, exec, $menu
|
|
||||||
bind = $mainMod, P, exec, qs ipc call shell power
|
|
||||||
|
|
||||||
# Takemi shell
|
|
||||||
bind = $mainMod SHIFT, N, exec, qs ipc call shell toggleDnd
|
|
||||||
bind = $mainMod CTRL SHIFT, N, exec, qs ipc call shell clearNotifications
|
|
||||||
bind = $mainMod SHIFT, R, exec, qs ipc call shell reloadConfig
|
|
||||||
# cycle keyboard layout (dvorak-intl <-> us-intl)
|
|
||||||
bind = $mainMod ALT, SPACE, exec, hyprctl switchxkblayout all next
|
|
||||||
# bind = $mainMod, t, togglesplit, # dwindle
|
|
||||||
bind = $mainMod, n, togglegroup
|
|
||||||
|
|
||||||
# Move focus with mainMod + arrow keys
|
|
||||||
bind = $mainMod, h, movefocus, l
|
|
||||||
bind = $mainMod, l, movefocus, r
|
|
||||||
bind = $mainMod, k, movefocus, u
|
|
||||||
bind = $mainMod, j, movefocus, d
|
|
||||||
|
|
||||||
bind = $mainMod SHIFT, H, movewindoworgroup, l
|
|
||||||
bind = $mainMod SHIFT, L, movewindoworgroup, r
|
|
||||||
bind = $mainMod SHIFT, K, movewindoworgroup, u
|
|
||||||
bind = $mainMod SHIFT, J, movewindoworgroup, d
|
|
||||||
|
|
||||||
# Switch workspaces with mainMod + [0-9]
|
|
||||||
bind = $mainMod, 1, workspace, 1
|
|
||||||
bind = $mainMod, 2, workspace, 2
|
|
||||||
bind = $mainMod, 3, workspace, 3
|
|
||||||
bind = $mainMod, 4, workspace, 4
|
|
||||||
bind = $mainMod, 5, workspace, 5
|
|
||||||
bind = $mainMod, 6, workspace, 6
|
|
||||||
bind = $mainMod, 7, workspace, 7
|
|
||||||
bind = $mainMod, 8, workspace, 8
|
|
||||||
bind = $mainMod, 9, workspace, 9
|
|
||||||
bind = $mainMod, 0, workspace, 10
|
|
||||||
|
|
||||||
# Move active window to a workspace with mainMod + SHIFT + [0-9]
|
|
||||||
bind = $mainMod SHIFT, 1, movetoworkspace, 1
|
|
||||||
bind = $mainMod SHIFT, 2, movetoworkspace, 2
|
|
||||||
bind = $mainMod SHIFT, 3, movetoworkspace, 3
|
|
||||||
bind = $mainMod SHIFT, 4, movetoworkspace, 4
|
|
||||||
bind = $mainMod SHIFT, 5, movetoworkspace, 5
|
|
||||||
bind = $mainMod SHIFT, 6, movetoworkspace, 6
|
|
||||||
bind = $mainMod SHIFT, 7, movetoworkspace, 7
|
|
||||||
bind = $mainMod SHIFT, 8, movetoworkspace, 8
|
|
||||||
bind = $mainMod SHIFT, 9, movetoworkspace, 9
|
|
||||||
bind = $mainMod SHIFT, 0, movetoworkspace, 10
|
|
||||||
|
|
||||||
# groups
|
|
||||||
# bind = ALT, Tab, changegroupactive, prev
|
|
||||||
bind = ALT, Tab, changegroupactive, next
|
|
||||||
|
|
||||||
|
|
||||||
# Example special workspace (scratchpad)
|
|
||||||
bind = $mainMod, S, togglespecialworkspace, virtual
|
|
||||||
bind = $mainMod SHIFT, S, movetoworkspace, special:virtual
|
|
||||||
bind = $mainMod, D, togglespecialworkspace, discord
|
|
||||||
bind = $mainMod SHIFT, D, movetoworkspace, special:discord
|
|
||||||
|
|
||||||
# Scroll through existing workspaces with mainMod + scroll
|
|
||||||
bind = $mainMod, mouse_down, workspace, e+1
|
|
||||||
bind = $mainMod, mouse_up, workspace, e-1
|
|
||||||
|
|
||||||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
|
||||||
bindm = $mainMod, mouse:272, movewindow
|
|
||||||
bindm = $mainMod, mouse:273, resizewindow
|
|
||||||
|
|
||||||
# Laptop multimedia keys for volume and LCD brightness
|
|
||||||
bindel = ,XF86AudioRaiseVolume, exec, fluxo vol up 5
|
|
||||||
bindel = ,XF86AudioLowerVolume, exec, fluxo vol down 5
|
|
||||||
bindel = ,XF86AudioMute, exec, fluxo vol mute
|
|
||||||
bindel = ,XF86AudioMicMute, exec, fluxo mic mute
|
|
||||||
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s +10%
|
|
||||||
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
|
||||||
|
|
||||||
# Requires playerctl
|
|
||||||
bindl = , XF86AudioNext, exec, playerctl next
|
|
||||||
bindl = , XF86AudioPause, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
# laptop screen
|
|
||||||
monitor = eDP-1, 1920x1080@60, 0x0, 1
|
|
||||||
# samsung home monitor
|
|
||||||
# monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 1280x720@240, 0x0, 1
|
|
||||||
monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 2560x1440@240, -2560x0, 1
|
|
||||||
# monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 2560x1440@144, 0x0, 1
|
|
||||||
# monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 1920x1080@144, 0x0, 1
|
|
||||||
# monitor = desc:Samsung Electric Company LC27G7xT H4ZRA00734, 2560x1440@60, 0x0, 1
|
|
||||||
|
|
||||||
|
|
||||||
# lid_state fallback
|
|
||||||
source = ~/.config/hypr/lid_state.conf
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/
|
|
||||||
|
|
||||||
# Set programs that you use
|
|
||||||
$terminal = alacritty
|
|
||||||
$fileManager = nautilus
|
|
||||||
$menu = fuzzel
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# Takemi palette — kept in step with ~/.config/quickshell/config/Theme.qml.
|
|
||||||
#
|
|
||||||
# Crimson, black, white. Nothing else carries hue.
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------- THE KNOB
|
|
||||||
# The one colour in this setup. Change this line and the window borders,
|
|
||||||
# group indicators and focus states all recolour with it.
|
|
||||||
#
|
|
||||||
# Keep it in step with `readonly property color accent` in
|
|
||||||
# ~/.config/quickshell/config/Theme.qml, which is what colours the shell.
|
|
||||||
# Those are the only two places the colour is written.
|
|
||||||
$accent = rgb(ff2d40)
|
|
||||||
|
|
||||||
$accentDim = rgb(8f1826)
|
|
||||||
$accentSoft = rgb(ff6b78)
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------ neutrals
|
|
||||||
$ink = rgb(000000)
|
|
||||||
|
|
||||||
$base = rgb(0a0a0c)
|
|
||||||
$mantle = rgb(0d0d10)
|
|
||||||
$surface = rgb(141418)
|
|
||||||
$surfaceAlt = rgb(1c1c22)
|
|
||||||
$overlay = rgb(26262e)
|
|
||||||
$outline = rgb(3a3a44)
|
|
||||||
|
|
||||||
$text = rgb(ffffff)
|
|
||||||
$subtext = rgb(c8c8ce)
|
|
||||||
$muted = rgb(6b6b70)
|
|
||||||
|
|
||||||
# Retired hues, kept as aliases so existing references resolve. The shell has
|
|
||||||
# no teal any more — the wallpaper is the colour in the composition.
|
|
||||||
$primary = $text
|
|
||||||
$primaryDim = rgb(9a9aa2)
|
|
||||||
$glow = $accent
|
|
||||||
$blue = $primaryDim
|
|
||||||
$deep = $surfaceAlt
|
|
||||||
$warn = $accentSoft
|
|
||||||
$ok = $text
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
# Takemi — Persona 5 flavoured theme, matched to ~/.config/quickshell.
|
|
||||||
source = ~/.config/hypr/modules/takemi.conf
|
|
||||||
|
|
||||||
# Refer to https://wiki.hyprland.org/Configuring/Variables/
|
|
||||||
|
|
||||||
# https://wiki.hyprland.org/Configuring/Variables/#general
|
|
||||||
general {
|
|
||||||
gaps_in = 5
|
|
||||||
gaps_out = 6, 8, 8, 8
|
|
||||||
|
|
||||||
border_size = 2
|
|
||||||
|
|
||||||
# Crimson into its own shadow, on the diagonal. The accent is the only hue
|
|
||||||
# here — a gradient into a second colour is what put blue in the border.
|
|
||||||
col.active_border = $accent $accentDim 135deg
|
|
||||||
col.inactive_border = $outline
|
|
||||||
|
|
||||||
resize_on_border = false
|
|
||||||
|
|
||||||
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
|
|
||||||
allow_tearing = false
|
|
||||||
|
|
||||||
layout = dwindle
|
|
||||||
}
|
|
||||||
|
|
||||||
# https://wiki.hyprland.org/Configuring/Variables/#decoration
|
|
||||||
decoration {
|
|
||||||
# Persona 5 has no rounded corners. Neither do we.
|
|
||||||
rounding = 0
|
|
||||||
|
|
||||||
# Fully opaque, both states. Flat ink on flat ground.
|
|
||||||
active_opacity = 1.0
|
|
||||||
inactive_opacity = 1.0
|
|
||||||
|
|
||||||
shadow {
|
|
||||||
enabled = true
|
|
||||||
range = 18
|
|
||||||
render_power = 3
|
|
||||||
offset = 0 4
|
|
||||||
color = rgba(000000ee)
|
|
||||||
color_inactive = rgba(00000088)
|
|
||||||
}
|
|
||||||
|
|
||||||
# https://wiki.hyprland.org/Configuring/Variables/#blur
|
|
||||||
#
|
|
||||||
# Off. Blur is the signature of the glass-and-frost look, which is the
|
|
||||||
# opposite of what this theme is doing — every surface here is opaque, flat
|
|
||||||
# and hard-edged. With nothing translucent left to blur it also costs three
|
|
||||||
# render passes for no visible result.
|
|
||||||
blur {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# https://wiki.hyprland.org/Configuring/Animations/
|
|
||||||
# Quick and clean. Motion should get out of the way, not perform.
|
|
||||||
#
|
|
||||||
# The previous pass overdid it: a 1.56 overshoot on every window, an 88% popin
|
|
||||||
# scale, and a borderangle looping forever so the focused border was in constant
|
|
||||||
# motion. The bounce is dialled back to a hint, the popin barely scales, and the
|
|
||||||
# border angle no longer animates at all.
|
|
||||||
animations {
|
|
||||||
enabled = yes, please :)
|
|
||||||
|
|
||||||
bezier = snap, 0.16, 1.00, 0.30, 1.00
|
|
||||||
bezier = overshoot, 0.34, 1.12, 0.64, 1.00
|
|
||||||
bezier = hard, 0.55, 0.00, 0.90, 0.35
|
|
||||||
bezier = linear, 0, 0, 1, 1
|
|
||||||
|
|
||||||
animation = global, 1, 4, snap
|
|
||||||
animation = border, 1, 5, snap
|
|
||||||
|
|
||||||
animation = windows, 1, 4, snap
|
|
||||||
animation = windowsIn, 1, 4, overshoot, popin 96%
|
|
||||||
animation = windowsOut, 1, 2.6, hard, popin 97%
|
|
||||||
animation = windowsMove, 1, 3.6, snap
|
|
||||||
|
|
||||||
animation = fade, 1, 3, snap
|
|
||||||
animation = fadeIn, 1, 2.4, snap
|
|
||||||
animation = fadeOut, 1, 1.8, hard
|
|
||||||
animation = fadeSwitch, 1, 2, snap
|
|
||||||
animation = fadeShadow, 1, 3, snap
|
|
||||||
animation = fadeDim, 1, 2.4, snap
|
|
||||||
|
|
||||||
animation = layers, 1, 3, snap
|
|
||||||
animation = layersIn, 1, 3, snap, slide
|
|
||||||
animation = layersOut, 1, 2, hard, slide
|
|
||||||
|
|
||||||
animation = workspaces, 1, 3, snap, slidevert
|
|
||||||
animation = workspacesIn, 1, 3, snap, slidevert
|
|
||||||
animation = workspacesOut, 1, 2.4, hard, slidevert
|
|
||||||
|
|
||||||
animation = specialWorkspace, 1, 3, snap, slidevert
|
|
||||||
}
|
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
|
|
||||||
master {
|
|
||||||
new_status = master
|
|
||||||
}
|
|
||||||
|
|
||||||
dwindle {
|
|
||||||
preserve_split = true
|
|
||||||
}
|
|
||||||
|
|
||||||
# https://wiki.hyprland.org/Configuring/Variables/#misc
|
|
||||||
misc {
|
|
||||||
force_default_wallpaper = 0
|
|
||||||
disable_hyprland_logo = true
|
|
||||||
# 0 = off, 1 = always, 2 = fullscreen only (G7 is a 240Hz VRR panel)
|
|
||||||
vrr = 2
|
|
||||||
font_family = FiraCode Nerd Font
|
|
||||||
background_color = $base
|
|
||||||
focus_on_activate = true
|
|
||||||
}
|
|
||||||
|
|
||||||
group {
|
|
||||||
col.border_active = $accent $accentDim 135deg
|
|
||||||
col.border_inactive = $outline
|
|
||||||
|
|
||||||
groupbar {
|
|
||||||
font_family = JetBrainsMono Nerd Font
|
|
||||||
font_size = 11
|
|
||||||
|
|
||||||
height = 24
|
|
||||||
gradients = false
|
|
||||||
|
|
||||||
# --- Active Tab ---
|
|
||||||
col.active = $accent
|
|
||||||
text_color = $ink
|
|
||||||
|
|
||||||
# --- Inactive Tab ---
|
|
||||||
col.inactive = $surface
|
|
||||||
text_color_inactive = $muted
|
|
||||||
|
|
||||||
indicator_height = 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# VARIABLES
|
|
||||||
# ==========================================
|
|
||||||
# Dialogs and utility apps that should float in the center
|
|
||||||
$dialog_titles = ^(Open Form|Open File|Select a File|Choose a file|Open Workspace|Choose Directory.*|Save As.*|Save File.*|branchdialog|pinentry-gtk-2|Confirm to replace files|File Operation Progress|Open Files.*|Anmelden.*|File Upload.*|TRuDI-Export laden)$
|
|
||||||
$dialog_classes = ^(pavucontrol|blueman-manager|nm-connection-editor|org.pulseaudio.pavucontrol|io.narl.proton-drive-linux-prompt)$
|
|
||||||
|
|
||||||
# App classes
|
|
||||||
$steam = ^(steam)$
|
|
||||||
$gamescope = ^(gamescope)$
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# GENERAL & FIXES
|
|
||||||
# ==========================================
|
|
||||||
# Ignore maximize requests from apps. You'll probably like this.
|
|
||||||
# windowrule = suppress_event maximize, match:class .*
|
|
||||||
|
|
||||||
# Fix some dragging issues with XWayland
|
|
||||||
# windowrule = no_focus 1, match:class ^$, match:title ^$, match:xwayland 1, match:floating 1, match:fullscreen 0, match:pinned 0
|
|
||||||
windowrule = no_blur 1, match:class ^$, match:title ^$
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# FLOATING & CENTERED DIALOGS
|
|
||||||
# ==========================================
|
|
||||||
# Make them float
|
|
||||||
windowrule = float 1, match:title $dialog_titles
|
|
||||||
windowrule = float 1, match:class $dialog_classes
|
|
||||||
|
|
||||||
# Set to 800x600
|
|
||||||
windowrule = size 800 600, match:title $dialog_titles
|
|
||||||
windowrule = size 800 600, match:class $dialog_classes
|
|
||||||
|
|
||||||
# Center them on the screen
|
|
||||||
windowrule = center 1, match:title $dialog_titles
|
|
||||||
windowrule = center 1, match:class $dialog_classes
|
|
||||||
|
|
||||||
# Disable blur
|
|
||||||
windowrule = no_blur 1, match:title $dialog_titles
|
|
||||||
windowrule = no_blur 1, match:class $dialog_classes
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# WORKSPACE ASSIGNMENTS
|
|
||||||
# ==========================================
|
|
||||||
# Normal Workspaces
|
|
||||||
# windowrule = workspace 1, match:class ^(firefox)$
|
|
||||||
# windowrule = workspace 2, match:class ^(kitty)$
|
|
||||||
# windowrule = workspace 3, match:class ^(Code)$
|
|
||||||
windowrule = workspace 1, match:class $gamescope
|
|
||||||
|
|
||||||
# Special Workspaces
|
|
||||||
windowrule = workspace special:virtual, match:class ^(Spotify|spotify)$
|
|
||||||
windowrule = workspace special:discord, match:class ^(discord|vesktop)$
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
|
||||||
# APP-SPECIFIC RULES: STEAM & GAMING
|
|
||||||
# ==========================================
|
|
||||||
# windowrule = workspace 3 silent, match:class $steam, match:title ^(Steam)$
|
|
||||||
|
|
||||||
# Fixed sizes for specific Steam windows
|
|
||||||
windowrule = size 400 800, match:title ^(Friends List)$, match:class $steam
|
|
||||||
windowrule = size 1000 800, match:title ^(Steam Settings)$, match:class $steam
|
|
||||||
windowrule = size 1000 800, match:title ^(Add Non-Steam Game)$, match:class $steam
|
|
||||||
|
|
||||||
# Float and disable blur for Steam windows that aren't the main window
|
|
||||||
windowrule = float 1, match:class $steam, match:title negative:^(Steam)$
|
|
||||||
windowrule = no_blur 1, match:class $steam, match:title negative:^(Steam)$
|
|
||||||
# windowrule = center 1, match:class $steam, match:title negative:^(Steam)$
|
|
||||||
|
|
||||||
# Allow tearing for games started with Gamescope
|
|
||||||
windowrule = immediate 1, match:class $gamescope
|
|
||||||
|
|
||||||
|
|
||||||
# Layer rules
|
|
||||||
|
|
||||||
# waybar blur
|
|
||||||
layerrule = blur on, match:namespace bottom
|
|
||||||
layerrule = blur on, match:namespace top
|
|
||||||
layerrule = ignore_alpha 0.5, match:namespace bottom
|
|
||||||
layerrule = ignore_alpha 0.5, match:namespace top
|
|
||||||
# launcher blur
|
|
||||||
layerrule = blur on, match:namespace launcher
|
|
||||||
layerrule = ignore_alpha 0.5, match:namespace launcher
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# ~/.config/hypr/scripts/lid_handler.sh
|
|
||||||
|
|
||||||
# The file that tells Hyprland to keep the lid off during reloads
|
|
||||||
LID_STATE_FILE="$HOME/.config/hypr/lid_state.conf"
|
|
||||||
|
|
||||||
restart_ui() {
|
|
||||||
# The Quickshell bar follows monitor hotplug on its own, so only the
|
|
||||||
# wallpaper daemon needs a kick.
|
|
||||||
systemctl restart --user hyprpaper
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ "$1" == "close" ]]; then
|
|
||||||
# Check if ANY external monitor is connected and active
|
|
||||||
if hyprctl monitors all | grep -qE "Monitor (DP|HDMI|Type-C)-"; then
|
|
||||||
|
|
||||||
# Prevent laptop screen from turning on during manual config reloads
|
|
||||||
echo "monitor=eDP-1, disable" > "$LID_STATE_FILE"
|
|
||||||
|
|
||||||
# Extract the CURRENT live settings of all external monitors using jq
|
|
||||||
# This grabs the active resolution, refresh rate, position, and scale.
|
|
||||||
LIVE_MONITORS=$(hyprctl -j monitors | jq -c '.[] | select(.name != "eDP-1")')
|
|
||||||
|
|
||||||
# 3. Disable the laptop screen
|
|
||||||
hyprctl keyword monitor "eDP-1, disable"
|
|
||||||
|
|
||||||
# 4. Re-apply the live settings to external monitors so they don't reset
|
|
||||||
echo "$LIVE_MONITORS" | while read -r mon_json; do
|
|
||||||
NAME=$(echo "$mon_json" | jq -r '.name')
|
|
||||||
WIDTH=$(echo "$mon_json" | jq -r '.width')
|
|
||||||
HEIGHT=$(echo "$mon_json" | jq -r '.height')
|
|
||||||
REFRESH=$(echo "$mon_json" | jq -r '.refreshRate')
|
|
||||||
X=$(echo "$mon_json" | jq -r '.x')
|
|
||||||
Y=$(echo "$mon_json" | jq -r '.y')
|
|
||||||
SCALE=$(echo "$mon_json" | jq -r '.scale')
|
|
||||||
|
|
||||||
# Formats it exactly as Hyprland expects: DP-1, 1920x1080@240, 0x0, 1
|
|
||||||
hyprctl keyword monitor "$NAME, ${WIDTH}x${HEIGHT}@${REFRESH}, ${X}x${Y}, $SCALE"
|
|
||||||
done
|
|
||||||
|
|
||||||
# restart ui
|
|
||||||
restart_ui
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [[ "$1" == "open" ]]; then
|
|
||||||
# Clear the override file so the laptop screen is allowed to turn on again
|
|
||||||
echo "" > "$LID_STATE_FILE"
|
|
||||||
|
|
||||||
# Let Hyprland reload itself.
|
|
||||||
# This automatically re-enables eDP-1 based on your hardcoded hyprland.conf!
|
|
||||||
hyprctl reload
|
|
||||||
|
|
||||||
restart_ui
|
|
||||||
fi
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
options="Shutdown\nReboot\nLock\nLogout"
|
|
||||||
selected=$(echo -e $options | fuzzel --dmenu --prompt='Power:')
|
|
||||||
|
|
||||||
case $selected in
|
|
||||||
"Shutdown")
|
|
||||||
systemctl poweroff
|
|
||||||
;;
|
|
||||||
"Reboot")
|
|
||||||
systemctl reboot
|
|
||||||
;;
|
|
||||||
"Lock")
|
|
||||||
hyprlock
|
|
||||||
;;
|
|
||||||
"Logout")
|
|
||||||
hyprctl dispatch exit
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
+1
-1
@@ -21,7 +21,7 @@ x-scheme-handler/claude-cli=claude-code-url-handler.desktop
|
|||||||
x-scheme-handler/msteams=teams-for-linux.desktop
|
x-scheme-handler/msteams=teams-for-linux.desktop
|
||||||
x-scheme-handler/slack=slack.desktop
|
x-scheme-handler/slack=slack.desktop
|
||||||
audio/flac=mpv.desktop
|
audio/flac=mpv.desktop
|
||||||
x-scheme-handler/codex=ChatGPT.desktop
|
x-scheme-handler/codex=chatgpt.desktop
|
||||||
|
|
||||||
[Added Associations]
|
[Added Associations]
|
||||||
application/pdf=org.pwmt.zathura-pdf-poppler.desktop;
|
application/pdf=org.pwmt.zathura-pdf-poppler.desktop;
|
||||||
|
|||||||
+1
-1
Submodule nvim updated: 8d657d0f8d...2cbfe6946a.
@@ -178,7 +178,6 @@ fribidi
|
|||||||
fuse-common
|
fuse-common
|
||||||
fuse2
|
fuse2
|
||||||
fuse3
|
fuse3
|
||||||
fuzzel
|
|
||||||
fzf
|
fzf
|
||||||
gawk
|
gawk
|
||||||
gc
|
gc
|
||||||
|
|||||||
@@ -199,8 +199,9 @@ Persona 3's blue and nothing else needs touching.
|
|||||||
`fish_frozen_theme.fish` that fish 4.3 generated on upgrade. The prompt arrow
|
`fish_frozen_theme.fish` that fish 4.3 generated on upgrade. The prompt arrow
|
||||||
is white and turns crimson on a non-zero exit — the shell's one "wrong"
|
is white and turns crimson on a non-zero exit — the shell's one "wrong"
|
||||||
signal, and so the one place that earns the accent.
|
signal, and so the one place that earns the accent.
|
||||||
- **Fuzzel** — `fuzzel/takemi.ini`, selected by the `include` in `fuzzel.ini`.
|
- **The launcher** — no external theming to keep in step, because it is part of
|
||||||
Square corners rather than the stock radius, and a fully opaque ground.
|
this shell (`launcher/`). Fuzzel is gone; `takemi-dmenu` stands in for
|
||||||
|
`fuzzel --dmenu` where a script needs a picker.
|
||||||
- **No glass anywhere.** Alacritty is `opacity = 1.0, blur = false`, and
|
- **No glass anywhere.** Alacritty is `opacity = 1.0, blur = false`, and
|
||||||
Hyprland's `decoration:blur` is disabled with both opacities at `1.0`. Blur is
|
Hyprland's `decoration:blur` is disabled with both opacities at `1.0`. Blur is
|
||||||
the signature of the frosted-glass look, which is the opposite of flat ink on
|
the signature of the frosted-glass look, which is the opposite of flat ink on
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ Item {
|
|||||||
readonly property string incomingTitle: mine && toplevel.title ? toplevel.title : "—"
|
readonly property string incomingTitle: mine && toplevel.title ? toplevel.title : "—"
|
||||||
property string displayedTitle: "—"
|
property string displayedTitle: "—"
|
||||||
|
|
||||||
|
// Which toplevel the landing transition last played for. The landing is a
|
||||||
|
// focus-change stamp, so it has to key off window identity rather than off
|
||||||
|
// the caption text — see commitTitle().
|
||||||
|
property var landedToplevel: null
|
||||||
|
|
||||||
// The bar shrinks this when the three clusters would otherwise collide.
|
// The bar shrinks this when the three clusters would otherwise collide.
|
||||||
property real maxWidth: 240
|
property real maxWidth: 240
|
||||||
|
|
||||||
@@ -67,11 +72,28 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adopt the settled caption, and stamp it only when focus actually moved.
|
||||||
|
//
|
||||||
|
// The landing used to restart on any title change, which is not the same
|
||||||
|
// thing: plenty of windows rewrite their own title on a timer — a terminal
|
||||||
|
// running a task with a spinner or a percentage, a browser tab with a live
|
||||||
|
// clock — and each rewrite restarted seven overlapping animations totalling
|
||||||
|
// over half a second. At a title churning twice a second on a 240 Hz screen
|
||||||
|
// the bar never stopped animating, and repainting it that hard measured at
|
||||||
|
// roughly 18% of a CPU core with nothing else happening. Keying the stamp to
|
||||||
|
// window identity restores what the effect was described as doing.
|
||||||
function commitTitle(): void {
|
function commitTitle(): void {
|
||||||
if (root.displayedTitle === root.incomingTitle)
|
const focusMoved = root.toplevel !== root.landedToplevel;
|
||||||
|
|
||||||
|
if (root.displayedTitle !== root.incomingTitle)
|
||||||
|
root.displayedTitle = root.incomingTitle;
|
||||||
|
else if (!focusMoved)
|
||||||
return;
|
return;
|
||||||
root.displayedTitle = root.incomingTitle;
|
|
||||||
titleLanding.restart();
|
if (focusMoved) {
|
||||||
|
root.landedToplevel = root.toplevel;
|
||||||
|
titleLanding.restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Browser tabs, terminals and editors can update titles several times in a
|
// Browser tabs, terminals and editors can update titles several times in a
|
||||||
@@ -85,7 +107,17 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onIncomingTitleChanged: titleSettle.restart()
|
onIncomingTitleChanged: titleSettle.restart()
|
||||||
Component.onCompleted: displayedTitle = incomingTitle
|
|
||||||
|
// Focus can move to a window whose caption happens to match the outgoing
|
||||||
|
// one, which changes no title and so would otherwise never land.
|
||||||
|
onToplevelChanged: titleSettle.restart()
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
displayedTitle = incomingTitle;
|
||||||
|
// Adopt the current window silently, so a config reload does not play a
|
||||||
|
// focus-change stamp for a focus that did not change.
|
||||||
|
landedToplevel = toplevel;
|
||||||
|
}
|
||||||
|
|
||||||
// A quick crimson wipe under the title on focus change.
|
// A quick crimson wipe under the title on focus change.
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|||||||
@@ -115,10 +115,17 @@ PanelWindow {
|
|||||||
implicitWidth: Theme.padM * 2
|
implicitWidth: Theme.padM * 2
|
||||||
implicitHeight: Theme.barHeight
|
implicitHeight: Theme.barHeight
|
||||||
|
|
||||||
|
// A leaning hairline needs a box wide enough to hold the lean: at 20px
|
||||||
|
// tall the top edge sits 20 * skew ≈ 5px right of the bottom one, so a
|
||||||
|
// 1px-wide Skew folded into a bowtie instead. Width is the lean plus the
|
||||||
|
// stroke the rule should actually read as.
|
||||||
|
readonly property real ruleWeight: 1.5
|
||||||
|
readonly property real ruleHeight: 20
|
||||||
|
|
||||||
Skew {
|
Skew {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: 1
|
width: parent.ruleHeight * Theme.skew + parent.ruleWeight
|
||||||
height: 20
|
height: parent.ruleHeight
|
||||||
color: Theme.alpha(Theme.outline, 0.9)
|
color: Theme.alpha(Theme.outline, 0.9)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,15 @@ Item {
|
|||||||
// crimson line struck through its bottom edge on hover. Reserving the band
|
// crimson line struck through its bottom edge on hover. Reserving the band
|
||||||
// and centring content in what is left is what keeps the rule under the
|
// and centring content in what is left is what keeps the rule under the
|
||||||
// module instead of across it.
|
// module instead of across it.
|
||||||
|
// The band reserved the full rule plus its inset — 7px off a 40px module,
|
||||||
|
// all of it taken from the bottom — so every module's content was centred
|
||||||
|
// 3.5px above the slab's own centre and the whole bar read as top-heavy.
|
||||||
|
// The rule is pushed closer to the edge now and the band keeps only enough
|
||||||
|
// clearance to stop the tallest content (the media pill's 24px art) from
|
||||||
|
// touching it, so content sits within a pixel of the slab's centre line.
|
||||||
readonly property real ruleHeight: 2
|
readonly property real ruleHeight: 2
|
||||||
readonly property real ruleInset: 5
|
readonly property real ruleInset: 3
|
||||||
readonly property real ruleBand: root.standalone ? 0 : root.ruleHeight + root.ruleInset
|
readonly property real ruleBand: root.standalone ? 0 : 2
|
||||||
|
|
||||||
// Modules with a notion of progress (the player's track position) draw it in
|
// Modules with a notion of progress (the player's track position) draw it in
|
||||||
// the same band, so it can never be struck through the content. A module
|
// the same band, so it can never be struck through the content. A module
|
||||||
@@ -109,15 +115,20 @@ Item {
|
|||||||
|
|
||||||
// Track progress, shown until the pointer arrives and the hover rule
|
// Track progress, shown until the pointer arrives and the hover rule
|
||||||
// takes the band over.
|
// takes the band over.
|
||||||
|
//
|
||||||
|
// Deliberately untweened. MPRIS position is polled once a second, and a
|
||||||
|
// 480 ms ease on a 1 Hz input meant this rule was mid-animation roughly
|
||||||
|
// half of every second — about 115 animated frames per second on a
|
||||||
|
// 240 Hz screen, each one rebuilding this Skew's Shape geometry through
|
||||||
|
// the curve renderer and re-rendering the pill's layer textures with it.
|
||||||
|
// Stepping once per second costs 1 frame instead of 115, matches the rate
|
||||||
|
// the underlying data actually arrives at, and makes a seek land exactly
|
||||||
|
// where it was dropped instead of gliding there.
|
||||||
Skew {
|
Skew {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width * Math.max(0, Math.min(1, root.progress))
|
width: parent.width * Math.max(0, Math.min(1, root.progress))
|
||||||
color: Theme.accent
|
color: Theme.accent
|
||||||
visible: root.progress >= 0 && !root.hovered && !root.active
|
visible: root.progress >= 0 && !root.hovered && !root.active
|
||||||
|
|
||||||
Behavior on width {
|
|
||||||
NumberAnimation { duration: 480; easing.type: Easing.OutQuad }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Skew {
|
Skew {
|
||||||
|
|||||||
@@ -50,18 +50,54 @@ BarPill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Declared with room for its own lean, so the slash sits inside the box
|
||||||
|
// the Row gave it instead of hanging several px into the date column.
|
||||||
Skew {
|
Skew {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 2
|
width: 22 * Theme.skew + 3
|
||||||
height: 22
|
height: 22
|
||||||
color: Theme.alpha(Theme.accent, 0.6)
|
color: Theme.alpha(Theme.accent, 0.6)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Archivo Black's digits are not all the same width, so a clock sized to
|
||||||
|
// its own text changed width as the minutes rolled over — 11:11 is
|
||||||
|
// several px narrower than 08:48 — and shoved the rest of the bar
|
||||||
|
// around. Reserve the widest possible reading and centre inside it.
|
||||||
|
TextMetrics {
|
||||||
|
id: timeMetrics
|
||||||
|
text: "88:88"
|
||||||
|
font.family: Theme.fontDisplay
|
||||||
|
font.pixelSize: Theme.fsTitle
|
||||||
|
font.weight: Theme.weightDisplay
|
||||||
|
font.italic: true
|
||||||
|
font.letterSpacing: 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
// Archivo Black reserves descender room the time never uses — "12:04"
|
||||||
|
// is all cap height — so centring the line box left the digits sitting
|
||||||
|
// above everything beside them. Centre the ink instead.
|
||||||
|
// `tightBoundingRect` is measured from the baseline, so the ink's top
|
||||||
|
// inside the line box is `ascent + ink.y`.
|
||||||
|
readonly property real timeInkOffset: {
|
||||||
|
const ink = timeMetrics.tightBoundingRect;
|
||||||
|
if (ink.height <= 0) return 0;
|
||||||
|
const inkCentre = timeFont.ascent + ink.y + ink.height / 2;
|
||||||
|
return Math.round(timeMetrics.boundingRect.height / 2 - inkCentre);
|
||||||
|
}
|
||||||
|
|
||||||
|
FontMetrics {
|
||||||
|
id: timeFont
|
||||||
|
font: timeMetrics.font
|
||||||
|
}
|
||||||
|
|
||||||
SplitText {
|
SplitText {
|
||||||
id: timeText
|
id: timeText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: layout.timeInkOffset
|
||||||
|
width: timeMetrics.advanceWidth
|
||||||
text: Qt.formatDateTime(clock.date, "HH:mm")
|
text: Qt.formatDateTime(clock.date, "HH:mm")
|
||||||
pixelSize: Theme.fsTitle
|
pixelSize: Theme.fsTitle
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
split: 1.4
|
split: 1.4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
|
import QtQuick.Window
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import "root:/components"
|
import "root:/components"
|
||||||
@@ -126,35 +127,77 @@ BarPill {
|
|||||||
|
|
||||||
// Compact play-state equaliser. It moves only while audio is playing
|
// Compact play-state equaliser. It moves only while audio is playing
|
||||||
// and freezes into three quiet bars when paused.
|
// and freezes into three quiet bars when paused.
|
||||||
|
//
|
||||||
|
// Sampled from a timer rather than tweened by an infinite
|
||||||
|
// NumberAnimation. DP-1 runs at 240 Hz, and a frame-synced animation
|
||||||
|
// here repainted the entire bar 240 times a second: this pill sits
|
||||||
|
// inside ancestors that use layer.enabled together with
|
||||||
|
// Shape.CurveRenderer, and the album art carries a MultiEffect pass, so
|
||||||
|
// every one of those frames re-rendered several layer textures. Measured
|
||||||
|
// on its own, this one animation cost about two thirds of a CPU core
|
||||||
|
// whenever anything was playing.
|
||||||
|
//
|
||||||
|
// The timer samples a sine, it does not step through arbitrary levels: a
|
||||||
|
// low tick rate only looks like the original if consecutive ticks stay
|
||||||
|
// near each other. Each bar keeps the eased breathing motion and the
|
||||||
|
// period it had before — the curve is just read 25 times a second
|
||||||
|
// instead of 240.
|
||||||
Row {
|
Row {
|
||||||
|
id: eq
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
|
||||||
|
// Sampling interval — the one knob trading smoothness against cost.
|
||||||
|
// Frames are the whole expense: a full-bar repaint runs about 0.3% of
|
||||||
|
// a core (the bar spans 2544x40 on a 240 Hz output), so cost scales
|
||||||
|
// linearly with this rate. 16 ms holds 60 Hz, which is visually
|
||||||
|
// indistinguishable from the original frame-synced tween at a quarter
|
||||||
|
// of its ~75%.
|
||||||
|
readonly property int tickMs: 16
|
||||||
|
property int phase: 0
|
||||||
|
|
||||||
|
// Reproduces the original per-bar tween exactly, sampled instead of
|
||||||
|
// frame-synced. Each bar eased between two heights with its own pair
|
||||||
|
// of durations, so the three differed in both swing and period — the
|
||||||
|
// middle bar moved barely a pixel while the outer two ran in
|
||||||
|
// opposition. Giving all three the full swing, as a single symmetric
|
||||||
|
// sine would, is three times the motion and reads far busier than
|
||||||
|
// this meter is supposed to.
|
||||||
|
function level(i: int): real {
|
||||||
|
const lo = 4 + (i * 5) % 13; // old first NumberAnimation `to`
|
||||||
|
const hi = 14 - (i * 4) % 9; // old second NumberAnimation `to`
|
||||||
|
const d1 = 320 + i * 90; // ...and their durations
|
||||||
|
const d2 = 280 + i * 70;
|
||||||
|
|
||||||
|
const t = (eq.phase * eq.tickMs) % (d1 + d2);
|
||||||
|
// Easing.InOutSine, which is what both halves used.
|
||||||
|
const ease = x => (1 - Math.cos(Math.PI * x)) / 2;
|
||||||
|
|
||||||
|
return t < d1
|
||||||
|
? hi + (lo - hi) * ease(t / d1)
|
||||||
|
: lo + (hi - lo) * ease((t - d1) / d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: eq.tickMs
|
||||||
|
running: Media.playing && eq.visible && (eq.Window.window?.visible ?? true)
|
||||||
|
repeat: true
|
||||||
|
onTriggered: eq.phase++
|
||||||
|
// Restart the cycle from its trough, so playback always begins
|
||||||
|
// from a settled meter rather than mid-swing.
|
||||||
|
onRunningChanged: if (!running) eq.phase = 0
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: 3
|
model: 3
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
required property int index
|
required property int index
|
||||||
width: 3
|
width: 3
|
||||||
height: 6
|
height: Media.playing ? eq.level(index) : 6
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: Media.playing ? Theme.primary : Theme.muted
|
color: Media.playing ? Theme.primary : Theme.muted
|
||||||
|
|
||||||
SequentialAnimation on height {
|
|
||||||
running: Media.playing
|
|
||||||
loops: Animation.Infinite
|
|
||||||
NumberAnimation {
|
|
||||||
to: 4 + (index * 5) % 13
|
|
||||||
duration: 320 + index * 90
|
|
||||||
easing.type: Easing.InOutSine
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
to: 14 - (index * 4) % 9
|
|
||||||
duration: 280 + index * 70
|
|
||||||
easing.type: Easing.InOutSine
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation { duration: Theme.durBase }
|
ColorAnimation { duration: Theme.durBase }
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-2
@@ -89,6 +89,7 @@ PanelWindow {
|
|||||||
id: volIcon
|
id: volIcon
|
||||||
icon: Audio.icon
|
icon: Audio.icon
|
||||||
readout: Audio.muted ? "" : Audio.volumePercent + "%"
|
readout: Audio.muted ? "" : Audio.volumePercent + "%"
|
||||||
|
reserveReadout: true
|
||||||
label: "Volume"
|
label: "Volume"
|
||||||
statusText: Audio.muted ? "Muted" : Audio.volumePercent + "% · " + Audio.sinkName
|
statusText: Audio.muted ? "Muted" : Audio.volumePercent + "% · " + Audio.sinkName
|
||||||
hint: "Scroll to adjust"
|
hint: "Scroll to adjust"
|
||||||
@@ -162,6 +163,7 @@ PanelWindow {
|
|||||||
readout: Notifs.unread > 0
|
readout: Notifs.unread > 0
|
||||||
? (Notifs.unread > 9 ? "9+" : String(Notifs.unread))
|
? (Notifs.unread > 9 ? "9+" : String(Notifs.unread))
|
||||||
: ""
|
: ""
|
||||||
|
reserveReadout: true
|
||||||
dim: Notifs.dnd
|
dim: Notifs.dnd
|
||||||
alert: Notifs.hasUnread && !Notifs.dnd
|
alert: Notifs.hasUnread && !Notifs.dnd
|
||||||
suppressTooltip: notifPopout.detailActive
|
suppressTooltip: notifPopout.detailActive
|
||||||
@@ -187,10 +189,17 @@ PanelWindow {
|
|||||||
implicitWidth: Theme.railWidth
|
implicitWidth: Theme.railWidth
|
||||||
implicitHeight: Theme.padM + 4
|
implicitHeight: Theme.padM + 4
|
||||||
|
|
||||||
|
// Same correction as the bar's divider, on the other axis: a 22px rule
|
||||||
|
// rises 22 * skew ≈ 5px across its run, so the box has to be that tall
|
||||||
|
// plus the weight of the stroke. At height 1 the polygon inverted and
|
||||||
|
// the rule rendered as a stubby wedge sitting left of centre.
|
||||||
|
readonly property real ruleWeight: 1.5
|
||||||
|
readonly property real ruleWidth: 22
|
||||||
|
|
||||||
Skew {
|
Skew {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: 22
|
width: parent.ruleWidth
|
||||||
height: 1
|
height: parent.ruleWidth * Theme.skew + parent.ruleWeight
|
||||||
vertical: true
|
vertical: true
|
||||||
color: Theme.alpha(Theme.outline, 0.9)
|
color: Theme.alpha(Theme.outline, 0.9)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ Item {
|
|||||||
property bool dim: false
|
property bool dim: false
|
||||||
property bool pulsing: false
|
property bool pulsing: false
|
||||||
|
|
||||||
|
// Hold the readout line open even while there is nothing to put in it.
|
||||||
|
// Volume drops its percentage when muted and the bell only carries a count
|
||||||
|
// when something is unread, so without this the slot collapsed from 42px to
|
||||||
|
// 32px and every icon below it jumped a third of its own height.
|
||||||
|
property bool reserveReadout: false
|
||||||
|
|
||||||
|
readonly property bool hasReadout: root.readout !== "" || root.reserveReadout
|
||||||
readonly property bool hovered: hover.hovered
|
readonly property bool hovered: hover.hovered
|
||||||
|
|
||||||
// Clearance between the wipe and the rail's left edge, chosen so the bar
|
// Clearance between the wipe and the rail's left edge, chosen so the bar
|
||||||
@@ -31,16 +38,42 @@ Item {
|
|||||||
signal scrolled(real delta)
|
signal scrolled(real delta)
|
||||||
|
|
||||||
implicitWidth: Theme.railWidth
|
implicitWidth: Theme.railWidth
|
||||||
implicitHeight: root.readout !== "" ? 42 : 32
|
implicitHeight: root.hasReadout ? root.glyphBand + readoutLine.height + 1 : root.glyphBand
|
||||||
|
|
||||||
Column {
|
// The glyph always sits centred in a fixed band at the top of the slot and
|
||||||
|
// the readout hangs below it, rather than the pair being centred together.
|
||||||
|
// Centring the pair meant the icon slid up and down by a few px whenever its
|
||||||
|
// number appeared or vanished — the icons stopped lining up with each other
|
||||||
|
// exactly when something was changing and you were looking at them.
|
||||||
|
readonly property real glyphBand: 32
|
||||||
|
|
||||||
|
// Nerd Font's status glyphs are not all centred inside their own advance —
|
||||||
|
// the muted-speaker and muted-mic marks carry their cross out to the right,
|
||||||
|
// so centring the advance box left them visibly off-axis next to the wifi
|
||||||
|
// and bluetooth glyphs. Centre the ink instead, capped so a glyph with an
|
||||||
|
// odd bounding box cannot slide far off the rail's axis.
|
||||||
|
readonly property real opticalShift: {
|
||||||
|
const ink = glyphMetrics.tightBoundingRect;
|
||||||
|
if (ink.width <= 0) return 0;
|
||||||
|
const off = glyphMetrics.advanceWidth / 2 - (ink.x + ink.width / 2);
|
||||||
|
return Math.max(-4, Math.min(4, off));
|
||||||
|
}
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: glyphMetrics
|
||||||
|
text: root.icon
|
||||||
|
font.family: Theme.fontIcon
|
||||||
|
font.pixelSize: Theme.fsLarge
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
id: layout
|
id: layout
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
spacing: 1
|
|
||||||
|
|
||||||
Icon {
|
Icon {
|
||||||
id: glyph
|
id: glyph
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
x: (root.width - width) / 2 + root.opticalShift
|
||||||
|
y: (root.glyphBand - height) / 2
|
||||||
text: root.icon
|
text: root.icon
|
||||||
pulsing: root.pulsing
|
pulsing: root.pulsing
|
||||||
font.pixelSize: Theme.fsLarge
|
font.pixelSize: Theme.fsLarge
|
||||||
@@ -57,7 +90,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: readoutLine
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: root.glyphBand + 1
|
||||||
visible: root.readout !== ""
|
visible: root.readout !== ""
|
||||||
text: root.readout
|
text: root.readout
|
||||||
color: root.dim ? Theme.muted : Theme.subtext
|
color: root.dim ? Theme.muted : Theme.subtext
|
||||||
@@ -88,7 +124,7 @@ Item {
|
|||||||
anchors.leftMargin: root.wipeInset
|
anchors.leftMargin: root.wipeInset
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 2
|
width: 2
|
||||||
height: root.hovered ? layout.implicitHeight : 0
|
height: root.hovered ? root.height - 4 : 0
|
||||||
color: Theme.glow
|
color: Theme.glow
|
||||||
|
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ BarPill {
|
|||||||
label: "CPU"
|
label: "CPU"
|
||||||
value: Sys.cpuUsage
|
value: Sys.cpuUsage
|
||||||
readout: Math.round(Sys.cpuUsage) + "%"
|
readout: Math.round(Sys.cpuUsage) + "%"
|
||||||
|
widest: "100%"
|
||||||
}
|
}
|
||||||
|
|
||||||
Divider {}
|
Divider {}
|
||||||
@@ -37,6 +38,7 @@ BarPill {
|
|||||||
label: "MEM"
|
label: "MEM"
|
||||||
value: Sys.memPercent
|
value: Sys.memPercent
|
||||||
readout: Sys.memUsed.toFixed(1) + "G"
|
readout: Sys.memUsed.toFixed(1) + "G"
|
||||||
|
widest: "88.8G"
|
||||||
}
|
}
|
||||||
|
|
||||||
Divider { visible: Sys.gpuAvailable }
|
Divider { visible: Sys.gpuAvailable }
|
||||||
@@ -46,14 +48,23 @@ BarPill {
|
|||||||
label: "GPU"
|
label: "GPU"
|
||||||
value: Sys.gpuUsage
|
value: Sys.gpuUsage
|
||||||
readout: Math.round(Sys.gpuUsage) + "%"
|
readout: Math.round(Sys.gpuUsage) + "%"
|
||||||
|
widest: "100%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component Divider: Skew {
|
component Divider: Item {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 1
|
implicitWidth: rule.width
|
||||||
height: 18
|
implicitHeight: 18
|
||||||
color: Theme.alpha(Theme.outline, 0.8)
|
|
||||||
|
// Sized to hold its own lean — see the note on the bar's divider.
|
||||||
|
Skew {
|
||||||
|
id: rule
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.height * Theme.skew + 1
|
||||||
|
height: parent.height
|
||||||
|
color: Theme.alpha(Theme.outline, 0.8)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A tiny fixed label makes every number self-describing without turning the
|
// A tiny fixed label makes every number self-describing without turning the
|
||||||
@@ -65,14 +76,35 @@ BarPill {
|
|||||||
property real value: 0
|
property real value: 0
|
||||||
property string readout: ""
|
property string readout: ""
|
||||||
|
|
||||||
|
// The widest reading this metric will ever show. The number column is
|
||||||
|
// sized from this rather than from the live text, because sizing to the
|
||||||
|
// live text is what made the whole right-hand group breathe in and out:
|
||||||
|
// "9%" and "100%" are ~14px apart in Archivo Black, so every tick of the
|
||||||
|
// CPU sampler nudged the metrics, the media pill and the clock sideways.
|
||||||
|
// Reserving the maximum costs a few px of blank and buys a bar that
|
||||||
|
// never moves.
|
||||||
|
property string widest: "100%"
|
||||||
|
|
||||||
|
readonly property real numberWidth: Math.max(gauge.width, metrics.advanceWidth)
|
||||||
|
readonly property real headWidth: labelText.implicitWidth + head.spacing + numberWidth
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
width: Math.max(headWidth, 44)
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: metrics
|
||||||
|
text: metric.widest
|
||||||
|
font: gauge.font
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
id: head
|
||||||
spacing: 4
|
spacing: 4
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.baseline: readoutText.baseline
|
id: labelText
|
||||||
|
anchors.baseline: gauge.baseline
|
||||||
text: metric.label
|
text: metric.label
|
||||||
color: Theme.muted
|
color: Theme.muted
|
||||||
font.family: Theme.fontMono
|
font.family: Theme.fontMono
|
||||||
@@ -83,7 +115,7 @@ BarPill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: readoutText
|
id: gauge
|
||||||
text: metric.readout
|
text: metric.readout
|
||||||
color: Theme.heat(metric.value)
|
color: Theme.heat(metric.value)
|
||||||
font.family: Theme.fontDisplay
|
font.family: Theme.fontDisplay
|
||||||
@@ -99,12 +131,15 @@ BarPill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ends flush with the reading above it instead of stopping short at a
|
||||||
|
// fixed 43px, so each metric reads as one block.
|
||||||
MeterBar {
|
MeterBar {
|
||||||
value: metric.value
|
value: metric.value
|
||||||
segments: 9
|
segments: 9
|
||||||
segmentWidth: 3
|
|
||||||
spacing: 2
|
spacing: 2
|
||||||
height: 5
|
height: 5
|
||||||
|
width: metric.width
|
||||||
|
segmentWidth: (width - 8 * spacing) / 9
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ BarPill {
|
|||||||
lean: Theme.skew
|
lean: Theme.skew
|
||||||
implicitWidth: Theme.barHeight + contentPad
|
implicitWidth: Theme.barHeight + contentPad
|
||||||
|
|
||||||
onClicked: Actions.launch("fuzzel")
|
onClicked: Actions.toggleLauncher()
|
||||||
onRightClicked: Actions.reloadShell()
|
onRightClicked: Actions.reloadShell()
|
||||||
|
|
||||||
// The wordmark. Was the Death arcana skull (nf-md-skull, U+F068C) — a
|
// The wordmark. Was the Death arcana skull (nf-md-skull, U+F068C) — a
|
||||||
|
|||||||
@@ -132,8 +132,13 @@ Item {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hyprland evaluates IPC `dispatch` payloads as Lua now that the
|
||||||
|
// config is Lua (hyprland.lua rather than hyprland.conf), so the
|
||||||
|
// old `dispatch workspace 3` string is a Lua syntax error and the
|
||||||
|
// click silently does nothing. Dispatchers have to be called the
|
||||||
|
// same way lua/binds/workspaces.lua calls them.
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: Hyprland.dispatch("workspace " + pip.wsId)
|
onTapped: Hyprland.dispatch("hl.dsp.focus({workspace = " + pip.wsId + "})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Window
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
|
|
||||||
// Horizontally scrolling text that only moves when it actually overflows, and
|
// Horizontally scrolling text that only moves when it actually overflows, and
|
||||||
@@ -18,6 +19,13 @@ Item {
|
|||||||
|
|
||||||
readonly property bool overflowing: label.implicitWidth > width + 1
|
readonly property bool overflowing: label.implicitWidth > width + 1
|
||||||
|
|
||||||
|
// An Item inside an unmapped PopupWindow still reports itself visible, so a
|
||||||
|
// marquee in a closed popout would keep its infinite animation alive. That
|
||||||
|
// animation writes QML properties on every frame — at 240 Hz, three closed
|
||||||
|
// popout marquees are enough to keep the whole animation driver spinning and
|
||||||
|
// burn a fifth of a core with nothing on screen. Follow the window instead.
|
||||||
|
readonly property bool onScreen: Window.window?.visible ?? true
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
implicitHeight: label.implicitHeight
|
implicitHeight: label.implicitHeight
|
||||||
implicitWidth: label.implicitWidth
|
implicitWidth: label.implicitWidth
|
||||||
@@ -38,7 +46,7 @@ Item {
|
|||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: scroll
|
id: scroll
|
||||||
running: root.running && root.overflowing && root.visible
|
running: root.running && root.overflowing && root.visible && root.onScreen
|
||||||
loops: Animation.Infinite
|
loops: Animation.Infinite
|
||||||
|
|
||||||
PauseAnimation { duration: root.pause }
|
PauseAnimation { duration: root.pause }
|
||||||
|
|||||||
@@ -31,6 +31,20 @@ Shape {
|
|||||||
// rail slab.
|
// rail slab.
|
||||||
property bool vertical: false
|
property bool vertical: false
|
||||||
|
|
||||||
|
// NOTE ON SIZING. The lean shifts one edge by `lean * height` (or by
|
||||||
|
// `lean * width` when vertical), and the piece that actually gets painted is
|
||||||
|
// what is left: a Skew declared 1px wide and 20px tall does not draw a 1px
|
||||||
|
// rule at an angle, it draws a rule |1 - 20 * 0.249| = 4px thick that hangs
|
||||||
|
// 4px to the *left* of the box it was given. That is why the bar's and the
|
||||||
|
// rail's hairlines came out fat and off-centre. A thin leaning rule has to be
|
||||||
|
// declared with room for its own lean — `height * Theme.skew + weight` — and
|
||||||
|
// the call sites that draw one now do exactly that.
|
||||||
|
//
|
||||||
|
// Zero-sized pieces still have a lean offset, so a collapsed hover wipe or a
|
||||||
|
// meter at 0 drew a sub-pixel wedge of pure accent — the stray red dot under
|
||||||
|
// the metrics. Nothing with no extent should paint at all.
|
||||||
|
visible: root.width > 0 && root.height > 0
|
||||||
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
preferredRendererType: Shape.CurveRenderer
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,549 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/components"
|
||||||
|
import "root:/popouts"
|
||||||
|
import "root:/services"
|
||||||
|
|
||||||
|
// The launcher. One input, one list, and a small amount of grammar.
|
||||||
|
//
|
||||||
|
// TYPING is always typing. Navigation lives on the arrows and on Ctrl+J/K so
|
||||||
|
// that nothing you can type is ever stolen from you — except in select mode,
|
||||||
|
// which hands h/j/k/l over to navigation. That is the compromise the vim keys
|
||||||
|
// need: a launcher whose input eats `j` is a launcher you cannot use to find
|
||||||
|
// Jellyfin.
|
||||||
|
//
|
||||||
|
// Select mode is vim's normal mode, and the modes change the way vim changes
|
||||||
|
// them: Escape leaves insert, `i` (or `a`) goes back into it without leaving
|
||||||
|
// an `i` behind, and Escape from select mode — with no insert left to leave —
|
||||||
|
// ends the prompt. Unbound keys in select mode are eaten, not typed.
|
||||||
|
//
|
||||||
|
// The other half of the grammar is the argument. Type a URL and the list turns
|
||||||
|
// into "open this with…", already sorted so the system default is row zero —
|
||||||
|
// so the fast path is type, Enter, done, and the slow path is one arrow key.
|
||||||
|
// Tab pins whatever is selected, which does the same thing for arguments that
|
||||||
|
// do not announce themselves as arguments.
|
||||||
|
PanelWindow {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
screen: modelData
|
||||||
|
|
||||||
|
// Only the screen that had focus when the launcher was asked for shows it;
|
||||||
|
// the other copies stay dormant so the query is never typed into thin air.
|
||||||
|
readonly property bool open: Actions.launcherOpen
|
||||||
|
&& Actions.launcherScreen === modelData.name
|
||||||
|
visible: root.open || closeAnim.running
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "takemi-launcher"
|
||||||
|
WlrLayershell.keyboardFocus: root.open
|
||||||
|
? WlrKeyboardFocus.Exclusive
|
||||||
|
: WlrKeyboardFocus.None
|
||||||
|
|
||||||
|
anchors { top: true; bottom: true; left: true; right: true }
|
||||||
|
color: "transparent"
|
||||||
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------- state
|
||||||
|
property string query: ""
|
||||||
|
property var pinned: null // an index item, frozen as the verb
|
||||||
|
property bool selectMode: false
|
||||||
|
property int selected: 0
|
||||||
|
|
||||||
|
readonly property int maxRows: 8
|
||||||
|
readonly property int rowHeight: 46
|
||||||
|
|
||||||
|
// --------------------------------------------------------------- grammar
|
||||||
|
readonly property string prefix: root.pinned ? "" : root.query.slice(0, 1)
|
||||||
|
// A dmenu request owns the window outright — there is no app search to
|
||||||
|
// fall back to, because the caller is waiting on a choice from its own
|
||||||
|
// list.
|
||||||
|
readonly property string mode: Apps.dmenuActive ? "dmenu"
|
||||||
|
: root.prefix === ">" ? "shell"
|
||||||
|
: root.prefix === "=" ? "calc"
|
||||||
|
: root.prefix === ":" ? "clip"
|
||||||
|
: "app"
|
||||||
|
|
||||||
|
readonly property bool prefixed: root.mode === "shell"
|
||||||
|
|| root.mode === "calc" || root.mode === "clip"
|
||||||
|
|
||||||
|
readonly property string body: root.prefixed
|
||||||
|
? root.query.slice(1)
|
||||||
|
: root.query
|
||||||
|
|
||||||
|
// With an app pinned, everything you type is the argument. Without one, an
|
||||||
|
// argument only exists if what you typed is self-evidently an object.
|
||||||
|
readonly property string argKind: root.pinned
|
||||||
|
? (Apps.classify(root.body) || "text")
|
||||||
|
: Apps.classify(root.body)
|
||||||
|
|
||||||
|
readonly property string arg: root.mode !== "app" || root.body.trim() === ""
|
||||||
|
? ""
|
||||||
|
: (root.pinned || root.argKind !== "")
|
||||||
|
? Apps.normalizeArg(root.body, root.argKind)
|
||||||
|
: ""
|
||||||
|
|
||||||
|
// What is left to match app names against. When the whole query has been
|
||||||
|
// claimed as an argument there is nothing left, and the list falls back to
|
||||||
|
// "every app, best handler first".
|
||||||
|
readonly property string term: root.mode !== "app" || root.pinned || root.arg !== ""
|
||||||
|
? ""
|
||||||
|
: root.body
|
||||||
|
|
||||||
|
readonly property var results: {
|
||||||
|
if (!root.open) return [];
|
||||||
|
|
||||||
|
if (root.mode === "calc") {
|
||||||
|
const v = Apps.calc(root.body);
|
||||||
|
if (v === "") return [];
|
||||||
|
return [{ kind: "calc", name: v, sub: "copy to clipboard",
|
||||||
|
icon: "accessories-calculator", value: v }];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.mode === "dmenu") return Apps.searchDmenu(root.body);
|
||||||
|
if (root.mode === "clip") return Apps.searchClips(root.body);
|
||||||
|
|
||||||
|
if (root.mode === "shell") {
|
||||||
|
if (root.body.trim() === "") return [];
|
||||||
|
return [
|
||||||
|
{ kind: "shell", name: root.body, sub: "run", icon: "utilities-terminal" },
|
||||||
|
{ kind: "shellterm", name: root.body, sub: "run in a terminal",
|
||||||
|
icon: "utilities-terminal" }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pinned: the verb is decided, so the list narrows to that app and the
|
||||||
|
// things it can do — which is where "Brave, but a private window"
|
||||||
|
// lives. Same list, one step further in.
|
||||||
|
if (root.pinned) {
|
||||||
|
const id = root.pinned.id;
|
||||||
|
return Apps.index.filter(e => e.id === id)
|
||||||
|
.sort((a, b) => (a.kind === "app" ? 0 : 1) - (b.kind === "app" ? 0 : 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Apps.search(root.term, root.arg, root.argKind);
|
||||||
|
}
|
||||||
|
|
||||||
|
onResultsChanged: root.selected = 0
|
||||||
|
|
||||||
|
// Typing the ":" prefix is the other way into the clipboard, and the
|
||||||
|
// history may have moved on since the window opened.
|
||||||
|
onModeChanged: if (root.mode === "clip") Apps.refreshClips()
|
||||||
|
onOpenChanged: {
|
||||||
|
if (root.open) {
|
||||||
|
PopupCoordinator.dismissAll();
|
||||||
|
root.reset();
|
||||||
|
openAnim.restart();
|
||||||
|
input.forceActiveFocus();
|
||||||
|
input.cursorPosition = input.text.length;
|
||||||
|
Apps.refreshClips();
|
||||||
|
} else {
|
||||||
|
// Dismissing a dmenu is a valid answer — an empty one. Without this
|
||||||
|
// the caller blocks until its own timeout.
|
||||||
|
Apps.finishDmenu("");
|
||||||
|
closeAnim.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset(): void {
|
||||||
|
root.query = Actions.launcherSeed;
|
||||||
|
root.pinned = null;
|
||||||
|
root.selectMode = false;
|
||||||
|
root.selected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function move(delta: int): void {
|
||||||
|
const n = root.results.length;
|
||||||
|
if (n === 0) return;
|
||||||
|
root.selected = (root.selected + delta + n) % n;
|
||||||
|
list.positionViewAtIndex(root.selected, ListView.Contain);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pin(): void {
|
||||||
|
const item = root.results[root.selected];
|
||||||
|
if (!item || (item.kind !== "app" && item.kind !== "action")) return;
|
||||||
|
root.pinned = item;
|
||||||
|
root.query = "";
|
||||||
|
root.selectMode = false;
|
||||||
|
input.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function unpin(): void {
|
||||||
|
if (!root.pinned) return;
|
||||||
|
root.query = root.pinned.name.split(" · ")[0];
|
||||||
|
root.pinned = null;
|
||||||
|
input.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function activate(): void {
|
||||||
|
const item = root.results[root.selected];
|
||||||
|
if (!item) return;
|
||||||
|
|
||||||
|
switch (item.kind) {
|
||||||
|
case "dmenu": Apps.finishDmenu(item.name); break;
|
||||||
|
case "clip": Apps.pasteClip(item); break;
|
||||||
|
case "calc": Apps.copy(item.value); break;
|
||||||
|
case "shell": Apps.runShell(root.body, false); break;
|
||||||
|
case "shellterm": Apps.runShell(root.body, true); break;
|
||||||
|
default: Apps.launch(item, root.arg); break;
|
||||||
|
}
|
||||||
|
Actions.closeLauncher();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------- backdrop
|
||||||
|
Rectangle {
|
||||||
|
id: backdrop
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.alpha(Theme.base, 0.72)
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
TapHandler { onTapped: Actions.closeLauncher() }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------- panel
|
||||||
|
Item {
|
||||||
|
id: shell
|
||||||
|
|
||||||
|
width: 680
|
||||||
|
height: header.height + divider.height + listBox.height + hint.height
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
// Sits above centre. A launcher pinned to the exact middle of a 1440p
|
||||||
|
// screen puts the list below the eyeline and the input above it; the
|
||||||
|
// input is the thing you are looking at.
|
||||||
|
y: parent.height * 0.22
|
||||||
|
|
||||||
|
opacity: 0
|
||||||
|
transform: Translate { id: rise; y: 24 }
|
||||||
|
|
||||||
|
PopoutSurface {
|
||||||
|
anchors.fill: parent
|
||||||
|
tone: root.arg !== "" ? Theme.accent : Theme.primary
|
||||||
|
padding: 0
|
||||||
|
slashWidth: root.arg !== "" ? 8 : 5
|
||||||
|
|
||||||
|
// ------------------------------------------------------- header
|
||||||
|
Item {
|
||||||
|
id: header
|
||||||
|
width: parent.width
|
||||||
|
height: 66
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Theme.padL
|
||||||
|
anchors.rightMargin: Theme.padL
|
||||||
|
spacing: Theme.padM
|
||||||
|
|
||||||
|
Icon {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: root.mode === "shell" ? "" : root.mode === "calc" ? ""
|
||||||
|
: root.mode === "clip" ? ""
|
||||||
|
: root.mode === "dmenu" ? ""
|
||||||
|
: root.arg !== "" ? "" : ""
|
||||||
|
color: root.arg !== "" ? Theme.accent : Theme.primary
|
||||||
|
font.pixelSize: Theme.fsTitle
|
||||||
|
}
|
||||||
|
|
||||||
|
// The pin chip. Once this is on screen the input means
|
||||||
|
// "argument", and the chip is the only thing saying so.
|
||||||
|
Item {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: root.pinned !== null
|
||||||
|
width: visible ? chipText.width + Theme.padM * 2 : 0
|
||||||
|
height: 26
|
||||||
|
|
||||||
|
Skew {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.accent
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: chipText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: root.pinned ? root.pinned.name.toUpperCase() : ""
|
||||||
|
color: Theme.treatmentDestructiveText
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsMicro
|
||||||
|
font.weight: Font.Bold
|
||||||
|
font.letterSpacing: 2
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
id: input
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: parent.width - x
|
||||||
|
text: root.query
|
||||||
|
onTextChanged: root.query = text
|
||||||
|
color: root.selectMode ? Theme.muted : Theme.text
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsLarge
|
||||||
|
selectionColor: Theme.accent
|
||||||
|
selectedTextColor: Theme.ink
|
||||||
|
clip: true
|
||||||
|
focus: true
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
|
// Ours must run before TextInput's, or select mode's
|
||||||
|
// h/j/k/l would be typed into the field before we ever
|
||||||
|
// saw them.
|
||||||
|
Keys.priority: Keys.BeforeItem
|
||||||
|
Keys.onPressed: event => root.handleKey(event)
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: input.text === ""
|
||||||
|
text: root.pinned ? "argument…"
|
||||||
|
: root.mode === "shell" ? "command…"
|
||||||
|
: root.mode === "calc" ? "expression…"
|
||||||
|
: root.mode === "clip" ? "clipboard history…"
|
||||||
|
: root.mode === "dmenu"
|
||||||
|
? (Apps.dmenuPrompt || "choose…")
|
||||||
|
: "search, or paste a link"
|
||||||
|
color: Theme.muted
|
||||||
|
font: input.font
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count, right-aligned over the input's tail.
|
||||||
|
Text {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.padL
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: root.results.length > 0
|
||||||
|
? (root.selected + 1) + "/" + root.results.length
|
||||||
|
: ""
|
||||||
|
color: Theme.muted
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsMicro
|
||||||
|
font.letterSpacing: 1
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Skew {
|
||||||
|
id: divider
|
||||||
|
anchors.top: header.bottom
|
||||||
|
width: parent.width
|
||||||
|
height: Theme.stroke
|
||||||
|
color: Theme.alpha(Theme.outline, 0.8)
|
||||||
|
lean: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------- list
|
||||||
|
Item {
|
||||||
|
id: listBox
|
||||||
|
anchors.top: divider.bottom
|
||||||
|
width: parent.width
|
||||||
|
height: Math.min(root.results.length, root.maxRows) * root.rowHeight
|
||||||
|
+ (root.results.length > 0 ? Theme.padS * 2 : 0)
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Behavior on height {
|
||||||
|
NumberAnimation { duration: Theme.durBase; easing.type: Easing.OutExpo }
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: list
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: Theme.padS
|
||||||
|
anchors.bottomMargin: Theme.padS
|
||||||
|
anchors.leftMargin: Theme.padM
|
||||||
|
anchors.rightMargin: Theme.padM
|
||||||
|
model: root.results
|
||||||
|
currentIndex: root.selected
|
||||||
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
reuseItems: true
|
||||||
|
|
||||||
|
delegate: ResultRow {
|
||||||
|
required property var modelData
|
||||||
|
required property int index
|
||||||
|
|
||||||
|
width: list.width
|
||||||
|
entry: modelData
|
||||||
|
selected: index === root.selected
|
||||||
|
badge: root.arg !== "" ? "OPEN ⏎" : "⏎"
|
||||||
|
onActivated: {
|
||||||
|
root.selected = index;
|
||||||
|
root.activate();
|
||||||
|
}
|
||||||
|
onPinRequested: {
|
||||||
|
root.selected = index;
|
||||||
|
root.pin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Empty state. Says which of the two ways to be empty it is,
|
||||||
|
// because "no results" and "nothing typed" want different
|
||||||
|
// things from you.
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: root.results.length === 0 && root.query !== ""
|
||||||
|
text: root.mode === "calc" ? "NOT AN EXPRESSION" : "NO MATCH"
|
||||||
|
color: Theme.muted
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsSmall
|
||||||
|
font.letterSpacing: 4
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------- hints
|
||||||
|
Item {
|
||||||
|
id: hint
|
||||||
|
anchors.top: listBox.bottom
|
||||||
|
width: parent.width
|
||||||
|
height: 30
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color: Theme.muted
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsMicro
|
||||||
|
font.letterSpacing: 3
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
text: root.selectMode
|
||||||
|
? "J K MOVE L PIN H UNPIN i TYPE ESC QUIT"
|
||||||
|
: root.mode === "dmenu"
|
||||||
|
? "⏎ CHOOSE ESC SELECT ↑↓ MOVE"
|
||||||
|
: root.mode === "clip"
|
||||||
|
? "⏎ COPY ESC SELECT ↑↓ MOVE"
|
||||||
|
: root.pinned
|
||||||
|
? "⏎ OPEN ESC SELECT ↑↓ PICK"
|
||||||
|
: "ESC SELECT TAB PIN > SHELL = CALC : CLIP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ keys
|
||||||
|
function handleKey(event: var): void {
|
||||||
|
if (!root.open) return;
|
||||||
|
|
||||||
|
const ctrl = (event.modifiers & Qt.ControlModifier) !== 0;
|
||||||
|
|
||||||
|
// Escape is the mode key, and it means what it means in vim: leave
|
||||||
|
// insert. From select mode there is nothing left to leave but the
|
||||||
|
// launcher itself, so the second press ends the prompt.
|
||||||
|
if (event.key === Qt.Key_Escape) {
|
||||||
|
if (!root.selectMode && root.results.length > 0) root.selectMode = true;
|
||||||
|
else Actions.closeLauncher();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// …and Ctrl+C still walks out in one press, from wherever you are.
|
||||||
|
if (ctrl && event.key === Qt.Key_C) {
|
||||||
|
Actions.closeLauncher();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||||
|
root.activate();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Tab) {
|
||||||
|
root.pin();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Down || (ctrl && event.key === Qt.Key_J)
|
||||||
|
|| (ctrl && event.key === Qt.Key_N)) {
|
||||||
|
root.move(1);
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === Qt.Key_Up || (ctrl && event.key === Qt.Key_K)
|
||||||
|
|| (ctrl && event.key === Qt.Key_P)) {
|
||||||
|
root.move(-1);
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctrl && event.key === Qt.Key_U) {
|
||||||
|
root.query = "";
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!root.selectMode) return;
|
||||||
|
|
||||||
|
// Select mode. The letters are commands, not text: `i` and `a` go back
|
||||||
|
// to insert without leaving an `i` behind, and everything unclaimed is
|
||||||
|
// swallowed rather than typed, so a stray `d` costs nothing at all.
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_J: root.move(1); event.accepted = true; return;
|
||||||
|
case Qt.Key_K: root.move(-1); event.accepted = true; return;
|
||||||
|
case Qt.Key_L: root.pin(); event.accepted = true; return;
|
||||||
|
case Qt.Key_H: root.unpin(); event.accepted = true; return;
|
||||||
|
case Qt.Key_I:
|
||||||
|
case Qt.Key_A:
|
||||||
|
root.selectMode = false;
|
||||||
|
input.forceActiveFocus();
|
||||||
|
// `a` appends, `i` leaves the cursor where it was — the same
|
||||||
|
// distinction, for the same reason.
|
||||||
|
if (event.key === Qt.Key_A) input.cursorPosition = input.text.length;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_G:
|
||||||
|
root.selected = (event.modifiers & Qt.ShiftModifier)
|
||||||
|
? root.results.length - 1 : 0;
|
||||||
|
list.positionViewAtIndex(root.selected, ListView.Contain);
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Backspace:
|
||||||
|
root.selectMode = false;
|
||||||
|
input.forceActiveFocus();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anything else in select mode is a command nobody bound. Eat it.
|
||||||
|
if (event.text !== "") event.accepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------- animation
|
||||||
|
ParallelAnimation {
|
||||||
|
id: openAnim
|
||||||
|
NumberAnimation {
|
||||||
|
target: backdrop; property: "opacity"
|
||||||
|
to: 1; duration: Theme.durBase; easing.type: Easing.OutQuad
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: shell; property: "opacity"
|
||||||
|
to: 1; duration: Theme.durBase
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: rise; property: "y"
|
||||||
|
from: 24; to: 0; duration: Theme.durSlow; easing.type: Easing.OutBack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ParallelAnimation {
|
||||||
|
id: closeAnim
|
||||||
|
NumberAnimation {
|
||||||
|
target: backdrop; property: "opacity"
|
||||||
|
to: 0; duration: Theme.durFast
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: shell; property: "opacity"
|
||||||
|
to: 0; duration: Theme.durFast
|
||||||
|
}
|
||||||
|
NumberAnimation {
|
||||||
|
target: rise; property: "y"
|
||||||
|
to: 16; duration: Theme.durFast; easing.type: Easing.InQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Widgets
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/components"
|
||||||
|
|
||||||
|
// One line in the result list. Rest is bare — no fill, no border — so a list of
|
||||||
|
// forty apps reads as a column of text rather than forty boxes. Only the
|
||||||
|
// selected row gets a slab, and it takes the full inverted treatment: white
|
||||||
|
// fill, black text. That is the strongest contrast the palette has, which is
|
||||||
|
// what the row you are about to launch should be wearing.
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property var entry
|
||||||
|
required property bool selected
|
||||||
|
property bool hovered: false
|
||||||
|
property string badge: ""
|
||||||
|
|
||||||
|
signal activated
|
||||||
|
signal pinRequested
|
||||||
|
|
||||||
|
implicitHeight: 46
|
||||||
|
|
||||||
|
// Selection slab. Leans like everything else; drawn as a Skew so the
|
||||||
|
// diagonals get analytic antialiasing instead of a pixel staircase.
|
||||||
|
Skew {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: -Theme.padS
|
||||||
|
anchors.rightMargin: -Theme.padS
|
||||||
|
color: root.selected ? Theme.treatmentSelectedFill : "transparent"
|
||||||
|
opacity: root.selected ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation { duration: Theme.durFast; easing.type: Easing.OutQuad }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hover is a crimson tick in the gutter rather than a second slab, so
|
||||||
|
// pointing at a row cannot be mistaken for selecting it.
|
||||||
|
Skew {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
x: -Theme.padS
|
||||||
|
width: 3
|
||||||
|
height: root.hovered && !root.selected ? parent.height - 10 : 0
|
||||||
|
color: Theme.accent
|
||||||
|
|
||||||
|
Behavior on height {
|
||||||
|
NumberAnimation { duration: Theme.durFast; easing.type: Easing.OutBack }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Theme.padM
|
||||||
|
anchors.rightMargin: Theme.padM
|
||||||
|
spacing: Theme.padM
|
||||||
|
|
||||||
|
IconImage {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
implicitSize: 26
|
||||||
|
asynchronous: true
|
||||||
|
source: root.entry.icon ? Quickshell.iconPath(root.entry.icon, true) : ""
|
||||||
|
visible: source !== ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entries with no icon still need to occupy the same gutter, or their
|
||||||
|
// labels wander left and the column stops being a column.
|
||||||
|
Icon {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 26
|
||||||
|
text: ""
|
||||||
|
color: root.selected ? Theme.treatmentSelectedText : Theme.muted
|
||||||
|
visible: !root.entry.icon && root.entry.kind !== "dmenu"
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: parent.width - 26 - Theme.padM * 2 - trailing.width
|
||||||
|
spacing: -1
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: root.entry.name
|
||||||
|
elide: Text.ElideRight
|
||||||
|
color: root.selected ? Theme.treatmentSelectedText : Theme.text
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsBody
|
||||||
|
font.weight: root.selected ? Font.Bold : Theme.weightBody
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
text: root.entry.sub
|
||||||
|
visible: text !== ""
|
||||||
|
elide: Text.ElideRight
|
||||||
|
color: root.selected ? Theme.alpha(Theme.ink, 0.6) : Theme.muted
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsMicro
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trailing hint: the key that fires this row. Only the selected row shows
|
||||||
|
// one, because a column of ⏎ glyphs tells you nothing.
|
||||||
|
Text {
|
||||||
|
id: trailing
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.padM
|
||||||
|
text: root.selected ? root.badge : ""
|
||||||
|
color: Theme.alpha(Theme.ink, 0.55)
|
||||||
|
font.family: Theme.fontMono
|
||||||
|
font.pixelSize: Theme.fsMicro
|
||||||
|
font.letterSpacing: 2
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
onHoveredChanged: root.hovered = hovered
|
||||||
|
}
|
||||||
|
|
||||||
|
TapHandler {
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
onTapped: (point, button) => {
|
||||||
|
if (button === Qt.RightButton) root.pinRequested();
|
||||||
|
else root.activated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# fuzzel --dmenu, backed by the Takemi launcher in Quickshell.
|
||||||
|
#
|
||||||
|
# Reads choices on stdin, prints the chosen line on stdout, prints nothing if
|
||||||
|
# the launcher was dismissed. Accepts the handful of fuzzel flags the callers
|
||||||
|
# in this config actually pass so they did not have to be rewritten.
|
||||||
|
#
|
||||||
|
# The launcher lives in the already-running shell process, so unlike fuzzel
|
||||||
|
# there is nothing to start; the cost here is the two-file handshake, which
|
||||||
|
# exists because `qs ipc call` returns immediately and a dmenu has to block.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
prompt=""
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--dmenu|-d) ;;
|
||||||
|
--prompt) prompt="${2-}"; shift ;;
|
||||||
|
--prompt=*) prompt="${1#--prompt=}" ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
dir=$(mktemp -d)
|
||||||
|
trap 'rm -rf "$dir"' EXIT INT TERM
|
||||||
|
cat > "$dir/in"
|
||||||
|
|
||||||
|
qs ipc call shell dmenu "$dir/in" "$dir/out" "$prompt" >/dev/null
|
||||||
|
|
||||||
|
# Give up after two minutes rather than wedging a caller forever if the shell
|
||||||
|
# is reloaded out from under us mid-choice.
|
||||||
|
i=0
|
||||||
|
while [ ! -e "$dir/out" ]; do
|
||||||
|
i=$((i + 1))
|
||||||
|
[ "$i" -gt 2400 ] && exit 1
|
||||||
|
sleep 0.05
|
||||||
|
done
|
||||||
|
|
||||||
|
cat "$dir/out"
|
||||||
@@ -3,6 +3,7 @@ pragma Singleton
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import Quickshell.Hyprland
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
|
|
||||||
// Shell-wide UI state and the handful of external commands the shell fires.
|
// Shell-wide UI state and the handful of external commands the shell fires.
|
||||||
@@ -15,6 +16,18 @@ Singleton {
|
|||||||
property bool powerMenuOpen: false
|
property bool powerMenuOpen: false
|
||||||
property bool lockRequested: false
|
property bool lockRequested: false
|
||||||
property bool sidebarOpen: false
|
property bool sidebarOpen: false
|
||||||
|
property bool launcherOpen: false
|
||||||
|
|
||||||
|
// Seed text for the next launcher open. Lets a keybind or a script hand the
|
||||||
|
// launcher a query it did not have to type — `qs ipc call shell prompt
|
||||||
|
// "https://…"` is an open-with dialog for anything that can run a command.
|
||||||
|
property string launcherSeed: ""
|
||||||
|
|
||||||
|
// A launcher window exists on every screen, but only one of them is being
|
||||||
|
// typed at. Latch the focused monitor at open time so the window appears
|
||||||
|
// there alone — latched rather than live, because the launcher itself takes
|
||||||
|
// keyboard focus and because a window should not hop mid-query.
|
||||||
|
property string launcherScreen: ""
|
||||||
|
|
||||||
signal osdRequested(string kind)
|
signal osdRequested(string kind)
|
||||||
|
|
||||||
@@ -22,21 +35,44 @@ Singleton {
|
|||||||
function closePowerMenu() { root.powerMenuOpen = false; }
|
function closePowerMenu() { root.powerMenuOpen = false; }
|
||||||
function lock() { root.powerMenuOpen = false; root.lockRequested = true; }
|
function lock() { root.powerMenuOpen = false; root.lockRequested = true; }
|
||||||
|
|
||||||
|
function focusedScreenName(): string {
|
||||||
|
return Hyprland.focusedMonitor?.name
|
||||||
|
?? Quickshell.screens[0]?.name
|
||||||
|
?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleLauncher() {
|
||||||
|
if (!root.launcherOpen) {
|
||||||
|
root.launcherSeed = "";
|
||||||
|
root.launcherScreen = root.focusedScreenName();
|
||||||
|
}
|
||||||
|
root.launcherOpen = !root.launcherOpen;
|
||||||
|
}
|
||||||
|
function closeLauncher() { root.launcherOpen = false; }
|
||||||
|
|
||||||
|
// Stand in for `fuzzel --dmenu`. See Apps.beginDmenu for the transport.
|
||||||
|
function dmenuLauncher(inPath: string, outPath: string, prompt: string) {
|
||||||
|
Apps.beginDmenu(inPath, outPath, prompt);
|
||||||
|
root.launcherSeed = "";
|
||||||
|
root.launcherScreen = root.focusedScreenName();
|
||||||
|
root.launcherOpen = false;
|
||||||
|
root.launcherOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function promptLauncher(seed: string) {
|
||||||
|
root.launcherSeed = seed;
|
||||||
|
root.launcherScreen = root.focusedScreenName();
|
||||||
|
root.launcherOpen = false;
|
||||||
|
root.launcherOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------- commands
|
// ------------------------------------------------------------- commands
|
||||||
// Each slot gets its own Process so a slow one cannot cancel another.
|
// Detached, because nothing here is ever read back. Rotating a fixed set of
|
||||||
Process { id: slotA }
|
// `Process` slots only moves the collision: `uwsm app` lives as long as the
|
||||||
Process { id: slotB }
|
// app it started, so the fourth launch reclaims the first slot and kills the
|
||||||
Process { id: slotC }
|
// app still holding it — and a shell reload kills every one of them at once.
|
||||||
|
|
||||||
property int _slot: 0
|
|
||||||
|
|
||||||
function run(argv: var) {
|
function run(argv: var) {
|
||||||
const slots = [slotA, slotB, slotC];
|
Quickshell.execDetached(argv);
|
||||||
const p = slots[root._slot % slots.length];
|
|
||||||
root._slot++;
|
|
||||||
p.running = false;
|
|
||||||
p.command = argv;
|
|
||||||
p.running = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function launch(app: string) {
|
function launch(app: string) {
|
||||||
@@ -62,6 +98,11 @@ Singleton {
|
|||||||
|
|
||||||
function lock(): void { root.lock(); }
|
function lock(): void { root.lock(); }
|
||||||
function power(): void { root.togglePowerMenu(); }
|
function power(): void { root.togglePowerMenu(); }
|
||||||
|
function launcher(): void { root.toggleLauncher(); }
|
||||||
|
function prompt(seed: string): void { root.promptLauncher(seed); }
|
||||||
|
function dmenu(inPath: string, outPath: string, prompt: string): void {
|
||||||
|
root.dmenuLauncher(inPath, outPath, prompt);
|
||||||
|
}
|
||||||
function reloadConfig(): void { root.reloadShell(); }
|
function reloadConfig(): void { root.reloadShell(); }
|
||||||
function toggleDnd(): void { Notifs.toggleDnd(); }
|
function toggleDnd(): void { Notifs.toggleDnd(); }
|
||||||
function clearNotifications(): void { Notifs.clearAll(); }
|
function clearNotifications(): void { Notifs.clearAll(); }
|
||||||
|
|||||||
@@ -0,0 +1,537 @@
|
|||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
// The launcher's brain: the application index, the query language, ranking,
|
||||||
|
// and the actual spawning. The UI in launcher/ owns no logic beyond keys and
|
||||||
|
// animation — everything it shows comes out of `results`.
|
||||||
|
//
|
||||||
|
// The one idea the launcher is built around is that a query is a *verb plus an
|
||||||
|
// object*. Fuzzel only ever had the verb: you typed a name and it ran the app
|
||||||
|
// with no arguments. Here the object is first class, so `gitlab.enqs.de` is a
|
||||||
|
// complete thought — the object is the URL, and the list becomes the set of
|
||||||
|
// verbs that can act on it, with the system default already selected. Hitting
|
||||||
|
// Enter the moment you stop typing is the fast path; arrowing down to a
|
||||||
|
// different verb is the slow one.
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
// ------------------------------------------------------------- the index
|
||||||
|
// Every launchable thing, flattened. A desktop entry with actions
|
||||||
|
// contributes one item per action as well as itself, so "Brave (Private)"
|
||||||
|
// is a peer of "Brave" in the list rather than something you have to drill
|
||||||
|
// into. That is the whole reason fuzzel's `show-actions` was off: nested
|
||||||
|
// disclosure in a launcher is a step too many.
|
||||||
|
readonly property var index: {
|
||||||
|
const out = [];
|
||||||
|
const apps = DesktopEntries.applications.values;
|
||||||
|
|
||||||
|
for (let i = 0; i < apps.length; i++) {
|
||||||
|
const e = apps[i];
|
||||||
|
if (e.noDisplay) continue;
|
||||||
|
|
||||||
|
out.push({
|
||||||
|
key: root._entryKey(e.id),
|
||||||
|
id: e.id,
|
||||||
|
actionId: "",
|
||||||
|
name: e.name,
|
||||||
|
sub: e.genericName || e.comment || "",
|
||||||
|
icon: e.icon,
|
||||||
|
exec: e.execString,
|
||||||
|
categories: root._bag(e.categories),
|
||||||
|
keywords: root._bag(e.keywords),
|
||||||
|
terminal: e.runInTerminal,
|
||||||
|
kind: "app"
|
||||||
|
});
|
||||||
|
|
||||||
|
const actions = e.actions;
|
||||||
|
for (let j = 0; j < actions.length; j++) {
|
||||||
|
const a = actions[j];
|
||||||
|
out.push({
|
||||||
|
key: root._entryKey(e.id) + ":" + a.id,
|
||||||
|
id: e.id,
|
||||||
|
actionId: a.id,
|
||||||
|
name: e.name + " · " + a.name,
|
||||||
|
sub: a.name,
|
||||||
|
icon: a.icon || e.icon,
|
||||||
|
exec: a.execString,
|
||||||
|
categories: root._bag(e.categories),
|
||||||
|
keywords: root._bag(e.keywords),
|
||||||
|
terminal: e.runInTerminal,
|
||||||
|
kind: "action"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _entryKey(id: string): string {
|
||||||
|
return id.endsWith(".desktop") ? id : id + ".desktop";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Categories and Keywords come across as string *lists*, not strings, and
|
||||||
|
// an absent one is undefined rather than empty. Both get flattened to one
|
||||||
|
// lowercase haystack so the scoring below can just call `includes`.
|
||||||
|
function _bag(v: var): string {
|
||||||
|
if (!v) return "";
|
||||||
|
return (Array.isArray(v) ? v.join(" ") : String(v)).toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------- query parsing
|
||||||
|
// A query resolves to a mode and, in app mode, an optional argument. There
|
||||||
|
// are two ways to end up with an argument:
|
||||||
|
//
|
||||||
|
// pinned you pressed Tab on a result, which froze that app as the verb
|
||||||
|
// and handed the rest of the input to it. Unambiguous, works
|
||||||
|
// for arguments that look like nothing in particular.
|
||||||
|
// implicit what you typed is *obviously* an object — a URL, a path, an
|
||||||
|
// email. Nothing is pinned, so every app is a candidate verb
|
||||||
|
// and the ranking decides who goes first.
|
||||||
|
//
|
||||||
|
// Implicit detection is deliberately conservative. A false positive turns
|
||||||
|
// an app search into an open-with list, which is jarring; a false negative
|
||||||
|
// just means you press Tab.
|
||||||
|
readonly property var urlRe: /^[a-z][a-z0-9+.-]*:\/\//i
|
||||||
|
readonly property var hostRe: /^([a-z0-9-]+\.)+[a-z]{2,}(\/\S*)?$/i
|
||||||
|
readonly property var mailRe: /^[^\s@]+@[^\s@]+\.[a-z]{2,}$/i
|
||||||
|
readonly property var pathRe: /^(~|\/|\.\/)\S*$/
|
||||||
|
|
||||||
|
function classify(text: string): string {
|
||||||
|
const t = text.trim();
|
||||||
|
if (t === "") return "";
|
||||||
|
if (root.urlRe.test(t) || root.hostRe.test(t)) return "url";
|
||||||
|
if (root.mailRe.test(t)) return "mail";
|
||||||
|
if (root.pathRe.test(t)) return "path";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn a bare host into something a browser will accept. `gitlab.enqs.de`
|
||||||
|
// on its own is a relative path as far as xdg-open is concerned.
|
||||||
|
function normalizeArg(text: string, kind: string): string {
|
||||||
|
const t = text.trim();
|
||||||
|
if (kind === "url") return root.urlRe.test(t) ? t : "https://" + t;
|
||||||
|
if (kind === "mail") return "mailto:" + t;
|
||||||
|
if (kind === "path" && t.startsWith("~"))
|
||||||
|
return Quickshell.env("HOME") + t.slice(1);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------- defaults
|
||||||
|
// Which app the system would have picked. This is what puts Brave at row
|
||||||
|
// zero without the launcher having an opinion about browsers.
|
||||||
|
property string defaultBrowser: ""
|
||||||
|
property string defaultMail: ""
|
||||||
|
|
||||||
|
Process {
|
||||||
|
running: true
|
||||||
|
command: ["xdg-mime", "query", "default", "x-scheme-handler/https"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: root.defaultBrowser = this.text.trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
running: true
|
||||||
|
command: ["xdg-mime", "query", "default", "x-scheme-handler/mailto"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: root.defaultMail = this.text.trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------- ranking
|
||||||
|
// Subsequence match with a bias toward matches that start a word. Returns
|
||||||
|
// -1 for no match. The numbers are only meaningful relative to each other.
|
||||||
|
function fuzzy(hay: string, needle: string): real {
|
||||||
|
if (needle === "") return 0;
|
||||||
|
const h = hay.toLowerCase();
|
||||||
|
const n = needle.toLowerCase();
|
||||||
|
|
||||||
|
if (h === n) return 1000;
|
||||||
|
if (h.startsWith(n)) return 700 - h.length;
|
||||||
|
|
||||||
|
// Start of any word inside the name — "code" hitting "Visual Studio
|
||||||
|
// Code" should beat "code" scattered through "Chromium Dev Tools".
|
||||||
|
const word = h.indexOf(" " + n);
|
||||||
|
if (word !== -1) return 500 - word;
|
||||||
|
if (h.includes(n)) return 300 - h.indexOf(n);
|
||||||
|
|
||||||
|
// Plain subsequence, penalised by how far apart the letters are.
|
||||||
|
let score = 120;
|
||||||
|
let at = -1;
|
||||||
|
for (let i = 0; i < n.length; i++) {
|
||||||
|
const next = h.indexOf(n[i], at + 1);
|
||||||
|
if (next === -1) return -1;
|
||||||
|
score -= (next - at - 1) * 0.5;
|
||||||
|
at = next;
|
||||||
|
}
|
||||||
|
return Math.max(score, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _appScore(item: var, term: string): real {
|
||||||
|
if (term === "") return 0;
|
||||||
|
|
||||||
|
let best = root.fuzzy(item.name, term);
|
||||||
|
|
||||||
|
// Secondary fields are worth less than the name on purpose: matching a
|
||||||
|
// Keywords= line should break a tie, not win outright.
|
||||||
|
const sub = root.fuzzy(item.sub, term);
|
||||||
|
if (sub > 0) best = Math.max(best, sub * 0.45);
|
||||||
|
|
||||||
|
const id = root.fuzzy(item.id, term);
|
||||||
|
if (id > 0) best = Math.max(best, id * 0.6);
|
||||||
|
|
||||||
|
if (item.keywords.includes(term.toLowerCase()))
|
||||||
|
best = Math.max(best, 140);
|
||||||
|
|
||||||
|
// An action only surfaces on a free-text search once you have typed
|
||||||
|
// enough to plausibly mean it, otherwise every browser triples the
|
||||||
|
// length of the list for a one-letter query.
|
||||||
|
if (item.kind === "action" && term.length < 2) return -1;
|
||||||
|
|
||||||
|
return best;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How well an app suits an object it did not ask for. Everything stays in
|
||||||
|
// the list — the point is that you can open a URL with anything — but the
|
||||||
|
// system default and then the plausible handlers float up.
|
||||||
|
function _affinity(item: var, kind: string): real {
|
||||||
|
let a = 0;
|
||||||
|
|
||||||
|
if (kind === "url" || kind === "mail") {
|
||||||
|
const wanted = kind === "url" ? root.defaultBrowser : root.defaultMail;
|
||||||
|
if (wanted !== "" && item.key.startsWith(wanted)) a += 4000;
|
||||||
|
if (item.categories.includes("webbrowser")) a += 2000;
|
||||||
|
if (kind === "mail" && item.categories.includes("email")) a += 2500;
|
||||||
|
if (item.categories.includes("network")) a += 400;
|
||||||
|
} else if (kind === "path") {
|
||||||
|
if (item.categories.includes("filemanager")) a += 2500;
|
||||||
|
if (item.categories.includes("texteditor")) a += 1800;
|
||||||
|
if (item.categories.includes("development")) a += 600;
|
||||||
|
if (item.terminal) a += 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The main entry outranks its own actions for an unasked-for object:
|
||||||
|
// "open this link in Brave" is the common case, "…in a private window"
|
||||||
|
// is the deliberate one.
|
||||||
|
if (item.kind === "action") a -= 250;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The single entry point the UI binds to.
|
||||||
|
//
|
||||||
|
// term what to match apps against ("" means "everything")
|
||||||
|
// arg the object, if any
|
||||||
|
// argKind "" | url | mail | path
|
||||||
|
function search(term: string, arg: string, argKind: string): var {
|
||||||
|
const scored = [];
|
||||||
|
const idx = root.index;
|
||||||
|
const open = arg !== "";
|
||||||
|
|
||||||
|
for (let i = 0; i < idx.length; i++) {
|
||||||
|
const item = idx[i];
|
||||||
|
let s = root._appScore(item, term);
|
||||||
|
if (term !== "" && s < 0) continue;
|
||||||
|
|
||||||
|
// With nothing typed, actions would double the length of a list
|
||||||
|
// that is already just "your apps, by how often you use them".
|
||||||
|
if (term === "" && !open && item.kind === "action") continue;
|
||||||
|
|
||||||
|
if (open) s += root._affinity(item, argKind);
|
||||||
|
s += root.frecency(item.key);
|
||||||
|
scored.push({ item: item, score: s });
|
||||||
|
}
|
||||||
|
|
||||||
|
scored.sort((a, b) => b.score - a.score || a.item.name.localeCompare(b.item.name));
|
||||||
|
return scored.slice(0, 60).map(e => e.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------- frecency
|
||||||
|
// Usage decays: something you opened forty times last year should not
|
||||||
|
// outrank what you opened twice this morning. Half-life is a week, which
|
||||||
|
// is long enough to be stable and short enough to follow a change of
|
||||||
|
// project.
|
||||||
|
property var usage: ({})
|
||||||
|
readonly property real halfLife: 7 * 24 * 3600
|
||||||
|
|
||||||
|
function frecency(key: string): real {
|
||||||
|
const u = root.usage[key];
|
||||||
|
if (!u) return 0;
|
||||||
|
const age = Date.now() / 1000 - u.t;
|
||||||
|
return u.n * 240 * Math.pow(0.5, age / root.halfLife);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _remember(key: string): void {
|
||||||
|
const u = root.usage[key];
|
||||||
|
const now = Date.now() / 1000;
|
||||||
|
|
||||||
|
// Decay the stored count on write rather than letting it grow without
|
||||||
|
// bound, so `n` stays a decayed weight instead of a lifetime total.
|
||||||
|
const decayed = u ? u.n * Math.pow(0.5, (now - u.t) / root.halfLife) : 0;
|
||||||
|
root.usage[key] = { n: decayed + 1, t: now };
|
||||||
|
root.usageChanged();
|
||||||
|
store.setText(JSON.stringify(root.usage));
|
||||||
|
}
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
id: store
|
||||||
|
path: Quickshell.env("HOME") + "/.local/state/takemi/launcher.json"
|
||||||
|
preload: true
|
||||||
|
printErrors: false
|
||||||
|
atomicWrites: true
|
||||||
|
onLoaded: {
|
||||||
|
try {
|
||||||
|
root.usage = JSON.parse(store.text()) || ({});
|
||||||
|
} catch (e) {
|
||||||
|
root.usage = ({});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------- spawn
|
||||||
|
// Handing uwsm a desktop ID is the good path: it expands the Exec field
|
||||||
|
// codes around our argument, picks the terminal for Terminal=true entries,
|
||||||
|
// and drops the process in its own scope.
|
||||||
|
//
|
||||||
|
// It refuses one thing, and it is exactly the thing this launcher is for.
|
||||||
|
// `Exec=brave --incognito` declares no field code, so uwsm rejects
|
||||||
|
// `brave-browser.desktop:new-private-window <url>` with "does not support
|
||||||
|
// arguments" — which would make "open this link in a private window", the
|
||||||
|
// motivating example for the whole feature, the one case that does not
|
||||||
|
// work. Most Desktop Action entries are written that way.
|
||||||
|
//
|
||||||
|
// So when the target declares no placeholder we build the command line
|
||||||
|
// ourselves and hand uwsm an argv instead of an ID. It is still scoped and
|
||||||
|
// still supervised; we just did the expansion.
|
||||||
|
readonly property var fieldRe: /%[fFuU]/
|
||||||
|
readonly property var anyFieldRe: /^%[a-zA-Z]$/
|
||||||
|
|
||||||
|
function launch(item: var, arg: string): void {
|
||||||
|
root._remember(item.key);
|
||||||
|
|
||||||
|
if (arg === "") {
|
||||||
|
Quickshell.execDetached(["uwsm", "app", "--", item.key]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.fieldRe.test(item.exec || "")) {
|
||||||
|
Quickshell.execDetached(["uwsm", "app", "--", item.key, arg]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const argv = root._tokenize(item.exec || "")
|
||||||
|
.filter(t => !root.anyFieldRe.test(t));
|
||||||
|
if (argv.length === 0) {
|
||||||
|
Quickshell.execDetached(["uwsm", "app", "--", item.key]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
argv.push(arg);
|
||||||
|
|
||||||
|
// Without this the unit is named after the bare executable and every
|
||||||
|
// app launched this way collides in the unit namespace.
|
||||||
|
const name = item.key.replace(".desktop", "").replace(/[^a-zA-Z0-9_-]/g, "-");
|
||||||
|
const head = ["uwsm", "app", "-a", name];
|
||||||
|
if (item.terminal) head.push("-T");
|
||||||
|
Quickshell.execDetached(head.concat(["--"]).concat(argv));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec lines are shell-ish but not shell: the spec allows double quotes and
|
||||||
|
// backslash escapes, and nothing else. Splitting on whitespace would break
|
||||||
|
// every entry with a quoted path, and running it through `sh -c` would make
|
||||||
|
// a desktop file a code-execution surface.
|
||||||
|
function _tokenize(line: string): var {
|
||||||
|
const out = [];
|
||||||
|
let cur = "";
|
||||||
|
let quoted = false;
|
||||||
|
let has = false;
|
||||||
|
|
||||||
|
for (let i = 0; i < line.length; i++) {
|
||||||
|
const c = line[i];
|
||||||
|
if (c === "\\" && i + 1 < line.length) {
|
||||||
|
cur += line[++i];
|
||||||
|
has = true;
|
||||||
|
} else if (c === '"') {
|
||||||
|
quoted = !quoted;
|
||||||
|
has = true;
|
||||||
|
} else if (!quoted && (c === " " || c === "\t")) {
|
||||||
|
if (has) { out.push(cur); cur = ""; has = false; }
|
||||||
|
} else {
|
||||||
|
cur += c;
|
||||||
|
has = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (has) out.push(cur);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runShell(line: string, inTerminal: bool): void {
|
||||||
|
if (line.trim() === "") return;
|
||||||
|
if (inTerminal) Quickshell.execDetached(["uwsm", "app", "-T", "--", "sh", "-c", line]);
|
||||||
|
else Quickshell.execDetached(["uwsm", "app", "--", "sh", "-c", line]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function copy(text: string): void {
|
||||||
|
Quickshell.execDetached(["wl-copy", "--", text]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Everything above spawns through `Quickshell.execDetached` rather than a
|
||||||
|
// `Process`, and it has to. `uwsm app` does not exit once the scope is up —
|
||||||
|
// it stays on as the scope's main process for as long as the app lives. A
|
||||||
|
// shared `Process` therefore never goes idle, so the next `exec()` kills the
|
||||||
|
// previous uwsm, systemd tears down the scope with it, and launching the
|
||||||
|
// second app closes the first. Shell reload did the same thing to every app
|
||||||
|
// at once, since `manageLifetime` kills the child when the object goes away.
|
||||||
|
//
|
||||||
|
// A detached spawn is owned by nobody here, which is exactly right: once
|
||||||
|
// uwsm has the scope, the shell has no further business in that lifetime.
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------- dmenu
|
||||||
|
// The launcher can stand in for `fuzzel --dmenu`, which is what lets fuzzel
|
||||||
|
// leave the system entirely: fluxo's bluetooth menu and anything else that
|
||||||
|
// pipes a list through a picker go through here instead.
|
||||||
|
//
|
||||||
|
// The transport is two files, because IPC calls return immediately and a
|
||||||
|
// dmenu has to block until someone chooses. `takemi-dmenu` writes the
|
||||||
|
// choices, calls in, then waits for the answer file to appear. If the
|
||||||
|
// launcher is dismissed the answer file is written empty, so the caller
|
||||||
|
// sees an empty selection rather than hanging.
|
||||||
|
property var dmenuItems: []
|
||||||
|
property string dmenuPrompt: ""
|
||||||
|
property string dmenuOut: ""
|
||||||
|
readonly property bool dmenuActive: root.dmenuOut !== ""
|
||||||
|
|
||||||
|
function beginDmenu(inPath: string, outPath: string, prompt: string): void {
|
||||||
|
root.dmenuPrompt = prompt;
|
||||||
|
root.dmenuOut = outPath;
|
||||||
|
dmenuIn.path = "";
|
||||||
|
dmenuIn.path = inPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Writing the answer with a FileView does not work: assigning `path` kicks
|
||||||
|
// off a read of a file that does not exist yet, and the write never lands —
|
||||||
|
// which leaves the caller blocked until its own timeout. A one-shot
|
||||||
|
// redirect is both simpler and actually synchronous from the caller's point
|
||||||
|
// of view, since the file appears complete or not at all.
|
||||||
|
//
|
||||||
|
// The choice and the path go in as positional arguments rather than being
|
||||||
|
// interpolated into the script, so a clipboard entry containing a quote or
|
||||||
|
// a `$(…)` is data and stays data.
|
||||||
|
function finishDmenu(choice: string): void {
|
||||||
|
if (root.dmenuOut === "") return;
|
||||||
|
// Write beside the target and rename, so the waiting script can treat
|
||||||
|
// "the file exists" as "the answer is complete".
|
||||||
|
dmenuWriter.exec(["sh", "-c",
|
||||||
|
'printf "%s" "$1" > "$2.part" && mv "$2.part" "$2"',
|
||||||
|
"sh", choice, root.dmenuOut]);
|
||||||
|
root.dmenuOut = "";
|
||||||
|
root.dmenuItems = [];
|
||||||
|
root.dmenuPrompt = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Process { id: dmenuWriter }
|
||||||
|
|
||||||
|
FileView {
|
||||||
|
id: dmenuIn
|
||||||
|
onLoaded: {
|
||||||
|
const out = [];
|
||||||
|
const lines = dmenuIn.text().split("\n");
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
if (lines[i] === "") continue;
|
||||||
|
out.push({ kind: "dmenu", name: lines[i], sub: "", icon: "" });
|
||||||
|
}
|
||||||
|
root.dmenuItems = out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchDmenu(term: string): var {
|
||||||
|
if (term === "") return root.dmenuItems.slice(0, 200);
|
||||||
|
const scored = [];
|
||||||
|
for (let i = 0; i < root.dmenuItems.length; i++) {
|
||||||
|
const c = root.dmenuItems[i];
|
||||||
|
const s = root.fuzzy(c.name, term);
|
||||||
|
if (s < 0) continue;
|
||||||
|
scored.push({ item: c, score: s });
|
||||||
|
}
|
||||||
|
scored.sort((a, b) => b.score - a.score);
|
||||||
|
return scored.slice(0, 200).map(e => e.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------- clipboard
|
||||||
|
// cliphist keeps the history; this just reads and replays it. `cliphist
|
||||||
|
// list` emits "<id>\t<preview>" per line, where the preview is already
|
||||||
|
// single-line and truncated — binary entries come through as a
|
||||||
|
// "[[ binary data … ]]" placeholder, which is exactly what should be shown
|
||||||
|
// for them anyway.
|
||||||
|
property var clips: []
|
||||||
|
|
||||||
|
function refreshClips(): void {
|
||||||
|
clipList.running = false;
|
||||||
|
clipList.running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: clipList
|
||||||
|
command: ["cliphist", "list"]
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
const out = [];
|
||||||
|
const lines = this.text.split("\n");
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const tab = lines[i].indexOf("\t");
|
||||||
|
if (tab <= 0) continue;
|
||||||
|
const id = lines[i].slice(0, tab);
|
||||||
|
if (!/^[0-9]+$/.test(id)) continue;
|
||||||
|
out.push({
|
||||||
|
kind: "clip",
|
||||||
|
clipId: id,
|
||||||
|
name: lines[i].slice(tab + 1),
|
||||||
|
sub: "",
|
||||||
|
icon: "edit-paste"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
root.clips = out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The id is checked against /^[0-9]+$/ on the way in, above, which is what
|
||||||
|
// makes it safe to put on a shell command line. Decoding needs the pipe:
|
||||||
|
// entries can be binary, so the bytes must go straight from cliphist into
|
||||||
|
// wl-copy without being round-tripped through a QML string.
|
||||||
|
function pasteClip(item: var): void {
|
||||||
|
if (!/^[0-9]+$/.test(item.clipId)) return;
|
||||||
|
Quickshell.execDetached(["sh", "-c", "cliphist decode " + item.clipId + " | wl-copy"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchClips(term: string): var {
|
||||||
|
if (term === "") return root.clips.slice(0, 60);
|
||||||
|
const scored = [];
|
||||||
|
for (let i = 0; i < root.clips.length; i++) {
|
||||||
|
const c = root.clips[i];
|
||||||
|
const s = root.fuzzy(c.name, term);
|
||||||
|
if (s < 0) continue;
|
||||||
|
scored.push({ item: c, score: s });
|
||||||
|
}
|
||||||
|
scored.sort((a, b) => b.score - a.score);
|
||||||
|
return scored.slice(0, 60).map(e => e.item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------ calculator
|
||||||
|
// Arithmetic only. The expression is checked against a whitelist before it
|
||||||
|
// goes anywhere near the JS engine — a launcher that evals whatever you
|
||||||
|
// typed is a launcher that runs whatever a stray paste contained.
|
||||||
|
readonly property var mathRe: /^[0-9+\-*/%(). ,e]+$/i
|
||||||
|
|
||||||
|
function calc(expr: string): string {
|
||||||
|
const e = expr.trim();
|
||||||
|
if (e === "" || !root.mathRe.test(e)) return "";
|
||||||
|
try {
|
||||||
|
const v = Function('"use strict"; return (' + e + ')')();
|
||||||
|
if (typeof v !== "number" || !isFinite(v)) return "";
|
||||||
|
return String(Math.round(v * 1e10) / 1e10);
|
||||||
|
} catch (err) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+101
-140
@@ -7,12 +7,18 @@ import Quickshell.Io
|
|||||||
// Hardware telemetry, sourced from the user's `fluxo` daemon. fluxo's hardware
|
// Hardware telemetry, sourced from the user's `fluxo` daemon. fluxo's hardware
|
||||||
// modules are configured to emit raw pipe-delimited values (see
|
// modules are configured to emit raw pipe-delimited values (see
|
||||||
// ~/.config/fluxo/config.toml); everything here is parsing and formatting.
|
// ~/.config/fluxo/config.toml); everything here is parsing and formatting.
|
||||||
|
//
|
||||||
|
// Fed by a single long-lived `fluxo stream` subscription. This used to be two
|
||||||
|
// Timers driving seven separate `Process` objects, each forking a `fluxo
|
||||||
|
// <module>` client — five forks every 2 s plus two more every 20 s, so about
|
||||||
|
// 2.5 process spawns a second, each one exec'ing and dynamically linking a 13 MB
|
||||||
|
// binary to read a number the daemon already had in memory, and each metric
|
||||||
|
// still up to one interval stale. `fluxo stream` keeps one connection open and
|
||||||
|
// pushes a JSON line only when a module's output actually changes: no forks, and
|
||||||
|
// values land as soon as the daemon has them.
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Poll interval. The bar reads these continuously, so keep it modest.
|
|
||||||
property int interval: 2000
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------ cpu
|
// ------------------------------------------------------------------ cpu
|
||||||
property real cpuUsage: 0
|
property real cpuUsage: 0
|
||||||
property real cpuTemp: 0
|
property real cpuTemp: 0
|
||||||
@@ -56,157 +62,112 @@ Singleton {
|
|||||||
// UPower drives the battery UI; fluxo supplies the TLP/AC detail line.
|
// UPower drives the battery UI; fluxo supplies the TLP/AC detail line.
|
||||||
property string powerDetail: ""
|
property string powerDetail: ""
|
||||||
|
|
||||||
// fluxo wraps values in zero-width spaces for Waybar's benefit.
|
// The one-shot `fluxo <module>` client wraps text in zero-width spaces so
|
||||||
|
// Waybar's proportional font stops reflowing. The stream deliberately does
|
||||||
|
// not, but stripping them costs nothing and keeps this parser usable against
|
||||||
|
// either source.
|
||||||
function _clean(s: string): string {
|
function _clean(s: string): string {
|
||||||
return (s || "").replace(//g, "").trim();
|
return (s || "").replace(//g, "").trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _fields(json: string): var {
|
|
||||||
try {
|
|
||||||
const o = JSON.parse(json);
|
|
||||||
return { parts: root._clean(o.text).split("|"), obj: o };
|
|
||||||
} catch (e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _num(v): real {
|
function _num(v): real {
|
||||||
const n = parseFloat(v);
|
const n = parseFloat(v);
|
||||||
return isNaN(n) ? 0 : n;
|
return isNaN(n) ? 0 : n;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
// ------------------------------------------------------------------ feed
|
||||||
interval: root.interval
|
// Modules fluxo pushes to us. `disk` streams the default mount, which fluxo
|
||||||
|
// resolves to "/" (see `signaler_default_args` in its registry).
|
||||||
|
readonly property var modules: ["cpu", "mem", "gpu", "net", "sys", "disk", "power"]
|
||||||
|
|
||||||
|
// One line of the stream: {"module":"cpu","text":"7.4|41.0","tooltip":...}.
|
||||||
|
function _ingest(line: string): void {
|
||||||
|
let ev;
|
||||||
|
try {
|
||||||
|
ev = JSON.parse(line);
|
||||||
|
} catch (e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!ev || !ev.module)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const parts = root._clean(ev.text).split("|");
|
||||||
|
const tip = ev.tooltip || "";
|
||||||
|
|
||||||
|
switch (ev.module) {
|
||||||
|
case "cpu":
|
||||||
|
root.cpuUsage = root._num(parts[0]);
|
||||||
|
root.cpuTemp = root._num(parts[1]);
|
||||||
|
root.cpuModel = tip;
|
||||||
|
break;
|
||||||
|
case "mem":
|
||||||
|
root.memUsed = root._num(parts[0]);
|
||||||
|
root.memTotal = root._num(parts[1]);
|
||||||
|
break;
|
||||||
|
case "gpu":
|
||||||
|
// fluxo emits a single non-numeric field ("No GPU") when it cannot
|
||||||
|
// find one, so field count is the availability test.
|
||||||
|
if (parts.length < 4) {
|
||||||
|
root.gpuAvailable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
root.gpuAvailable = true;
|
||||||
|
root.gpuUsage = root._num(parts[0]);
|
||||||
|
root.gpuVramUsed = root._num(parts[1]);
|
||||||
|
root.gpuVramTotal = root._num(parts[2]);
|
||||||
|
root.gpuTemp = root._num(parts[3]);
|
||||||
|
const gm = /Model:\s*(.+)/.exec(tip);
|
||||||
|
if (gm)
|
||||||
|
root.gpuModel = gm[1];
|
||||||
|
break;
|
||||||
|
case "net":
|
||||||
|
root.netInterface = parts[0] || "";
|
||||||
|
root.netIp = parts[1] || "";
|
||||||
|
root.netRx = root._num(parts[2]);
|
||||||
|
root.netTx = root._num(parts[3]);
|
||||||
|
break;
|
||||||
|
case "sys":
|
||||||
|
root.uptime = parts[0] || "";
|
||||||
|
root.load1 = root._num(parts[1]);
|
||||||
|
root.load5 = root._num(parts[2]);
|
||||||
|
root.load15 = root._num(parts[3]);
|
||||||
|
const pm = /Processes:\s*(\d+)/.exec(tip);
|
||||||
|
if (pm)
|
||||||
|
root.procs = parseInt(pm[1]);
|
||||||
|
break;
|
||||||
|
case "disk":
|
||||||
|
root.diskUsed = root._num(parts[1]);
|
||||||
|
root.diskTotal = root._num(parts[2]);
|
||||||
|
root.diskPercent = ev.percentage || 0;
|
||||||
|
const fm = /Free:\s*(\S+)/.exec(tip);
|
||||||
|
root.diskFree = fm ? fm[1] : "";
|
||||||
|
break;
|
||||||
|
case "power":
|
||||||
|
root.powerDetail = tip;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: source
|
||||||
|
command: ["fluxo", "stream"].concat(root.modules)
|
||||||
running: true
|
running: true
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
stdout: SplitParser {
|
||||||
onTriggered: {
|
onRead: data => root._ingest(data)
|
||||||
cpuReader.running = true;
|
|
||||||
memReader.running = true;
|
|
||||||
gpuReader.running = true;
|
|
||||||
netReader.running = true;
|
|
||||||
sysReader.running = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The daemon restarting (or not being up yet at login) drops us. Retry
|
||||||
|
// on a slow cadence: this is a reconnect, not a poll, so it only ever
|
||||||
|
// fires while the stream is actually down.
|
||||||
|
onExited: retry.restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disk and battery move slowly; poll them a tenth as often.
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: root.interval * 10
|
id: retry
|
||||||
running: true
|
interval: 2000
|
||||||
repeat: true
|
repeat: false
|
||||||
triggeredOnStart: true
|
onTriggered: source.running = true
|
||||||
onTriggered: {
|
|
||||||
diskReader.running = true;
|
|
||||||
powerReader.running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: cpuReader
|
|
||||||
command: ["fluxo", "cpu"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const f = root._fields(text);
|
|
||||||
if (!f) return;
|
|
||||||
root.cpuUsage = root._num(f.parts[0]);
|
|
||||||
root.cpuTemp = root._num(f.parts[1]);
|
|
||||||
root.cpuModel = f.obj.tooltip || "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: memReader
|
|
||||||
command: ["fluxo", "mem"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const f = root._fields(text);
|
|
||||||
if (!f) return;
|
|
||||||
root.memUsed = root._num(f.parts[0]);
|
|
||||||
root.memTotal = root._num(f.parts[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: gpuReader
|
|
||||||
command: ["fluxo", "gpu"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const f = root._fields(text);
|
|
||||||
if (!f || f.parts.length < 4) {
|
|
||||||
root.gpuAvailable = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
root.gpuAvailable = true;
|
|
||||||
root.gpuUsage = root._num(f.parts[0]);
|
|
||||||
root.gpuVramUsed = root._num(f.parts[1]);
|
|
||||||
root.gpuVramTotal = root._num(f.parts[2]);
|
|
||||||
root.gpuTemp = root._num(f.parts[3]);
|
|
||||||
const m = /Model:\s*(.+)/.exec(f.obj.tooltip || "");
|
|
||||||
if (m) root.gpuModel = m[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: diskReader
|
|
||||||
command: ["fluxo", "disk", "/"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const f = root._fields(text);
|
|
||||||
if (!f) return;
|
|
||||||
root.diskUsed = root._num(f.parts[1]);
|
|
||||||
root.diskTotal = root._num(f.parts[2]);
|
|
||||||
root.diskPercent = f.obj.percentage || 0;
|
|
||||||
const m = /Free:\s*(\S+)/.exec(f.obj.tooltip || "");
|
|
||||||
root.diskFree = m ? m[1] : "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: netReader
|
|
||||||
command: ["fluxo", "net"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const f = root._fields(text);
|
|
||||||
if (!f) return;
|
|
||||||
root.netInterface = f.parts[0] || "";
|
|
||||||
root.netIp = f.parts[1] || "";
|
|
||||||
root.netRx = root._num(f.parts[2]);
|
|
||||||
root.netTx = root._num(f.parts[3]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: sysReader
|
|
||||||
command: ["fluxo", "sys"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
const f = root._fields(text);
|
|
||||||
if (!f) return;
|
|
||||||
root.uptime = f.parts[0] || "";
|
|
||||||
root.load1 = root._num(f.parts[1]);
|
|
||||||
root.load5 = root._num(f.parts[2]);
|
|
||||||
root.load15 = root._num(f.parts[3]);
|
|
||||||
const m = /Processes:\s*(\d+)/.exec(f.obj.tooltip || "");
|
|
||||||
if (m) root.procs = parseInt(m[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: powerReader
|
|
||||||
command: ["fluxo", "power"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
try {
|
|
||||||
root.powerDetail = JSON.parse(text).tooltip || "";
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------ formatting
|
// ------------------------------------------------------------ formatting
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Quickshell
|
|||||||
import "root:/config"
|
import "root:/config"
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
import "root:/bar"
|
import "root:/bar"
|
||||||
|
import "root:/launcher"
|
||||||
import "root:/overlays"
|
import "root:/overlays"
|
||||||
import "root:/lock"
|
import "root:/lock"
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import "root:/lock"
|
|||||||
//
|
//
|
||||||
// bar/ the top bar and its modules
|
// bar/ the top bar and its modules
|
||||||
// popouts/ hover panels hanging off bar modules
|
// popouts/ hover panels hanging off bar modules
|
||||||
|
// launcher/ the application launcher
|
||||||
// overlays/ power menu, notification toasts, OSD
|
// overlays/ power menu, notification toasts, OSD
|
||||||
// lock/ session lock
|
// lock/ session lock
|
||||||
// services/ data sources (fluxo, pipewire, bluez, upower, mpris, …)
|
// services/ data sources (fluxo, pipewire, bluez, upower, mpris, …)
|
||||||
@@ -28,6 +30,7 @@ ShellRoot {
|
|||||||
void Net.wifiEnabled;
|
void Net.wifiEnabled;
|
||||||
void Bt.available;
|
void Bt.available;
|
||||||
void Actions.powerMenuOpen;
|
void Actions.powerMenuOpen;
|
||||||
|
void Apps.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
@@ -42,6 +45,12 @@ ShellRoot {
|
|||||||
Rail {}
|
Rail {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Variants {
|
||||||
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
Launcher {}
|
||||||
|
}
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/narl/.config/systemd/user/headroom-private.service
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/home/narl/.config/systemd/user/headroom-work.service
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Headroom proxy (private Claude profile)
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=HEADROOM_WORKSPACE_DIR=%h/.headroom
|
||||||
|
Environment=HEADROOM_TELEMETRY=off
|
||||||
|
ExecStart=%h/.local/share/headroom-venv/bin/headroom proxy --host 127.0.0.1 --port 8787 --mode cache --no-telemetry
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Headroom proxy (work Claude profile)
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=HEADROOM_WORKSPACE_DIR=%h/.headroom-work
|
||||||
|
Environment=HEADROOM_TELEMETRY=off
|
||||||
|
ExecStart=%h/.local/share/headroom-venv/bin/headroom proxy --host 127.0.0.1 --port 8788 --mode cache --no-telemetry
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
Reference in new issue
Block a user