-
Notifications
You must be signed in to change notification settings - Fork 1
/
themes.lua
47 lines (37 loc) · 1.33 KB
/
themes.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-------------------------------------------------------------
-- Carrot theming
-------------------------------------------------------------
-- Licensed under the GNU General Public License v3:
-- https://opensource.org/licenses/GPL-3.0
-------------------------------------------------------------
-- Copyright (c) 2018 Pouyan Heyratpour <[email protected]>
-------------------------------------------------------------
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful") -- Theme handling library
local file_readable = gears.filesystem.file_readable or awful.util.file_readable
local getGlobalThemesDir = gears.filesystem.get_themes_dir or awful.util.get_themes_dir
local function getUserThemesDir()
return os.getenv("HOME") .. "/.config/awesome/themes/"
end
local function apply(name)
local themePaths = {
getUserThemesDir() .. name .. "/theme.lua",
getGlobalThemesDir() .. name .. "/theme.lua"
}
local themePath = ""
for k, v in pairs(themePaths) do
if file_readable(v) then
themePath = v
break
end
end
if "" == themePath then
error(string.format("Cannot load theme `%s`", name))
end
beautiful.init(themePath)
end
return {
Apply = apply;
}
-- vim: foldmethod=marker:filetype=lua:expandtab:shiftwidth=2:tabstop=2:softtabstop=2:textwidth=80