Rename src/resource to src/assets
- `dist/resources` was not included in linux packages. - There were two "resources" directories. Close #360
@@ -78,18 +78,18 @@ Format the source codes to pass `npm test`.
|
||||
```
|
||||
Mattermost Desktop
|
||||
├── docs/ - Documentations.
|
||||
├── resources/ - Resources which are used outside of the application codes.
|
||||
├── resources/ - Resources which are used outside of the application codes, and original images of assets.
|
||||
├── scripts/ - Helper scripts.
|
||||
├── src/ - Application source code.
|
||||
│ ├── assets/ - Assets which are loaded from the application codes.
|
||||
│ ├── browser/ - Implementation of Electron's renderer process.
|
||||
│ │ ├── components/ - React.js components.
|
||||
│ │ ├── css/ - Stylesheets.
|
||||
│ │ ├── js/ - Helper JavaScript modules.
|
||||
│ │ └── webview/ - Injection code for Electron's <webview> tag.
|
||||
│ ├── common/ - Common JavaScript modules for both Electron's processes.
|
||||
│ ├── main/ - Implementation of Electron's main process.
|
||||
│ │ └── menus/ - Application menu.
|
||||
│ └── resources/ - Resources which are loaded from the application codes.
|
||||
│ └── main/ - Implementation of Electron's main process.
|
||||
│ └── menus/ - Application menu.
|
||||
└── test/ - Automated tests.
|
||||
├── modules/ - Scripts which are commonly used in tests.
|
||||
└── specs/ - Test scripts.
|
||||
|
12
gulpfile.js
@@ -68,11 +68,11 @@ gulp.task('build', ['sync-meta', 'copy'], (cb) => {
|
||||
fs.writeFile('./dist/package.json', JSON.stringify(distPackageJson, null, ' '), cb);
|
||||
});
|
||||
|
||||
gulp.task('copy', ['copy:resources', 'copy:html/css', 'copy:modules']);
|
||||
gulp.task('copy', ['copy:assets', 'copy:html/css', 'copy:modules']);
|
||||
|
||||
gulp.task('copy:resources', () => {
|
||||
return gulp.src('src/resources/**').
|
||||
pipe(gulp.dest('dist/resources'));
|
||||
gulp.task('copy:assets', () => {
|
||||
return gulp.src('src/assets/**').
|
||||
pipe(gulp.dest('dist/assets'));
|
||||
});
|
||||
|
||||
gulp.task('copy:html/css', () => {
|
||||
@@ -108,9 +108,9 @@ gulp.task('watch', ['build', 'webpack:main', 'webpack:renderer'], () => {
|
||||
|
||||
gulp.watch(['src/main.js', 'src/main/**/*.js', 'src/common/**/*.js'], ['webpack:main']);
|
||||
gulp.watch(['src/browser/**/*.js', 'src/browser/**/*.jsx'], ['webpack:renderer']);
|
||||
gulp.watch(['src/browser/**/*.css', 'src/browser/**/*.html', 'src/resources/**/*.png'], ['copy']);
|
||||
gulp.watch(['src/browser/**/*.css', 'src/browser/**/*.html', 'src/assets/**/*.png'], ['copy']);
|
||||
|
||||
gulp.watch(['dist/main.js', 'dist/resources/**'], () => {
|
||||
gulp.watch(['dist/main.js', 'dist/assets/**'], () => {
|
||||
electron.restart(options);
|
||||
});
|
||||
gulp.watch(['dist/browser/*.js'], electron.reload);
|
||||
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 836 B After Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 913 B After Width: | Height: | Size: 913 B |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 1023 B After Width: | Height: | Size: 1023 B |
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 487 B |
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 1002 B |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 497 B After Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -3,7 +3,7 @@
|
||||
const OriginalNotification = Notification;
|
||||
const {remote} = require('electron');
|
||||
|
||||
const appIconURL = `file:///${remote.app.getAppPath()}/resources/appicon.png`;
|
||||
const appIconURL = `file:///${remote.app.getAppPath()}/assets/appicon.png`;
|
||||
|
||||
function override(eventHandlers) {
|
||||
Notification = function constructor(title, options) { // eslint-disable-line no-global-assign, no-native-reassign
|
||||
|
38
src/main.js
@@ -58,6 +58,8 @@ const appMenu = require('./main/menus/app');
|
||||
const trayMenu = require('./main/menus/tray');
|
||||
const allowProtocolDialog = require('./main/allowProtocolDialog');
|
||||
|
||||
const assetsDir = path.resolve(app.getAppPath(), 'assets');
|
||||
|
||||
// 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.
|
||||
var mainWindow = null;
|
||||
@@ -122,34 +124,36 @@ const trayImages = (() => {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return {
|
||||
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/windows/tray.ico')),
|
||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/windows/tray_unread.ico')),
|
||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/windows/tray_mention.ico'))
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray.ico')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_unread.ico')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico'))
|
||||
};
|
||||
case 'darwin':
|
||||
{
|
||||
const icons = {
|
||||
light: {
|
||||
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIcon.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconUnread.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMention.png'))
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIcon.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconUnread.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconMention.png'))
|
||||
},
|
||||
clicked: {
|
||||
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/ClickedMenuIcon.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/ClickedMenuIconUnread.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/ClickedMenuIconMention.png'))
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIcon.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconUnread.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconMention.png'))
|
||||
}
|
||||
};
|
||||
switchMenuIconImages(icons, systemPreferences.isDarkMode());
|
||||
return icons;
|
||||
}
|
||||
case 'linux':
|
||||
var resourcesDir = 'resources/linux/' + (config.trayIconTheme || 'light') + '/';
|
||||
return {
|
||||
normal: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconTemplate.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconUnreadTemplate.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconMentionTemplate.png'))
|
||||
};
|
||||
{
|
||||
const theme = config.trayIconTheme || 'light';
|
||||
return {
|
||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png'))
|
||||
};
|
||||
}
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@@ -346,7 +350,7 @@ app.on('ready', () => {
|
||||
// In current version, use tray balloon for notification
|
||||
if (osVersion.isLowerThanOrEqualWindows8_1()) {
|
||||
trayIcon.displayBalloon({
|
||||
icon: path.resolve(__dirname, 'resources/appicon.png'),
|
||||
icon: path.resolve(assetsDir, 'appicon.png'),
|
||||
title: arg.title,
|
||||
content: arg.options.body
|
||||
});
|
||||
@@ -394,7 +398,7 @@ app.on('ready', () => {
|
||||
windowOptions = {};
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
windowOptions.icon = path.resolve(__dirname, 'resources/appicon.png');
|
||||
windowOptions.icon = path.resolve(assetsDir, 'appicon.png');
|
||||
}
|
||||
windowOptions.title = app.getName();
|
||||
mainWindow = new BrowserWindow(windowOptions);
|
||||
|