summaryrefslogtreecommitdiff
path: root/src/config/types.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-10 18:49:09 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-10 18:49:09 +1000
commitaeec219e843ad1d5b50378dd5817323c3ab4c324 (patch)
tree761d91358cfd9daeeec105a8c9332101fe957bf5 /src/config/types.ts
parentstyle: make transparency same for light/dark (diff)
downloadcaelestia-shell-aeec219e843ad1d5b50378dd5817323c3ab4c324.tar.gz
caelestia-shell-aeec219e843ad1d5b50378dd5817323c3ab4c324.tar.bz2
caelestia-shell-aeec219e843ad1d5b50378dd5817323c3ab4c324.zip
config: limit news param types
Limit countries, categories and languages to specific literals
Diffstat (limited to 'src/config/types.ts')
-rw-r--r--src/config/types.ts32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/config/types.ts b/src/config/types.ts
index 0e9138d..b79c408 100644
--- a/src/config/types.ts
+++ b/src/config/types.ts
@@ -1,25 +1,11 @@
+import { BAR_MODULES, NEWS_CATEGORIES, NEWS_COUNTRIES, NEWS_LANGUAGES } from "./literals";
+
const BOOL = "boolean";
const STR = "string";
const NUM = "number";
const ARR = (type: string | string[]) => `array of ${typeof type === "string" ? type : JSON.stringify(type)}`;
const OBJ_ARR = (shape: object) => ARR(JSON.stringify(shape));
-const barModules = [
- "osIcon",
- "activeWindow",
- "mediaPlaying",
- "brightnessSpacer",
- "workspaces",
- "volumeSpacer",
- "tray",
- "statusIcons",
- "pkgUpdates",
- "notifCount",
- "battery",
- "dateTime",
- "power",
-];
-
export default {
"style.transparency": ["off", "normal", "high"],
"style.borders": BOOL,
@@ -29,10 +15,10 @@ export default {
"bar.vertical": BOOL,
"bar.style": ["gaps", "panel", "embedded"],
"bar.layout.type": ["centerbox", "flowbox"],
- "bar.layout.centerbox.start": ARR(barModules),
- "bar.layout.centerbox.center": ARR(barModules),
- "bar.layout.centerbox.end": ARR(barModules),
- "bar.layout.flowbox": ARR(barModules),
+ "bar.layout.centerbox.start": ARR(BAR_MODULES),
+ "bar.layout.centerbox.center": ARR(BAR_MODULES),
+ "bar.layout.centerbox.end": ARR(BAR_MODULES),
+ "bar.layout.flowbox": ARR(BAR_MODULES),
"bar.modules.workspaces.shown": NUM,
"bar.modules.workspaces.showLabels": BOOL,
"bar.modules.workspaces.labels": ARR(STR),
@@ -95,9 +81,9 @@ export default {
"thumbnailer.defaults.height": NUM,
"thumbnailer.defaults.exact": BOOL,
"news.apiKey": STR,
- "news.countries": ARR(STR),
- "news.categories": ARR(STR),
- "news.languages": ARR(STR),
+ "news.countries": ARR(NEWS_COUNTRIES),
+ "news.categories": ARR(NEWS_CATEGORIES),
+ "news.languages": ARR(NEWS_LANGUAGES),
"news.domains": ARR(STR),
"news.timezone": STR,
"news.pages": NUM,