clipcat
clipcat copied to clipboard
Some software think that clipboard daemon is not running
xfce4-screenshooter shows "Copy to the clipboard" button only if it thinks a clipboard manager is running (screenshot is with xfce4-clipman running):
When I'm running $ ./clipcatd --no-daemon
(with default config from README, also running with daemonized didn't change a thing) this clipboard button is not showing in xfce4-screenshooter (source code).
The above line calls https://developer.gnome.org/gdk3/stable/GdkDisplay.html#gdk-display-supports-clipboard-persistence which is documented as:
Returns whether the speicifed display supports clipboard persistance; i.e. if it’s possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.
I'm on X11. Copy/pastes are showing up in clipcatd log and things are running just fine, am able to copy/paste images etc. but for some reason Gnome-based software doesn't recognize there's a clipboard manager running. I haven't dug deeper to understand what their heuristics are.
I had lots of trouble finding that function from GDK source code (GitHub search returned no results for gdk_display_supports_clipboard_persistence
, but it's there allright), but I found something good: https://github.com/GNOME/gtk/commit/06c4bb44b139f2ed40b70c0303836e1e8558e8d9#diff-6ab4fcfe66397619d5843c2bb1ac48094eb7dba764739979a7b36dc217b06ff8R1096
I used this code snippet (in Go):
func debugClipboardManager() error {
X, err := xgb.NewConn()
if err != nil {
return err
}
defer X.Close()
atomName := "CLIPBOARD_MANAGER"
clipboardManagerAtom, err := xproto.InternAtom(X, true, uint16(len(atomName)), atomName).Reply()
if err != nil {
return err
}
clipboardManagerOwnerWindow, err := xproto.GetSelectionOwner(X, clipboardManagerAtom.Atom).Reply()
if err != nil {
return err
}
fmt.Printf("owner window: %d\n", clipboardManagerOwnerWindow.Owner)
return nil
}
When no clipboard manager is running:
owner window: 0
When xfce4-clipman
is running:
owner window: 192937998
When clipcatd
is running:
owner window: 0