Option to minimize KeeWeb on copy

https://github.com/keeweb/keeweb/issues/1718
This commit is contained in:
is 2021-02-22 15:02:42 +02:00
parent e5428b67b8
commit 7c4326939a
7 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,7 @@ const DefaultAppSettings = {
rememberKeyFiles: 'path', // remember keyfiles selected on the Open screen
idleMinutes: 15, // app lock timeout after inactivity, minutes
minimizeOnClose: false, // minimise the app instead of closing
minimizeOnCopy: false, // minimise the app on copy
tableView: false, // view entries as a table instead of list
colorfulIcons: false, // use colorful custom icons instead of grayscale
useMarkdown: true, // use Markdown in Notes field

View File

@ -19,6 +19,11 @@ const Copyable = {
const msg = clipboardTime
? Locale.detFieldCopiedTime.replace('{}', clipboardTime)
: Locale.detFieldCopied;
if (AppSettingsModel.minimizeOnCopy) {
setTimeout(() => {
Events.emit('minimize-app');
}, 0);
}
let tip;
if (!this.isHidden()) {
tip = Tip.createTip(fieldLabel[0], {

View File

@ -443,6 +443,7 @@
"setGenClearSeconds": "In {} seconds",
"setGenClearMinute": "In a minute",
"setGenMinInstead": "Minimize the app instead of close",
"setGenMinOnCopy": "Minimize on copy",
"setGenLock": "Auto lock",
"setGenLockMinimize": "When the app is minimized",
"setGenLockCopy": "On password copy",

View File

@ -69,6 +69,7 @@ class AppView extends View {
this.listenTo(Events, 'select-all', this.selectAll);
this.listenTo(Events, 'menu-select', this.menuSelect);
this.listenTo(Events, 'lock-workspace', this.lockWorkspace);
this.listenTo(Events, 'minimize-app', this.minimizeApp);
this.listenTo(Events, 'show-file', this.showFileSettings);
this.listenTo(Events, 'open-file', this.toggleOpenFile);
this.listenTo(Events, 'save-all', this.saveAll);
@ -603,6 +604,10 @@ class AppView extends View {
}
}
minimizeApp() {
Launcher.minimizeApp();
}
closeAllFilesAndShowFirst() {
let fileToShow = this.model.files.find(
(file) => !file.demo && !file.created && !file.external

View File

@ -36,6 +36,7 @@ class SettingsGeneralView extends View {
'change .settings__general-auto-save-interval': 'changeAutoSaveInterval',
'change .settings__general-remember-key-files': 'changeRememberKeyFiles',
'change .settings__general-minimize': 'changeMinimize',
'change .settings__general-minimize-on-copy': 'changeMinimizeOnCopy',
'change .settings__general-audit-passwords': 'changeAuditPasswords',
'change .settings__general-audit-password-entropy': 'changeAuditPasswordEntropy',
'change .settings__general-exclude-pins-from-audit': 'changeExcludePinsFromAudit',

View File

@ -154,6 +154,11 @@
{{#if minimizeOnClose}}checked{{/if}} />
<label for="settings__general-minimize">{{res 'setGenMinInstead'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__general-minimize-on-copy" id="settings__general-minimize-on-copy"
{{#if minimizeOnCopy}}checked{{/if}} />
<label for="settings__general-minimize-on-copy">{{res 'setGenMinOnCopy'}}</label>
</div>
{{/if}}
{{#if canAutoType}}
<div>

View File

@ -174,6 +174,10 @@ main.restartAndUpdate = function (updateFilePath) {
};
main.minimizeApp = function (menuItemLabels) {
let imagePath;
// a workaround to correctly restore focus on windows platform
if (process.platform === 'win32') {
mainWindow.minimize();
}
mainWindow.hide();
if (process.platform === 'darwin') {
main.dock.hide();