You are not logged in.
I'd want to key-bind an execution of an application (it is geany) at a single-instanse mode: if the app is already running, just focus it instead of starting new instanse.
How to?
"I exist" is the best myth I know..
Offline
Write a script to check if the pidof geany returns anything. if yes, then pull that pid else start a new instance of the app.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Write a script to check if the pidof geany returns anything. if yes, then pull that pid else start a new instance of the app.
There isn't a pid, but there is a socket:
$ netstat -l | grep geany_socket
unix 2 [ ACC ] STREAM LISTENING 528982 /tmp/geany_socket.cc71320d
Unfortunately I don't know how to use it. Is there some example I can adapt?
Last edited by student975 (2011-04-14 17:06:29)
"I exist" is the best myth I know..
Offline
Digging here and there (and being far from bash programming) I have "wrote" the script:
#!/bin/bash
CTX="\[sysFiles\] - Geany"
APP=$(wmctrl -l | grep "$CTX" | awk '{print $1}')
if [ -z "$APP" ]; then
geany
else
wmctrl -i -a $APP
fi
exit 0
It seems to work as expected, but I'm not sure it is a good solution. So prefer to wait for critics before marking the topic as SOLVED.
Last edited by student975 (2011-04-14 19:51:41)
"I exist" is the best myth I know..
Offline