-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy paththeme.lua
More file actions
234 lines (221 loc) · 10.6 KB
/
Copy paththeme.lua
File metadata and controls
234 lines (221 loc) · 10.6 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
local cyberpunk = os.getenv("HOME") .. "/.config/hypr/themes/cyberpunk"
local once = function(cmd)
hl.on("hyprland.start", function()
hl.exec_cmd(cmd)
end)
end
hl.exec_cmd("dbus-update-activation-environment --systemd --all")
hl.exec_cmd("sh -c 'sleep 3; hyprctl dispatch exec \"dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XAUTHORITY XCURSOR_THEME XCURSOR_SIZE\"' &")
hl.exec_cmd("killall -9 waybar mako dunst swaync 2>/dev/null; systemctl --user stop waybar mako dunst swaync 2>/dev/null || true")
hl.exec_cmd("sh -c 'pgrep -x gjs >/dev/null 2>&1 || { " .. os.getenv("HOME") .. "/.local/bin/ags quit -i cyberpunk 2>/dev/null; sleep 1; " .. cyberpunk .. "/scripts/launch-theme; }'")
hl.exec_cmd(cyberpunk .. "/scripts/ws pin")
local user_dir = (os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME") .. "/.config")) .. "/cyberarch"
local ucfg = {}
local cfgf = loadfile(user_dir .. "/user_config.lua")
if cfgf then
local ok, res = pcall(cfgf)
if ok and type(res) == "table" then
ucfg = res
end
end
local anim_master = ucfg["anim"] ~= false
local anim_workspace = anim_master and ucfg["animWorkspace"] == true
local wallpapers_path = os.getenv("HOME") .. "/Pictures/Wallpapers"
local set_wallpaper = wallpapers_path .. "/netwatch/main.mp4"
local wf = loadfile(user_dir .. "/wallpaper.lua")
if wf then
local ok, res = pcall(wf)
if ok and type(res) == "string" and res ~= "" then
set_wallpaper = res
end
end
once("bash " .. cyberpunk .. "/scripts/set-wallpaper '" .. set_wallpaper .. "'")
local accent = { 255, 45, 61 }
local acc2 = { 255, 102, 119 }
local h2rgb = function(h)
if type(h) == "string" and #h == 6 then
local r = { tonumber(h:sub(1, 2), 16), tonumber(h:sub(3, 4), 16), tonumber(h:sub(5, 6), 16) }
if r[1] and r[2] and r[3] then return r end
end
return nil
end
local rounding = 0
local power = 2.0
local border_size = 2
local glow = true
local glow_range = 12
local glow_alpha = "38"
local glow_rp = 2
local scf = loadfile(user_dir .. "/shell_colors.lua")
if scf then
local ok, res = pcall(scf)
if ok and type(res) == "table" then
local a1 = h2rgb(res.accent)
local a2 = h2rgb(res.accent2)
if a1 and a2 then accent, acc2 = a1, a2 end
if type(res.rounding) == "number" then rounding = res.rounding end
if type(res.rounding_power) == "number" then power = res.rounding_power end
if type(res.border) == "number" then border_size = res.border end
if type(res.glow) == "boolean" then glow = res.glow end
if type(res.glow_range) == "number" then glow_range = res.glow_range end
if type(res.glow_alpha) == "string" then glow_alpha = res.glow_alpha end
if type(res.glow_rp) == "number" then glow_rp = res.glow_rp end
end
end
local wm = {}
local wmt = {}
local wmf = loadfile(user_dir .. "/wm_config.lua")
if wmf then
local ok, res = pcall(wmf)
if ok and type(res) == "table" then
wm = type(res.wm) == "table" and res.wm or {}
wmt = type(res.t) == "table" and res.t or {}
end
end
local shadow_color = nil
local border_override = nil
if wmt.wmBorderSize and type(wm.wmBorderSize) == "number" then border_size = wm.wmBorderSize end
if wmt.wmBorders and wm.wmBorders == false then border_size = 0 end
if type(wm.wmBorderColor) == "string" then border_override = h2rgb(wm.wmBorderColor) end
if type(wm.wmShadowColor) == "string" and wm.wmShadowColor ~= "" then shadow_color = h2rgb(wm.wmShadowColor) end
if wmt.wmGlow ~= nil then glow = wm.wmGlow == true end
if wmt.wmGlowRange and type(wm.wmGlowRange) == "number" then glow_range = wm.wmGlowRange end
if wmt.wmGlowRp and type(wm.wmGlowRp) == "number" then glow_rp = wm.wmGlowRp end
if wmt.wmRounding and type(wm.wmRounding) == "number" then rounding = math.floor(wm.wmRounding + 0.5) end
local corner_mode = type(wm.wmCorners) == "string" and wm.wmCorners or "round"
local corner_touched = wmt.wmRoundingTl or wmt.wmRoundingTr or wmt.wmRoundingBl or wmt.wmRoundingBr
if wmt.wmCorners then
if corner_mode == "sharp" then
rounding = 0
power = 2
elseif corner_mode == "bevel" then
power = 1
else
power = 2
end
end
if corner_mode ~= "sharp" and corner_touched then
local cr = { wm.wmRoundingTl, wm.wmRoundingTr, wm.wmRoundingBl, wm.wmRoundingBr }
local sum, n = 0, 0
for i = 1, 4 do
if type(cr[i]) == "number" then sum = sum + cr[i]; n = n + 1 end
end
if n > 0 then rounding = math.floor(sum / n + 0.5) end
end
if rounding > 40 then rounding = 40 end
local shadow_on = true
if wmt.wmShadow ~= nil then shadow_on = wm.wmShadow == true end
local shadow_range = glow_range
if wmt.wmShadowRange and type(wm.wmShadowRange) == "number" then shadow_range = wm.wmShadowRange end
local shadow_alpha = glow_alpha
if wmt.wmShadowAlpha and type(wm.wmShadowAlpha) == "number" then
shadow_alpha = string.format("%02x", math.floor(wm.wmShadowAlpha * 2.55 + 0.5))
end
local opacity = 1
if wm.wmOpacity == true and type(wm.wmOpacityVal) == "number" then opacity = wm.wmOpacityVal end
local hex = function(v) return string.format("%02x", math.floor(v + 0.5)) end
local rgba = function(c, a) return "rgba(" .. hex(c[1]) .. hex(c[2]) .. hex(c[3]) .. a .. ")" end
local rgb = function(c) return "rgb(" .. hex(c[1]) .. hex(c[2]) .. hex(c[3]) .. ")" end
hl.exec_cmd("mkdir -p " .. os.getenv("HOME") .. "/.config/kitty && ln -sfn " .. cyberpunk .. "/assets/kitty/kitty.conf " .. os.getenv("HOME") .. "/.config/kitty/kitty.conf")
hl.exec_cmd("mkdir -p " .. os.getenv("HOME") .. "/.local/share/icons && ln -sfn " .. cyberpunk .. "/assets/gtk/iconpack " .. os.getenv("HOME") .. "/.local/share/icons/iconpack")
hl.exec_cmd("gsettings set org.gnome.desktop.interface icon-theme 'iconpack'")
hl.exec_cmd("ln -sfn " .. cyberpunk .. "/assets/cursor " .. os.getenv("HOME") .. "/.local/share/icons/neurodance")
hl.exec_cmd("gsettings set org.gnome.desktop.interface cursor-theme 'neurodance'")
hl.exec_cmd("hyprctl setcursor neurodance 48")
hl.env("XCURSOR_THEME", "neurodance")
hl.env("XCURSOR_SIZE", "48")
hl.env("QT_STYLE_OVERRIDE", "kvantum")
once("bash " .. cyberpunk .. "/scripts/apply_theme")
dofile(cyberpunk .. "/config/keybinds.lua")
hl.config({
misc = {
allow_session_lock_restore = true,
force_default_wallpaper = 0,
-- hyprland reloads itself whenever these files change, and the modal writes
-- user.lua every time u save. leave this true unless u want a full reload each
-- time someone edits a keybind, theres a button in the modal for that
disable_autoreload = true,
},
general = {
border_size = border_size,
gaps_in = 12,
gaps_out = 24,
col = {
active_border = border_override
and { colors = { rgba(border_override, "ff"), rgba(border_override, "ff") }, angle = 45 }
or { colors = { rgba(accent, "ff"), rgba(acc2, "ff") }, angle = 45 },
inactive_border = rgba(border_override or accent, "44"),
},
},
decoration = {
rounding = rounding,
rounding_power = power,
active_opacity = opacity,
inactive_opacity = math.max(0.5, opacity - 0.08),
glow = {
enabled = glow and border_size > 0,
color = rgba(border_override or accent, "ff"),
range = glow_range,
render_power = glow_rp,
},
shadow = {
enabled = shadow_on,
range = shadow_range,
render_power = glow_rp,
color = rgba(shadow_color or accent, shadow_alpha),
color_inactive = rgba(shadow_color or border_override or accent, "18"),
offset = { 0, 0 },
},
blur = {
enabled = true,
size = 3,
passes = 1,
noise = 0.04,
},
screen_shader = "",
},
})
hl.layer_rule({ match = { namespace = "modal_.*" }, blur = true })
hl.window_rule({
name = "rio-terminal",
match = { class = "^(rio)$" },
border_size = 0,
no_shadow = true,
decorate = false,
float = true,
size = "1238 766",
center = true,
})
hl.window_rule({ match = { class = "^cool-retro-term$" }, float = true })
hl.window_rule({ match = { class = "^cool-retro-term$" }, center = true })
hl.window_rule({ match = { class = "^cool-retro-term$" }, size = "60% 65%" })
hl.window_rule({ match = { class = "^xdg-desktop-portal-gtk$" }, float = true })
hl.window_rule({ match = { class = "^xdg-desktop-portal-gtk$" }, center = true })
hl.window_rule({ match = { class = "^xdg-desktop-portal-gtk$" }, size = "60% 65%" })
local filewin = "^(File Upload|Save As|Save File|Save Image|Enter name of file|Open File|Open Files|Select File|Select Files|Choose.*[Ff]ile|Upload File).*$"
hl.window_rule({ match = { title = filewin }, float = true })
hl.window_rule({ match = { title = filewin }, center = true })
hl.window_rule({ match = { title = filewin }, size = "60% 65%" })
local opwin = "^(Rename.*|Create New Folder|Create Folder|Create Document|Bulk Rename.*|Properties.*|Confirm to replace.*|File Operation.*|Permissions.*|Delete|Trash|Empty Trash)$"
hl.window_rule({ match = { title = opwin }, float = true })
hl.window_rule({ match = { title = opwin }, center = true })
if wm.wmOpacity == true and type(wm.wmOpacityMode) == "string" and wm.wmOpacityMode ~= "off"
and type(wm.wmOpacityApps) == "string" and wm.wmOpacityApps ~= ""
and type(wm.wmOpacityVal) == "number" then
for app in string.gmatch(wm.wmOpacityApps, "[^,]+") do
local c = app:gsub("^%s+", ""):gsub("%s+$", "")
if c ~= "" then
local cls = wm.wmOpacityMode == "only" and ("(?i)^" .. c .. "$") or ("(?i)^((?!" .. c .. ").)*$")
hl.window_rule({ name = "cyberarch-wm", match = { class = cls }, opacity = wm.wmOpacityVal })
end
end
end
hl.config({ animations = { enabled = anim_master } })
hl.curve("swiftOut", { type = "bezier", points = { {0.05, 0.7}, {0.1, 1.0} } })
hl.animation({ leaf = "windows", enabled = true, speed = 4, bezier = "swiftOut", style = "slide" })
hl.animation({ leaf = "windowsIn", enabled = true, speed = 4, bezier = "swiftOut", style = "slide left" })
hl.animation({ leaf = "windowsOut", enabled = true, speed = 3, bezier = "swiftOut", style = "slide right" })
hl.animation({ leaf = "windowsMove", enabled = true, speed = 4, bezier = "swiftOut", style = "slide" })
hl.animation({ leaf = "fade", enabled = true, speed = 4, bezier = "swiftOut" })
hl.animation({ leaf = "workspaces", enabled = anim_workspace, speed = 4, bezier = "swiftOut", style = "slide" })
hl.animation({ leaf = "layers", enabled = true, speed = 3, bezier = "swiftOut", style = "fade" })