mod_star

.config/thp/thpd

[star]
# https://en.wikipedia.org/wiki/Spica
name=Spica
ra=13h25m11.5793s
dec=-11d09m40.759s

# https://en.wikipedia.org/wiki/Alpha_Centauri
name=α Cen
ra=14h39m36.4951s
dec=-60d50m02.308s

# https://en.wikipedia.org/wiki/Beta_Centauri
name=β Cen
ra=14h03m49.4s
dec=-60d22m23.0s

# https://en.wikipedia.org/wiki/Proxima_Centauri
name=Proxima
ra=14h29m42.946s
dec=-62d40m46.16s

# https://en.wikipedia.org/wiki/Achernar
name=Achernar
ra=01h37m42.8s
dec=-57d14m12.0s

.config/thp/thp

spec=s:def|m:star|s:red;;bold|m:path|s:;;reset|m:sigil

mod_lua

_XDG_DATA_HOME_/thp/thp.lua

function dir_icon()
    local dirs = {
        [thp.env.home] = "🏠",
        [thp.env.home .. "/Desktop"] = "🖥",
        [thp.env.home .. "/Documents"] = "📄",
        [thp.env.home .. "/Downloads"] = "🔽",
        [thp.env.home .. "/Music"] = "🎵",
        [thp.env.home .. "/Pictures"] = "🖼️",
        ["/boot"] = "👢",
        ["/etc"] = "⚙️",
        ["/opt"] = "🎯",
        ["/srv"] = "☢️",
        ["/var/www/html"] = "🌎",
    }

    -- find the longest match
    local i = 0
    local icon = nil
    for dir, img in pairs(dirs) do
        local a, b = thp.env.pwd:find(dir)
        if a and a == 1 and b > i then
            i = b
            icon = img
        end
    end
    return icon
end

-- This script must return a string
-- (any value convertible to string)
return dir_icon() or ""

Julian Date

_XDG_DATA_HOME_/thp/jd.lua

function julian_day()  
    local UNIX_EPOCH_JD = 2440587.5 -- 1970-01-01 00:00
    local DAY_SECONDS = 86400.0
    return UNIX_EPOCH_JD + os.time()/DAY_SECONDS
end

-- Before lunch
if os.date("*t").hour < 13 then
    return julian_day()
else
    return ""
end

provide/receive

~/.config/thp/thp

spec=s:def|m:lua(a)|m:lua(b)|s:;;reset|m:sigil

${XDG_DATA_HOME}/thp/a.lua

provide("lua", "v1", "a1")
provide("lua", "v2", "a2")
return "a"

${XDG_DATA_HOME}/thp/b.lua

return receive("lua", "v1", "123")

うね