You are not logged in.

#51 2012-07-30 22:55:00

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Pushed bit better regex for matching urls in 'lolictrl -u' mode. Perfection can't be attained for matching urls, but finding good balance for general use.

Offline

#52 2012-07-31 21:22:11

webspider
Member
Registered: 2012-07-19
Posts: 27

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

So I have seen this excellent little tool and decided to integrate it in my dwm-workflow. Although I've been reading a lot about how X implements the clipboard and selection buffers, I don't really understand how to use it as efficiently as possible. Maybe I'm just too tired and will gain sudden insight the next morning.

If I've understood everything correctly, there are two trivial and two not so trivial cases:
- Copy/Paste between terminals/ttys or in a terminal/tty: Select  and press Shift+Insert to paste the selection.
- Copy/Paste between GUI applications or in a GUI application: Use the controls given (usually these would be Ctrl+C and Ctrl+V).
- Copy/Paste from a terminal to a GUI application: use ``echo "ABC" | loliclip -c`` in the terminal, then use Ctrl+V in the GUI application.
- Copy/Paste from a GUI application to a terminal: use Ctrl+C in the GUI application, then use ``loliclip --get`` in the terminal.

Is this correct? It feels very clunky to me and I currently don't see how to make things go smoother by binding certain loliclip or lolictrl commands to keys or writing scripts that use loliclip or lolictrl to autosync stuff. Maybe I'm just too used to the Microsoft way and am over-thinking everything. It would be cool if somebody can give me a hint or even write a small round-up on Clipboards and tools to manage them. Thank you, guys.

Offline

#53 2012-07-31 21:30:07

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

webspider wrote:

Is this correct? It feels very clunky to me and I currently don't see how to make things go smoother by binding certain loliclip or lolictrl commands to keys or writing scripts that use loliclip or lolictrl to autosync stuff. Maybe I'm just too used to the Microsoft way and am over-thinking everything. It would be cool if somebody can give me a hint or even write a small round-up on Clipboards and tools to manage them. Thank you, guys.

Copy/Paste from GUI to terminal: Ctrl+C in GUI, shift+insert in terminal (this is what default config.h in loliclip does)
Copy/Paste from terminal to GUI: bind 'lolictrl -spc' in your wm or whatever you use to bind keys.
And use that to synchorize primary to clipboard manually when you need it.

From vim without X clipboard support compiled in:
vmap <C-c> :<Esc>`>a<CR><Esc>mx`<i<CR><Esc>my'xk$v'y!tee >(loliclip -c)<CR>u

It's possible to set primary to sync to clipboard automatically as well in config.h
But it's quite counter innutive since your clipboard gets replaced each text selection.

That's at least my workflow.. and 'lolictrl' for history, 'lolictrl -u' for url history.
(I have these binded to 'meta-c' and 'meta-shift-c' the primary sync is binded to 'alt-shift-c')

If you copy files in GUI filemanager, it will remember that file copy even if you go and copy some text.
Same for other special selections that isn't shared. You can see shared special selections in config.h.
Shared selections get overwritten when you copy some other stuff that is shared as well.
This is to reduce ram (for example gimp image copy).
However INCR is not yet supported so you can't even copy big chunks of data.



Everyone else:
The default history limit @ git has been bumped from 15 to 150. Change in config.h if you prefer something else.

Last edited by Cloudef (2012-07-31 21:45:55)

Offline

#54 2012-08-01 13:48:33

webspider
Member
Registered: 2012-07-19
Posts: 27

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Thank you very much, I've used your settings for everything and they work out fine.

edit: Could you maybe put that info into the first post for other new users?

Last edited by webspider (2012-08-01 19:22:09)

Offline

#55 2012-08-01 19:44:52

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Problem:

I have

# pacman -Qi loliclip|grep Version
Version        : 1.7-8

and just wanted to copy an entry in LibreOffice Calc from one place to another with Ctrl+c and Ctrl+v. The content doesn't appear in loliclip's history, so it doesn't work.

