I want to see if a file is opened with gedit. Is it possible?

Solution 1:

gedit doesn't keep the file open while you are editing it, so I'm not sure you can. You could probably write a gedit plugin that could tell you, but let's ignore that option for now.

Going on the comments above, you are really just wanting a way to edit a file, and know when it's been closed. @TimoKluck suggests --standalone, but I think you probably want --wait instead.

You can also achieve the same thing through gedit's D-Bus API. When you open a file, it gives you a cookie, which you can then wait on.