Pass home and cache through bundler
This commit is contained in:
parent
2d7ad5977f
commit
01540ca9d2
6 changed files with 8 additions and 31 deletions
22
env.d.ts
vendored
22
env.d.ts
vendored
|
|
@ -1,21 +1,3 @@
|
||||||
|
declare const HOME: string;
|
||||||
|
declare const CACHE: string;
|
||||||
declare const SRC: 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;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import AstalHyprland from "gi://AstalHyprland";
|
||||||
import { launcher as config } from "../config";
|
import { launcher as config } from "../config";
|
||||||
import { Apps } from "../services/apps";
|
import { Apps } from "../services/apps";
|
||||||
import Math, { type HistoryItem } from "../services/math";
|
import Math, { type HistoryItem } from "../services/math";
|
||||||
import { HOME } from "../utils/constants";
|
|
||||||
import { getAppCategoryIcon } from "../utils/icons";
|
import { getAppCategoryIcon } from "../utils/icons";
|
||||||
import { launch } from "../utils/system";
|
import { launch } from "../utils/system";
|
||||||
import { PopupWindow, setupCustomTooltip, TransitionType } from "../utils/widgets";
|
import { PopupWindow, setupCustomTooltip, TransitionType } from "../utils/widgets";
|
||||||
|
|
|
||||||
5
run.fish
5
run.fish
|
|
@ -3,9 +3,12 @@
|
||||||
cd (dirname (status filename)) || exit 1
|
cd (dirname (status filename)) || exit 1
|
||||||
|
|
||||||
set -q XDG_RUNTIME_DIR && set bundle_dir $XDG_RUNTIME_DIR || set bundle_dir /tmp
|
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 \
|
./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://*' \
|
--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
|
gjs -m $bundle_dir/caelestia.js
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { GLib, GObject, property, readFile, register, writeFileAsync } from "astal";
|
import { GLib, GObject, property, readFile, register, writeFileAsync } from "astal";
|
||||||
import { derivative, evaluate, rationalize, simplify } from "mathjs/number";
|
import { derivative, evaluate, rationalize, simplify } from "mathjs/number";
|
||||||
import { CACHE_DIR } from "../utils/constants";
|
|
||||||
|
|
||||||
export interface HistoryItem {
|
export interface HistoryItem {
|
||||||
equation: string;
|
equation: string;
|
||||||
|
|
@ -18,7 +17,7 @@ export default class Math extends GObject.Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly #maxHistory = 20;
|
readonly #maxHistory = 20;
|
||||||
readonly #path = `${CACHE_DIR}/math-history.json`;
|
readonly #path = `${CACHE}/math-history.json`;
|
||||||
readonly #history: HistoryItem[] = [];
|
readonly #history: HistoryItem[] = [];
|
||||||
|
|
||||||
#variables: Record<string, string> = {};
|
#variables: Record<string, string> = {};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import { GLib, GObject, property, readFile, register, writeFileAsync } from "astal";
|
import { GLib, GObject, property, readFile, register, writeFileAsync } from "astal";
|
||||||
import AstalMpris from "gi://AstalMpris";
|
import AstalMpris from "gi://AstalMpris";
|
||||||
import { CACHE_DIR } from "../utils/constants";
|
|
||||||
import { isRealPlayer } from "../utils/mpris";
|
import { isRealPlayer } from "../utils/mpris";
|
||||||
|
|
||||||
@register({ GTypeName: "Players" })
|
@register({ GTypeName: "Players" })
|
||||||
|
|
@ -12,7 +11,7 @@ export default class Players extends GObject.Object {
|
||||||
return this.instance;
|
return this.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly #path = `${CACHE_DIR}/players.txt`;
|
readonly #path = `${CACHE}/players.txt`;
|
||||||
readonly #players: AstalMpris.Player[] = [];
|
readonly #players: AstalMpris.Player[] = [];
|
||||||
readonly #subs = new Map<
|
readonly #subs = new Map<
|
||||||
JSX.Element,
|
JSX.Element,
|
||||||
|
|
|
||||||
|
|
@ -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}'`);
|
|
||||||
Loading…
Add table
Reference in a new issue