diff options
| -rw-r--r-- | env.d.ts | 22 | ||||
| -rw-r--r-- | modules/launcher.tsx | 1 | ||||
| -rwxr-xr-x | run.fish | 5 | ||||
| -rw-r--r-- | services/math.ts | 3 | ||||
| -rw-r--r-- | services/players.ts | 3 | ||||
| -rw-r--r-- | utils/constants.ts | 5 |
6 files changed, 8 insertions, 31 deletions
@@ -1,21 +1,3 @@ +declare const HOME: string; +declare const CACHE: string; declare const SRC: string; - -declare module "inline:*" { - const content: string; - export default content; -} - -declare module "*.scss" { - const content: string; - export default content; -} - -declare module "*.blp" { - const content: string; - export default content; -} - -declare module "*.css" { - const content: string; - export default content; -} diff --git a/modules/launcher.tsx b/modules/launcher.tsx index 0768539..83245ca 100644 --- a/modules/launcher.tsx +++ b/modules/launcher.tsx @@ -6,7 +6,6 @@ import AstalHyprland from "gi://AstalHyprland"; import { launcher as config } from "../config"; import { Apps } from "../services/apps"; import Math, { type HistoryItem } from "../services/math"; -import { HOME } from "../utils/constants"; import { getAppCategoryIcon } from "../utils/icons"; import { launch } from "../utils/system"; import { PopupWindow, setupCustomTooltip, TransitionType } from "../utils/widgets"; @@ -3,9 +3,12 @@ cd (dirname (status filename)) || exit 1 set -q XDG_RUNTIME_DIR && set bundle_dir $XDG_RUNTIME_DIR || set bundle_dir /tmp +set -q XDG_CACHE_HOME && set cache_dir $XDG_CACHE_HOME/caelestia || set cache_dir $HOME/.cache/caelestia + +mkdir -p $cache_dir ./node_modules/.bin/esbuild app.tsx --bundle --outfile=$bundle_dir/caelestia.js \ --external:console --external:system --external:cairo --external:gettext --external:'file://*' --external:'gi://*' --external:'resource://*' \ - --define:SRC=\"(pwd)\" --format=esm --platform=neutral --main-fields=module,main + --define:HOME=\"$HOME\" --define:CACHE=\"$cache_dir\" --define:SRC=\"(pwd)\" --format=esm --platform=neutral --main-fields=module,main gjs -m $bundle_dir/caelestia.js diff --git a/services/math.ts b/services/math.ts index 41e1488..2c7fabd 100644 --- a/services/math.ts +++ b/services/math.ts @@ -1,6 +1,5 @@ import { GLib, GObject, property, readFile, register, writeFileAsync } from "astal"; import { derivative, evaluate, rationalize, simplify } from "mathjs/number"; -import { CACHE_DIR } from "../utils/constants"; export interface HistoryItem { equation: string; @@ -18,7 +17,7 @@ export default class Math extends GObject.Object { } readonly #maxHistory = 20; - readonly #path = `${CACHE_DIR}/math-history.json`; + readonly #path = `${CACHE}/math-history.json`; readonly #history: HistoryItem[] = []; #variables: Record<string, string> = {}; diff --git a/services/players.ts b/services/players.ts index 3313595..b81d4b5 100644 --- a/services/players.ts +++ b/services/players.ts @@ -1,6 +1,5 @@ import { GLib, GObject, property, readFile, register, writeFileAsync } from "astal"; import AstalMpris from "gi://AstalMpris"; -import { CACHE_DIR } from "../utils/constants"; import { isRealPlayer } from "../utils/mpris"; @register({ GTypeName: "Players" }) @@ -12,7 +11,7 @@ export default class Players extends GObject.Object { return this.instance; } - readonly #path = `${CACHE_DIR}/players.txt`; + readonly #path = `${CACHE}/players.txt`; readonly #players: AstalMpris.Player[] = []; readonly #subs = new Map< JSX.Element, diff --git a/utils/constants.ts b/utils/constants.ts deleted file mode 100644 index 2604c0e..0000000 --- a/utils/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { exec, GLib } from "astal"; - -export const HOME = GLib.get_home_dir(); -export const CACHE_DIR = GLib.get_user_cache_dir() + "/caelestia"; -exec(`mkdir -p '${CACHE_DIR}'`); |