I had to kill loliclip, do the copying and restart loliclip.

Here's the debugging, hope this helps:

% gcc -Wall -g loliclip.c -lxcb -lz -o loliclip
loliclip.c:981:13: warning: ‘handle_incr’ defined but not used [-Wunused-function]
loliclip.c:1301:13: warning: ‘handle_property’ defined but not used [-Wunused-function]
% gdb ./loliclip
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/army/Programme/cloudef/PKGBUILDS/loliclip/loliclip...done.
(gdb) run
Starting program: /home/army/Programme/cloudef/PKGBUILDS/loliclip/loliclip 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
-!- [0] XSEL_DATA = 0x155
-!- [1] ATOM = 0x4
-!- [2] INTEGER = 0x13
-!- [3] UTF8_STRING = 0x156
-!- [4] TIMESTAMP = 0x157
-!- [5] TEXT = 0x158
-!- [6] STRING = 0x1f
-!- [7] TARGETS = 0x159
-!- Owning clipboard PRIMARY
-!- PRIMARY = 0x1
-!- Owning clipboard SECONDARY
-!- SECONDARY = 0x2
-!- Owning clipboard CLIPBOARD
-!- Restoring selection
-!- Synced from CLIPBOARD to PRIMARY
-!- CLIPBOARD = 0x15a
-!- text/uri-list = 0x27c
-!- x-special/gnome-copied-files = 0x15b
-!- application/x-kde-cutselection = 0x2a5
-!- image/tiff = 0x15c
-!- image/bmp = 0x15d
-!- image/x-bmp = 0x15e
-!- image/x-MS-bmp = 0x15f
-!- image/x-icon = 0x160
-!- image/x-ico = 0x161
-!- image/x-win-bitmap = 0x162
-!- image/jpeg = 0x163
-!- 1669 [loliclip.c :: main]: Starting loliclip
-!- xcb: selection request
-!- Targets request
-!- SENT: http://download.media.tagesschau.de/video/2012/0731/TV-20120731-1545-1201.webl.h264.mp4 [87]
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard PRIMARY
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard PRIMARY
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard PRIMARY
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Start of PRIMARY copy
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- End of PRIMARY copy
<comment>
the next lines appeared when I selected the content in Calc
</comment>
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Requesting selection from X
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard CLIPBOARD
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard PRIMARY
-!- xcb: unhandled event
-!- xcb: selection request
-!- Targets request
-!- SENT: http://download.media.tagesschau.de/video/2012/0731/TV-20120731-1545-1201.webl.h264.mp4 [87]
-!- xcb: selection request
-!- UTF8 request
-!- SENT: http://download.media.tagesschau.de/video/2012/0731/TV-20120731-1545-1201.webl.h264.mp4 [87]
-!- xcb: selection request
-!- UTF8 request
-!- SENT: http://download.media.tagesschau.de/video/2012/0731/TV-20120731-1545-1201.webl.h264.mp4 [87]
^C
Program received signal SIGINT, Interrupt.
0x00007ffff76deea0 in __poll_nocancel () from /lib/libc.so.6
(gdb) bt full
#0  0x00007ffff76deea0 in __poll_nocancel () from /lib/libc.so.6
No symbol table info available.
#1  0x00007ffff7bc6e42 in ?? () from /lib/libxcb.so.1
No symbol table info available.
#2  0x00007ffff7bc85bf in xcb_wait_for_event () from /lib/libxcb.so.1
No symbol table info available.
#3  0x0000000000406dfc in main (argc=1, argv=0x7fffffffdd78) at loliclip.c:1674
        ev = 0x610070
        i = 3
        doblock = 1
        skiploop = 0
        __func__ = "main"

What I did:
I started loliclip in gdb, switched over to the already running Calc, selected the content, waited, pressed Ctrl+c, waited, selected the empty field and pressed Ctrl+v


