Giter Club home page Giter Club logo

clipnotify's People

Contributors

cdown avatar foxxx0 avatar iamleot avatar terminaldweller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clipnotify's Issues

Continuous monitor mode

The way, when command is run per each request or for each event, is somewhat ineffective. Clipnotify could stay at stdout, sending something (may be just a newline) on each event. For example, some other tools support daemon mode: inotifywait, alsactl and amixer, pacmd, skb (similar tool for xkb layout watching), free (program, not word).

If clipnotify supported such mode, it would allow to make super-effective clipmenud by moving maximum job into special utilities, arranging them into persistant pipeline, while shell would only manage its setup.
Example option: -o, --stdout, -m, --monitor (last two as for inotifywait).

FreeBSD Makefile changes

When building on FreeBSD the location of the include files for cc are in /usr/local/include and /usr/local/lib. In the Makefile there is already the following variable defined x11_bsd_flags = -I/usr/X11R6/include -L/usr/X11R6/lib which seems valid for OpenBSD

Add Wayland support

Now clipnotify uses XFIXES extension to X11. Since the world is moving to Wayland would be great to support it.

request: empty clipboard notification

if X emits an event when the clipboard is emptied (i.e. when the owner dies)
then clipnotify could relay that to automatically restore the clipboard from history
and so solve the problem of may-be-missing contents without stealing ownership

clipnotify compling error

For compliling & installing clipmenu, clipnotify was not available on debian, so I tried to compile, but failed on this error

cc   clipnotify.c -o clipnotify -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXfixes
clipnotify.c:3:10: fatal error: X11/extensions/Xfixes.h: No such file or directory
    3 | #include <X11/extensions/Xfixes.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Discriminate between primary and clipboard notification

Hi, thanks for this little program quite useful ! I use it to automatically copy the primary selection to the clipboard when I select something :

while clipnotify; do
    xclip -sel p -o | xclip -sel c
done

But, this poses a problem when on an application like libreoffice I need to copy with ctrl+c directly to clipboard, as my script gonna erase this selection overwriting the clipboard with the primary selection. I use now a trick : storing the clipboard content in a variable, I can check if the new clipboard content is different than the stored one (a new clipboard selection is done) or not (a new primary selection is done).

while clipnotify; do
   if [[ $(xclip -sel c -o) == "$clipboard" ]]; then
      xclip -sel p -o | xclip -sel c
   fi
   clipboard=$(xclip -sel c -o)
done

But it would be more elegant to have the possibility to discriminate between primary and clipboard notification with clipnotify or something else. I would like a syntax like:

while clipnotify; do
    if the sel is primary then
done

Why not something like the bspwm daemon : bspc subscribe node_geometry | while read -a msg; do sending just a message with the name of the X selection (primary/clipboard...) ?

Isn't there a race / hang?

The example calls clipnotify and, when it returns, does something with the new selection value.
But what if a change arrives just before clipnotify starts listening?
Then the program will wait forever and not notice the new selection value, right?

I understand it may be impossible to catch brief transient values, but I'd like eventual consistency; e.g. if the selection value changes to "foo" and stays that way, the script should eventually notice that.

To demonstrate:

In bash shell window #1, run this clipnotify loop:
while ./clipnotify; do echo "PRIMARY: '$(xclip -o -sel p)' CLIPBOARD: '$(xclip -o -sel c)'"; done
In bash shell window #2, run this naive polling loop:
p0=$(xclip -o -sel p); c0=$(xclip -o -sel c); while true; do p1=$(xclip -o -sel p); c1=$(xclip -o -sel c); if [[ "$p1" != "$p0" || "$c1" != "$c0" ]]; then echo "PRIMARY: '$p1' CLIPBOARD: '$c1'"; p0=$p1; c0=$c1; fi; done
In bash shell window #3, run this repeatedly:
echo -n foo | xclip; echo -n bar | xclip

Desired result: the last line, in both windows #1 and #2, should always look like:

...
PRIMARY: 'bar'  CLIPBOARD: 'whatever'

Actual result: window #2 (the naive polling loop) is always good. But window #1 (the clipnotify loop) sometimes ends up showing the not-most-recent value:

...
PRIMARY: 'foo'  CLIPBOARD: 'whatever'

Chromium v64 sends many SetSelectionOwner events sent while making selection

I'm running Chromium 64.0.3282.167, clipnotify 071c3d3, and clipmenu caab3f6a62a. As I select text using my trackpad I see many entries being added by clipmenud, which clutters up the history when I run clipmenu. I'm inferring that Chromium sends many SetSelectionOwner events while a selection is being made, which doesn't seem to break any ICCCM recommendations, but also doesn't work well with clipnotify. I can't think of a Works Every Time way to handle this. Maybe the answer is to change Chromium's behaviour.

Oddly, I've heard that Chrome doesn't display this behaviour.

Install errors on Ubuntu

I receive this error

~/.clipnotify(master โœ”) make
cc   clipnotify.c -o clipnotify -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXfixes
clipnotify.c:1:10: fatal error: X11/Xatom.h: No such file or directory
 #include <X11/Xatom.h>
          ^~~~~~~~~~~~~
compilation terminated.
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1

I'm sure the solution may be simple but I'd need to see it. Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.