Chnaged AGS config
This commit is contained in:
@@ -2,79 +2,73 @@ 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,
|
||||
hyprland,
|
||||
theme: {
|
||||
radius,
|
||||
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,
|
||||
"hyprland",
|
||||
radius.id,
|
||||
blur.id,
|
||||
shadows.id,
|
||||
darkActive.id,
|
||||
lightActive.id,
|
||||
scheme.id,
|
||||
]
|
||||
|
||||
function activeBorder() {
|
||||
const color = scheme.value === "dark"
|
||||
? darkActive.value
|
||||
: lightActive.value
|
||||
const color = scheme.value === "dark"
|
||||
? darkActive.value
|
||||
: lightActive.value
|
||||
|
||||
return color.replace("#", "")
|
||||
return color.replace("#", "")
|
||||
}
|
||||
|
||||
function sendBatch(batch: string[]) {
|
||||
const cmd = batch
|
||||
.filter(x => !!x)
|
||||
.map(x => `keyword ${x}`)
|
||||
.join("; ")
|
||||
const cmd = batch
|
||||
.filter(x => !!x)
|
||||
.map(x => `keyword ${x}`)
|
||||
.join("; ")
|
||||
|
||||
return messageAsync(`[[BATCH]]/${cmd}`)
|
||||
return messageAsync(`[[BATCH]]/${cmd}`)
|
||||
}
|
||||
|
||||
async function setupHyprland() {
|
||||
const wm_gaps = Math.floor(hyprland.gaps.value * spacing.value)
|
||||
sendBatch([
|
||||
`general:border_size ${hyprland.borderSize.value}`,
|
||||
`general:gaps_out ${hyprland.gapsOut.value}`,
|
||||
`general:gaps_in ${hyprland.gapsIn.value}`,
|
||||
`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}`,
|
||||
])
|
||||
|
||||
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}`))
|
||||
|
||||
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}`,
|
||||
]))
|
||||
}
|
||||
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()
|
||||
options.handler(deps, setupHyprland)
|
||||
setupHyprland()
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ export function mkOptions<T extends object>(cacheFile: string, object: T) {
|
||||
|
||||
Utils.ensureDirectory(cacheFile.split("/").slice(0, -1).join("/"))
|
||||
|
||||
const configFile = `${TMP}/config.json`
|
||||
console.log(configFile)
|
||||
const configFile = `${App.configDir}/config.json`
|
||||
console.log("Config file: " + configFile)
|
||||
const values = getOptions(object).reduce((obj, { id, value }) => ({ [id]: value, ...obj }), {})
|
||||
Utils.writeFileSync(JSON.stringify(values, null, 2), configFile)
|
||||
Utils.monitorFile(configFile, () => {
|
||||
|
||||
Reference in New Issue
Block a user