You are not logged in.

#1 2023-03-20 03:37:17

freebench
Member
Registered: 2020-06-14
Posts: 33

[SOLVED]XFCE Keyboard Shortcut doesn't work as expected

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

#2 2023-03-20 09:44:31

seth
Member
Registered: 2012-09-03
Posts: 51,213

Re: [SOLVED]XFCE Keyboard Shortcut doesn't work as expected

Is the script executable and do you reference it w/ its absolute path?
Does it start at all ("date > /tmp/sample.sh.invoked")?

Offline

#3 2023-03-20 22:17:03

freebench
Member
Registered: 2020-06-14
Posts: 33

Re: [SOLVED]XFCE Keyboard Shortcut doesn't work as expected

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

#4 2023-03-21 02:35:15

freebench
Member
Registered: 2020-06-14
Posts: 33

Re: [SOLVED]XFCE Keyboard Shortcut doesn't work as expected

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

https://imgur.com/4SN2cl8.png

the sample.sh file name works and the other does not

Offline

#5 2023-03-21 07:55:14

seth
Member
Registered: 2012-09-03
Posts: 51,213

Re: [SOLVED]XFCE Keyboard Shortcut doesn't work as expected

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

Board footer

Powered by FluxBB