If I try to edit something in gedit, on the first typing, the following warning pops up on my terminal.

(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 appear on my Ubuntu and Kali Linux. I tried several solutions I could find, but the warning persists. Since it’s just a warning, I can use the error redirection to suppress the error message.

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

$ cat /usr/bin/gedit-null 
#!/bin/bash

/usr/bin/gedit "$@" 2>/dev/null
  • $@ 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.

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

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