diff options
author | rany | 2020-12-31 23:41:02 +0200 |
---|---|---|
committer | rany | 2020-12-31 23:41:02 +0200 |
commit | 31ee41ad8eec3adc5e9b649954d7d9f91550f2a7 (patch) | |
tree | 5eb751951f08ddefba17273c84979545397deec2 | |
parent | 4e0a0331067ce73ff5e60392d7cf2175963797b8 (diff) | |
download | aur-31ee41ad8eec3adc5e9b649954d7d9f91550f2a7.tar.gz |
Fix icon
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | glowing-bear.sh | 5 | ||||
-rw-r--r-- | index.js | 47 |
4 files changed, 61 insertions, 9 deletions
@@ -1,7 +1,7 @@ pkgbase = glowing-bear-electron pkgdesc = A web client for Weechat (Electron version) pkgver = 0.9.0 - pkgrel = 1 + pkgrel = 2 url = https://www.glowing-bear.org/ arch = any groups = irc @@ -12,8 +12,10 @@ pkgbase = glowing-bear-electron depends = glowing-bear-web source = glowing-bear.desktop source = glowing-bear.sh + source = index.js sha256sums = 8e8f5c38849a8e76e0f217c38c24b5b6b297b7c644ea3513ea80a5ac39787424 - sha256sums = d7a07b5c49a625df89f849333a0486e219b6b31d5090b1f13a651d5f4524399b + sha256sums = 6f629478fc412719c7200b43a360aceafdabc58a76016cba66cc41188d86e5bf + sha256sums = 5104282cf97cdc605d562d553b564040b9872627e1651ea005459b30f7f86bea pkgname = glowing-bear-electron @@ -1,7 +1,7 @@ # Maintainer: rany <rany@disroot.org> pkgname=glowing-bear-electron pkgver=0.9.0 -pkgrel=1 +pkgrel=2 pkgdesc="A web client for Weechat (Electron version)" arch=(any) url="https://www.glowing-bear.org/" @@ -10,9 +10,11 @@ groups=(irc weechat) depends=(electron glowing-bear-web) makedepends=(librsvg) source=("glowing-bear.desktop" - "glowing-bear.sh") + "glowing-bear.sh" + "index.js") sha256sums=("8e8f5c38849a8e76e0f217c38c24b5b6b297b7c644ea3513ea80a5ac39787424" - "d7a07b5c49a625df89f849333a0486e219b6b31d5090b1f13a651d5f4524399b") + "6f629478fc412719c7200b43a360aceafdabc58a76016cba66cc41188d86e5bf" + "5104282cf97cdc605d562d553b564040b9872627e1651ea005459b30f7f86bea") package() { # Register the binary as glowing-bear @@ -28,6 +30,10 @@ package() { rsvg-convert -h $icon -w $icon /usr/share/webapps/glowing-bear/assets/img/glowing-bear.svg -o "${pkgdir}/usr/share/icons/hicolor/${icon}x${icon}/apps/glowing-bear.png" done + # Setup /usr/lib/glowing-bear + install -Dm644 "$srcdir/index.js" "${pkgdir}/usr/lib/glowing-bear" + ln -sf /usr/share/webapps/glowing-bear "${pkgdir}/usr/lib/glowing-bear/webapp" + # Add the .desktop file install -Dm644 "$srcdir/glowing-bear.desktop" "${pkgdir}/usr/share/applications/glowing-bear.desktop" } diff --git a/glowing-bear.sh b/glowing-bear.sh index 4dc7b077efb6..3fbef6ab943e 100644..100755 --- a/glowing-bear.sh +++ b/glowing-bear.sh @@ -1,5 +1,2 @@ #!/bin/bash - -mkdir -p "$HOME/.config/glowing-bear" -cd "$HOME/.config/glowing-bear" -exec electron /usr/share/webapps/glowing-bear "${@}" +exec electron /usr/lib/glowing-bear/index.js "${@}" diff --git a/index.js b/index.js new file mode 100644 index 000000000000..6589bb87affe --- /dev/null +++ b/index.js @@ -0,0 +1,47 @@ +// Modules to control application life and create native browser window +const {app, BrowserWindow} = require('electron') +const path = require('path') +const iconPath = path.join(__dirname, "webapp/assets/img/glowing-bear.png"); +const userPath = path.join(app.getPath('home'), ".config/glowing-bear"); + +app.setPath('userData', userPath); + +function createWindow () { + // Create the browser window. + const mainWindow = new BrowserWindow({ + title: "Glowing Bear", + icon: iconPath, + webPreferences: { + contextIsolation: true + } + }) + + // and load the index.html of the app. + mainWindow.loadFile('webapp/index.html') + + // hide menu bar because it's useless + mainWindow.setMenuBarVisibility(false) + + // Open the DevTools. + //mainWindow.webContents.openDevTools() +} + +// This method will be called when Electron has finished +// initialization and is ready to create browser windows. +// Some APIs can only be used after this event occurs. +app.whenReady().then(() => { + createWindow() + + app.on('activate', function () { + // On macOS it's common to re-create a window in the app when the + // dock icon is clicked and there are no other windows open. + if (BrowserWindow.getAllWindows().length === 0) createWindow() + }) +}) + +// Quit when all windows are closed, except on macOS. There, it's common +// for applications and their menu bar to stay active until the user quits +// explicitly with Cmd + Q. +app.on('window-all-closed', function () { + if (process.platform !== 'darwin') app.quit() +}) |