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
|
import options from "options"
const { messageAsync } = await Service.import("hyprland")
const {
hyprland,
theme: {
spacing,
radius,
border: { width },
blur,
shadows,
dark: {
primary: { bg: darkActive },
},
light: {
primary: { bg: lightActive },
},
scheme,
},
} = options
const deps = [
"hyprland",
spacing.id,
radius.id,
blur.id,
width.id,
shadows.id,
darkActive.id,
lightActive.id,
scheme.id,
]
function activeBorder() {
const color = scheme.value === "dark"
? darkActive.value
: lightActive.value
return color.replace("#", "")
}
function sendBatch(batch: string[]) {
const cmd = batch
.filter(x => !!x)
.map(x => `keyword ${x}`)
.join("; ")
return messageAsync(`[[BATCH]]/${cmd}`)
}
async function setupHyprland() {
const wm_gaps = Math.floor(hyprland.gaps.value * spacing.value)
//sendBatch([
// `general:border_size ${width}`,
// `general:gaps_out ${wm_gaps}`,
// `general:gaps_in ${Math.floor(wm_gaps / 2)}`,
// `general:col.active_border rgba(${activeBorder()}ff)`,
// `general:col.inactive_border rgba(${hyprland.inactiveBorder.value})`,
// `decoration:rounding ${radius}`,
// `decoration:drop_shadow ${shadows.value ? "yes" : "no"}`,
// `dwindle:no_gaps_when_only ${hyprland.gapsWhenOnly.value ? 0 : 1}`,
// `master:no_gaps_when_only ${hyprland.gapsWhenOnly.value ? 0 : 1}`,
//])
//await sendBatch(App.windows.map(({ name }) => `layerrule unset, ${name}`))
if (blur.value > 0) {
sendBatch(App.windows.flatMap(({ name }) => [
`layerrule unset, ${name}`,
`layerrule blur, ${name}`,
`layerrule ignorealpha ${/* based on shadow color */.29}, ${name}`,
]))
}
}
export default function init() {
options.handler(deps, setupHyprland)
setupHyprland()
}
|