Cloudef, do you need anything else?

Last edited by Army (2012-08-01 19:48:08)

Offline

#56 2012-08-01 23:15:27

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Army, get the python script from repo.
Copy something from Calc without loliclip running and paste the output here (from python script).
Most likely you just need to add one line in config.h.

Also, I've been working on INCR support today. I already have it working for requests,
but sending INCR's to other applications is bit broken atm.. I'm also refactoring the code to make it do less stuff on background.

Last edited by Cloudef (2012-08-02 06:27:11)

Offline

#57 2012-08-02 05:17:02

hunterm
Member
From: the series of tubes
Registered: 2010-07-30
Posts: 20

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

I was using Xfce's clipman stuff before, though it had been getting in the way too much. loliclip is much more KISS, and is working beautifully. Thanks for making this.

Offline

#58 2012-08-02 10:54:56

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Ok, I opened Calc, put "this is a test" in one field, marked it, pressed Ctrl+c and then ran

python2 get_targets.py > loliclip

You can find the file here

Hope I did everything right smile

Offline

#59 2012-08-02 11:05:45

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Add these to config.h, ugh.. So many selections used in openoffice.
Maybe I should add wildcarding to the selection names.

Change the 0 to 1, if you want to share the buffer. But this is not probably ideal for the open office stuff.
I might zlib compress the data for special selections since there are so much of them.

REGISTER_SELECTION("application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", 0),
REGISTER_SELECTION("application/x-openoffice-sylk;windows_formatname=\"Sylk\"", 0),
REGISTER_SELECTION("application/x-openoffice-dif;windows_formatname=\"DIF\"", 0),
REGISTER_SELECTION("application/x-openoffice-link;windows_formatname=\"Link\"", 0),
REGISTER_SELECTION("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", 0),
REGISTER_SELECTION("application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", 0),
REGISTER_SELECTION("application/x-openoffice-wmf;windows_formatname=\"Image EMF\"", 0),
REGISTER_SELECTION("application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", 0),
REGISTER_SELECTION("text/html", 0),
REGISTER_SELECTION("text/richtext", 0),

Last edited by Cloudef (2012-08-02 11:08:00)

Offline

#60 2012-08-02 18:35:06

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

I found out that when loliclip is on, qtfm file manager can't cut and paste files. Copying works but at the moment of copying it freezes qtfm for couple of seconds. It worked with some older version of loliclip, this is a fairly recent regression.

This is the debug output when copying (when qtfm stalls):

~ >>> loliclip 
-!- [0] XSEL_DATA = 0x18d
-!- [1] ATOM = 0x4
-!- [2] INTEGER = 0x13
-!- [3] UTF8_STRING = 0x110
-!- [4] TIMESTAMP = 0x18e
-!- [5] TEXT = 0x18f
-!- [6] STRING = 0x1f
-!- [7] TARGETS = 0x190
-!- Owning clipboard PRIMARY
-!- PRIMARY = 0x1
-!- Owning clipboard SECONDARY
-!- SECONDARY = 0x2
-!- Owning clipboard CLIPBOARD
-!- Synced from CLIPBOARD to PRIMARY
-!- CLIPBOARD = 0x191
-!- text/uri-list = 0x192
-!- x-special/gnome-copied-files = 0x193
-!- application/x-kde-cutselection = 0x194
-!- image/tiff = 0x195
-!- image/bmp = 0x196
-!- image/x-bmp = 0x197
-!- image/x-MS-bmp = 0x198
-!- image/x-icon = 0x199
-!- image/x-ico = 0x19a
-!- image/x-win-bitmap = 0x19b
-!- image/jpeg = 0x19c
-!- 1669 [/home/igor/Downloads/PKGBUILDS/loliclip/src/loliclip.c :: main]: Starting loliclip
-!- xcb: selection request
-!- Targets request
-!- SENT: (null) [0]
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: unhandled event
-!- xcb: unhandled event
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard PRIMARY
-!- xcb: unhandled event
-!- xcb: unhandled event
/////////////////////////////////////////////////////////////////////// this is where qtfm stalls for 5 seconds, loliclip also waits
-!- xcb: clear request
-!- Requesting selection from X
-!- Got special data from text/uri-list
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard CLIPBOARD
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: selection request
-!- Targets request
-!- SENT: (null) [0]

