Module defines the classes and methods needed to set and edit session lock files.

The app has two session modes. When common.active_mode is common.SynchronisedActivePaths, the app will save active paths in the user settings file. However, when multiple app instances are running, this poses a problem, because instances will mutually overwrite each other’s active paths.

Hence, when a second app instance is launched common.active_mode is automatically set to common.PrivateActivePaths. When this mode is active, the initial active path values are read from the user settings, but active paths changes won’t be saved to the settings file.

To toggle between the two modes use bookmarks.actions.toggle_active_mode(). Also see bookmarks.statusbar.ToggleSessionModeButton.



Returns the path to the current session's lock file.


Initialises the Bookmark's session lock.


Removes stale lock files not associated with running PIDs.


Removes the session lock file.

write_current_mode_to_lock(*args, **kwargs)

Write this session's current mode to the lock file.


Returns the path to the current session’s lock file.


Initialises the Bookmark’s session lock.

We’ll check all lock-files and to see if there’s already a SynchronisedActivePaths session. As we want only one session controlling the active path settings we’ll set all subsequent application sessions to be PrivateActivePaths (when PrivateActivePaths is on, all active path settings will be kept in memory, instead of writing them out to the disk).


Removes stale lock files not associated with running PIDs.


Removes the session lock file.

bookmarks.common.session_lock.write_current_mode_to_lock(*args, **kwargs)[source]#

Write this session’s current mode to the lock file.