Skip to content

Commit

Permalink
Fix Windows Menubar
Browse files Browse the repository at this point in the history
  • Loading branch information
kemzops committed Mar 15, 2023
1 parent 80696e2 commit 18d4085
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/* PACKAGES */
require('v8-compile-cache');
const { BrowserWindow, ipcMain, app, Tray, Menu } = require('electron');
const { menubar } = require('menubar');
const path = require('path');
const fs = require('fs-extra');

Expand Down Expand Up @@ -149,6 +148,7 @@ app.on('ready', async (e) => {
});
}
} catch (e) { }
const { menubar } = require('menubar');

let windowsMenubar = menubar({
browserWindow: {
Expand All @@ -161,22 +161,22 @@ app.on('ready', async (e) => {
maxHeight: 380,
show: false,
title: 'التقوى',
icon: path.join(__dirname, '../build/icons/icon.png'),
icon: path.join(__dirname, './build/icons/icon.png'),
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, '../preload/tray_window.js'),
preload: path.join(__dirname, './preload/tray_window.js'),
devTools: false
}
},
index: path.join(__dirname, '../pages/tray_window.html'),
icon: path.join(__dirname, '../build/icons/icon@2x.png'),
index: path.join(__dirname, './pages/tray_window.html'),
icon: path.join(__dirname, './build/icons/icon@2x.png'),
tray: tray
});

windowsMenubar.on('ready', () => {
windowsMenubar.tray.on('click', () => {
if (windowsMenubar?.isVisible()) {
windowsMenubar?.hide();
if (win?.isVisible()) {
win?.hide();
windowsMenubar?.showWindow();
} else {
win?.show();
Expand Down Expand Up @@ -237,7 +237,7 @@ app.on('ready', async (e) => {
ipcMain?.on('show3', () => {
audioWindow?.show();
});

audioWindow?.on('closed', (event) => {
event?.preventDefault();
audioWindow = null
Expand Down
14 changes: 7 additions & 7 deletions src/modules/appInitialization.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = async (path, fs, App_Path) => {

fs.existsSync(App_Path) ? true : await fs.mkdirsSync(App_Path, { recursive: true });
fs.existsSync(App_Path) ? true : fs.mkdirsSync(App_Path, { recursive: true });

fs.existsSync(path.join(App_Path, "./data")) ? true :
await fs.mkdirsSync(path.join(App_Path, "./data"), { recursive: true });
fs.mkdirsSync(path.join(App_Path, "./data"), { recursive: true });

fs.existsSync(path.join(App_Path, "./data/settings.json")) ? true :
await fs.writeJsonSync(path.join(App_Path, './data/settings.json'), {
fs.writeJsonSync(path.join(App_Path, './data/settings.json'), {
"Calculation": "UmmAlQura",
"notifications_adhan": true,
"notifications_adhkar": true,
Expand All @@ -32,7 +32,7 @@ module.exports = async (path, fs, App_Path) => {
if (status !== 200) return
let body = await response?.json();

await fs.writeJsonSync(path.join(App_Path, './data/location.json'), {
fs.writeJsonSync(path.join(App_Path, './data/location.json'), {
country: body?.country,
countryCode: body?.countryCode,
regionName: body?.regionName,
Expand All @@ -50,10 +50,10 @@ module.exports = async (path, fs, App_Path) => {
}

fs.existsSync(path.join(App_Path, "./data/Now.json")) ? true :
await fs.writeJsonSync(path.join(App_Path, './data/Now.json'), { "id": "surah_number_1" });
fs.writeJsonSync(path.join(App_Path, './data/Now.json'), { "id": "surah_number_1" });

await fs.writeJsonSync(path.join(App_Path, './data/audio_window.json'), { "start": false });
fs.writeJsonSync(path.join(App_Path, './data/audio_window.json'), { "start": false });

await fs.writeJsonSync(path.join(App_Path, './data/sound.json'), { "sound": true });
fs.writeJsonSync(path.join(App_Path, './data/sound.json'), { "sound": true });

}

0 comments on commit 18d4085

Please sign in to comment.