Set up a script which uses pgrep to check for all running instances of conky - then use awk to filter out results that contain the name of the .conkyrc file you use to start the conky instance you want to toggle and then print/store any returned PIDS to a variable.
If the variable is empty:
- Start conky in the background using the appropriate .conkyrc file.
If it contains one or more PIDs:
- kill all of the PIDs stored in the variable.
That should effectively toggle an instance of conky which has been started using a particular .conkyrc file.
Which completely off the top of my head - and completely untested would look something like this:
toggleconky.sh
Bash:
#!/usr/bin/env bash
# Try to get a list of PIDs for appropriate conky's
runningConkys=$(pgrep -a conky | awk '/nameofconkyrc/{print $1}')
# if runningConkys is empty
if [[ -z "$runningConkys" ]]; then
# start conky
conky -q -c /path/to/nameofconkyrc &
else #not empty
#Kill all of the PIDs listed in $runningConkys
echo "$runningConkys" | xargs -n 1 kill -15
fi
Extremely important:
Before attempting to run the above script - you need to do a couple of things.
- In the awk - replace nameofconkyrc with the file-name of the .conkyrc file for the conky you want to toggle. (No path - just the file-name for the rc file)
- Where we start the conky - replace /path/to/nameofconkyrc with the full path and filename of the .conkyrc for the conky you want to toggle.
Then you simply make the script executable and assign a keybind to run the script in your DE/WM and that's it!
That should allow you to toggle your extra conky instance.
Again - I've written this completely off the top of my head, so this hasn't been tested. But I don't see any reason why it wouldn't work.
If it's not completely correct - it'll at least be close!
[edit]
I'll have a little play with this when I get home from work this evening and see if it works. I might have some uses for a script like this myself.
[/edit]