mrichar1/clipster

Clipboard is not replaced when selecting item from history

Hagfjall opened this issue · 4 comments

I'm not sure why, not much in the log (see below)
OS: Ubuntu 20.04
VM: i3 (Regolith)
Python 3.8.2
And I have installed gir1.2-gtk-3.0-package

~/applications/scripts/clipster -d -l DEBUG
DEBUG:Debugging Enabled.
DEBUG:Trying to read config file: /home/user/.config/clipster/clipster.ini
DEBUG:Merged config: [('active_selections', 'PRIMARY,CLIPBOARD'), ('blacklist_classes', ''), ('conf_dir', '/home/user/.config/clipster'), ('data_dir', '/home/user/.local/share/clipster'), ('default_selection', 'CLIPBOARD'), ('duplicates', 'no'), ('extract_emails', 'yes'), ('extract_patterns', 'no'), ('extract_patterns_file', '/home/user/.config/clipster/patterns'), ('extract_uris', 'yes'), ('history_file', '/home/user/.local/share/clipster/history'), ('history_size', '2'), ('history_update_interval', '60'), ('ignore_patterns', 'no'), ('ignore_patterns_file', '/home/user/.config/clipster/ignore_patterns'), ('max_input', '50000'), ('pattern_as_selection', 'no'), ('pid_file', '/run/user/1000/clipster.pid'), ('row_height', '3'), ('smart_update', '1'), ('socket_file', '/home/user/.local/share/clipster/clipster_sock'), ('sync_selections', 'no'), ('whitelist_classes', ''), ('write_on_change', 'no')]
/home/user/applications/scripts/clipster:707: PyGIDeprecationWarning: GObject.io_add_watch is deprecated; use GLib.io_add_watch instead
  GObject.io_add_watch(self.sock, GObject.IO_IN,
/home/user/applications/scripts/clipster:707: PyGIDeprecationWarning: GObject.IO_IN is deprecated; use GLib.IO_IN instead
  GObject.io_add_watch(self.sock, GObject.IO_IN,
DEBUG:Writing history file every 60 seconds
/home/user/applications/scripts/clipster:719: PyGIDeprecationWarning: GObject.timeout_add_seconds is deprecated; use GLib.timeout_add_seconds instead
  GObject.timeout_add_seconds(history_timeout,
V/home/user/applications/scripts/clipster:515: PyGIDeprecationWarning: GObject.io_add_watch is deprecated; use GLib.io_add_watch instead
  GObject.io_add_watch(conn, GObject.IO_IN,
/home/user/applications/scripts/clipster:515: PyGIDeprecationWarning: GObject.IO_IN is deprecated; use GLib.IO_IN instead
  GObject.io_add_watch(conn, GObject.IO_IN,
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
/home/user/applications/scripts/clipster:285: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "model" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  tree = Gtk.TreeView(model)
/home/user/applications/scripts/clipster:306: DeprecationWarning: Gtk.TreeView.set_rules_hint is deprecated
  tree.set_rules_hint(True)
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
/home/user/applications/scripts/clipster:486: DeprecationWarning: Gdk.Display.get_pointer is deprecated
  while Gdk.ModifierType.BUTTON1_MASK & display.get_pointer().mask:
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['immediately', 'clipster', 'history']
DEBUG:owner-change event!
DEBUG:selection: CLIPBOARD
DEBUG:Selection in 'active_selections'
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['immediately', 'clipster', 'history']
DEBUG:Selection is text.
DEBUG:Updating clipboard: CLIPBOARD
DEBUG:['history']
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['immediately', 'clipster', 'history', 'CLIPBOARD']
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['immediately', 'clipster', 'CLIPBOARD', 'history']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['immediately', 'clipster', 'CLIPBOARD', 'history']
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['clipster', 'CLIPBOARD', 'history', 'immediately']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['clipster', 'CLIPBOARD', 'history', 'immediately']
^CDEBUG:Daemon exiting...
DEBUG:Writing history to file.

Hi - I'm trying to work out what the exact issue here is...
I'm assuming you mean that with sync_selections = yes in the config, there is a problem updating the CLIPBOARD board when selecting in the SELECT board using the UI?

I can't seem to immediately reproduce this, doing the following (I'm also on 20.04 with i3 and python 3.8.2)

rm -rf ~/.local/share/clipster/history
clipster -d -l DEBUG
# select the words 'a', 'b', 'c', 'd' in turn

This results in the (trimmed) debug:

DEBUG:Updating clipboard: PRIMARY
DEBUG:['a', 'b', 'c', 'd']
DEBUG:Syncing board PRIMARY to CLIPBOARD
DEBUG:selection: CLIPBOARD
DEBUG:Updating clipboard: CLIPBOARD
DEBUG:['a', 'b', 'c', 'd']

I then do:

clipster -s
# Select 'a' from the UI

The debug output is now:

DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['b', 'c', 'd', 'a']
DEBUG:Syncing board PRIMARY to CLIPBOARD
DEBUG:selection: PRIMARY
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['b', 'c', 'd', 'a']
DEBUG:selection: CLIPBOARD
DEBUG:Updating clipboard: CLIPBOARD
DEBUG:Removing from history.
DEBUG:['b', 'c', 'd', 'a']

Which looks to be working as expected.

Thanks for your reply. I'm not sure it has anything to do with the config, I tried a bunch of different settings yesterday without any luck. I'm removing the config completely and do the following (default config then I assume):
Select first a, then b, c and last d. Then I launch clipster -s, select a and presses enter. Still my clipboard remains the same as I had before launching clipster and no a is pasted in anywhere. I expect my clipboard to be replaced with an a when I chooses that, is that the correct use of this tool?

$ rm -rf ~/.local/share/clipster/history
$ ~/applications/scripts/clipster -d -l DEBUG
DEBUG:Debugging Enabled.
DEBUG:Trying to read config file: /home/user/.config/clipster/clipster.ini
DEBUG:Unable to read config file: /home/user/.config/clipster/clipster.ini
DEBUG:Merged config: [('active_selections', 'PRIMARY,CLIPBOARD'), ('blacklist_classes', ''), ('conf_dir', '/home/user/.config/clipster'), ('data_dir', '/home/user/.local/share/clipster'), ('default_selection', 'PRIMARY'), ('duplicates', 'no'), ('extract_emails', 'yes'), ('extract_patterns', 'no'), ('extract_patterns_file', '/home/user/.config/clipster/patterns'), ('extract_uris', 'yes'), ('history_file', '/home/user/.local/share/clipster/history'), ('history_size', '200'), ('history_update_interval', '60'), ('ignore_patterns', 'no'), ('ignore_patterns_file', '/home/user/.config/clipster/ignore_patterns'), ('max_input', '50000'), ('pattern_as_selection', 'no'), ('pid_file', '/run/user/1000/clipster.pid'), ('row_height', '3'), ('smart_update', '1'), ('socket_file', '/home/user/.local/share/clipster/clipster_sock'), ('sync_selections', 'no'), ('whitelist_classes', ''), ('write_on_change', 'no')]
/home/user/applications/scripts/clipster:707: PyGIDeprecationWarning: GObject.io_add_watch is deprecated; use GLib.io_add_watch instead
  GObject.io_add_watch(self.sock, GObject.IO_IN,
/home/user/applications/scripts/clipster:707: PyGIDeprecationWarning: GObject.IO_IN is deprecated; use GLib.IO_IN instead
  GObject.io_add_watch(self.sock, GObject.IO_IN,
DEBUG:Writing history file every 60 seconds
/home/user/applications/scripts/clipster:719: PyGIDeprecationWarning: GObject.timeout_add_seconds is deprecated; use GLib.timeout_add_seconds instead
  GObject.timeout_add_seconds(history_timeout,
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
/home/user/applications/scripts/clipster:486: DeprecationWarning: Gdk.Display.get_pointer is deprecated
  while Gdk.ModifierType.BUTTON1_MASK & display.get_pointer().mask:
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['a']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['a', 'b']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['a', 'b', 'c']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['a', 'b', 'c', 'd']
/home/user/applications/scripts/clipster:515: PyGIDeprecationWarning: GObject.io_add_watch is deprecated; use GLib.io_add_watch instead
  GObject.io_add_watch(conn, GObject.IO_IN,
/home/user/applications/scripts/clipster:515: PyGIDeprecationWarning: GObject.IO_IN is deprecated; use GLib.IO_IN instead
  GObject.io_add_watch(conn, GObject.IO_IN,
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:PRIMARY, count:0
/home/user/applications/scripts/clipster:285: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "model" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  tree = Gtk.TreeView(model)
/home/user/applications/scripts/clipster:306: DeprecationWarning: Gtk.TreeView.set_rules_hint is deprecated
  tree.set_rules_hint(True)
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['b', 'c', 'd', 'a']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:Removing from history.
DEBUG:['b', 'c', 'd', 'a']
^CDEBUG:Daemon exiting...
DEBUG:Writing history to file.

Yes, after selecting a it should then be in the clipboard when you paste. This is likely down to their being 2 clipboard buffers in X, each accessed differently.

The default clipboard in use is the SELECT clipboard - the usual way to paste from this in X is to middle-click, or you can use a 3rd party tool to verify the contents, e.g. xclip -o. The other CLIPBOARD board is more commonly accessed with ctrl-x/c/v and can be verified using xclip -o -selection clipboard.

If you want to default to the CLIPBOARD clipboard, then either switch the default_selection config option to CLIPBOARD, or set sync_Selections = yes to keep the 2 in step.

Confirmed and working now! Just config error from my end. Thank you so much for clarification and a great tool!