Automount Onedrive at Gnome startup

Microsoft does not have an official OneDrive client for Linux. To get around this you can use a really good client called Rclone. Rclone works with more than just OneDrive it works with most cloud storage providers. Below is a step by step on setting it up to mount your OneDrive storage at Gnome startup.

First you will want to install Rclone. You can do this by opening the software app and searching for rclone or by running the following command.

pacman -S rclone

Once Installed Refer to RClones Website to configure RClone with Onedrive. Take note of the name you give this config as you will need it later.

Now that RClone is configured we can create a script to mount onedrive to a folder in your home directory. First create the folder

/home/<USER>/OneDriveCode language: HTML, XML (xml)

Once the directory is created we are going to create a script called onedrive in /home/user/bin

touch /home/user/bin/onedrive
chmod +x /home/user/bin/onedrive

Now use your favorite editor to edit the onedrive script and add the Rclone command. In this example we used the name OneDrive as our config name. Replace that with your actual config name from setup.

#!/bin/bash
rclone mount onedrive:/ /home/user/OneDrive --vfs-cache-mode full --daemon Code language: JavaScript (javascript)

Now save the script. To test you can open a terminal and type:

onedrive
ls -la /home/user/OneDrive

You should get a directory listing of your onedrive files. Now we can setup the application shortcut for easy access. To do this we will create a file named onedrive.desktop with the following contents

[Desktop Entry]
Name=OneDrive
Comment=OneDrive
GenericName=Utilities
Exec=/home/user/bin/onedrive
Icon=/home/user/Pictures/onedrive.png
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;
MimeType=text/plain;
Terminal=false
Code language: JavaScript (javascript)

Copy the onedrive.desktop file to /usr/share/applications/ and download this OneDrive Icon to your Pictures folder. Now when you go to activities and type onedrive in the search you will see your app.

Gnome Launcher: OneDrive App

Now that the app is setup and accessible we can set it to launch when gnome starts. To do this make sure you have Gnome Tweaks installed. You can install it by opening software and searching for “Gnome Tweaks” or running this command

pacman -S gnome-tweaks

Once installed open the Gnome Tweaks tool and Click the startup applications and Click the + sign. Now type OneDrive and you will see your OneDrive app select it and click add.

You can also add the app to the autostart folder manually by moving the desktop file to the autostart directory located at ~/.config/autostart

Read full article here

Related posts

Leave A Comment