dotfiles
bugabingas dorkfiles
owned by bugabinga
nugu: add hypr and console generators
d6b87790dd39d09a3df36d40c520da3cf725c408
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Changed files (5)
4 4 set shell := [
"nu",
"--commands"]
10 +link: nugu-linux-console nugu-hypr
11 11 java bootstripper.java bootstrap
15 + just --justfile nugu/justfile --working-directory nugu linux-console
18 + just --justfile nugu/justfile --working-directory nugu hypr
15 22 java bootstripper.java check
25 + java bootstripper.java clean
19 29 java bootstripper.java pre-commit
new file mode 100644 5 + dark: (nugu dark | get palette)
6 + light: (nugu light | get palette)
7 + } | to json --indent
2 10 +def q [s: string] { $
'"($s)"' }
12 +def lua-palette [p: record] {
13 +$' debug = (q
$p.debug),
14 + error = (q
$p.error),
15 + warning = (q
$p.warning),
18 + normal = (q
$p.content.normal),
19 + backdrop = (q
$p.content.backdrop),
20 + accent = (q
$p.content.accent),
21 + minor = (q
$p.content.minor),
22 + focus = (q
$p.content.focus),
23 + unfocus = (q
$p.content.unfocus),
24 + important_local = (q
$p.content.important_local),
25 + important_global = (q
$p.content.important_global),
28 + normal = (q
$p.ui.normal),
29 + backdrop = (q
$p.ui.backdrop),
30 + accent = (q
$p.ui.accent),
31 + minor = (q
$p.ui.minor),
32 + focus = (q
$p.ui.focus),
33 + unfocus = (q
$p.ui.unfocus),
34 + important_local = (q
$p.ui.important_local),
35 + important_global = (q
$p.ui.important_global),
40 + let dark = (nugu dark | get palette)
41 + let light = (nugu light | get palette)
48 + (lua-palette
$light)
55 + ' local path = os.getenv("HOME") .. "/.cache/nugu/mode"' 56 + ' local file = io.open(path, "r")' 57 + ' if not file then return "dark" end' 58 + ' local mode = file:read("*l") or "dark"' 60 + ' if mode == "light" then return "light" end' 64 + 'function M.current()' 65 + ' return palette[M.mode()]' 68 + 'function M.get(mode)' 69 + ' return palette[mode]' 72 + 'function M.hex(color)' 73 + ' return color:gsub("#", "")' 76 + 'function M.rgba(color, alpha)' 77 + ' return "rgba(" .. M.hex(color) .. (alpha or "ff") .. ")"' 80 + 'function M.rgb(color)' 81 + ' return "rgb(" .. M.hex(color) .. ")"' 12 12 open helix.nu | nu-check --as-module --debug helix.nu
13 13 open wezterm.nu | nu-check --as-module --debug wezterm.nu
14 14 open ghostty.nu | nu-check --as-module --debug ghostty.nu
15 + open linux_console.nu | nu-check --as-module --debug linux_console.nu
16 + open hypr.nu | nu-check --as-module --debug hypr.nu
64 66 cp
{{output}}/ghostty/nugu-dark ../ghostty/themes/nugu-dark
65 67 cp
{{output}}/ghostty/nugu-light ../ghostty/themes/nugu-light
67 -install: helix wezterm ghostty
70 + rm --force --recursive
{{output}}/hypr
71 + mkdir
{{output}}/hypr
72 + use hypr.nu; hypr json | save --raw
{{output}}/hypr/nugu.json
73 + use hypr.nu; hypr lua | save --raw
{{output}}/hypr/nugu.lua
74 + mkdir ../hypr/generated
75 + cp
{{output}}/hypr/nugu.json ../hypr/generated/nugu.json
76 + cp
{{output}}/hypr/nugu.lua ../hypr/generated/nugu.lua
79 + rm --force --recursive
{{output}}/linux-console
80 + mkdir
{{output}}/linux-console
81 + mkdir ../bash/linux-console
82 + use linux_console.nu; linux_console theme dark | save --raw --force
{{output}}/linux-console/nugu-dark.sh
83 + use linux_console.nu; linux_console theme light | save --raw --force
{{output}}/linux-console/nugu-light.sh
84 + cp
{{output}}/linux-console/nugu-dark.sh ../bash/linux-console/nugu-dark.sh
85 + cp
{{output}}/linux-console/nugu-light.sh ../bash/linux-console/nugu-light.sh
87 +install: helix wezterm ghostty linux-console hypr
nugu/linux_console.nu
Addednew file mode 100644 7 +export def theme [mode: string] {
8 + let nugu = (palette nugu
$mode)
9 + let p =
$nugu.palette 16 + $p.content.important_local 24 + $p.content.important_global 26 + $p.ui.important_local 27 + $p.ui.important_global 30 + let palette_lines = (
$colors | enumerate |
each {|e|
31 + $
"printf '\\033]P(hex-index $e.index)(strip-hash $e.item)'" 36 + "# Generated by nugu/linux_console.nu." 37 + "# Sudo-free Linux virtual console palette." 38 + "# No effect outside TERM=linux." 40 + "if [ \"${TERM:-}\" != linux ]; then" 41 + "\treturn 0 2>/dev/null || exit 0" 44 + $
"export NUGU_CONSOLE_THEME=($mode)" 50 + "# After palette rewrite, black=slot 0 and white=slot 7." 51 + "if command -v setterm >/dev/null 2>&1; then" 52 + "\tsetterm --foreground white --background black --store" 57 + (
$header ++
$palette_lines ++
$footer) | str join
"\n" 60 +def strip-hash [hex: string] {
61 + $hex | str trim | str replace --regex
'^#' '' | str downcase
64 +def hex-index [index: int] {