Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"license": "MIT",
"main": ".webpack/main",
"scripts": {
"start": "NODE_ENV=development electron-forge start",
"start": "DRAWPEN_DEV=1 electron-forge start",
"package_no_sign": "electron-forge package -- --no-sign",
"package": "electron-forge package",
"make": "electron-forge make",
Expand Down
32 changes: 19 additions & 13 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (electronSquirrelStartup) {
app.quit();
}

const isDevelopment = process.env.NODE_ENV === 'development'
const isDevelopment = process.env.DRAWPEN_DEV === '1'
const isMac = process.platform === 'darwin'
const isLinux = process.platform === 'linux'
const isWin = process.platform === 'win32'
Expand Down Expand Up @@ -252,11 +252,11 @@ function createMainWindow() {
let hasDevTools = false

if (isDevelopment) {
isResizable = true
hasDevTools = true
isResizable = true;
hasDevTools = true;
}

mainWindow = new BrowserWindow({
const mainWindowOptions = {
show: false,
transparent: true,
backgroundColor: '#00000000', // 8-symbol ARGB
Expand All @@ -271,8 +271,17 @@ function createMainWindow() {
devTools: hasDevTools,
nodeIntegration: false,
preload: APP_WINDOW_PRELOAD_WEBPACK_ENTRY,
}
})
},
};

if (isDevelopment) {
mainWindowOptions.x = 0;
mainWindowOptions.y = 0;
mainWindowOptions.width = 500;
mainWindowOptions.height = 500;
}

mainWindow = new BrowserWindow(mainWindowOptions)

mainWindow.loadURL(APP_WINDOW_WEBPACK_ENTRY);

Expand Down Expand Up @@ -505,6 +514,8 @@ ipcMain.handle('get_settings', () => {
key_binding_clear_desk: normalizeAcceleratorForUI(store.get('key_binding_clear_desk')),
key_binding_open_settings: normalizeAcceleratorForUI(KEY_SETTINGS),
key_binding_make_screenshot: normalizeAcceleratorForUI(KEY_MAKE_SCREENSHOT),

is_development: isDevelopment,
};
});

Expand Down Expand Up @@ -965,13 +976,8 @@ function sendNotification(data) {
function showWindowOnScreen() {
const currentDisplay = getDrawingDisplay()

mainWindow.setBounds(currentDisplay.workArea)

if (isDevelopment) {
mainWindow.setBounds({
width: 500,
height: 500
})
if (!isDevelopment) {
mainWindow.setBounds(currentDisplay.workArea)
}

if (store.get('active_monitor_id') === currentDisplay.id) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/app_page/components/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Application = (settings) => {

let initialFigures = []

if (process.env.NODE_ENV === 'development') {
if (settings.is_development) {
initialFigures = [
{ id: 0, type: 'arrow', colorIndex: 0, widthIndex: 2, points: [[100, 100], [400, 100]], rainbowColorDeg: (Math.random() * 360) },
{ id: 1, type: 'line', colorIndex: 0, widthIndex: 2, points: [[100, 200], [400, 200]], rainbowColorDeg: 250 },
Expand Down
2 changes: 1 addition & 1 deletion tools/webpack/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const rules = [
]

function inDev() {
return process.env.NODE_ENV == 'development';
return process.env.DRAWPEN_DEV === '1';
}

const copyPlugins = [
Expand Down