I'm not sure if I'm in the right place for lxqt-globalkeys bugs - if not, please point me in the right direction.
Expected Behavior
I want to use lxqt-globalkeys to take screenshots using scrot.
I'm trying to add a shortcut using lxqt-config-globalkeyshortcuts
to execute a command, for example:
scrot '%Y-%m-%d_%Hh%Mm%Ss.png' -e 'mv $f ~/Pictures/screenshots/'
I'd expect the exact command to be executed, as if I had typed it into a shell.
Current Behavior
Edit: I think you can skip this section and see Steps to Reproduce for a tl;dr
There seem to be problems with sanitising the command input field in lxqt-config-globalkeyshortcuts.
If I add a shortcut to execute this command:
scrot '%Y-%m-%d_%Hh%Mm%Ss.png' -e 'mv $f ~/Pictures/screenshots/'
pressing the defined shortcut will result in this error being printed in the shell where I started lxqt-globalkeysd (not sure what happens when the daemon is started automatically):
giblib error: Saving to file 2017-10-23_16h11m53s.png' -e 'mv ~/Pictures/screenshots/ failed
This seems to indicate that something funky happens to the outer set of quotes. I can replicate the error by typing the following scrot command in a terminal (note the outer double quotes):
scrot "%Y-%m-%d_%Hh%Mm%Ss.png' -e 'mv $f ~/Pictures/screenshots/"
It gets even weirder if I try to use the same command with double quotes, like this:
scrot "%Y-%m-%d_%Hh%Mm%Ss.png" -e "mv $f ~/Pictures/screenshots/"
The command will instead by saved like this:
scrot '%Y-%m-%d_%Hh%Mm%Ss.png" -e "mv $f ~/Pictures/screenshots/'
Note the single quotes.
If I try to save it with all single quotes escaped, like this:
scrot \'%Y-%m-%d_%Hh%Mm%Ss.png\' -e \'mv $f ~/Pictures/screenshots/\'
The window for shortcut input closes, but no entry is added to the list of shortcuts. No error is printed to the console, and nothing happens when I press the key I defined.
The same thing happens if I only escape the outer quotes, like this:
scrot \'%Y-%m-%d_%Hh%Mm%Ss.png' -e 'mv $f ~/Pictures/screenshots/\'
If I only escape the inner set of quotes, like this:
scrot '%Y-%m-%d_%Hh%Mm%Ss.png\' -e \'mv $f ~/Pictures/screenshots/'
The command is displayed in the list just like I typed it (including \'
for the inner quotes), but the error message again looks like this:
giblib error: Saving to file 2017-10-23_16h25m50s.png' -e 'mv ~/Pictures/screenshots/ failed
Steps to Reproduce
Case 1: Escaped single quotes
- Launch
lxqt-config-globalkeyshortcuts
- Click Add ...
- Define a shortcut key, enter some description, click radio button for "Command"
- Enter this into the command field:
echo \'asdf\'
- Click OK.
-> The window will close, but no shortcut is added to the list.
![lxqt-scrot](https://user-images.githubusercontent.com/1479612/31894977-422a88d6-b810-11e7-8f3f-01ee26b6805f.png)
Case 2: Non-Escaped single quotes
- Run steps 1-5 as before, but enter the following command:
echo \'asdf\'
-> The entry will appear in the list, but without the quotation marks
![singlequotes](https://user-images.githubusercontent.com/1479612/31895368-42eb1e06-b811-11e7-823b-2624a81917ce.png)
Case 2: Nested single quotes
- Run steps 1-5 as before, but enter the following command:
echo 'asdf'; echo 'foo'
-> The command will appear in the list exactly as it was entered
![nestedquotes](https://user-images.githubusercontent.com/1479612/31895765-55b4c59a-b812-11e7-9e1c-ea6a5d6714e6.png)
- Press the shortcut defined before
-> Only the first echo
command will run, with the following output: asdf'; echo 'foo
System Information
- Distribution & Version: Debian GNU/Linux 9 (stretch)
- Kernel: Linux 4.9.51-1 amd64
- Package version: lxqt-globalkeys/stable 0.11.1-1 amd64
- Display manager: gdm3
- Window manager: awesome 4.0