and this is the debug when cutting:

~ >>> loliclip 
-!- [0] XSEL_DATA = 0x18d
-!- [1] ATOM = 0x4
-!- [2] INTEGER = 0x13
-!- [3] UTF8_STRING = 0x110
-!- [4] TIMESTAMP = 0x18e
-!- [5] TEXT = 0x18f
-!- [6] STRING = 0x1f
-!- [7] TARGETS = 0x190
-!- Owning clipboard PRIMARY
-!- PRIMARY = 0x1
-!- Owning clipboard SECONDARY
-!- SECONDARY = 0x2
-!- Owning clipboard CLIPBOARD
-!- Synced from CLIPBOARD to PRIMARY
-!- CLIPBOARD = 0x191
-!- text/uri-list = 0x192
-!- x-special/gnome-copied-files = 0x193
-!- application/x-kde-cutselection = 0x194
-!- image/tiff = 0x195
-!- image/bmp = 0x196
-!- image/x-bmp = 0x197
-!- image/x-MS-bmp = 0x198
-!- image/x-icon = 0x199
-!- image/x-ico = 0x19a
-!- image/x-win-bitmap = 0x19b
-!- image/jpeg = 0x19c
-!- 1669 [/home/igor/Downloads/PKGBUILDS/loliclip/src/loliclip.c :: main]: Starting loliclip
-!- xcb: selection request
-!- Targets request
-!- SENT: (null) [0]
-!- xcb: clear request
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Got special data from x-special/gnome-copied-files
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Requesting selection from X
-!- Failed to get selection from X
-!- Owning clipboard CLIPBOARD
-!- Requesting selection from X
-!- Failed to get selection from X
-!- xcb: selection request
-!- Targets request
-!- SENT: (null) [0]

and when pasting after cut (continuation on previous):

-!- xcb: selection request
-!- Targets request
-!- SENT: (null) [0]
-!- xcb: selection request
-!- Special data request from text/uri-list
-!- SENT: file:///home/igor/Downloads/PKGBUILDS/README
 [46]
-!- xcb: clear request
-!- Owning clipboard CLIPBOARD
-!- xcb: selection request
-!- Targets request
-!- SENT: (null) [0]

after paste I get an error that file does not longer exist.

Last edited by karabaja4 (2012-08-02 18:56:24)

Offline

#61 2012-08-02 18:44:28

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

karabaja4 wrote:

I found out that when loliclip is on, qtfm file manager can't cut and paste files. Copying works but at the moment of copying it freezes qtfm for couple of seconds. It worked with some older version of loliclip, this is a fairly recent regression.

I'll check what's up while refactoring.

Offline

#62 2012-08-02 19:03:38

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

Maybe it's worth mentioning that this bug occurs at random, so try to cut/paste file few times. In my case it fails more than it succeeds.

Offline

#63 2012-08-02 19:23:04

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

karabaja4 wrote:

Maybe it's worth mentioning that this bug occurs at random, so try to cut/paste file few times. In my case it fails more than it succeeds.

Yeah, I already know what causes this smile

Offline

#64 2012-08-04 00:01:47

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

@karabaja4
Your issue should be fixed @ git. Also INCR is now supported..

@everyone
There's again been quite lots of changes, so tell me if anything's broken.
So far In my use everything's been good (actually better than before)

Keep in mind that the binary data currently isn't compressed at all in RAM.
Nor are failed INCR transfers cleaned up yet. So the memory usage atm can be quite high depending on the data you have on clipboard.
Images should be shared however, so you won't have every kind of image data on memory at the same time.

