Auto Save Database Before Minimizing to Tray/Taskbar

  • Mark377

    Mark377 - 2013-12-06


    For KeePass (v2.24), I have these options checked:
    Under Interface>Main Window section:
    "Close button [X] minimizes main window instead of terminating the application"
    "Minimize to tray instead of taskbar"
    "Show tray icon only if main window has been sent to tray"
    Under Advanced>Start and Exit section:
    "Automatically save when closing/locking the database"
    Under Advanced>File Input/Output Connections section:
    "Verify written file after saving a database"

    The other day I made changes to my main database and closed it by the [X] button which sent it to the tray. It stays open in the tray until I manually close/exit KeePass. With a save pending, I did a Windows XP shutdown instead of exiting KeePass. The next day I noticed my database was not saved. Also, I found that KeePass created a ...kdbx.tmp file (~1.7MB) in the same folder with my main database and with the same name.

    I need to include that my main database is large in size (~5.5MB) due to documents/pictures attachments. On my PC, it takes KeePass about 6 sec. to open my database (with Key transformation rounds= <2s) after entering the master password, and slightly more time to save/verify changes . Obviously, KeePass doesn't have enough time to save/verify a database of this size once a Windows shutdown is initiated. I'm guessing most users don't have databases this large.

    Anyway, I tried the same process on a small (44KB) test database, but found that KeePass had enough time to save the test database successfully during a Windows shutdown. The problem appears to be database size related.

    Maybe there could be an option to automatically save a modified database before minimizing it to the tray or to the taskbar (if "Minimize to tray instead of taskbar" is unchecked).

    [My PC: Windows XP Home SP3 32-bit;


  • wellread1

    wellread1 - 2013-12-06

    Maybe there could be an option to automatically save a modified database before minimizing it to the tray or to the taskbar (if "Minimize to tray instead of taskbar" is unchecked).

    There is no option to save on minimize. There is an option in Tools>Options>Security(tab)>Options(section) to "Lock Workspace when minimizing main window". This would would cause KeePass to automatically save the database or to prompt to save depending on other settings.

    Another option is use triggers to automatically save after every change. A trigger set to do this has been posted here. It can be pasted directly into the KeePass 2.24 trigger system.

    If neither of the options above are suitable, then your best bet is to work on slimming down your database so it takes less time to shut down. If you can't slim down, reduce your number of key transformations to <1s and/or break the database into smaller databases and open one database only at any given time.

    As an aside, in my experience, modern OSes have improved shutdown behavior. Also you may or may not be aware that Microsoft is ending all support for Windows XP including security patches on April 8, 2014 (4 months from now). After that continuing to use XP will be an increasingly risky proposition.

    • Mark377

      Mark377 - 2013-12-06

      Hi wellread,

      I decided to go with your trigger set. With Auto Save turned ON, a change to the database is saved right away. That's exactly what I wanted. Now when it's always open and minimized to the tray, I can shutdown/restart without losing any change(s).

      Yea, I'll be upgrading to Windows 7 or 8 soon.

      Thanks much.

  • wellread1

    wellread1 - 2013-12-06

    Glad it worked for you. I have used that trigger set for years and continue to use it even as the need has diminished due to improvements in OSes and KeePass.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks