You are not logged in.
hi
consider the following script to bring up an existing instance of the leafpad if it exists or create a new one.
this works as expected if run in terminal, but if put into the file
.local/bin/sample.sh
and mapped to a shortcut via xfce4 keyboard settings => Application Shortcuts - it doesn't.
Why ?
#!/bin/bash
if [ ! `pgrep leafpad` ]; then
echo "spawn new one"
leafpad
else
echo "bringing up the existing one"
xdotool search "leafpad" windowactivate
fi
Last edited by freebench (2023-03-21 02:35:42)
Offline
Is the script executable and do you reference it w/ its absolute path?
Does it start at all ("date > /tmp/sample.sh.invoked")?
Offline
It's executable.
Path is an absolute in keyboard shortcut settings.
It does start. The most weird thing is that in the IF-ELSE part only one works fine
when the leafpad already exists - the ELSE part
No matter how I change the script the other, IF bit - never ever get executed.
It worked only in one case [ 1 == 1 ]; - in this case it did run the code ...
I've ran out of options...
The script is fine - since it works as expected when run from terminal
Offline
believe it or not
$ls -rtl ~/.local/bin
-rwxr-xr-x 1 admin admin 183 Mar 21 04:14 get_leafpad.sh
-rwxr-xr-x 1 admin admin 183 Mar 21 04:14 sample.sh
the sample.sh file name works and the other does not
Offline
I actually believe it - this came up before, but I don't remember whether it was the XFCE shortcut daemon as well.
This doesn't fit some descriptions in #3, though…
Offline