Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Fix paths to work in Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamerlin committed Jun 29, 2019
1 parent 7dda60e commit 94b430e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "tsc",
"prestart": "yarn run build",
"start": "electron ./app/main.js",
"start": "electron ./app/main.js --no-sandbox",
"pack": "electron-builder --dir",
"predist": "yarn run build",
"dist": "electron-builder",
Expand Down
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ How it works:

![Windows](./docs/pomodorino_win.gif)

#### Linux installer troubleshoot ####
If you install it on arch linux or some other versions, you will have to edit the shortcut and add this as argument:
`--no-sandbox`


#### I want to add more or change the timers:
Just search on `main.js` for `{ id: '25', label: '25', type: 'normal', click: menuClick },`
This is the line that adds the 25 mins timer. You just add more or remove them. What is used as the time is the id field, so you an change the label for anything you need to.
Expand Down
6 changes: 4 additions & 2 deletions src/alerts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Notification} from "electron"
import * as path from 'path';


export class Alerts {
shouldBlink: boolean = true;
Expand All @@ -11,8 +13,8 @@ export class Alerts {

constructor(renderer: Electron.BrowserWindow, baseDir: string) {
this.renderer = renderer;
this.audioFile = `${baseDir}/res/audio/ring-fixed-bitrate.mp3`;
this.notificationIcon = `${baseDir}/res/tomato.png`;
this.audioFile = path.join(baseDir, '/res/audio/ring-fixed-bitrate.mp3');
this.notificationIcon = path.join(baseDir,'/res/tomato.png');
}

configurePlayAudio(onOff: boolean) {
Expand Down
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { app, BrowserWindow, Menu, MenuItem } from 'electron';
import { Alerts } from './alerts';
import { PomoEngine } from './pomoEngine';
import * as path from 'path';

const dir = `${__dirname}/..`;
const dir = path.join(__dirname,'/..');

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
Expand All @@ -22,7 +23,7 @@ function appReady() {
show: false,
webPreferences: { nodeIntegration: true }
})
invisibleRenderer.loadURL(`file://${dir}/src/renderer.html`);
invisibleRenderer.loadURL(`file://${path.join(dir,'/src/renderer.html')}`);
alerts = new Alerts(invisibleRenderer, `${dir}`);
pomo = new PomoEngine(alerts, generateContextMenu(), dir);
}
Expand Down
7 changes: 4 additions & 3 deletions src/pomoEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Tray, nativeImage, Menu } from 'electron';
*/
import * as Timr from 'timrjs';
import { Alerts } from "./alerts";
import * as path from 'path';

export class PomoEngine {
private readonly alert: Alerts;
Expand All @@ -19,8 +20,8 @@ export class PomoEngine {
private timer = null;

constructor(alert: Alerts, menu: Menu, baseDir: string) {
this.defaultTrayImg = `${baseDir}/res/tomato.png`
this.alertTrayImg = `${baseDir}/res/yomato.png`
this.defaultTrayImg = path.join(baseDir,'/res/tomato.png');
this.alertTrayImg = path.join(baseDir,'/res/yomato.png');
this.tray = new Tray(this.defaultTrayImg);
this.tray.setContextMenu(menu);
this.tray.on('click', () => this.trayClicked());
Expand Down Expand Up @@ -79,7 +80,7 @@ export class PomoEngine {
private generateImage(overlayText, setTrayImageClosure) {
let useBiggerFonts = (process.platform == "win32")
let Jimp = require("jimp");
let fileName = `${this.baseDir}/res/tomato.png`;
let fileName = path.join(this.baseDir,'/res/tomato.png');
let calculatedY = useBiggerFonts ? 0 : 8
let calculatedX = useBiggerFonts ?
(overlayText.length > 1) ? 0 : 8
Expand Down

0 comments on commit 94b430e

Please sign in to comment.