use png for tray on linux

This commit is contained in:
dragonwocky 2020-07-09 18:32:20 +10:00
parent 156b4061b0
commit 422be7410a
Signed by: dragonwocky
GPG Key ID: C7A48B7846AA706D
4 changed files with 14 additions and 11 deletions

View File

@ -104,10 +104,10 @@ try:
with open(os.path.join(filepath, 'app', 'ENHANCER_VERSION.txt'), 'w', encoding='UTF-8') as write:
write.write(enhancer_version)
if os.path.isfile(os.path.join(filepath, "app", "renderer", "preload.js")):
if os.path.isfile(os.path.join(filepath, 'app', 'renderer', 'preload.js')):
print(
f' ...adding preload.js to {os.path.join(filepath, "app","renderer","preload.js")}')
with open(os.path.join(filepath, "app", "renderer", "preload.js"), 'r', encoding='UTF-8') as content:
with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'r', encoding='UTF-8') as content:
if '/* === INJECTION MARKER === */' in content.read():
print(' * preload.js already added. replacing it.')
content.seek(0)
@ -116,12 +116,12 @@ try:
if '/* === INJECTION MARKER === */' in line:
break
original += line
with open(os.path.join(filepath, "app", "renderer", "preload.js"), 'w', encoding='UTF-8') as write:
with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'w', encoding='UTF-8') as write:
write.writelines(original)
else:
with open(os.path.join(filepath, "app", "renderer", "preload.js"), 'a', encoding='UTF-8') as append:
with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'a', encoding='UTF-8') as append:
append.write('\n\n')
with open(os.path.join(filepath, "app", "renderer", "preload.js"), 'a', encoding='UTF-8') as append:
with open(os.path.join(filepath, 'app', 'renderer', 'preload.js'), 'a', encoding='UTF-8') as append:
print(
f' ...linking to {os.path.join(".", "resources", "user.css")}')
with open(os.path.join(__dirname__, 'resources', 'preload.js'), 'r', encoding='UTF-8') as insert:

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -17,6 +17,7 @@ let tray;
function enhancements() {
const { Tray, Menu, nativeImage, app } = require('electron'),
isMac = process.platform === 'darwin',
isWin = process.platform.includes('win'),
path = require('path'),
store = require(path.join(__dirname, '..', 'store.js'))({
config: 'user-preferences',
@ -28,12 +29,14 @@ function enhancements() {
},
});
tray = new Tray(
isMac
? new nativeImage.createFromPath('☃☃☃resources☃☃☃/icons/mac.png').resize({
isWin
? '☃☃☃resources☃☃☃/icons/windows.ico'
: new nativeImage.createFromPath('☃☃☃resources☃☃☃/icons/tray.png').resize(
{
width: 16,
height: 16,
})
: '☃☃☃resources☃☃☃/icons/tray.ico'
}
)
);
const contextMenu = Menu.buildFromTemplate([
{