Skip to content

Instantly share code, notes, and snippets.

@matyklug18
Created June 15, 2021 22:56
Show Gist options
  • Save matyklug18/83708bb9ff6f3bfbdcb9b83bffdfb8b2 to your computer and use it in GitHub Desktop.
Save matyklug18/83708bb9ff6f3bfbdcb9b83bffdfb8b2 to your computer and use it in GitHub Desktop.
local utils = require("utils")
return {
"kitty",
{
expose = {
["font.family"] = {
itype = "conf",
ttype = "string",
default = "Fira Code"
},
["font.size"] = {
itype = "conf",
ttype = "number",
default = 11.0
},
["alpha"] = {
itype = "conf",
ttype = "number",
default = 0.9
},
["theme.name"] = {
itype = "conf",
ttype = "string",
default = "none"
},
["theme.source.repo.url"] = {
itype = "conf",
ttype = "string",
default = "https://github.com/dexpota/kitty-themes"
},
["theme.source.repo.name"] = {
itype = "conf",
ttype = "string",
default = "kitty-themes"
},
["theme.source.path"] = {
itype = "conf",
ttype = "string",
default = "./kitty-themes/themes/"
}
},
install = function(cfg)
local dest = os.getenv("HOME") .. "/.config/kitty/" .. cfg:read("kitty.theme.source.repo.name")
if not utils.file.exists(dest) then
os.execute("git clone " .. cfg:read("kitty.theme.source.repo.url") .. ' ' .. dest)
end
utils.pkg.install("kitty") -- TODO
end,
catch = {
config = {
itype = "files.conf",
args = {
path = os.getenv("HOME").."/.config/kitty/kitty.conf",
data = {
process = true,
process_type = "read_config",
args = {
value = function(cfg)
return string.gsub(utils.string.match_table([[
{{theme}}
font_family {{font_family}}
font_size {{font_size}}
background_opacity {{opacity}}
cursor_stop_blinking_after 0
]], {
font_family = cfg:read("kitty.font.family"),
font_size = cfg:read("kitty.font.size"),
opacity = cfg:read("kitty.alpha"),
theme = "" and cfg:read("kitty.theme.name") == "none" or "include " .. cfg:read("kitty.theme.source.path") .. cfg:read("kitty.theme.name") .. ".conf"
}), "[\t]+", "")
end
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment