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

Commit

Permalink
Basic loading of user-style.css from userData. Fixes #40
Browse files Browse the repository at this point in the history
https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname
userData: $appData/IRCCloud
appData is:
	%APPDATA% on Windows
	$XDG_CONFIG_HOME or ~/.config on Linux
	~/Library/Application Support on macOS
  • Loading branch information
jwheare committed Jul 14, 2016
1 parent bb3b433 commit fd963c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Shell = electron.shell;
const dialog = electron.dialog;

const path = require('path');
const FS = require('fs');

const ConfigStore = require('configstore');
const Menu = require('./menu');
Expand Down Expand Up @@ -149,6 +150,16 @@ function openMainWindow() {
}
});


mainWindow.webContents.on('dom-ready', function(event) {
var userStylePath = path.join(app.getPath('userData'), 'user-style.css');
FS.readFile(userStylePath, 'utf8', function (err, data) {
if (!err) {
mainWindow.webContents.insertCSS(data);
}
});
});

mainWindow.webContents.on('will-navigate', function (e, url) {
// Make sure the invite cookie persists over logout
enableStreamlinedLogin();
Expand Down

0 comments on commit fd963c9

Please sign in to comment.