mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Customize installer
This commit is contained in:
4
Makefile
4
Makefile
@@ -38,6 +38,10 @@ test:
|
||||
package:
|
||||
mvn clean package
|
||||
|
||||
.PHONY: runx
|
||||
runx:
|
||||
./src/main/shell/run-electron-app-in-xorg
|
||||
|
||||
.PHONY: ssl
|
||||
ssl:
|
||||
mkdir -p local
|
||||
|
||||
11
package.json
11
package.json
@@ -4,7 +4,7 @@
|
||||
"description": "Electron wrapper for the Imgfloat overlay",
|
||||
"main": "app.js",
|
||||
"build": {
|
||||
"appId": "dev.kruhlmann.imgfloat.overlay",
|
||||
"appId": "dev.kruhlmann.imgfloat",
|
||||
"productName": "Imgfloat",
|
||||
"files": [ "src/main/node/app.js" ],
|
||||
"asar": false,
|
||||
@@ -18,6 +18,15 @@
|
||||
"target": ["nsis"]
|
||||
"icon": "assets/icon/appicon.ico"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": true,
|
||||
"perMachine": true,
|
||||
"allowElevation": true,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"createDesktopShortcut": true,
|
||||
"createStartMenuShortcut": true,
|
||||
"shortcutName": "Imgfloat"
|
||||
},
|
||||
"mac": {
|
||||
"category": "public.app-category.productivity"
|
||||
"icon": "assets/icon/macos.icns"
|
||||
|
||||
12
shell.nix
12
shell.nix
@@ -2,14 +2,16 @@
|
||||
|
||||
pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.openssl
|
||||
pkgs.electron
|
||||
pkgs.openjdk
|
||||
pkgs.maven
|
||||
pkgs.nodejs
|
||||
pkgs.nodePackages.prettier
|
||||
pkgs.jdt-language-server
|
||||
pkgs.maven
|
||||
pkgs.mkcert
|
||||
pkgs.nodePackages.prettier
|
||||
pkgs.nodejs
|
||||
pkgs.nss
|
||||
pkgs.openbox
|
||||
pkgs.openjdk
|
||||
pkgs.openssl
|
||||
pkgs.xorg.xorgserver
|
||||
];
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ function createWindow() {
|
||||
icon: path.join(__dirname, "../resources/assets/icon/appicon.ico"),
|
||||
webPreferences: { backgroundThrottling: false },
|
||||
});
|
||||
win.setMenu(null);
|
||||
applicationWindow.setMenu(null);
|
||||
|
||||
let canvasSizeInterval;
|
||||
const clearCanvasSizeInterval = () => {
|
||||
|
||||
46
src/main/shell/run-electron-app-in-xorg
Executable file
46
src/main/shell/run-electron-app-in-xorg
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
APP_ENTRY="src/main/node/app.js"
|
||||
SCREEN="1280x800"
|
||||
|
||||
for d in 99 98 97 96 95; do
|
||||
if ! xdpyinfo -display ":$d" >/dev/null 2>&1; then
|
||||
DISP="$d"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -n "${DISP:-}" ] || {
|
||||
echo "No free DISPLAY found" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Using DISPLAY=:$DISP"
|
||||
|
||||
Xephyr ":$DISP" -screen "$SCREEN" -resizeable -ac &
|
||||
XEPHYR_PID=$!
|
||||
|
||||
cleanup() {
|
||||
kill "$ELECTRON_PID" "$OPENBOX_PID" "$XEPHYR_PID" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
sleep 1
|
||||
|
||||
DISPLAY=":$DISP" openbox &
|
||||
OPENBOX_PID=$!
|
||||
|
||||
sleep 0.5
|
||||
|
||||
DISPLAY=":$DISP" electron "$APP_ENTRY" &
|
||||
ELECTRON_PID=$!
|
||||
|
||||
# monitor X server — when it dies, kill Electron
|
||||
while kill -0 "$XEPHYR_PID" 2>/dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
echo "Xephyr exited — killing Electron"
|
||||
kill "$ELECTRON_PID" 2>/dev/null || true
|
||||
wait "$ELECTRON_PID" 2>/dev/null || true
|
||||
Reference in New Issue
Block a user