Skip to main content

Traycortex

traycortex is an application that will show the status of borgmatic backup in your system tray. It will also let you trigger backups from the menu.

Features:

  • System tray menu for running borgmatic (all or single config)
  • Client application to integrate with borgmatic for detecting timed backup runs
  • Notifications (backup started, backup finished)
  • Configuration file to allow customizing the borgmatic command
  • ssh-agent detection to enable easy use of password protected ssh keys

Along with it comes a traycortex-cli application, that is used in the borgmatic hooks configuration to signal the tray icon. Possible states are job_started, job_finished and job_error.

screenshot of tray running

When the status of a backup is updated, a notification will be displayed and the icon changes accordingly.

Installation

Prerequisites

Some packages are required to build and install traycortex (probably incomplete):

  • Ubuntu: apt install libcairo2-dev python-gi-dev libgirepository1.0-dev
  • Arch: pacman -S gobject-introspection python-cairo libappindicator-gtk3

Recommended way to install:

pipx install traycortex

Also works:

pip install traycortex

Packagers welcome

Nix / home-manager

Add

inputs.traycortex.url = "github:sstark/traycortex";

as an input in your flake.nix and import the home-manager module, e. g.:

homeConfigurations."you@host" = home-manager.lib.homeManagerConfiguration {
  pkgs = nixpkgs.legacyPackages.x86_64-linux;
  modules = [
    traycortex.homeModules.default
    ./home.nix
  ];
};

Then enable it:

services.traycortex.enable = true;

This installs traycortex and starts it as a systemd user service. Set services.traycortex.useSystemd = false if you prefer to start it yourself (e.g. via your desktop autostart), or override services.traycortex.package to use a different package.

You can also run it directly without home-manager:

nix run github:sstark/traycortex

Configuration File

Location: $XDG_CONFIG_HOME/traycortex.ini

If not found, an initial basic configuration file with a random authkey will be created on first run of traycortex.

The same configuration file is used for both, traycortex and traycortex-cli.

Configuration File Options

The authentication key and port for the connection between traycortex and traycortex-cli:

[connection]
; no default value. Randomly set on first run.
authkey = ce03f7af891ebc29defc0643faf71025
; default:
;   port = 35234
port = 54321

The command used to create a backup (when selecting the "Engage" menu item):

[borgmatic]
; default:
;   command = borgmatic
; For testing non-interactive ssh you can set this:
;   command = ssh -oBatchMode=yes <backupserver> date
command = systemd-inhibit --why="Backup is running" /usr/local/bin/borgmatic

You may add the string @CONFIG@ to the command option. For instance you could set:

[borgmatic]
command = /bin/borgmatic @CONFIG@ create

@CONFIG@ will be replaced by -c <yamlfile> in case you selected a specific yaml file to be run. Otherwise it will be replaced with the empty string. The command that will be execeuted in this example will be /bin/borgmatic create if you just clicked on Engage, or /bin/borgmatic -c /some/config.yml create if you clicked on Engage /some/config.yml.

If you engage an individual yaml file without having @CONFIG@ in your config, the resulting action will be equivalent to that of just having clicked Engage.

Running

To start the tray application from the command line:

traycortex &

Or create a desktop file ~/.local/share/applications/traycortex.desktop:

[Desktop Entry]
Exec=traycortex
; For the icon to work you need to place borgmatic.png in `~/.icons`
Icon=borgmatic
Name=traycortex
Type=Application

Now you can start traycortex with your usual desktop method.

Tray Menu

  • Engage All: Run a borgmatic backup
  • Engage : Run a borgmatic backup for this specific configuration
  • Discard: Quit traycortex and remove the icon from the tray. If a backup is currently running, it will be killed.

Integrating with borgmatic

If you want to receive notifications for borgmatic jobs that are not directly triggered from traycortex, you have to configure the corresponding hooks in your borgmatic configuration.

Example ~/.config/borgmatic.d/home.yaml:

[...]
source_directories:
    - /home/seb
repositories:
    - path: ssh://...
before_backup:
    - traycortex-cli -m job_started -a "{configuration_filename}"
after_check:
    - traycortex-cli -m job_finished -a "{configuration_filename}"
on_error:
    - traycortex-cli -m job_error -a "{configuration_filename}"
[...]

ssh-agent detection

With borgmatic it is likely you use ssh to access a remote backup repository. You probably have public key authentication set up for this to allow non-interactive use. And probably you also want to have a passphrase set for the private ssh key.

traycortex will try to detect a running ssh-agent and set the environment for borgmatic to have the SSH_AUTH_SOCK environment variable set. This makes it independent from its starting environment with regard to that variable.

You will still have to add your key to the running ssh-agent.

It is recommended to use

ssh_command: ssh -oBatchMode=yes

in your borgmatic configuration. This way, if ssh-agent detection fails, or you have not added the necessary key to it, borgmatic will properly fail and not wait for input in the background.

If you have multiple ssh-agents running, traycortex currently has no way to know which one is correct and will simply use the first one found.

Metadata

Release files for traycortex 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traycortex 0.5.3
File Size Uploaded Provenance Actions
traycortex-0.5.3.tar.gz 49.0 kB Without provenance Details for traycortex-0.5.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traycortex 0.5.3
File Interpreter ABI Platform Actions
traycortex-0.5.3-py3-none-any.whl Python 3 none any Details for traycortex-0.5.3-py3-none-any.whl

Total release size: 97.9 kB

Release files / traycortex-0.5.3.tar.gz

Download URL traycortex-0.5.3.tar.gz
Size 49.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f62f4f7a9ea2b762886756b24a98b5ab1f760878951a07f440e5d5108a8c2006
BLAKE2b-256 checksum
How to use checksums
3954547f2b682fa91379f7c6bbf34feadedda766d0c6631213dcbcfb143df064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / traycortex-0.5.3-py3-none-any.whl

Download URL traycortex-0.5.3-py3-none-any.whl
Size 48.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3016957eb23fca0c4566953b2b7aa7923050db6f4e860a4e972b17280edf69fc
BLAKE2b-256 checksum
How to use checksums
3294d49f15f92d2157849cde9fe2b6b01c778e72e55bfc322a310a068ef500b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for traycortex 0.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page