Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to paste written words to any program #8

Open
luisiuman1998519 opened this issue Aug 7, 2019 · 7 comments
Open

Unable to paste written words to any program #8

luisiuman1998519 opened this issue Aug 7, 2019 · 7 comments

Comments

@luisiuman1998519
Copy link

Just newly installed Debian 10 and as soon as possible tried to install the Google-Chinese Writing-ime. The program shows up OK, and can recognize my handwriting, but it seems unable to paste any words I had written in it to any program, like firefox, libreoffice.

In config.js , I alter the line use_clipboard: true

I am using Debian 10 with GNOME 3.30.2

Screenshot from 2019-08-08 01-44-47
Screenshot from 2019-08-08 01-45-05

When the focus is on the program, the words just disappear after I pressed the blue button or press Enter on the keyboard. Not sure where the words go.

@Saren-Arterius
Copy link
Owner

Does use_clipboard: false work for you?

@luisiuman1998519
Copy link
Author

No, i switched to true because that didn't work

Do you guys have additional setting or packages installed? The IME has to have focus on it for the blue paste button or my keyboard Enter to respond, and the textbox in my browser firefox will lose its cursor and seems unable for me to type or paste any words

@luisiuman1998519
Copy link
Author

A workaround:
Copying translation to clipboard and paste it.
I can sort of use the program :) I don't think one is intended to use it this way?

Screenshot from 2019-08-09 16-12-22
Screenshot from 2019-08-09 16-12-42

@Saren-Arterius
Copy link
Owner

Will look into this issue for once and for all, if I have time.

@eddstng
Copy link

eddstng commented May 26, 2022

Hello, did you by any chance have time to look into this issue?

@Saren-Arterius
Copy link
Owner

Saren-Arterius commented May 26, 2022

Hi. I don't think this program would work anymore since Google likes to break things very much and unfortunately this program relies on it. Also with the rise of wayland, the touchpad input grabbing and copy-pasting would never work the same way at least without sudo.

However sending ctrl+v by writing into device fd works very well. I have a similar simple input method project using that.

#include <fcntl.h>
#include <linux/input.h>
#include <stdio.h>
#include <unistd.h>

#define EV_PRESSED 1
#define EV_RELEASED 0
#define EV_REPEAT 2

/*
 * Purpose: Stuffs the Linux keyboard buffer with a key and
 * reads it back out of the buffer.
 * All key definitions can be found in input.h file:
 * /usr/src/linux-headers-3.2.0-23/include/linux
 *
 */

int fd = 0;
// char *device = "/dev/input/event4";
char *device = "/dev/input/by-path/platform-i8042-serio-0-event-kbd";

void send_backspace() {
  if ((fd = open(device, O_RDWR)) > 0) {
    struct input_event event;

    // Press a key (stuff the keyboard with a keypress)
    event.type = EV_KEY;
    event.value = EV_PRESSED;
    event.code = KEY_BACKSPACE;
    write(fd, &event, sizeof(struct input_event));

    // Release the key
    event.value = EV_RELEASED;
    event.code = KEY_BACKSPACE;
    write(fd, &event, sizeof(struct input_event));
    close(fd);
  }
}

void send_ctrl_v() {
  if ((fd = open(device, O_RDWR)) > 0) {
    struct input_event event;

    // Press a key (stuff the keyboard with a keypress)
    event.type = EV_KEY;
    event.value = EV_PRESSED;
    event.code = KEY_LEFTCTRL;
    write(fd, &event, sizeof(struct input_event));

    event.type = EV_KEY;
    event.value = EV_PRESSED;
    event.code = KEY_V;
    write(fd, &event, sizeof(struct input_event));

    // Release the key
    event.value = EV_RELEASED;
    event.code = KEY_V;
    write(fd, &event, sizeof(struct input_event));

    // Release the key
    event.value = EV_RELEASED;
    event.code = KEY_LEFTCTRL;
    write(fd, &event, sizeof(struct input_event));
    close(fd);
  }
}

For this project I don't know if I can ever make it work again.

@eddstng
Copy link

eddstng commented May 26, 2022

Thank you for your efforts. I look forward to your future projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants