I have a simple script that stores the user info in a file and then locks the screen:
#!/bin/bash
echo $USER > /tmp/file.txt
# Lock the screen:
gnome-screensaver-command -l
When I execute it from the terminal, my username is stored inside. But when it is executed from the shortcut Super+L, it just locks the screen, and there is no file present. Why is this?