Anyways, it's quite neat to copy image on gimp, then some text and still be able to paste the image back to gimp.
In addition to INCR, "binary" data isn't saved to history as well (anything with 0 terminator midway).

Last edited by Cloudef (2012-08-04 00:05:15)

Offline

#65 2012-08-04 11:41:25

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

I can't test it yet on my main desktop because I'm away for the weekend, but on my laptop everything works perfectly, qtfm, gimp and text copying. I'll test everything in detail on Monday.

Cloudef, thanks alot for this awesome little app. Just work out those memory issues and we'll (finally) have a perfect clipboard manager for linux.

EDIT: one small issue, "loliclip -b image/jpeg > image.jpg" doesn't seem to work when doing "Copy image" from Firefox right click menu on images. This is what I get:

-!- xcb: clear request
-!- Clearing clipboard PRIMARY
-!- NONBLOCK
-!- xcb: selection request
-!- Targets request
-!- check 76 bytes
-!- xcb: clear request
-!- Clearing clipboard CLIPBOARD
-!- Owning clipboard PRIMARY
-!- Owning clipboard CLIPBOARD
-!- xcb: selection request
-!- Targets request
-!- check 76 bytes
-!- WAIT FOR INCR!
-!- Got 1 bytes [32]
-!- Got 1 bytes [32]
-!- Got 1 bytes [32]
-!- Got 17291 bytes [8]
-!- Got 486 bytes [8]
-!- Got 262144 bytes [8]
-!- Got 176862 bytes [8]
-!- INCR end
-!- Finished with 456786 bytes
-!- Got special data from image/tiff
-!- BLOCKING

It seems like it always detects tiff even when selecting jpg's?

Last edited by karabaja4 (2012-08-04 12:09:55)

Offline

#66 2012-08-04 12:10:19

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

karabaja4 wrote:

EDIT: one small issue, "loliclip -b image/jpeg > image.jpg" doesn't seem to work. It just waits as if it's expecting input. image/tiff works though.

It means that image/jpeg has no data, gimp/(or any program) randomly selects the selection where it puts it's data. Most of the time it's image/tiff though.
I don't yet know what affects this.

Edit: Hmm actually, try putting the image/jpeg in config.h higher in the list. I think it converts to the first requested format of course smile

As for other selections that are not specified in config.h, like those ridiculous amount for openoffice that Army posted.
I'm thinking of allocating these at runtime whenever selection that is not specified in config.h is found.
If the data from selection is bigger than certain amount in config.h it's added as shared selection, otherwise it has it's own buffer.
Does this sound good?

Last edited by Cloudef (2012-08-04 12:17:21)

Offline

#67 2012-08-04 12:14:08

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

