diff --git a/README.md b/README.md index 6623a4f36ecdeacddc4c93d05a271f83fc2131b4..3eeb9384ae12cf988992ebbbd87d24c312affee0 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ gnome-keyring-yubikey-unlock/create_secret_file.sh /path/to/your_secret [Your Gn As an example, I need to input `login:My_Very_Long_Login_Password`. (You may use `seahorse` or `tools/list_keyrings.sh` to determine the name of your keyring) -Then, add the following command to gnome-autostart. You should know how to auto-run a command after starting gnome. +Then, add the following command to gnome-autostart. If you don't know how to do it, [read me](doc/how-to-gnome-autostart.md)! ``` /path/to/this/project/unlock_keyrings.sh /path/to/your_secret diff --git a/doc/how-to-gnome-autostart.md b/doc/how-to-gnome-autostart.md new file mode 100644 index 0000000000000000000000000000000000000000..511348d289bef9df8c3986a8ae85747eff0205aa --- /dev/null +++ b/doc/how-to-gnome-autostart.md @@ -0,0 +1,34 @@ +# How To Autostart On Gnome + +To automatically unlock keyrings right after logging into Gnome, you need to autostart +`unlock_keyrings.sh`. There are different ways to to this. + +## Start Via Systemd + +Create a new file at `~/.config/systemd/user/unlock-keyring.service` with the following content +(adapt the command after `ExecStart` to your setup): + +```ini +[Unit] +Description=Unlock keyring using YubiKey +BindsTo=gnome-session.target + +[Service] +Type=oneshot +ExecStart=/path/to/this/project/unlock_keyrings.sh /path/to/your_secret 123456 + +[Install] +WantedBy=gnome-session.target +``` + +Run the following command (not root): + +```sh +systemctl --user enable unlock-keyring.service +``` + +When doing changes to the service file, run + +```sh +systemctl --user daemon-reload +```