Hacer tema configurable
This commit is contained in:
parent
f525c0eaa1
commit
857c36192d
1 changed files with 15 additions and 5 deletions
20
themer.lua
20
themer.lua
|
@ -2,11 +2,6 @@
|
|||
|
||||
local templater = require 'utils/template'
|
||||
|
||||
theme = require 'themes/rose-pine-moon'
|
||||
|
||||
local status = os.execute("mkdir -p ~/.cache/themer.lua/")
|
||||
if not (status == 0) then return status end
|
||||
|
||||
function expect_nil(result)
|
||||
if result then
|
||||
print("Error: "..result)
|
||||
|
@ -15,6 +10,21 @@ function expect_nil(result)
|
|||
return nil
|
||||
end
|
||||
|
||||
local function read_file(path)
|
||||
local file = io.open(path, "r")
|
||||
if not file then return nil end
|
||||
local content = file:read "*a" -- *a or *all reads the whole file
|
||||
file:close()
|
||||
return content
|
||||
end
|
||||
|
||||
local theme_name_path = os.getenv('HOME').."/.config/themer.lua.theme"
|
||||
local theme_name = read_file(theme_name_path)
|
||||
theme = dofile("themes/"..theme_name..".lua")
|
||||
|
||||
local status = os.execute("mkdir -p ~/.cache/themer.lua/")
|
||||
if not (status == 0) then return status end
|
||||
|
||||
function save_config(name, template, params)
|
||||
local file, err = io.open("/home/diablo/.cache/themer.lua/"..name, "w+")
|
||||
if not file then expect_nil(err) end
|
||||
|
|
Loading…
Reference in a new issue