Skip to content

Commit

Permalink
fix: added icons for both light and dark themes
Browse files Browse the repository at this point in the history
  • Loading branch information
urz9999 committed Jul 7, 2021
1 parent c9a8096 commit 9bc35c9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/app/components/shared/tray-menu/tray-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {AwsIamRoleFederatedSession} from '../../../models/aws-iam-role-federated
import {UpdaterService} from '../../../services/updater.service';
import {SessionService} from '../../../services/session.service';
import {SessionFactoryService} from '../../../services/session-factory.service';
import {normalizeSourceMaps} from "@angular-devkit/build-angular/src/utils";

@Component({
selector: 'app-tray-menu',
Expand Down Expand Up @@ -138,14 +139,22 @@ export class TrayMenuComponent implements OnInit, OnDestroy {
}
this.appService.getMenu().setApplicationMenu(this.appService.getMenu().buildFromTemplate(template));

// check for dark mode
let normalIcon = 'LeappMini';
let updateIcon = 'LeappMini2';
if (this.appService.isDarkMode()) {
normalIcon = 'LeappMini3';
updateIcon = 'Leappmini4';
}

if (!this.currentTray) {
this.currentTray = new (this.appService.getTray())(__dirname + `/assets/images/LeappMini.png`);
this.currentTray = new (this.appService.getTray())(__dirname + `/assets/images/${normalIcon}.png`);
}

if (this.updaterService.getSavedVersionComparison() && this.updaterService.isReady()) {
voices.push({ type: 'separator' });
voices.push({ label: 'Check for Updates...', type: 'normal', click: () => this.updaterService.updateDialog() });
this.currentTray.setImage(__dirname + `/assets/images/LeappMini2.png`);
this.currentTray.setImage(__dirname + `/assets/images/${updateIcon}.png`);
}

voices = voices.concat(extraInfo);
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/native-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class NativeService {
protected followRedirects: any;
protected httpProxyAgent: any;
protected httpsProxyAgent: any;
protected nativeTheme: any;

constructor() {
if ((window as any).native) {
Expand Down Expand Up @@ -67,6 +68,9 @@ export class NativeService {
this.menu = (window as any).native.Menu;
this.tray = (window as any).native.Tray;
this.ipcRenderer = (window as any).native.ipcRenderer;
this.nativeTheme = (window as any).native.nativeTheme;

console.log(this.nativeTheme);
}
}
}
Binary file modified src/assets/images/LeappMini.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/LeappMini2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/LeappMini3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/LeappMini4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
currentWindow: require('electron').remote.getCurrentWindow(),
Menu: require('electron').remote.Menu,
Tray: require('electron').remote.Tray,
ipcRenderer: require('electron').ipcRenderer
ipcRenderer: require('electron').ipcRenderer,
nativeTheme: require('electron').remote.nativeTheme
};
</script>
<app-root></app-root>
Expand Down

0 comments on commit 9bc35c9

Please sign in to comment.