This is a followup to a question about dialog boxes.
I want to show a dialog box both at the start of a session, and after n minutes of inactivity. I have decided to use
xautolock. I have success invoking both from the command line (bash).
zenity --text=text --warning
xautolock -time 15 -locker "zenity --text=sometext --warning"
However, there are some constraints:
- The text has multiple words. If it has spaces,
zenitywill only show the first word and try to parse the other words as parameters. To fix this, I enclose the text in double quotes (
"), but it leads to:
xautolocktakes the entire
zenitycommand as an option for its
-lockerparameter. The command has multiple words, so I have to enclose it in quotes. But it already had quotes originally, so it conflicts on quotes-inside-quotes.
- I want the alert text to be customizable, so I'm using
So now what I have is:
zenity --text="$(cat .filename)" --warning
xautolock -time 15 -locker "zenity --text="$(cat .filename)" --warning"
If I run each line separately on a terminal session (bash), they do work. The cursor gets stalled waiting for the process to terminate, but the dialog boxes are displayed the way I need them.
Now I need it to start automatically with no user intervention. What I did:
- I've put each line separetedly on the Startup Applications list. Instead of showing the desired text, they will show $(cat on the dialog box.
- I created a
command.shfile on my
~folder, pasted these two lines, made it executable.
- Running the script from the command line works.
~/command.shas an entry on Startup Applications does not work. Nothing happens, nothing is displayed, no error message, nothing. According to this answer, it should work.
- Putting /home/username/command.sh does work, but this user is just a "skel" that gets copied to a guest user folder created upon login, so the username folder will be "guest-RANDOMSTRING", and I can't set is as a Startup Applications entry. For permission reasons, I can't set in to the "skel" user as well.