AutoStart Maestral Dropbox Client In Python Virtual Environment

Update May 1st, 2024:

Maestral is now available via pipx. Pipx is similar to virtual environments and simplifies things. First thing, open the terminal and run each command as listed. # = comment…

Install pipx:

sudo apt install pipx # I am running Ubuntu 24.04 currently. Alter for your system.
pipx ensurepath

Install maestral:

pipx install maestral

OR

pipx install maestral[gui]

Configure to run in the background:

maestral auth link
# Copy the link into your browser and log in.
# Copy the id and paste in the terminal
maestral autostart -Y
maestral start # Start for you current session else logoff/logon.
maestral notification level ERROR # Limit messages to errors only as not to be annoyed.

Old way using virtual env.

I got an update that hosed Dropbox today. I had installed the client directly from the Dropbox site. I tried their headless install for the hell of it and that did not work either. I did not try the AUR version as I assume I would get the same result.

After a little poking around the internet I decided to use Maestral to sync my Dropbox files. It seemed to be less hands on and easier to setup than some other alternatives, like RClone. I’m sure RClone works great so give it a look over.

My Requirements and System

I want a status icon in the system tray. Maestral can be run with GUI to achieve this. I also want simple.

My system is Garuda Linux running Gnome 44.1

Creating the virtual environment

Enter these commands one at a time in the terminal to create the environment.

 cd ~
 mkdir maestral
 python3 -m venv maestral
 cd maestral
 source bin/activate

Activate puts you in the environment so now you can install Maestral. Issue the following commend:

python3 -m pip install --upgrade 'maestral[gui]'

Let’s run it to make sure it works. Back to the terminal:

source ~/maestral/bin/activate; ~/maestral/bin/maestral gui

If all went well the icon should appear in the system tray. If you don’t have any tray icons on Gnome you’ll likely want to install a Gnome extension. I use Tray Icons Reloaded. You can also install Maestral without the GUI if you prefer.

With Maestral running right click the tray icon and open preferences. Tick the “Start Maestral at logon”. This worked for me. Log off then back on and it should start up. If you want to create a menu item or create a more transparent autostart you can create a Bash script and desktop file.

Alternate autostart using Bash script and desktop file.

Create a file called maestral_start.sh, make it executable. Then just add the execute command in the file, i.e., source ~/maestral/bin/activate; ~/maestral/bin/maestral gui

Don’t forget the Bash shebang line at the beginning of the script.

Also create a file named maestral.desktop in .local/share/applications and add the following. Change paths to match where you created the above files.

[Desktop Entry]
Version=1.0
Name=Maestral AutoStart
Comment=Sync client for DropBox.
Exec=maestral_start.sh
Icon=dropbox.svg
Terminal=false
Type=Application

Now you should be able to go into Gnome Tweaks or whatever and point to the Bash script for autostart but will also have an entry to start the app from the menu.