dotfiles
bugabingas dorkfiles
owned by bugabinga
hypr: replace nushell scripts with lua, update references
cb814db409217faf758fd463b4d79d171c28136f
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Changed files (7)
11 11 - Mako: `mako/nugu.conf` via `include=~/.config/mako/nugu.conf`
12 12 - Hypr Lua: `hypr/generated/nugu.lua`
13 13 - Runtime JSON: `hypr/generated/nugu.json`
14 -- Runtime switcher `hypr/scripts/theme.nu` writes active color fragments under `$XDG_CONFIG_HOME`.
14 +- Runtime switcher `hypr/scripts/theme.lua` writes active color fragments under `$XDG_CONFIG_HOME`.
17 17 - Never rewrite `hyprtoolkit.conf` while Hyprtoolkit apps run.
37 37 - UI sans: `IBM Plex Sans`; mono/status: `IBM Plex Mono`.
40 -- After theme edits: `NUGU_NO_NOTIFY=1 hypr/scripts/theme.nu dark|light`.
40 +- After theme edits: `NUGU_NO_NOTIFY=1 hypr/scripts/theme.lua dark|light`.
41 41 - Check `systemctl --user is-active mako.service ironbar.service hyprpaper.service`.
42 42 - Screenshot dark/light with `grim`; inspect actual rendered colors, not just CSS.
hypr/lib/apps.lua
Modified11 11 wifi = function() tui.spawn(
"impala")
end,
13 13 logout
= "hyprshutdown --dry-run",
14 - theme_toggle
= "nu ~/.config/hypr/scripts/theme.nu toggle",
15 - theme_auto
= "nu ~/.config/hypr/scripts/theme.nu auto",
14 + theme_toggle
= "lua ~/.config/hypr/scripts/theme.lua toggle",
15 + theme_auto
= "lua ~/.config/hypr/scripts/theme.lua auto",
16 16 clipboard
= "bash -lc 'cliphist list | hyprlauncher --dmenu | cliphist decode | wl-copy'",
17 17 screenshot_region
= "hyprshot -m region -z",
18 18 screenshot_window
= "hyprshot -m window -z",
19 19 screenshot_output
= "hyprshot -m output -z",
20 20 screenshot_annotate
= "hyprshot -m region -z -- satty --filename",
21 - binds_help
= "nu ~/.config/hypr/scripts/show_binds.nu",
22 - clients_help
= "nu ~/.config/hypr/scripts/show_clients.nu",
21 + binds_help
= "lua ~/.config/hypr/scripts/show_binds.lua",
22 + clients_help
= "lua ~/.config/hypr/scripts/show_clients.lua",
hypr/scripts/show_binds.nu
Deleteddeleted file mode 100644 2 -def parse_modmask [modmask: int] {
4 - { mask:
64, name:
"SUPER" },
5 - { mask:
1, name:
"SHIFT" },
6 - { mask:
4, name:
"CTRL" },
7 - { mask:
8, name:
"ALT" }
9 - let active_mods =
$modifiers |
where { |mod| (
$modmask | bits and
$mod.mask) !=
0 } | get name
10 - if (
$active_mods | is-empty) {
"None" }
else {
$active_mods | str join
"+" }
14 -def format_key [key: string, mouse: bool] {
16 - $key | str replace
"mouse:" "MOUSE_" 25 - let binds = (hyprctl binds -j | from json)
28 - let formatted_binds =
$binds |
each { |bind|
29 - let mods = (parse_modmask
$bind.modmask)
30 - let key = (format_key
$bind.key $bind.mouse)
31 - let display = $
"($mods) + ($key) -> ($bind.dispatcher): ($bind.arg)" 32 - { display:
$display, arg:
$bind.arg, dispatcher:
$bind.dispatcher }
36 - let temp_file = (mktemp -t hypr_binds.XXXXXX | str trim)
37 - $formatted_binds |
each { |b|
$b.display } | str join
"\n" | save -f
$temp_file 40 - let selection = (cat
$temp_file | fuzzel --dmenu --prompt
"Keybindings: " | str trim)
44 - if (
$selection | is-not-empty) {
45 - let selected_bind = (
$formatted_binds |
where display ==
$selection | first)
46 - if (
$selected_bind | is-not-empty) {
47 - if $selected_bind.dispatcher ==
"exec" {
48 - run-external (
$selected_bind.arg | split row
' ')
50 - hyprctl dispatch
$selected_bind.dispatcher $selected_bind.arg hypr/scripts/show_clients.nu
Deleteddeleted file mode 100644 2 -let clients = (hyprctl clients -j | from json)
5 -let formatted = (
$clients |
each { |client|
6 - $
"($client.class): ($client.title) \(($client.workspace.name)\)" 10 -let selected = (
$formatted | fuzzel --dmenu --prompt
"Select window: " | str trim)
13 -if (
$selected | is-empty) {
18 -let selected_index = (
$formatted | split row
"\n" | enumerate |
where item ==
$selected | get
0.index)
21 -let address = (
$clients | get
$selected_index | get address)
24 -hyprctl -q dispatch focuswindow address:(
$address)
25 -hyprctl -q dispatch alterzorder top
hypr/scripts/theme.nu
Deleteddeleted file mode 100755 5 -const modes = [dark light]
7 -def config-home [] {
$env.XDG_CONFIG_HOME? | default (
$env.HOME | path join
".config") }
8 -def cache-dir [] {
$env.HOME | path join
".cache" "nugu" }
9 -def mode-file [] { cache-dir | path join
"mode" }
10 -def auto-file [] { cache-dir | path join
"auto" }
11 -def palette-file [] { config-home | path join
"hypr" "generated" "nugu.json" }
14 - let path = (mode-file)
15 - if (
$path | path exists) {
16 - let mode = (open --raw
$path | str trim)
17 - if $mode in $modes { return
$mode }
23 - let hour = (date now | format date
"%H" | into int)
24 - if $hour >=
7 and
$hour <
19 {
"light" }
else {
"dark" }
27 -def hex-no-hash [color: string] {
$color | str replace --all
"#" "" }
28 -def argb [color: string] { $
"0xFF(hex-no-hash $color)" }
30 -def palette [mode: string] {
31 - open (palette-file) | get
$mode 34 -def auto-enabled [] {
35 - let path = (auto-file)
36 - if not (
$path | path exists) { return true }
37 - (open --raw
$path | str trim) !=
"0" 40 -def set-auto [enabled: bool] {
41 - (
if $enabled {
"1" }
else {
"0" }) | save --raw --force (auto-file)
44 -def write-desktop-color-scheme [mode: string] {
45 - let scheme =
if $mode ==
"dark" {
"prefer-dark" }
else {
"prefer-light" }
46 - try { gsettings set org.gnome.desktop.interface color-scheme
$scheme | ignore }
49 -def write-hyprtoolkit [mode: string, p: record] {
50 - let out = (config-home | path join
"hypr" "hyprtoolkit.conf")
51 - $"background = (argb
$p.content.backdrop)
52 -base = (argb
$p.ui.backdrop)
53 -alternate_base = (argb
$p.ui.unfocus)
54 -text = (argb
$p.content.normal)
55 -bright_text = (argb
$p.ui.important_global)
56 -accent = (argb
$p.ui.accent)
57 -accent_secondary = (argb
$p.content.important_local)
63 -font_family = IBM Plex Sans
64 -font_family_monospace = IBM Plex Mono
66 -" | save --raw --force
$out 69 -def write-mako [mode: string, p: record] {
70 - mkdir (config-home | path join
"mako")
71 - let out = (config-home | path join
"mako" "nugu.conf")
73 -background-color=(
$p.ui.backdrop)ee
74 -text-color=(
$p.ui.normal)ff
75 -border-color=(
$p.ui.accent)ff
76 -progress-color=over (
$p.ui.focus)ff
79 -background-color=(
$p.content.backdrop)e6
80 -text-color=(
$p.content.minor)ff
81 -border-color=(
$p.ui.unfocus)ff
82 -progress-color=over (
$p.content.minor)ff
85 -border-color=(
$p.ui.accent)ff
86 -progress-color=over (
$p.ui.focus)ff
89 -background-color=(
$p.ui.backdrop)ff
90 -text-color=(
$p.ui.important_global)ff
91 -border-color=(
$p.error)ff
92 -progress-color=over (
$p.error)ff
94 -[summary~=\"[Ee]rror|[Ff]ailed|[Ff]ailure|[Cc]rash\"]
95 -border-color=(
$p.error)ff
96 -progress-color=over (
$p.error)ff
98 -[summary~=\"[Ww]arn|[Ww]arning\"]
99 -border-color=(
$p.warning)ff
100 -progress-color=over (
$p.warning)ff
102 -[summary~=\"[Ii]nfo|[Nn]otice\"]
103 -border-color=(
$p.info)ff
104 -progress-color=over (
$p.info)ff
105 -" | save --raw --force
$out 108 -def write-ironbar [mode: string, p: record] {
109 - mkdir (config-home | path join
"ironbar")
110 - let out = (config-home | path join
"ironbar" "nugu.css")
111 - let surface =
$p.ui.minor 112 - let on_focus =
$p.content.backdrop 113 - $"/* Generated by hypr/scripts/theme.nu from Nugu palette. */
115 - --bg: (
$p.ui.backdrop);
116 - --bg-transparent: (
$p.ui.backdrop)ee;
117 - --surface: (
$surface);
118 - --fg: (
$p.ui.normal);
119 - --accent: (
$p.ui.accent);
120 - --focus: (
$p.ui.focus);
121 - --on-focus: (
$on_focus);
122 - --muted: (
$p.ui.minor);
123 - --unfocus: (
$p.ui.unfocus);
124 - --error: (
$p.error);
125 - --warning: (
$p.warning);
127 - --debug: (
$p.debug);
128 - --border: (
$p.ui.accent);
130 -" | save --raw --force
$out 133 -def apply-mode [mode: string] {
135 - let p = (palette
$mode)
136 - $mode | save --raw --force (mode-file)
137 - write-desktop-color-scheme
$mode 141 - write-mako
$mode $p 142 - write-ironbar
$mode $p 144 - try { hyprctl hyprpaper wallpaper $
",~/.config/hypr/wallpapers/nugu-($mode).png" | ignore }
145 - try { hyprctl reload | ignore }
146 - if ((
$env.NUGU_NO_RESTART_MAKO? | default
"") !=
"1") {
147 - try { systemctl --user restart mako.service | ignore }
149 - try { systemctl --user restart ironbar.service | ignore }
150 - if ((
$env.NUGU_NO_NOTIFY? | default
"") !=
"1") {
151 - try { notify-send --expire-time
1500 "nugu" $
"($mode) mode" | ignore }
155 -def next-mode [] {
if (active-mode) ==
"dark" {
"light" }
else {
"dark" } }
157 -def main [mode: string =
"toggle"] {
158 - let manual =
$mode in [dark light toggle]
159 - if $manual { set-auto false }
160 - if $mode ==
"auto" { set-auto true }
162 - let target =
match $mode {
164 - "light" =>
"light",
165 - "toggle" => (next-mode),
166 - "auto" => (auto-mode),
167 - "current" => (active-mode),
168 - "watch" => { watch; return },
169 - _ => { error make { msg:
"mode must be dark|light|toggle|auto|current|watch" } },
176 - if (auto-enabled) {
177 - let target = (auto-mode)
178 - if $target != (active-mode) { apply-mode
$target }
hypr/systemd/mako.service
Modified 7 7 Environment=NUGU_NO_RESTART_MAKO=1
8 8 Environment=NUGU_NO_NOTIFY=1
9 -ExecStartPre=/usr/bin/nu %h/.config/hypr/scripts/theme.nu current
9 +ExecStartPre=/usr/bin/lua %h/.config/hypr/scripts/theme.lua current
10 10 ExecStart=/usr/bin/mako --config %h/.config/mako/config
hypr/systemd/nugu-theme.service
Modified 5 5 Wants=hyprpaper.service
8 -ExecStart=/usr/bin/nu %h/.config/hypr/scripts/theme.nu watch
8 +ExecStart=/usr/bin/lua %h/.config/hypr/scripts/theme.lua watch