Skip to content

Commit

Permalink
Merge pull request #17 from termit-uanic/main
Browse files Browse the repository at this point in the history
Add "Hidden on startup" setting
  • Loading branch information
kumakichi committed Apr 5, 2024
2 parents fe46291 + d7a425b commit 881c0d3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
19 changes: 17 additions & 2 deletions README.org
Expand Up @@ -14,7 +14,7 @@
Open deepl-linux-electron, select text in any application, press Ctrl+c to copy selected content into clipboard, then use shortcut *Control+Alt+D* to translate

** set shortcut
You can change this shortcut on the program menu: Settings -> Shortcut
You can change this shortcut on the program menu: Settings -> Shortcut

** user-defined css
Support user-defined css, just put your css code into
Expand Down Expand Up @@ -53,5 +53,20 @@
yarn dev

# for build
yarn dist:dir # generated file : dist/linux-unpacked/deepl-linux-electron
yarn dist:dir # generated file : dist/linux-unpacked/deepl-linux-electron
#+END_SRC

** build in docker
#+BEGIN_SRC sh
# run docker in repo dir
docker run -it --rm --name deepl-linux -v $(pwd):/app -w /app --entrypoint /bin/bash node:18

# build
yarn install
yarn dist
#+END_SRC

** run on linux
Deepl may not start with the error `FATAL:gpu_data_manager_impl_private.cc(445)] GPU process isn't usable. Goodbye.`

If you encounter this, try running `deepl --in-process-gpu`.
13 changes: 12 additions & 1 deletion src/main/index.js
Expand Up @@ -6,6 +6,7 @@ let fs = require('fs')
let gShortcut;

let isRemoveLineBreaks = false;
let isHiddenOnStartup = false;

const Store = require('electron-store');
const store = new Store();
Expand Down Expand Up @@ -36,6 +37,7 @@ app.setAboutPanelOptions({
app.on('ready', function() {
let Menu = require('electron').Menu;
isRemoveLineBreaks = store.get('remove_line_breaks');
isHiddenOnStartup = store.get('hidden_on_startup');
let templateArr = [{
label: "Settings",
submenu: [{
Expand Down Expand Up @@ -63,6 +65,14 @@ app.on('ready', function() {
store.set('remove_line_breaks', isRemoveLineBreaks);
win.webContents.send('translateClipboard', item.checked);
}
}, {
label: "Hidden on startup",
type: "checkbox",
checked: isHiddenOnStartup,
click: (item) => {
isHiddenOnStartup = item.checked;
store.set('hidden_on_startup', isHiddenOnStartup);
}
}, {
label: "Quit",
role: 'quit'
Expand Down Expand Up @@ -117,7 +127,8 @@ app.on('ready', function() {
height: 600,
webPreferences: {
preload: path.join(__static, 'preload.js')
}
},
show: !isHiddenOnStartup
});

win.loadURL("https://www.deepl.com/translator", {
Expand Down

0 comments on commit 881c0d3

Please sign in to comment.