Recently, I noticed if I try to edit something using gedit, the following warning always arises.

(gedit:10160): Gtk-WARNING **: 17:22:36.887: Calling org.xfce.Session.Manager.Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method “Inhibit”

The warning message only appears on my Ubuntu and Kali Linux. I’ve tried several solutions I could find, but the warning persists.

So I came up with a solution where I use the error redirection to suppress the warning message.

First, I’ll create a gedit “wrapper” in a resolvable path such as /usr/bin or /usr/local/bin:

$ cat /usr/bin/gedit-null 

/usr/bin/gedit "$@" 2>/dev/null

Command explanations:

  • $@ will take all the parameters passed to the wrapper (/usr/bin/gedit-null), and the wrapper will pass them to the gedit executable/binary.
  • 2>/dev/null hide the warning message.

And then, just add alias for gedit that points to the wrapper (gedit-null) in .bashrc or .zshrc.

$ echo  'alias gedit="gedit-null"'  > ~/.zshrc
$ source ~/.zshrc

Well that’s it.