1
0
mirror of https://github.com/rhysd/Mstdn.git synced 2025-02-27 05:54:15 +01:00

add icons

This commit is contained in:
rhysd 2017-04-15 17:05:32 +09:00
parent ed0a1682d3
commit e230b271c2
8 changed files with 11 additions and 9 deletions

View File

@ -3,10 +3,10 @@ Web-based Desktop Client for [Mastodon][]
Features: Features:
- Small window on your menubar (or isolated window) - [x] Small window on your menubar (or isolated window)
- Desktop notification - [ ] Desktop notification
- Customizable shortcut keybinds - [ ] Customizable shortcut keybinds
- Multi-account - [ ] Multi-account
Mastodon is an open source project. So if you want to make a new UI, you can just fork the project, Mastodon is an open source project. So if you want to make a new UI, you can just fork the project,
implement your favorite UI and host it on your place. Then you can participate Mastodon networks from it. implement your favorite UI and host it on your place. Then you can participate Mastodon networks from it.

View File

@ -3,7 +3,7 @@ import {app, BrowserWindow, globalShortcut, Tray} from 'electron';
import windowState = require('electron-window-state'); import windowState = require('electron-window-state');
import * as menubar from 'menubar'; import * as menubar from 'menubar';
import log from './log'; import log from './log';
import {Config} from './config' import {Config, Account} from './config'
const IS_DEBUG = process.env.NODE_ENV === 'development'; const IS_DEBUG = process.env.NODE_ENV === 'development';
const IS_DARWIN = process.platform === 'darwin'; const IS_DARWIN = process.platform === 'darwin';
@ -12,23 +12,23 @@ const DEFAULT_WIDTH = 340;
const DEFAULT_HEIGHT = 400; const DEFAULT_HEIGHT = 400;
export class App { export class App {
private host: string; private account: Account;
constructor(private win: Electron.BrowserWindow, private config: Config) { constructor(private win: Electron.BrowserWindow, private config: Config) {
if (config.accounts.length === 0) { if (config.accounts.length === 0) {
throw new Error('No account found. Please check the config.'); throw new Error('No account found. Please check the config.');
} }
this.host = this.config.accounts[0].host; this.account = this.config.accounts[0];
} }
open() { open() {
this.win.loadURL(`https://${this.host}`); this.win.loadURL(`https://${this.account.host}${this.account.default_page}`);
this.win.show(); this.win.show();
} }
} }
function trayIcon(color: string) { function trayIcon(color: string) {
return path.join(__dirname, '..', 'resources', `tray-icon-${ return path.join(__dirname, '..', 'resources', 'icon', `tray-icon-${
color === 'white' ? 'white' : 'black' color === 'white' ? 'white' : 'black'
}@2x.png`); }@2x.png`);
} }
@ -109,6 +109,7 @@ function startNormalWindow(config: Config): Promise<Electron.BrowserWindow> {
tray.on('double-click', toggleWindow); tray.on('double-click', toggleWindow);
if (IS_DARWIN) { if (IS_DARWIN) {
tray.setHighlightMode('never'); tray.setHighlightMode('never');
app.dock.setIcon(APP_ICON);
} }
}); });
} }

View File

@ -6,6 +6,7 @@ import log from './log';
export interface Account { export interface Account {
host: string; host: string;
name: string; name: string;
default_page: string;
} }
export interface Config { export interface Config {

BIN
resources/icon/icon.icns Normal file

Binary file not shown.

BIN
resources/icon/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resources/icon/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B