Skip to content

Commit

Permalink
Merge branch 'Jas-SinghFSU:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
benvonh authored Dec 28, 2024
2 parents e52460c + a7b5537 commit ef26c78
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 49 deletions.
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare const SRC: string;
declare const DATADIR: string;

declare module 'inline:*' {
const content: string;
Expand Down
50 changes: 15 additions & 35 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,57 +1,37 @@
project('hyprpanel')
project(
'hyprpanel',
default_options: [
'prefix=/usr',
],
)

bindir = get_option('prefix') / get_option('bindir')
datadir = get_option('prefix') / get_option('datadir') / 'hyprpanel'
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir') / meson.project_name()

ags = find_program('ags', required: true)
find_program('gjs', required: true)

src_file_list_process = run_command(
'find',
'src',
'-type', 'f',
'(',
'-name', '*.ts',
'-o',
'-name', '*.tsx',
'-o',
'-name', '*.scss',
')',
)

if src_file_list_process.returncode() != 0
error('Failed to find source files.')
endif

src_file_list = src_file_list_process.stdout().split('\n')

all_sources = []

foreach file : src_file_list
file_stripped = file.strip()
if file_stripped != ''
all_sources += meson.project_source_root() / file_stripped
endif
endforeach

custom_target(
'hyprpanel_bundle',
input: all_sources,
input: files('app.ts'),
command: [
ags,
'bundle',
'--define', 'DATADIR="' + datadir + '"',
'--root', meson.project_source_root(),
meson.project_source_root() / 'app.ts',
'@OUTPUT@',
'--src', meson.project_source_root(),
],
output: 'hyprpanel.js',
output: meson.project_name() + '.js',
install: true,
install_dir: datadir,
build_always_stale: true,
)

configure_file(
input: 'scripts/hyprpanel_launcher.sh.in',
output: 'hyprpanel',
output: meson.project_name(),
configuration: {'DATADIR': datadir},
install: true,
install_dir: bindir,
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"name": "hyprpanel",
"version": "1.0.0",
"description": "A customizable panel built for Hyprland.",
"main": "config.js",
"directories": {
"lib": "lib"
},
"main": "app.ts",
"scripts": {
"lint": "eslint --config .eslintrc.js .",
"lint:fix": "eslint --config .eslintrc.js . --fix",
Expand All @@ -14,6 +11,9 @@
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"astal": "/usr/share/astal/gjs"
},
"devDependencies": {
"@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^8.5.0",
Expand Down
2 changes: 0 additions & 2 deletions scripts/hyprpanel_launcher.sh.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

export HYPRPANEL_DATADIR="@DATADIR@"

if [ "$#" -eq 0 ]; then
exec gjs -m "@DATADIR@/hyprpanel.js"
else
Expand Down
4 changes: 3 additions & 1 deletion src/lib/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ export function ensureFile(path: string): void {
}
}

const dataDir = typeof DATADIR !== 'undefined' ? DATADIR : SRC;

Object.assign(globalThis, {
CONFIG: `${GLib.get_user_config_dir()}/hyprpanel/config.json`,
TMP: `${GLib.get_tmp_dir()}/hyprpanel`,
USER: GLib.get_user_name(),
SRC_DIR: GLib.getenv('HYPRPANEL_DATADIR') ?? SRC,
SRC_DIR: dataDir,
});

ensureDirectory(TMP);
Expand Down
9 changes: 2 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
"types": [],
"experimentalDecorators": true,
"jsx": "react-jsx",
"jsxImportSource": "/usr/share/astal/gjs/gtk3",
"paths": {
"astal": ["/usr/share/astal/gjs"],
"astal/*": ["/usr/share/astal/gjs/*"]
}
},
"exclude": ["astal/gtk3/jsx-runtime.ts"]
"jsxImportSource": "astal/gtk3"
}
}

0 comments on commit ef26c78

Please sign in to comment.