I edited the last post. I'm doing this from Firefox, selecting Copy image on jpgs. loliclip detects them as tiff. When I do loliclip -b image/tiff > image.tiff on copied jpg, gpicview can't open it (error: Couldn't recognize image file format).

EDIT: I'll try the config.h thing.

Last edited by karabaja4 (2012-08-04 12:14:53)

Offline

#68 2012-08-04 12:19:25

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

karabaja4 wrote:

I edited the last post. I'm doing this from Firefox, selecting Copy image on jpgs. loliclip detects them as tiff. When I do loliclip -b image/tiff > image.tiff on copied jpg, gpicview can't open it (error: Couldn't recognize image file format).

This sounds strange though, why would firefox give image/tiff data if it can't give it proberly? I'll investigate.

Offline

#69 2012-08-04 12:23:34

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

This is what I get when I put image/jpeg as first in the config.h:

-!- xcb: clear request
-!- Clearing clipboard PRIMARY
-!- NONBLOCK
-!- xcb: clear request
-!- Clearing clipboard CLIPBOARD
-!- Owning clipboard PRIMARY
-!- Owning clipboard CLIPBOARD
-!- Got special data from image/jpeg
-!- WAIT FOR INCR!
-!- Got 1 bytes [32]
-!- Got 1 bytes [32]
-!- Got 1 bytes [32]
-!- Got 486 bytes [8]
-!- Got 262144 bytes [8]
-!- Got 176862 bytes [8]
-!- INCR end
-!- Finished with 439495 bytes
-!- Got special data from image/tiff
-!- BLOCKING

it behaves the same though, I do "copy image" on jpg from Firefox, loliclip -b image/jpeg waits for input, and loliclip -b image/tiff produces tiff I can't open.

Last edited by karabaja4 (2012-08-04 12:28:14)

Offline

#70 2012-08-04 12:32:16

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

it behaves the same though, I do "copy image" on jpg from Firefox, loliclip -b image/jpeg waits for input, and loliclip -b image/tiff produces tiff I can't open.

Yeah, seems like you've found 2 bugs then. I'll squish them when I find time smile Thanks.

I'll solve one of them by not announcing conversions for formats which selection is empty.
Also for the input waiting, I need to send response that we have no data.

Last edited by Cloudef (2012-08-04 12:34:12)

Offline

#71 2012-08-04 12:34:43

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

I think I found another one smile

If image/jpeg is first in config.h, gimp puts it's selection in image/jpeg. But later, when trying to paste in gimp, it tries to take it's data from image/tiff, so nothing gets pasted.

Last edited by karabaja4 (2012-08-04 12:35:13)

Offline

#72 2012-08-04 12:35:56

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

karabaja4 wrote:

If image/jpeg is first in config.h, gimp puts it's selection in image/jpeg. But later, when trying to paste in gimp, it tries to take it's data from image/tiff, so nothing gets pasted.

Yeah, this will be fixed by only telling the requestor the selections we have data on.
I think, right now it tries to take the data from first announced selection (even if it has none)

Last edited by Cloudef (2012-08-04 12:36:31)

Offline

#73 2012-08-04 16:04:53

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

@karabaja4
I've pushed a update. Tell me if there is still something weird.

Actually, I broke something..
Edit: Should be ok now! smile
Edit2: Should propably add input mode for --binary switch as well, so you could do 'cat image.tiff | loliclip -b image/tiff'

There currently is quite interesting possibilities with loliclip.
eg. view image from clipboard in sxiv:

loliclip -b image/png > /tmp/clipboard.png && { sxiv /tmp/clipboard.png; rm /tmp/clipboard.png; }

It's still quite not so nice though, I need to see what information I can give easily accessable to stdout.
eg. the above script would not work if the image was not in image/tiff format.

Edit3: Managed to break normal text copy this time.. Should be fixed tongue
The AUR currently has quite old version for reason.

Edit4: Added image/png and text/plain selections..
Also modified the python script to not print contents of selections, since that's not the point of it.

Last edited by Cloudef (2012-08-04 16:46:33)

Offline

#74 2012-08-04 16:54:28

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

It works beautifully now, any type of image (jpg, bmp) copied from Firefox or Gimp ends up as image/png, that is to be expected, right?

Offline

#75 2012-08-04 16:56:49

Cloudef
Member
Registered: 2010-10-12
Posts: 636

Re: xcmenu - lightweight clipboard manager for X (formerly loliclip)

karabaja4 wrote:

It works beautifully now, any type of image (jpg, bmp) copied from Firefox or Gimp ends up as image/png, that is to be expected, right?

Yes, firefox supports the conversion to png and does it.
You can prioritize the conversions in config.h, I added better comments there to explain what happens, even though I'm not the best writer.

If you want to have more image types same time, then just turn off the shared flag for those selections, however this will keep the images in seperate buffers.
So if you have many images, you use more ram. And the data is stored RAW in ram without any compression atm (though most image formats are quite neatly compressed anyways).

Last edited by Cloudef (2012-08-04 16:58:36)

Offline

Board footer

Powered by FluxBB