You are not logged in.
Pages: 1
I have a launcher in my panel I call Google-Calendar. Pretty simple, really ... it's just a menu command with the name "Google Calendar" and the command
google-chrome --app=https://calendar.google.com/calendar
Oh, and I grabbed an icon as well.
So, this works great and brings up my calendar with a single click.
Now, I'd like to program this so that clicking the icon a 2nd time kills off the chrome window. I'm thinking that if I put this into a little script which looks like this it should work:
# custom launcher
if window is present:
remove window
else:
google-chrome --app=https://calendar.google.com/calendar
Suggestion as to figure out "window is present" and "remove" would be appreciated.
Offline
You can use pgrep to see if its running. Try a script like this:
#!/bin/bash
pgrep -f calendar.google.com && \
pkill -f calendar.google.com || \
google-chrome --app=https://calendar.google.com/calendar
Basically,
Line 1 = see if there is a process running that has "calendar.google.com" in its command string, AND ( && ) if so
Line 2 = kill it, OR ( || )
Line 3 = start it
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Thanks so much. Works perfectly.
Not that it really matters since I'm not calling this from a terminal, but if I do I get:
bob$ my-google-cal
[1187805:1187805:0408/194309.189680:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
[1187763:1187831:0408/194309.703448:ERROR:nss_util.cc(286)] After loading Root Certs, loaded==false: NSS error code: -8018
Assuming that this is google-chrome complaining. Hmmm, quick search shows that there is a disparity between the application and the nss lib. I'm probably safe to return to the bliss generated by my ignorance.
Offline
Pages: 1
[ Generated in 0.011 seconds, 9 queries executed - Memory usage: 535.82 KiB (Peak: 536.66 KiB) ]