Code Monkey home page Code Monkey logo

node-clipboard-event's People

Contributors

bigotto avatar jlstdio avatar sudhakar3697 avatar wilux-source 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

Watchers

 avatar  avatar

node-clipboard-event's Issues

clipboard-event module spawns a hidden/invisible window incorrectly

Hi @sudhakar3697
I'm using your clipboard-event module in my electron and so far it is grate.
However, I'm observing that if I use this module and when my app launches, the focus first lands to my app and then an invisible window spawns with the title of clipboard-event-handler-win32.
This hidden/invisible window steals our focus from the application which is not good for the users.
If we unknowingly press alt+f4 on that window, the clipboard events in our app stops working.
Can you help here? I guess some executable is getting launched for capturing the clipboard which is spawning the invisible window.
Can you do something to hide that window?
(I'm on Windows)
(I'm targetting keyboard users mainly with this app)

Provide types

Awesome library. It does the job pretty well!

I would suggest to provide the types, to make it easier to integrate with TypeScript.

Compiled clipboard-event handler is executed twice in Ubuntu 22

I have a Electron app which uses clipboard-event package in ubuntu 20 and works fine. Now I want to run it in Ubuntu 22 for development and I saw that clipboard changes where not detected. The cause is that in the package the data received from the compiled clipboard handler is checked if it is equal to "CLIPBOARD_CHANGE". However, the data it is receiving is "CLIPBOARD_CHANGE\nCLIPBOARD_CHANGE". As a result the comparation is false and the event is not emitted.

Did anyone had this behaviour?

Problem to use in Electron

Hi, i have this problem, node-clipboard-event doesn't work for me when I call it in electron

I have a test file called test.js, when I open it with "node test.js" it works perfect

const clipboardListener = require('clipboard-event');

clipboardListener.startListening();

clipboardListener.on('change', () => {
    console.log("hi")
});

but... if I call this file from background.js (electron) it just doesn't do anything

also if I put the code directly in background.js it does nothing

I have the nodeIntegration: true. Why doesn't it work in electron but with "node" directly?

Clipboard change not being detected [Ubuntu 22]

Nothing happens when copying text even though I have copied the example from the repo.

OS: Ubuntu 22.04.2
Node version: 16.16.0

Code:

const cL = require("clipboard-event");

console.log("Running"); // THIS RUNS
cL.startListening();
cL.on("change", () => {
    console.log("Test") // NEVER RUNS
}
console.log(cL); // Shows ClipboardEventListener object with evensCount: 1 (so event has registered correctly)

Plan to support/develop native (v2) module?

Hi @sudhakar3697
I've checked that you have the "v2" branch for the native module of node-clipboard-event in this repository but it is not updated since 2020.
So, are there any plans to develop/support the native module further? Actually I needed the native implementation for one of my electron project and I don't want to use the module based on child_process.
Please help

Error - Uncaught Not yet supported

I was trying to use this library using https://github.com/WilianZilv/reactron ( React + Electron ). Here's the code that I tried:

import React from 'react';
import Grid from "@material-ui/core/Grid";
import {useOvermind} from "../Others/OvermindHelper";
import {on, startListening} from 'clipboard-event'
import Button from "@material-ui/core/Button";

const sl = () => {
    startListening()
    console.log("Clipboard Listening")
    on('change', () => {
        console.log('Clipboard changed');
    });
}

const Clipboard = () => {
    const {state, actions} = useOvermind()

    return (
        <Grid>
            <Button variant='contained' color='primary' onClick={() => {
                sl()
            }}>START</Button>
        </Grid>
    );
};

export default Clipboard;

but it shows these errors:
Screenshot (51)
Screenshot (52)

Any solution?
Thanks...

Missing execute property on file clipboard-event-handler-linux NPM package

Hi @sudhakar3697,
Thanks for creating this valuable package! I used your example code in an electron desktop application, but did not detect any clipboard changes:

package.json:

  "dependencies": {
    "clipboard-event": "^1.5.0"
  },

Installation: npm install

// Monitor clipboard changes
import clipboardListener from "clipboard-event";

// To start listening
clipboardListener.startListening();

clipboardListener.on('change', () => {
    console.log('Clipboard changed');
});

Reason is that the executable has no exec permission after installation:

/node_modules/clipboard-event/platform$ ll
total 124
drwxrwxr-x 2 a a  4096 Jul  2 21:29 ./
drwxrwxr-x 3 a a  4096 Jul  2 21:29 ../
-rw-rw-r-- 1 a a 12928 Oct 26  1985 clipboard-event-handler-linux
-rw-rw-r-- 1 a a  1081 Oct 26  1985 clipboard-event-handler-linux.c
-rw-rw-r-- 1 a a 75440 Oct 26  1985 clipboard-event-handler-mac
-rw-rw-r-- 1 a a   394 Oct 26  1985 clipboard-event-handler-mac.swift
-rw-rw-r-- 1 a a  1973 Oct 26  1985 clipboard-event-handler-win32.cs
-rw-rw-r-- 1 a a  8696 Oct 26  1985 clipboard-event-handler-win32.exe

Manually setting it solved it:

$ chmod +x clipboard-event-handler-linux

Output:

Clipboard changed
Clipboard changed
Clipboard changed

Can you add this into Git?

$ git update-index --chmod=+x clipboard-event-handler-linux
$ git ls-files --stage
$ git push

Thanks!

`clipboard-event-handler-mac` does not start properly on Mac

clipboard-event-handler-mac does not start properly on Mac.

Processes are automatically killed when executed in the terminal.

If you use the following terminal command before executing:

chmod +x ./clipboard-event-handler-mac

you will get an error: clipboard-event-handler-mac will harm your computer and you should move it to the Trash.

Other than that, it executes fine under Linux and Win.

I don't know how to fix this, if anyone could provide a little advice, I'd be grateful! ๐Ÿ˜ข

clipboard-event dont work with pkg?

I dont know why , but when i open my file try.js:

    const clipboardListener = require('clipboard-event');

    clipboardListener.startListening();

    clipboardListener.on('change', () => {
console.log('Clipboard changed');
}

with "node try.js" work good, but...

when i use "pkg try.js --target node14-win-x64" and open the file try.exe (the same file this literally) just close whiout show error. Am I the only one that this happens to? or is it a bug in this package?

The file that is executed does not have execute permission

Was using this package while developing on a Linux (Ubuntu) machine, but apparently, the package was not working as intended, after going through the source, and found out that the system was not able to execute the Linux file named 'clipboard-event-handler-linux' which is an executable I suppose. And this was happening because the file did not have execute permission.

To give permission to the file:
$ chmod u+x <PROGRAM_DIRECTORY>/node_modules/clipboard-event/platform/clipboard-event-handler-linux

Also, my flavor of ubuntu apparently does not use xclip for clipboard based events so had to run sudo apt install xclip

Anywho, got it running, Just wrote this for reference is case anyone is having a hard time!
Cheers!

Seperate Listeners for cut,copy and paste

Is it possible to create separate Listeners for cut,copy and paste? Something like this

clipboardListener.on('cut', () => { // When text is cut });
clipboardListener.on('copy', () => { // When text is copied });
clipboardListener.on('paste', () => { // When text is pasted });

Detect clipboard content

Is there any way to get the clipboard content like:

const clipboardListener = require('clipboard-event');
clipboardListener.startListening();
clipboardListener.on('change', (content) => {
    console.log('Clipboard changed, content: ' + content);
});
clipboardListener.stopListening();

Provide event with callback

I think it would be nice if the callback would get infos:

clipboardListener.on('change', (e) => {
    console.log('Clipboard changed: ' + e.text);
});

Or rather - I'd need any way to get the clipboard's content after the event triggered.

How do we access changed clipboard data?

Hey bro,
First of all thanks a lot for this amazing module.
Actually I'm working on a clipboard manager and I want to take some action when user copies some text to the clipboard. However, I'm unable to find the detail/implementation that how to access the clipboard data/text in
clipboardListener.on("change", () => {
}

here, there's no parameter for the data.
Please help

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.