1

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?

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
igobivo
  • 153
  • 2
    I would assume that Super + L isn't launching your script. Perhaps if you were to [edit] your question to include what you attempted to insure that your script ran when you used that shortcut someone could help you. As it is there isn't much to work with. – Elder Geek Mar 03 '17 at 23:09
  • You are right @Elder Geek, my script is not launched by the key combination. In system settings > Keyboard > Shortcuts > System, I changed Lock screen to combination Super + ` and this works, however Super + L still locks the screen too. How can I identify which program is using this combination to lock the screen? I also remapped my script to be activated by Super + Z, and this works fine. – igobivo Mar 06 '17 at 21:16
  • That sounds like a different question. that has answers should provide some clues. Not to mention the answer to that question is already in your script... ;-) – Elder Geek Mar 06 '17 at 21:59

0 Answers0