mrichar1 / clipster Goto Github PK
View Code? Open in Web Editor NEWclipster - python clipboard manager
License: GNU Affero General Public License v3.0
clipster - python clipboard manager
License: GNU Affero General Public License v3.0
The smart_update is not very reliable, when selecting text fast, it doesn't kick in and lets a lot of "incomplete" duplicate populate the history.
text = safe_decode(text)
if not self.config.getboolean('clipster', 'duplicates'):
self.remove_history(board, text)
diff = self.config.getint('clipster', 'smart_update')
try:
last_item = self.boards[board][-1]
except IndexError:
# List was empty
last_item = ''
# Check for growing or shrinking, but ignore duplicates
if last_item and text != last_item and (text in last_item or last_item in text):
# Make length difference a positive number before comparing
if abs(len(text) - len(last_item)) <= diff:
logging.debug("smart-update: removing.")
# new selection is a longer/shorter version of previous
self.boards[board].pop()
Why is diff
compared here? Its value is supposed to be 1 here, how is that supposed to be efficient?
text
will most likely be longer than last_item
(at least when doing a selection from left to right), and there is a high chance the abs difference will yield something bigger than 1. Am I missing something?
Anyway, why is the history populating when "copy" is not even clicked on (in Chrome, after right-clicking)? Shouldn't it only populate when the clipboard is actually being updated? (the CLIPBOARD clipboard, not the PRIMARY clipboard if I understand right...)
It seems Clipster is emulating the "copy-on-selecting" from Linux in Chrome, which causes it to update the PRIMARY clipboard all the time... but then why is the CLIPBOARD clipboard updated as well?
Nice program, thanks for sharing. I'm interested because I'm trying to make a python script run automatically when the clipboard is updated. Clipster would be a nice module to use in other programs.
I think this is a feature request, but perhaps I don't understand how best to use this. Would I would like to accomplish is that after clipster -s
that if I press Enter on that screen, the output is pasted. I prefer this to needing to press paste afterwards.
It might be useful to have any changes to a clipboard be copied to the other one, for those people who always want to use mouse selection/Ctrl-C/V and not have to work out which board a selection went to.
Points to note:
It looks like clipster isn't properly deleting entries. For example if I were to create a clip:
echo '1234' | clipster -c
And then tried to delete that clip using the following commands:
echo '1234' | clipster -r
clipster -r '1234'
clipster -r
None of them seem to actually result in deleting the item from the clipboard.
By the way I absolutely love this clipboard daemon!
clipster_dir
should default to .config/clipster (and have support for /etc - see: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Hi @mrichar1 ,
Thanks a lot for this tool, I had great time playing with it and it'll probably help my a lot in various pipelines in coming years.
Here is a quick gadget I made to integrate clipster into i3block, allowing me to quickly view if an element has been copied, and helping me merging the last 2 elements from the pasteboard (main usecase: merging a website url with a matching text description).
$HOME/.i3blocks.conf
[clipster]
command=$HOME/.config/i3/clipster
interval=1
$HOME/.config/i3/clipster
#!/bin/bash
shortlength=30;
content=`clipster -o -n 2`;
if [ ${#content} -gt 0 ]; then
isFirstLineRead=false;
firstLine="";
secondLine="";
while read -r line; do
if [ "$isFirstLineRead" = false ]; then
isFirstLineRead=true;
firstLine=$line;
else
secondLine=$line;
fi
done <<< "$content"
case $BLOCK_BUTTON in
1) echo "$secondLine $firstLine" | clipster ;;
esac
if [ ${#firstLine} -gt 30 ]; then
firstLine="${firstLine:0:20}...${firstLine: -10}"
fi
if [ ${#secondLine} -gt 30 ]; then
secondLine="${secondLine:0:7}..."
fi
echo "$secondLine | $firstLine"
else
echo "#empty#"
fi
$HOME/.config/i3/clipster
chmod +x $HOME/.config/i3/clipster
i3-msg restart
The bash script could probably be clearer, improvements and other ideas are welcomed. I'll test it for a week and propose it to https://github.com/acleverpun/i3-blocks-contrib next weekend.
Have a nice day,
Alex
If I set sync_selections = yes
and I select some text in my urxvt
terminal, the selection highlight vanishes away. This might be tricky but I wish to keep the selected text highlighted. Thank you!
TIP: If I select the same text twice or more, it stays highlighted the second time onwards.
Hi,
The Windows open-source clipboard manager Ditto has an unique feature which I've yet to find in any Linux clipboard manager: unlimited history.
That is, there can be no limit to the number of stored entries. All entries are saved in an SQLite database, which is indexed with SQLite's excellent full text indexing. This allows incrementally searching through hundreds of thousands of clipboard entries in seconds.
I have found this to be incredibly convenient, as it means that I can always cut instead of delete anything, with the peace of mind that I can always recover it later. It also allows me to quickly paste in code snippets written any amount of time ago.
Would this be a viable feature request for this project?
This is an aide-memoire for some of the utf-8 related code for python2...
If we add £3.99
to the clipboard, then (with debugging turned on) we see the in-memory buffer holds:
python3: '£3.99'
(we can walk away at this point...)
python2: '\xc2\xa33.99'
In both cases, the JSON history file will contain the 'ascii-fied' "\u00a33.99"
However, with python2 when the history file is read back in, it becomes:
python2 u'\xa33.99'
This causes the smart-update and duplicates code to fail, since these will be treated as unequal when compared.
The solution is to always try to decode('utf-8')
the selection, ignoring any failures. This will ensure that all comparisons are of u''
objects.
The other solution of course is to just use python3.
This is by far one of the lightest clipboard managers available for X. How hard would it be add dmenu support. If you could give me somewhere to start I could probably give it a go myself and then create pull request.
Thanks for the release!
On 1.0.0 I get the following error:
$ Traceback (most recent call last):
File "/nix/store/vxwz45d3wqs1l28s7dax8vsfia9gvcx5-python3-3.5.3-env/lib/python3.5/site-packages/gi/overrides/GLib.py", line 735, in <lambda>
func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data)
File "/nix/store/8yclnhbfzz5xkgqsspdhkz3hf7qcqaid-clipster-1.0.0/bin/.clipster-wrapped", line 514, in socket_recv
self.process_msg(conn)
File "/nix/store/8yclnhbfzz5xkgqsspdhkz3hf7qcqaid-clipster-1.0.0/bin/.clipster-wrapped", line 544, in process_msg
conn.sendall(json.dumps(self.boards[board][-count:][::-1]).encode('utf-8'))
BrokenPipeError: [Errno 32] Broken pipe
Traceback (most recent call last):
File "/nix/store/vxwz45d3wqs1l28s7dax8vsfia9gvcx5-python3-3.5.3-env/lib/python3.5/site-packages/gi/overrides/GLib.py", line 735, in <lambda>
func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data)
File "/nix/store/8yclnhbfzz5xkgqsspdhkz3hf7qcqaid-clipster-1.0.0/bin/.clipster-wrapped", line 514, in socket_recv
self.process_msg(conn)
File "/nix/store/8yclnhbfzz5xkgqsspdhkz3hf7qcqaid-clipster-1.0.0/bin/.clipster-wrapped", line 544, in process_msg
conn.sendall(json.dumps(self.boards[board][-count:][::-1]).encode('utf-8'))
BrokenPipeError: [Errno 32] Broken pipe
Traceback (most recent call last):
File "/nix/store/vxwz45d3wqs1l28s7dax8vsfia9gvcx5-python3-3.5.3-env/lib/python3.5/site-packages/gi/overrides/GLib.py", line 735, in <lambda>
func_fdtransform = lambda _, cond, *data: callback(channel, cond, *data)
File "/nix/store/8yclnhbfzz5xkgqsspdhkz3hf7qcqaid-clipster-1.0.0/bin/.clipster-wrapped", line 514, in socket_recv
self.process_msg(conn)
File "/nix/store/8yclnhbfzz5xkgqsspdhkz3hf7qcqaid-clipster-1.0.0/bin/.clipster-wrapped", line 544, in process_msg
This would be useful for dumping the output of the clipboard in a text editor friendly format:
\n
is ambiguous since clipboard entries often contains \n
Please allow delimiter specification (like >>>>>>>
) in the config file and/or the CLI.
I'm not exactly sure how this happens, but I am able to recreate on my system with three different browsers, so I assume it is related to clipster. This has been happening for a while as well, I've just been too lazy to document it.
It looks like any time a top level page's URL is copied, you get two entries in clipster, the second entry (the newer of the two) differs by having a trailing '/'.
Example:
https://www.google.com/
https://www.google.com
https://duckduckgo.com/
https://duckduckgo.com
This does not appear to happen for some urls with content after the '/, depending on what I assume is a relationship to certain special characters like '.' and '-'.
Example of non double entry:
https://github.com/qutebrowser/qutebrowser/blob/master/INSTALL.asciidoc
Thanks for your time.
-demure
In the config file, you have:
# Directory for clipster data/files (usually `$HOME/.local/share/clipster`)
data_dir = $XDG_DATA_HOME
I didn't think twice and copy pasted the config. But using this value in fact creates a folder called \$XDG_DATA_HOME
in the current directory! Commenting the line out works as expected.
As the title says, I noticed that history sometimes (most of the times) doesn’t get written (the file isn’t created, or if it exists it isn’t updated). Still, if I launch clipster -s I get everything (until I restart the demon).
I tried all the -l modes, but it seems nothing strange is happening.
Thanks for making clipster!
When I copy a text from google search results, clipster -d -l DEBUG
goes into an endless loop, presumably because of #1.
When I build clipster with python3, all is fine.
Hi. What license does clipster have?
Currently clipster fails on wayland (wm: sway). The stacktrace reports that libwnck is "designed to work under X11 only".
I fear this is going to be difficult to fix. If I understand correctly, wayland makes getting data from other windows very difficult (for security reasons). Clipit too doesn't run on wayland.
I'm using clipster with rofi and loving it so far. So, thank you very much for your work :)
I recently noticed that I have a lot of entries that follow a certain pattern and that I don't want to save. However, I cannot find a configuration value to ignore a selection change based on a pattern. Have I overlooked something? Would it be possible to implement something like this?
Thanks again!
Whilte using the primary clipboard it happends quite offen to me that I accidentialy mark way more than I actually want to in a console, or just simply move my mouse a little too much and send 2 or even more lines to the primary clipboard, padded by a whole lot of whitespaces.
It would be awesome if we could filter those extra whitespaces out. The difficult thing would be to not filter out too much.
I guess it could be done with patterns alone, I just wanted to know what you think about it.
I'm not sure if this is a bug, but wanted to pass the info anyway.
When I run clipster -s
in the terminal, I get 18 times:
(.clipster-wrapped:4373): Gtk-WARNING **: Allocating size to GtkDialog 0x213ff40 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?
Hello and thank you for this project.
I am running clipster
like this...
./clipster -d -l DEBUG -f /home/marc/.config/clipster/clipster.ini
...and this is my config file:
[0] ~/.config/clipster >> egrep -v "^#|^$" clipster.ini
[clipster]
data_dir = /home/marc/clipster
default_selection = PRIMARY
active_selections = PRIMARY,CLIPBOARD
sync_selections = yes
history_file = /home/marc/clipster/history
history_size = 200
history_update_interval = 60
write_on_change = no
socket_file = /home/marc/clipster/clipster_sock
pid_file = /home/marc/clipster/clipster.pid
max_input = 50000
row_height = 3
duplicates = no
smart_update = 1
extract_uris = no
extract_emails = no
extract_patterns = no
But when I select some text in my urxvt
terminal the selection is not synced to the CLIPBOARD
.
[0] ~/git/clipster (master) >> ./clipster -d -l DEBUG -f /home/marc/.config/clipster/clipster.ini
DEBUG:Debugging Enabled.
DEBUG:Trying to read config file: /home/marc/.config/clipster/clipster.ini
DEBUG:Merged config: [('active_selections', 'PRIMARY,CLIPBOARD'), ('data_dir', '/home/marc/clipster'), ('default_selection', 'PRIMARY'), ('duplicates', 'no'), ('extract_emails', 'no'), ('extract_patterns', 'no'), ('extract_uris', 'no'), ('filter_classes', ''), ('history_file', '/home/marc/clipster/history'), ('history_size', '200'), ('history_update_interval', '60'), ('max_input', '50000'), ('pid_file', '/home/marc/clipster/clipster.pid'), ('row_height', '3'), ('smart_update', '1'), ('socket_file', '/home/marc/clipster/clipster_sock'), ('sync_selections', 'yes'), ('write_on_change', 'no')]
DEBUG:Writing history file every 60 seconds
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection in 'active_selections'
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['history']
DEBUG:Writing history to file.
^CDEBUG:Daemon exiting...
DEBUG:History unchanged - not writing to file.
There should be some way to delete things from the clipboard history (other than opening the history file in a JSON editor...)
2 possible interfaces:
As discussed, would be nice to have a white list.
I've made a patch, submitting pull request.
I have some small improvements I'll include in another pull request too: getting config options every time the owner-change method is called seems very inefficient to me (python is slow enough as it is). ;)
This corresponds to #11 : it would be useful being able to mark items as to-be-kept when deleting or cicling history
In testing, I have found that clipster errors and fails to delete any entry containing unicode.
~ -> clipster -d -l DEBUG
DEBUG:Debugging Enabled.
DEBUG:Merged config: [('active_selections', 'PRIMARY,CLIPBOARD'), ('data_dir', '/home/demure/.local/share/clipster'), ('default_selection', 'PRIMARY'), ('duplicates', 'no'), ('extract_emails', 'yes'), ('extract_patterns', 'no'), ('extract_uris', 'yes'), ('filter_classes', ''), ('history_file', '/home/demure/.local/share/clipster/history'), ('history_size', '200'), ('history_update_interval', '60'), ('max_input', '50000'), ('pid_file', '/home/demure/.local/share/clipster/clipster.pid'), ('row_height', '3'), ('smart_update', '1'), ('socket_file', '/home/demure/.local/share/clipster/clipster_sock'), ('sync_selections', 'no'), ('write_on_change', 'no')]
DEBUG:Writing history file every 60 seconds
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:CLIPBOARD, count:0(clipster:1402): Gtk-WARNING **: Allocating size to GtkDialog 0x56208489e330 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?
DEBUG:Deleting history entry: ☃
/usr/local/sbin/clipster:217: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if self.read_board(board) == item:
/usr/local/sbin/clipster:349: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if text in self.boards[board]:
DEBUG:Deleting history entry: ☈
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:CLIPBOARD, count:0(clipster:1402): Gtk-WARNING **: Allocating size to GtkDialog 0x5620849d4560 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?
DEBUG:Deleting history entry: ☃
DEBUG:Deleting history entry: ☈
DEBUG:Client connection received.
DEBUG:Received: sig:SELECT, board:CLIPBOARD, count:0(clipster:1402): Gtk-WARNING **: Allocating size to GtkDialog 0x562084a32e50 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?
DEBUG:Deleting history entry: ☃
DEBUG:Deleting history entry: ☈
Thank you for your time.
-demure
Does clipster support copying pictures (jpeg, png, etc) to clipboard, or even select and copy a region from Gimp?
I use clipster trough rofi, with the command clipster -o -n 0 -0 | rofi -i -dmenu -sep '\x00' -eh 2 -p paste: | sed -ze 's/\n$//' | clipster
.
On version 1.0.1 that worked just fine, but on 1.2.4 I get all the text overlaid on one line: https://imgur.com/a/QKpjT
Also more minimal versions fail in similar ways:
clipster -o -n 0 -0 | rofi -dmenu
clipster -o -n 0 -0 | dmenu
I am using different X server instances, and have noticed that you can only have one clipster daemon running, and it's bound to that $DISPLAY.
I might be nice to have headless daemon that can be used from different environments, and where clipster -s
(to open the selection window) uses the current $DISPLAY.
I'm using clipster with roficlip, that is, clipster is called with clipster -c -o -n 500 -0
.
Unfortunately, that fails with the following error:
Traceback (most recent call last):
File "/usr/local/bin/clipster", line 854, in <module>
main()
File "/usr/local/bin/clipster", line 837, in main
print(client.output(), end='')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 41: ordinal not in range(128)
It seems that the wrong encoding is used. How can I change that?
Using the latest in master (3d0c2bc) with a fresh history file, whenever I attempt to pipe anything in using clipster -c
or clipster -p
, the daemon throws the follow error and does not save the clip to the specified clipboard.
DEBUG:Client connection received.
DEBUG:Received: sig:BOARD, board:CLIPBOARD, count:0
DEBUG:Sending requested selection(s): []
ERROR:Socket error [Errno 32] Broken pipe
DEBUG:Exception:
Traceback (most recent call last):
File "./clipster", line 555, in process_msg
conn.sendall(json.dumps(result[-count:][::-1]).encode('utf-8'))
BrokenPipeError: [Errno 32] Broken pipe
DEBUG:History unchanged - not writing to file.
Using any version of clipster before the July 20th batch of updates works as expected. It seems the commit "Restructure msg protocol to extend querying server" is the culprit.
I'm at work currently, but will look into creating a pull request after work.
I suggest you create a version for clipster to be packaged.
Only the beginning of clipboard entries is matched when typing a word in the clipboard history window. Searching should match anywhere inside the entries, not just the beginning.
Related to this, there's no way to jump to the next match of a search (or is there?).
I'm sorry for not having a clearer idea of when this happens, but sometimes a multi-line copy turns into a one-line paste.
Here's how I use clipster (bound to a key in my WM):
clipster -o -n 200 -0 | rofi -i -dmenu -sep '\x00' -eh 2 -p paste: | tr -d '\n' | clipster
❯ Traceback (most recent call last): [17:41:09]
File "/usr/bin/clipster", line 484, in owner_change
File "/usr/bin/clipster", line 416, in update_history
File "/usr/bin/clipster", line 317, in write_history_file
File "/usr/lib/python3.6/tempfile.py", line 342, in mkstemp
File "/usr/lib/python3.6/tempfile.py", line 260, in _mkstemp_inner
OSError: [Errno 24] Too many open files: '/home/jack/.config/clipster/tmp0tv2av8_'
Traceback (most recent call last):
File "/usr/bin/clipster", line 484, in owner_change
File "/usr/bin/clipster", line 416, in update_history
File "/usr/bin/clipster", line 317, in write_history_file
File "/usr/lib/python3.6/tempfile.py", line 342, in mkstemp
File "/usr/lib/python3.6/tempfile.py", line 260, in _mkstemp_inner
OSError: [Errno 24] Too many open files: '/home/jack/.config/clipster/tmp9iayxe0f'
I'd love to post something more meaningful than just a traceback but I cannot seem to pinpoint the cause. (This does repeatedly happen occasionally though)
Config below :
[clipster]
data_dir = /home/jack/.config/clipster
default_selection = PRIMARY
active_selections = PRIMARY,SECONDARY,CLIPBOARD
sync_selections = yes
history_file = %(data_dir)s/history
history_size = 5000
history_update_interval = 30
write_on_change = yes
socket_file = %(data_dir)s/clipster_sock
pid_file = %(data_dir)s/clipster.pid
max_input = 50000
row_height = 3
duplicates = no
smart_update = 1
extract_uris = yes
extract_emails = yes
extract_patterns = no
filter_classes = ""
Hi,
could you change
data_files = [("share/doc/clipster", ["LICENSE.md", "README.md"])],
in setup.py to
data_files = [("share/doc/clipster", ["README.md"]), ("share/license/clipster", ["LICENSE.md"])],
since that's were the license file actually belongs?
Thanks!
Following latest update I can’t run clipster because of:
line 438
os.chmod(self.sock_file, 0600)
SyntaxError: invalid token
I tried changing to 600
: now the demon starts, but then when launching -s I get: ERROR:Error connecting to socket. Is daemon running?
When I copy e.g. from my editor, then I close it, the selection is not available anymore for other applications (i.e. the system’s clipboard is emptied) unless I open clipster and copy it again from it.
I realized that my primary clipboard is often flooded with strings that grow or shrink to the left. This is caused, for example, when I select text with the mouse from right to left . Then the smart_update
feature doesn't work, because in method update_history
, the checks in line 372 use str.startswith()
.
Would you maybe agree to switch to a in b
here to detect growth in any direction? Or would you rather make that optional via the configuration?
(Update: python strings don't have a contains()
method :) )
Easiest implementation is probably that if history_size = 0 then nothing is written to disk.
.
For example disabling primary, that many people don’t use or don’t want to store for reuse. Main advantage is that if we write history on every change it becomes much less invasive (we are always selecting text, whereas we rarely ctrl-c)
sync_selections is not working
HEAD: 3ca241f
[~]── - clipster -d -f ~/.config/clipster/clipster.ini -l DEBUG
(clipster:15593): Gtk-WARNING **: Theme parsing error: gtk.css:3881:29: The style property GtkButton:inner-border is deprecated and shouldn't be used anymore. It will be removed in a future version
DEBUG:Debugging Enabled.
DEBUG:Trying to read config file: /home/benedikt/.config/clipster/clipster.ini
DEBUG:Merged config: [('active_selections', 'PRIMARY,CLIPBOARD'), ('clipster_dir', '/home/benedikt/.clipster'), ('data_dir', '$XDG_DATA_HOME'), ('default_selection', 'PRIMARY'), ('duplicates', 'no'), ('extract_emails', 'yes'), ('extract_patterns', 'no'), ('extract_uris', 'yes'), ('filter_classes', '"pass,rofi"'), ('history_file', '/home/benedikt/.clipster/history'), ('history_size', '200'), ('history_update_interval', '60'), ('max_input', '50000'), ('pid_file', '/home/benedikt/.clipster/clipster.pid'), ('row_height', '3'), ('smart_update', '1'), ('socket_file', '/home/benedikt/.clipster/clipster_sock'), ('sync_selections', 'yes'), ('write_on_change', 'no')]
DEBUG:Writing history file every 60 seconds
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['', 'clipboard-test']
DEBUG:owner-change event!
DEBUG:selection: CLIPBOARD
DEBUG:Selection is text.
DEBUG:Updating clipboard: CLIPBOARD
DEBUG:['', 'clipboard-test']
DEBUG:owner-change event!
DEBUG:selection: PRIMARY
DEBUG:Selection is text.
DEBUG:Updating clipboard: PRIMARY
DEBUG:['', 'clipboard-test', 'primary-test']
^CDEBUG:Daemon exiting...
DEBUG:Writing history to file.
Running the latest git revision (dfa75b5). Python 3.6.
Since some days, when running clipster -d
I get the following traceback:
Traceback (most recent call last):
File "clipster", line 810, in <module>
main()
File "clipster", line 783, in main
Daemon(config).run()
File "clipster", line 639, in run
self.prepare_files()
File "clipster", line 580, in prepare_files
os.kill(pid, 0)
PermissionError: [Errno 1] Operation not permitted
I tried googling for this error, and found this
I would find it neat to have clipster
allow me to save a clipboard history item and associate a name to it.
On the command line, I see the following changes, add:
-w, --save PATTERN NAME
# Save all matching line history number under NAME
-e, --edit NAME
# Opens $EDITOR with the saved clipboard history as content
Update:
-o [NAME], --output [NAME] Output last selection from history (or more, see -n) or saved clipboard history if NAME is given.
I totally agree that this could be done with just a hint of batch scripting, saving can be done with:
clipster -n 0 | grep PATTERN > ~/.config/clipster/saved/NAME
Editing with
$EDITOR ~/.config/clipster/saved/NAME
Copying back with:
clipster --ignore && clipster < ~/.config/clipster/saved/NAME
What I don't like about this last solution is the need to use grep
, clipster daemon should be able to accept a PATTERN option so that it doesn't need to send everything back to the client.
That being said, I just would find it neater to be integrated.
What do you think? I'm okay to propose a PR.
As raised in #64
Currently the GUI window doesn't have any WM_* attributes set - like NAME or CLASS so xprop shows (on i3):
WM_NAME(STRING) = "[i3 con] floatingcon around 0x55fa99de0030"
WM_CLASS(STRING) = "i3-frame", "i3-frame"
This may cause unexpeted issues, especially in cases where people are using these attributes to assign the GUI to workspaces etc.
WM attributes should be added - at least NAME and CLASS but possibly also things like roles, and maybe popup-esque attributes.
Anything copied from Blender doesn't end up in clipster's history.
Blender works fine with clipit, so I suspect this is a clipster issue.
Debug output:
% clipster -d -l DEBUG
** (clipster:6892): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-0jJrcSQjtc: Connection refused
DEBUG:Debugging Enabled.
DEBUG:Trying to read config file: /home/gandalf3/.config/clipster/clipster.ini
DEBUG:Merged config: [('active_selections', 'CLIPBOARD'), ('data_dir', '/home/gandalf3/.local/share/clipster'), ('default_selection', 'CLIPBOARD'), ('duplicates', 'no'), ('extract_emails', 'yes'), ('extract_patterns', 'no'), ('extract_uris', 'yes'), ('filter_classes', ''), ('history_file', '/home/gandalf3/.local/share/clipster/history'), ('history_size', '30'), ('history_update_interval', '60'), ('max_input', '50000'), ('pid_file', '/home/gandalf3/.local/share/clipster/clipster.pid'), ('row_height', '3'), ('smart_update', '1'), ('socket_file', '/home/gandalf3/.local/share/clipster/clipster_sock'), ('sync_selections', 'no'), ('write_on_change', 'no')]
DEBUG:Writing history file every 60 seconds
# Here I attempt to copy
DEBUG:owner-change event!
DEBUG:selection: CLIPBOARD
DEBUG:Selection in 'active_selections'
DEBUG:Client connection received.
# And here I run clipster -sc
DEBUG:Received: sig:SELECT, board:CLIPBOARD, count:0
Investigate ignoring clipboard changes for certain apps, such as password managers, so as to not cache passwords in history.
In theory, we can look at the clipboard owner, get the WM_NAME, WM_CLASS etc and use a user-defined filter to exclude these... however gtk doesn't seem keen to give us this information.
We can get the owning GDK window associated with the event as follows:
owner = event.owner
This window has no useful methods to directly get the X properties though - we have to go via something indirect like libwnck's window_get
from the xid: https://developer.gnome.org/libwnck/stable/WnckWindow.html#wnck-window-get
xid = owner.get_xid()
wnck_win = Wnck.Window.get(xid)
wm_name = wnck_win.get_name()
wm_class = wnck_win.get_name()
However the xid here is NOT the xid of the 'application root' window, and so Wnck returns None
. Perhaps we need to get it's parent:
parent_xid = owner.get_parent().get_xid()
# Repeat as above...
However get_parent
doesn't ask X for the parent, so seems to always return the root window: https://developer.gnome.org/gdk3/3.16/gdk3-Windows.html#gdk-window-get-parent
This is where I'm stuck for now - if anyone has any ideas I'm interested! I'd rather avoid having to add xlib if I can help it...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.