Zim

How to know which notebook is open, using linux terminal?

Asked by Shivam Sharma

If we look at the running processes in Linux, Zim is shown as :

/usr/bin/python /usr/local/bin/zim --ipc-server-main /tmp/zim-shivam/zim-server-socket 30

If we have several notebooks open, several Zim processes are shown as running, all showing the same as above.

Now, I need to know which Zim process corresponds to which notebook. Is it possible? And if it is not, can this feature be implemented? Can Zim broadcast this information over to the processes list?

Question information

Language:
English Edit question
Status:
Solved
For:
Zim Edit question
Assignee:
No assignee Edit question
Solved by:
Shivam Sharma
Solved:
Last query:
Last reply:
Revision history for this message
Shivam Sharma (shivams-cool) said :
#1

A hack to know the names of the open notebooks is using some utility which can display information of open windows on desktop.

So, running this command will give you the window title:
wmctrl -lp

If you don't have the utility installed, install it using:
sudo apt-get install wmctrl

One can then use regex to filter out the name of the notebooks:
wmctrl -lp | grep -P '\-\sZim' | sed -e 's/.*'"$(hostname)"'//g' | sed -e 's/\-\sZim//g'

It is a hack but it works.

It'd have been better is the notebook name was available in the process list itself.

Revision history for this message
Shivam Sharma (shivams-cool) said :
#2

The above hack works by extracting the Zim notebook names from the open Zim windows' titles.

It is a pretty neat hack. And it does solve the problem. So I am marking it as solved.