Delete pynput from repo
This commit is contained in:
parent
9999e8864e
commit
37dbfcc86d
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -3985,7 +3985,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"widestring 1.0.2",
|
"widestring 1.0.2",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
"x11",
|
"x11 2.20.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -4993,11 +4993,12 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tfc"
|
name = "tfc"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
source = "git+https://github.com/asur4s/The-Fat-Controller#25bfa7ef1cb0bd0b522cc4155dea6b99673bcfd4"
|
source = "git+https://github.com/asur4s/The-Fat-Controller#8ef82be83d8d941f08bdb84e77bea52290f92050"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-graphics 0.22.3",
|
"core-graphics 0.22.3",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
|
"x11 2.19.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5931,6 +5932,15 @@ dependencies = [
|
|||||||
"tap",
|
"tap",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "x11"
|
||||||
|
version = "2.19.0"
|
||||||
|
source = "git+https://github.com/bjornsnoen/x11-rs#c2e9bfaa7b196938f8700245564d8ac5d447786a"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11"
|
name = "x11"
|
||||||
version = "2.20.0"
|
version = "2.20.0"
|
||||||
|
@ -12,9 +12,6 @@ if [ "$1" = configure ]; then
|
|||||||
fi
|
fi
|
||||||
version=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)')
|
version=$(python3 -V 2>&1 | grep -Po '(?<=Python )(.+)')
|
||||||
parsedVersion=$(echo "${version//./}")
|
parsedVersion=$(echo "${version//./}")
|
||||||
if [[ "$parsedVersion" -gt "360" ]]; then
|
|
||||||
sudo -H pip3 install pynput
|
|
||||||
fi
|
|
||||||
cp /usr/share/rustdesk/files/systemd/rustdesk.service /usr/lib/systemd/system/rustdesk.service
|
cp /usr/share/rustdesk/files/systemd/rustdesk.service /usr/lib/systemd/system/rustdesk.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable rustdesk
|
systemctl enable rustdesk
|
||||||
|
1
PKGBUILD
1
PKGBUILD
@ -26,6 +26,5 @@ package() {
|
|||||||
install -Dm 644 ${HBB}/libsciter-gtk.so -t "${pkgdir}/usr/lib/rustdesk"
|
install -Dm 644 ${HBB}/libsciter-gtk.so -t "${pkgdir}/usr/lib/rustdesk"
|
||||||
install -Dm 644 $HBB/rustdesk.service -t "${pkgdir}/usr/share/rustdesk/files"
|
install -Dm 644 $HBB/rustdesk.service -t "${pkgdir}/usr/share/rustdesk/files"
|
||||||
install -Dm 644 $HBB/rustdesk.desktop -t "${pkgdir}/usr/share/rustdesk/files"
|
install -Dm 644 $HBB/rustdesk.desktop -t "${pkgdir}/usr/share/rustdesk/files"
|
||||||
install -Dm 644 $HBB/pynput_service.py -t "${pkgdir}/usr/share/rustdesk/files"
|
|
||||||
install -Dm 644 $HBB/128x128@2x.png "${pkgdir}/usr/share/rustdesk/files/rustdesk.png"
|
install -Dm 644 $HBB/128x128@2x.png "${pkgdir}/usr/share/rustdesk/files/rustdesk.png"
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### pynput package تثبيت
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### vcpkg تثبيت
|
### vcpkg تثبيت
|
||||||
|
|
||||||
|
@ -75,12 +75,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### Instalace balíčku pynput
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### Instalace vcpkg
|
### Instalace vcpkg
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -78,12 +78,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### بسته pynput را نصب کنید
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### نرم افزار vcpkg را نصب کنید
|
### نرم افزار vcpkg را نصب کنید
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -81,12 +81,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### Telepítsd a pynput csomagot
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### Telepítsd a vcpkg-t
|
### Telepítsd a vcpkg-t
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -80,12 +80,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install pynput package
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install vcpkg
|
### Install vcpkg
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -78,12 +78,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install pynput package
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install vcpkg
|
### Install vcpkg
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -82,12 +82,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cách tải về gói hàng pynput
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cách cài vcpkg
|
### Cách cài vcpkg
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -80,12 +80,6 @@ sudo yum -y install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-
|
|||||||
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
sudo pacman -Syu --needed unzip git cmake gcc curl wget yasm nasm zip make pkg-config clang gtk3 xdotool libxcb libxfixes alsa-lib pulseaudio
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install pynput package
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pip3 install pynput
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install vcpkg
|
### Install vcpkg
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -9,8 +9,6 @@ script:
|
|||||||
# Download sciter.so
|
# Download sciter.so
|
||||||
- mkdir -p AppDir/usr/lib/rustdesk/
|
- mkdir -p AppDir/usr/lib/rustdesk/
|
||||||
- pushd AppDir/usr/lib/rustdesk && wget https://github.com/c-smile/sciter-sdk/raw/29a598b6d20220b93848b5e8abab704619296857/bin.lnx/x64/libsciter-gtk.so && popd
|
- pushd AppDir/usr/lib/rustdesk && wget https://github.com/c-smile/sciter-sdk/raw/29a598b6d20220b93848b5e8abab704619296857/bin.lnx/x64/libsciter-gtk.so && popd
|
||||||
# pynput_service.py
|
|
||||||
- cp ../pynput_service.py ./AppDir/usr/lib/rustdesk
|
|
||||||
# Build rustdesk
|
# Build rustdesk
|
||||||
- pushd .. && python3 inline-sciter.py && cargo build --features inline,appimage --release && popd
|
- pushd .. && python3 inline-sciter.py && cargo build --features inline,appimage --release && popd
|
||||||
- mkdir -p AppDir/usr/bin
|
- mkdir -p AppDir/usr/bin
|
||||||
|
@ -1 +0,0 @@
|
|||||||
pynput
|
|
6
build.py
6
build.py
@ -140,8 +140,6 @@ def build_flutter_deb(version):
|
|||||||
'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
|
'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
|
||||||
os.system(
|
os.system(
|
||||||
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
|
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
|
||||||
os.system(
|
|
||||||
'cp ../pynput_service.py tmpdeb/usr/share/rustdesk/files/')
|
|
||||||
os.system(
|
os.system(
|
||||||
'cp ../128x128@2x.png tmpdeb/usr/share/rustdesk/files/rustdesk.png')
|
'cp ../128x128@2x.png tmpdeb/usr/share/rustdesk/files/rustdesk.png')
|
||||||
os.system(
|
os.system(
|
||||||
@ -150,7 +148,6 @@ def build_flutter_deb(version):
|
|||||||
os.system('cp -a ../DEBIAN/* tmpdeb/DEBIAN/')
|
os.system('cp -a ../DEBIAN/* tmpdeb/DEBIAN/')
|
||||||
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service')
|
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service')
|
||||||
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user')
|
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user')
|
||||||
md5_file('usr/share/rustdesk/files/pynput_service.py')
|
|
||||||
os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/')
|
os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/')
|
||||||
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
|
os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
@ -285,15 +282,12 @@ def main():
|
|||||||
'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
|
'cp rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/')
|
||||||
os.system(
|
os.system(
|
||||||
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
|
'cp rustdesk.service.user tmpdeb/usr/share/rustdesk/files/systemd/')
|
||||||
os.system(
|
|
||||||
'cp pynput_service.py tmpdeb/usr/share/rustdesk/files/')
|
|
||||||
os.system('cp -a DEBIAN/* tmpdeb/DEBIAN/')
|
os.system('cp -a DEBIAN/* tmpdeb/DEBIAN/')
|
||||||
os.system('strip tmpdeb/usr/bin/rustdesk')
|
os.system('strip tmpdeb/usr/bin/rustdesk')
|
||||||
os.system('mkdir -p tmpdeb/usr/lib/rustdesk')
|
os.system('mkdir -p tmpdeb/usr/lib/rustdesk')
|
||||||
os.system('cp libsciter-gtk.so tmpdeb/usr/lib/rustdesk/')
|
os.system('cp libsciter-gtk.so tmpdeb/usr/lib/rustdesk/')
|
||||||
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service')
|
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service')
|
||||||
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user')
|
md5_file('usr/share/rustdesk/files/systemd/rustdesk.service.user')
|
||||||
md5_file('usr/share/rustdesk/files/pynput_service.py')
|
|
||||||
md5_file('usr/lib/rustdesk/libsciter-gtk.so')
|
md5_file('usr/lib/rustdesk/libsciter-gtk.so')
|
||||||
os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/')
|
os.system('dpkg-deb -b tmpdeb rustdesk.deb; /bin/rm -rf tmpdeb/')
|
||||||
os.rename('rustdesk.deb', 'rustdesk-%s.deb' % version)
|
os.rename('rustdesk.deb', 'rustdesk-%s.deb' % version)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
mod nix_impl;
|
mod nix_impl;
|
||||||
mod pynput;
|
|
||||||
mod xdo;
|
mod xdo;
|
||||||
|
|
||||||
pub use self::nix_impl::Enigo;
|
pub use self::nix_impl::Enigo;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
use super::{pynput::EnigoPynput, xdo::EnigoXdo};
|
use super::{xdo::EnigoXdo};
|
||||||
use crate::{Key, KeyboardControllable, MouseButton, MouseControllable};
|
use crate::{Key, KeyboardControllable, MouseButton, MouseControllable};
|
||||||
|
|
||||||
/// The main struct for handling the event emitting
|
/// The main struct for handling the event emitting
|
||||||
// #[derive(Default)]
|
// #[derive(Default)]
|
||||||
pub struct Enigo {
|
pub struct Enigo {
|
||||||
xdo: EnigoXdo,
|
xdo: EnigoXdo,
|
||||||
pynput: EnigoPynput,
|
|
||||||
is_x11: bool,
|
is_x11: bool,
|
||||||
uinput_keyboard: Option<Box<dyn KeyboardControllable + Send>>,
|
uinput_keyboard: Option<Box<dyn KeyboardControllable + Send>>,
|
||||||
uinput_mouse: Option<Box<dyn MouseControllable + Send>>,
|
uinput_mouse: Option<Box<dyn MouseControllable + Send>>,
|
||||||
@ -20,9 +19,9 @@ impl Enigo {
|
|||||||
pub fn set_delay(&mut self, delay: u64) {
|
pub fn set_delay(&mut self, delay: u64) {
|
||||||
self.xdo.set_delay(delay)
|
self.xdo.set_delay(delay)
|
||||||
}
|
}
|
||||||
/// Reset pynput.
|
/// Reset pynput?.
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.pynput.reset();
|
todo!()
|
||||||
}
|
}
|
||||||
/// Set uinput keyboard.
|
/// Set uinput keyboard.
|
||||||
pub fn set_uinput_keyboard(
|
pub fn set_uinput_keyboard(
|
||||||
@ -44,7 +43,6 @@ impl Default for Enigo {
|
|||||||
uinput_keyboard: None,
|
uinput_keyboard: None,
|
||||||
uinput_mouse: None,
|
uinput_mouse: None,
|
||||||
xdo: EnigoXdo::default(),
|
xdo: EnigoXdo::default(),
|
||||||
pynput: EnigoPynput::default(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,9 +140,6 @@ impl KeyboardControllable for Enigo {
|
|||||||
|
|
||||||
fn key_down(&mut self, key: Key) -> crate::ResultType {
|
fn key_down(&mut self, key: Key) -> crate::ResultType {
|
||||||
if self.is_x11 {
|
if self.is_x11 {
|
||||||
if self.pynput.send_pynput(&key, true) {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
self.xdo.key_down(key)
|
self.xdo.key_down(key)
|
||||||
} else {
|
} else {
|
||||||
if let Some(keyboard) = &mut self.uinput_keyboard {
|
if let Some(keyboard) = &mut self.uinput_keyboard {
|
||||||
@ -156,9 +151,6 @@ impl KeyboardControllable for Enigo {
|
|||||||
}
|
}
|
||||||
fn key_up(&mut self, key: Key) {
|
fn key_up(&mut self, key: Key) {
|
||||||
if self.is_x11 {
|
if self.is_x11 {
|
||||||
if self.pynput.send_pynput(&key, false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
self.xdo.key_up(key)
|
self.xdo.key_up(key)
|
||||||
} else {
|
} else {
|
||||||
if let Some(keyboard) = &mut self.uinput_keyboard {
|
if let Some(keyboard) = &mut self.uinput_keyboard {
|
||||||
|
@ -1,279 +0,0 @@
|
|||||||
use crate::Key;
|
|
||||||
use std::{io::prelude::*, sync::mpsc};
|
|
||||||
|
|
||||||
enum PyMsg {
|
|
||||||
Char(char),
|
|
||||||
Str(&'static str),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The main struct for handling the event emitting
|
|
||||||
pub(super) struct EnigoPynput {
|
|
||||||
tx: mpsc::Sender<(PyMsg, bool)>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for EnigoPynput {
|
|
||||||
fn default() -> Self {
|
|
||||||
let (tx, rx) = mpsc::channel();
|
|
||||||
start_pynput_service(rx);
|
|
||||||
Self { tx }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl EnigoPynput {
|
|
||||||
pub(super) fn reset(&mut self) {
|
|
||||||
self.tx.send((PyMsg::Char('\0'), true)).ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub(super) fn send_pynput(&mut self, key: &Key, is_press: bool) -> bool {
|
|
||||||
if unsafe { PYNPUT_EXIT || !PYNPUT_REDAY } {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if let Key::Layout(c) = key {
|
|
||||||
return self.tx.send((PyMsg::Char(*c), is_press)).is_ok();
|
|
||||||
}
|
|
||||||
if let Key::Raw(_) = key {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#[allow(deprecated)]
|
|
||||||
let s = match key {
|
|
||||||
Key::Alt => "Alt_L",
|
|
||||||
Key::Backspace => "BackSpace",
|
|
||||||
Key::CapsLock => "Caps_Lock",
|
|
||||||
Key::Control => "Control_L",
|
|
||||||
Key::Delete => "Delete",
|
|
||||||
Key::DownArrow => "Down",
|
|
||||||
Key::End => "End",
|
|
||||||
Key::Escape => "Escape",
|
|
||||||
Key::F1 => "F1",
|
|
||||||
Key::F10 => "F10",
|
|
||||||
Key::F11 => "F11",
|
|
||||||
Key::F12 => "F12",
|
|
||||||
Key::F2 => "F2",
|
|
||||||
Key::F3 => "F3",
|
|
||||||
Key::F4 => "F4",
|
|
||||||
Key::F5 => "F5",
|
|
||||||
Key::F6 => "F6",
|
|
||||||
Key::F7 => "F7",
|
|
||||||
Key::F8 => "F8",
|
|
||||||
Key::F9 => "F9",
|
|
||||||
Key::Home => "Home",
|
|
||||||
Key::LeftArrow => "Left",
|
|
||||||
Key::Option => "Option",
|
|
||||||
Key::PageDown => "Page_Down",
|
|
||||||
Key::PageUp => "Page_Up",
|
|
||||||
Key::Return => "Return",
|
|
||||||
Key::RightArrow => "Right",
|
|
||||||
Key::Shift => "Shift_L",
|
|
||||||
Key::Space => "space",
|
|
||||||
Key::Tab => "Tab",
|
|
||||||
Key::UpArrow => "Up",
|
|
||||||
Key::Numpad0 => "KP_0",
|
|
||||||
Key::Numpad1 => "KP_1",
|
|
||||||
Key::Numpad2 => "KP_2",
|
|
||||||
Key::Numpad3 => "KP_3",
|
|
||||||
Key::Numpad4 => "KP_4",
|
|
||||||
Key::Numpad5 => "KP_5",
|
|
||||||
Key::Numpad6 => "KP_6",
|
|
||||||
Key::Numpad7 => "KP_7",
|
|
||||||
Key::Numpad8 => "KP_8",
|
|
||||||
Key::Numpad9 => "KP_9",
|
|
||||||
Key::Decimal => "KP_Decimal",
|
|
||||||
Key::Cancel => "Cancel",
|
|
||||||
Key::Clear => "Clear",
|
|
||||||
Key::Pause => "Pause",
|
|
||||||
Key::Kana => "Kana",
|
|
||||||
Key::Hangul => "Hangul",
|
|
||||||
Key::Hanja => "Hanja",
|
|
||||||
Key::Kanji => "Kanji",
|
|
||||||
Key::Select => "Select",
|
|
||||||
Key::Print => "Print",
|
|
||||||
Key::Execute => "Execute",
|
|
||||||
Key::Snapshot => "3270_PrintScreen",
|
|
||||||
Key::Insert => "Insert",
|
|
||||||
Key::Help => "Help",
|
|
||||||
Key::Separator => "KP_Separator",
|
|
||||||
Key::Scroll => "Scroll_Lock",
|
|
||||||
Key::NumLock => "Num_Lock",
|
|
||||||
Key::RWin => "Super_R",
|
|
||||||
Key::Apps => "Menu",
|
|
||||||
Key::Multiply => "KP_Multiply",
|
|
||||||
Key::Add => "KP_Add",
|
|
||||||
Key::Subtract => "KP_Subtract",
|
|
||||||
Key::Divide => "KP_Divide",
|
|
||||||
Key::Equals => "KP_Equal",
|
|
||||||
Key::NumpadEnter => "KP_Enter",
|
|
||||||
Key::RightShift => "Shift_R",
|
|
||||||
Key::RightControl => "Control_R",
|
|
||||||
Key::RightAlt => "Mode_switch",
|
|
||||||
Key::Command | Key::Super | Key::Windows | Key::Meta => "Super_L",
|
|
||||||
_ => {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return self.tx.send((PyMsg::Str(s), is_press)).is_ok();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// impl MouseControllable for EnigoPynput {
|
|
||||||
// fn mouse_move_to(&mut self, _x: i32, _y: i32) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn mouse_move_relative(&mut self, _x: i32, _y: i32) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn mouse_down(&mut self, _button: MouseButton) -> crate::ResultType {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn mouse_up(&mut self, _button: MouseButton) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn mouse_click(&mut self, _button: MouseButton) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn mouse_scroll_x(&mut self, _length: i32) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn mouse_scroll_y(&mut self, _length: i32) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// impl KeyboardControllable for EnigoPynput {
|
|
||||||
// fn get_key_state(&mut self, _key: Key) -> bool {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn key_sequence(&mut self, _sequence: &str) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// fn key_down(&mut self, key: Key) -> crate::ResultType {
|
|
||||||
// let _ = self.send_pynput(&key, true);
|
|
||||||
// Ok(())
|
|
||||||
// }
|
|
||||||
// fn key_up(&mut self, key: Key) {
|
|
||||||
// let _ = self.send_pynput(&key, false);
|
|
||||||
// }
|
|
||||||
// fn key_click(&mut self, _key: Key) {
|
|
||||||
// unimplemented!()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
static mut PYNPUT_EXIT: bool = false;
|
|
||||||
static mut PYNPUT_REDAY: bool = false;
|
|
||||||
static IPC_FILE: &'static str = "/tmp/RustDesk/pynput_service";
|
|
||||||
|
|
||||||
fn start_pynput_service(rx: mpsc::Receiver<(PyMsg, bool)>) {
|
|
||||||
let mut py = "./pynput_service.py".to_owned();
|
|
||||||
if !std::path::Path::new(&py).exists() {
|
|
||||||
py = "/usr/share/rustdesk/files/pynput_service.py".to_owned();
|
|
||||||
if !std::path::Path::new(&py).exists() {
|
|
||||||
py = "/usr/lib/rustdesk/pynput_service.py".to_owned();
|
|
||||||
if !std::path::Path::new(&py).exists() {
|
|
||||||
log::error!("{} not exits", py);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log::info!("pynput service: {}", py);
|
|
||||||
std::thread::spawn(move || {
|
|
||||||
let username = std::env::var("PYNPUT_USERNAME").unwrap_or("".to_owned());
|
|
||||||
let userid = std::env::var("PYNPUT_USERID").unwrap_or("".to_owned());
|
|
||||||
let status = if username.is_empty() {
|
|
||||||
std::process::Command::new("python3")
|
|
||||||
.arg(&py)
|
|
||||||
.arg(IPC_FILE)
|
|
||||||
.status()
|
|
||||||
.map(|x| x.success())
|
|
||||||
} else {
|
|
||||||
let mut status = Ok(true);
|
|
||||||
for i in 0..100 {
|
|
||||||
if i % 10 == 0 {
|
|
||||||
log::info!("#{} try to start pynput server", i);
|
|
||||||
}
|
|
||||||
status = std::process::Command::new("sudo")
|
|
||||||
.args(vec![
|
|
||||||
"-E",
|
|
||||||
&format!("XDG_RUNTIME_DIR=/run/user/{}", userid) as &str,
|
|
||||||
"-u",
|
|
||||||
&username,
|
|
||||||
"python3",
|
|
||||||
&py,
|
|
||||||
IPC_FILE,
|
|
||||||
])
|
|
||||||
.status()
|
|
||||||
.map(|x| x.success());
|
|
||||||
match status {
|
|
||||||
Ok(true) => break,
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
|
||||||
}
|
|
||||||
status
|
|
||||||
};
|
|
||||||
log::info!(
|
|
||||||
"pynput server exit with username/id {}/{}: {:?}",
|
|
||||||
username,
|
|
||||||
userid,
|
|
||||||
status
|
|
||||||
);
|
|
||||||
unsafe {
|
|
||||||
PYNPUT_EXIT = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
std::thread::spawn(move || {
|
|
||||||
for i in 0..300 {
|
|
||||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
|
||||||
let mut conn = match std::os::unix::net::UnixStream::connect(IPC_FILE) {
|
|
||||||
Ok(conn) => conn,
|
|
||||||
Err(err) => {
|
|
||||||
if i % 15 == 0 {
|
|
||||||
log::warn!("Failed to connect to {}: {}", IPC_FILE, err);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if let Err(err) = conn.set_nonblocking(true) {
|
|
||||||
log::error!("Failed to set ipc nonblocking: {}", err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
log::info!("Conntected to pynput server");
|
|
||||||
let d = std::time::Duration::from_millis(30);
|
|
||||||
unsafe {
|
|
||||||
PYNPUT_REDAY = true;
|
|
||||||
}
|
|
||||||
let mut buf = [0u8; 1024];
|
|
||||||
loop {
|
|
||||||
if unsafe { PYNPUT_EXIT } {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
match rx.recv_timeout(d) {
|
|
||||||
Ok((msg, is_press)) => {
|
|
||||||
let msg = match msg {
|
|
||||||
PyMsg::Char(chr) => {
|
|
||||||
format!("{}{}", if is_press { 'p' } else { 'r' }, chr)
|
|
||||||
}
|
|
||||||
PyMsg::Str(s) => format!("{}{}", if is_press { 'p' } else { 'r' }, s),
|
|
||||||
};
|
|
||||||
let n = msg.len();
|
|
||||||
buf[0] = n as _;
|
|
||||||
buf[1..(n + 1)].copy_from_slice(msg.as_bytes());
|
|
||||||
if let Err(err) = conn.write_all(&buf[..n + 1]) {
|
|
||||||
log::error!("Failed to write to ipc: {}", err);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(err) => match err {
|
|
||||||
mpsc::RecvTimeoutError::Disconnected => {
|
|
||||||
log::error!("pynput sender disconnecte");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unsafe {
|
|
||||||
PYNPUT_REDAY = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
@ -7,7 +7,7 @@ post_install() {
|
|||||||
# do something here
|
# do something here
|
||||||
cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service
|
cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service
|
||||||
cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/
|
cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/
|
||||||
sudo -H pip3 install pynput
|
sudo -H pip3 install
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable rustdesk
|
systemctl enable rustdesk
|
||||||
systemctl start rustdesk
|
systemctl start rustdesk
|
||||||
|
@ -1,240 +0,0 @@
|
|||||||
from pynput.keyboard import Key, Controller
|
|
||||||
from pynput.keyboard._xorg import KeyCode
|
|
||||||
from pynput._util.xorg import display_manager
|
|
||||||
import Xlib
|
|
||||||
from pynput._util.xorg import *
|
|
||||||
import Xlib
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import socket
|
|
||||||
|
|
||||||
KeyCode._from_symbol("\0") # test
|
|
||||||
|
|
||||||
DEAD_KEYS = {
|
|
||||||
'`': 65104,
|
|
||||||
'´': 65105,
|
|
||||||
'^': 65106,
|
|
||||||
'~': 65107,
|
|
||||||
'¯': 65108,
|
|
||||||
'˘': 65109,
|
|
||||||
'˙': 65110,
|
|
||||||
'¨': 65111,
|
|
||||||
'˚': 65112,
|
|
||||||
'˝': 65113,
|
|
||||||
'ˇ': 65114,
|
|
||||||
'¸': 65115,
|
|
||||||
'˛': 65116,
|
|
||||||
'℩': 65117, # ?
|
|
||||||
'゛': 65118, # ?
|
|
||||||
'゚ ': 65119,
|
|
||||||
'ٜ': 65120,
|
|
||||||
'↪': 65121,
|
|
||||||
' ̛': 65122,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def my_keyboard_mapping(display):
|
|
||||||
"""Generates a mapping from *keysyms* to *key codes* and required
|
|
||||||
modifier shift states.
|
|
||||||
|
|
||||||
:param Xlib.display.Display display: The display for which to retrieve the
|
|
||||||
keyboard mapping.
|
|
||||||
|
|
||||||
:return: the keyboard mapping
|
|
||||||
"""
|
|
||||||
mapping = {}
|
|
||||||
|
|
||||||
shift_mask = 1 << 0
|
|
||||||
group_mask = alt_gr_mask(display)
|
|
||||||
|
|
||||||
# Iterate over all keysym lists in the keyboard mapping
|
|
||||||
min_keycode = display.display.info.min_keycode
|
|
||||||
keycode_count = display.display.info.max_keycode - min_keycode + 1
|
|
||||||
for index, keysyms in enumerate(display.get_keyboard_mapping(
|
|
||||||
min_keycode, keycode_count)):
|
|
||||||
key_code = index + min_keycode
|
|
||||||
|
|
||||||
# Normalise the keysym list to yield a tuple containing the two groups
|
|
||||||
normalized = keysym_normalize(keysyms)
|
|
||||||
if not normalized:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Iterate over the groups to extract the shift and modifier state
|
|
||||||
for groups, group in zip(normalized, (False, True)):
|
|
||||||
for keysym, shift in zip(groups, (False, True)):
|
|
||||||
|
|
||||||
if not keysym:
|
|
||||||
continue
|
|
||||||
shift_state = 0 \
|
|
||||||
| (shift_mask if shift else 0) \
|
|
||||||
| (group_mask if group else 0)
|
|
||||||
|
|
||||||
# !!!: Save all keycode combinations of keysym
|
|
||||||
if keysym in mapping:
|
|
||||||
mapping[keysym].append((key_code, shift_state))
|
|
||||||
else:
|
|
||||||
mapping[keysym] = [(key_code, shift_state)]
|
|
||||||
return mapping
|
|
||||||
|
|
||||||
|
|
||||||
class MyController(Controller):
|
|
||||||
def _update_keyboard_mapping(self):
|
|
||||||
"""Updates the keyboard mapping.
|
|
||||||
"""
|
|
||||||
with display_manager(self._display) as dm:
|
|
||||||
self._keyboard_mapping = my_keyboard_mapping(dm)
|
|
||||||
|
|
||||||
def send_event(self, event, keycode, shift_state):
|
|
||||||
with display_manager(self._display) as dm, self.modifiers as modifiers:
|
|
||||||
# Under certain cimcumstances, such as when running under Xephyr,
|
|
||||||
# the value returned by dm.get_input_focus is an int
|
|
||||||
window = dm.get_input_focus().focus
|
|
||||||
send_event = getattr(
|
|
||||||
window,
|
|
||||||
'send_event',
|
|
||||||
lambda event: dm.send_event(window, event))
|
|
||||||
send_event(event(
|
|
||||||
detail=keycode,
|
|
||||||
state=shift_state | self._shift_mask(modifiers),
|
|
||||||
time=0,
|
|
||||||
root=dm.screen().root,
|
|
||||||
window=window,
|
|
||||||
same_screen=0,
|
|
||||||
child=Xlib.X.NONE,
|
|
||||||
root_x=0, root_y=0, event_x=0, event_y=0))
|
|
||||||
|
|
||||||
def fake_input(self, keycode, is_press):
|
|
||||||
with display_manager(self._display) as dm:
|
|
||||||
Xlib.ext.xtest.fake_input(
|
|
||||||
dm,
|
|
||||||
Xlib.X.KeyPress if is_press else Xlib.X.KeyRelease,
|
|
||||||
keycode)
|
|
||||||
|
|
||||||
def _handle(self, key, is_press):
|
|
||||||
"""Resolves a key identifier and sends a keyboard event.
|
|
||||||
:param event: The *X* keyboard event.
|
|
||||||
:param int keysym: The keysym to handle.
|
|
||||||
"""
|
|
||||||
event = Xlib.display.event.KeyPress if is_press \
|
|
||||||
else Xlib.display.event.KeyRelease
|
|
||||||
keysym = self._keysym(key)
|
|
||||||
|
|
||||||
if key.vk is not None:
|
|
||||||
keycode = self._display.keysym_to_keycode(key.vk)
|
|
||||||
self.fake_input(keycode, is_press)
|
|
||||||
# Otherwise use XSendEvent; we need to use this in the general case to
|
|
||||||
# work around problems with keyboard layouts
|
|
||||||
self._emit('_on_fake_event', key, is_press)
|
|
||||||
return
|
|
||||||
|
|
||||||
# Make sure to verify that the key was resolved
|
|
||||||
if keysym is None:
|
|
||||||
raise self.InvalidKeyException(key)
|
|
||||||
|
|
||||||
# There may be multiple keycodes for keysym in keyboard_mapping
|
|
||||||
keycode_flag = len(self.keyboard_mapping[keysym]) == 1
|
|
||||||
if keycode_flag:
|
|
||||||
keycode, shift_state = self.keyboard_mapping[keysym][0]
|
|
||||||
else:
|
|
||||||
keycode, shift_state = self._display.keysym_to_keycode(keysym), 0
|
|
||||||
|
|
||||||
keycode_set = set(map(lambda x: x[0], self.keyboard_mapping[keysym]))
|
|
||||||
# The keycode of the dead key is inconsistent, The keysym has multiple combinations of a keycode.
|
|
||||||
if keycode != self._display.keysym_to_keycode(keysym) \
|
|
||||||
or (keycode_flag == False and keycode == list(keycode_set)[0] and len(keycode_set) == 1):
|
|
||||||
deakkey_chr = str(key).replace("'", '')
|
|
||||||
keysym = DEAD_KEYS[deakkey_chr]
|
|
||||||
# shift_state = 0
|
|
||||||
keycode, shift_state = list(
|
|
||||||
filter(lambda x: x[1] == 0,
|
|
||||||
self.keyboard_mapping[keysym])
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
# If the key has a virtual key code, use that immediately with
|
|
||||||
# fake_input; fake input,being an X server extension, has access to
|
|
||||||
# more internal state that we do
|
|
||||||
|
|
||||||
try:
|
|
||||||
with self.modifiers as modifiers:
|
|
||||||
alt_gr = Key.alt_gr in modifiers
|
|
||||||
# !!!: Send_event can't support lock screen, this condition cann't be modified
|
|
||||||
if alt_gr:
|
|
||||||
self.send_event(
|
|
||||||
event, keycode, shift_state)
|
|
||||||
else:
|
|
||||||
self.fake_input(keycode, is_press)
|
|
||||||
except KeyError:
|
|
||||||
with self._borrow_lock:
|
|
||||||
keycode, index, count = self._borrows[keysym]
|
|
||||||
self._send_key(
|
|
||||||
event,
|
|
||||||
keycode,
|
|
||||||
index_to_shift(self._display, index))
|
|
||||||
count += 1 if is_press else -1
|
|
||||||
self._borrows[keysym] = (keycode, index, count)
|
|
||||||
|
|
||||||
# Notify any running listeners
|
|
||||||
self._emit('_on_fake_event', key, is_press)
|
|
||||||
|
|
||||||
|
|
||||||
keyboard = MyController()
|
|
||||||
|
|
||||||
server_address = sys.argv[1]
|
|
||||||
if not os.path.exists(os.path.dirname(server_address)):
|
|
||||||
os.makedirs(os.path.dirname(server_address))
|
|
||||||
|
|
||||||
try:
|
|
||||||
os.unlink(server_address)
|
|
||||||
except OSError:
|
|
||||||
if os.path.exists(server_address):
|
|
||||||
raise
|
|
||||||
|
|
||||||
server = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
||||||
server.bind(server_address)
|
|
||||||
server.listen(1)
|
|
||||||
clientsocket, address = server.accept()
|
|
||||||
os.system('chmod a+rw %s' % server_address)
|
|
||||||
print("Got pynput connection")
|
|
||||||
|
|
||||||
|
|
||||||
def loop():
|
|
||||||
global keyboard
|
|
||||||
buf = []
|
|
||||||
while True:
|
|
||||||
data = clientsocket.recv(1024)
|
|
||||||
if not data:
|
|
||||||
print("Connection broken")
|
|
||||||
break
|
|
||||||
buf.extend(data)
|
|
||||||
while buf:
|
|
||||||
n = buf[0]
|
|
||||||
n = n + 1
|
|
||||||
if len(buf) < n:
|
|
||||||
break
|
|
||||||
msg = bytearray(buf[1:n]).decode("utf-8")
|
|
||||||
buf = buf[n:]
|
|
||||||
if len(msg) < 2:
|
|
||||||
continue
|
|
||||||
if msg[1] == "\0":
|
|
||||||
keyboard = MyController()
|
|
||||||
print("Keyboard reset")
|
|
||||||
continue
|
|
||||||
if len(msg) == 2:
|
|
||||||
name = msg[1]
|
|
||||||
else:
|
|
||||||
name = KeyCode._from_symbol(msg[1:])
|
|
||||||
if str(name) == "<0>":
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
if msg[0] == "p":
|
|
||||||
keyboard.press(name)
|
|
||||||
else:
|
|
||||||
keyboard.release(name)
|
|
||||||
except Exception as e:
|
|
||||||
print('[x] error key',e)
|
|
||||||
|
|
||||||
|
|
||||||
loop()
|
|
||||||
clientsocket.close()
|
|
||||||
server.close()
|
|
@ -25,7 +25,6 @@ install $HBB/libsciter-gtk.so %{buildroot}/usr/lib/rustdesk/libsciter-gtk.so
|
|||||||
install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/
|
install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/
|
||||||
install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
|
install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
|
||||||
install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/
|
install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/
|
||||||
install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
/usr/bin/rustdesk
|
/usr/bin/rustdesk
|
||||||
@ -33,7 +32,6 @@ install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/
|
|||||||
/usr/share/rustdesk/files/rustdesk.service
|
/usr/share/rustdesk/files/rustdesk.service
|
||||||
/usr/share/rustdesk/files/rustdesk.png
|
/usr/share/rustdesk/files/rustdesk.png
|
||||||
/usr/share/rustdesk/files/rustdesk.desktop
|
/usr/share/rustdesk/files/rustdesk.desktop
|
||||||
/usr/share/rustdesk/files/pynput_service.py
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
# let's skip this for now
|
# let's skip this for now
|
||||||
@ -54,7 +52,6 @@ esac
|
|||||||
%post
|
%post
|
||||||
cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service
|
cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service
|
||||||
cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/
|
cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/
|
||||||
sudo -H pip3 install pynput
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable rustdesk
|
systemctl enable rustdesk
|
||||||
systemctl start rustdesk
|
systemctl start rustdesk
|
||||||
|
3
rpm.spec
3
rpm.spec
@ -25,7 +25,6 @@ install $HBB/libsciter-gtk.so %{buildroot}/usr/lib/rustdesk/libsciter-gtk.so
|
|||||||
install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/
|
install $HBB/rustdesk.service %{buildroot}/usr/share/rustdesk/files/
|
||||||
install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
|
install $HBB/128x128@2x.png %{buildroot}/usr/share/rustdesk/files/rustdesk.png
|
||||||
install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/
|
install $HBB/rustdesk.desktop %{buildroot}/usr/share/rustdesk/files/
|
||||||
install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
/usr/bin/rustdesk
|
/usr/bin/rustdesk
|
||||||
@ -33,7 +32,6 @@ install $HBB/pynput_service.py %{buildroot}/usr/share/rustdesk/files/
|
|||||||
/usr/share/rustdesk/files/rustdesk.service
|
/usr/share/rustdesk/files/rustdesk.service
|
||||||
/usr/share/rustdesk/files/rustdesk.png
|
/usr/share/rustdesk/files/rustdesk.png
|
||||||
/usr/share/rustdesk/files/rustdesk.desktop
|
/usr/share/rustdesk/files/rustdesk.desktop
|
||||||
/usr/share/rustdesk/files/pynput_service.py
|
|
||||||
/usr/share/rustdesk/files/__pycache__/*
|
/usr/share/rustdesk/files/__pycache__/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
@ -55,7 +53,6 @@ esac
|
|||||||
%post
|
%post
|
||||||
cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service
|
cp /usr/share/rustdesk/files/rustdesk.service /etc/systemd/system/rustdesk.service
|
||||||
cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/
|
cp /usr/share/rustdesk/files/rustdesk.desktop /usr/share/applications/
|
||||||
sudo -H pip3 install pynput
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable rustdesk
|
systemctl enable rustdesk
|
||||||
systemctl start rustdesk
|
systemctl start rustdesk
|
||||||
|
@ -108,13 +108,7 @@ parts:
|
|||||||
plugin: nil
|
plugin: nil
|
||||||
override-pull: |
|
override-pull: |
|
||||||
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/
|
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/
|
||||||
cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/pynput_service.py ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/
|
|
||||||
cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/rustdesk.service ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/
|
cp ${SNAPCRAFT_PART_SRC}/../../rustdesk/src/rustdesk.service ${SNAPCRAFT_PART_INSTALL}/usr/share/rustdesk/files/systemd/
|
||||||
|
|
||||||
python3-deps:
|
|
||||||
plugin: python
|
|
||||||
python-packages:
|
|
||||||
- pynput == 1.7.6
|
|
||||||
|
|
||||||
layout:
|
layout:
|
||||||
/usr/share/rustdesk:
|
/usr/share/rustdesk:
|
||||||
|
@ -226,7 +226,6 @@ impl Session {
|
|||||||
pub fn send_key_event(&self, mut evt: KeyEvent, keyboard_mode: KeyboardMode) {
|
pub fn send_key_event(&self, mut evt: KeyEvent, keyboard_mode: KeyboardMode) {
|
||||||
// mode: legacy(0), map(1), translate(2), auto(3)
|
// mode: legacy(0), map(1), translate(2), auto(3)
|
||||||
evt.mode = keyboard_mode.into();
|
evt.mode = keyboard_mode.into();
|
||||||
dbg!(&evt);
|
|
||||||
let mut msg_out = Message::new();
|
let mut msg_out = Message::new();
|
||||||
msg_out.set_key_event(evt);
|
msg_out.set_key_event(evt);
|
||||||
self.send(Data::Message(msg_out));
|
self.send(Data::Message(msg_out));
|
||||||
|
@ -169,13 +169,6 @@ fn run_cursor(sp: MouseCursorService, state: &mut StateCursor) -> ResultType<()>
|
|||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref ENIGO: Arc<Mutex<Enigo>> = {
|
static ref ENIGO: Arc<Mutex<Enigo>> = {
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
{
|
|
||||||
if crate::platform::is_root() {
|
|
||||||
std::env::set_var("PYNPUT_USERNAME", crate::platform::linux::get_active_username());
|
|
||||||
std::env::set_var("PYNPUT_USERID", crate::platform::linux::get_active_userid());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Arc::new(Mutex::new(Enigo::new()))
|
Arc::new(Mutex::new(Enigo::new()))
|
||||||
};
|
};
|
||||||
static ref KEYS_DOWN: Arc<Mutex<HashMap<u64, Instant>>> = Default::default();
|
static ref KEYS_DOWN: Arc<Mutex<HashMap<u64, Instant>>> = Default::default();
|
||||||
@ -680,7 +673,6 @@ fn map_keyboard_mode(evt: &KeyEvent) {
|
|||||||
|
|
||||||
fn tfc_key_down_or_up(key: Key, down: bool, up: bool) {
|
fn tfc_key_down_or_up(key: Key, down: bool, up: bool) {
|
||||||
if let Key::Layout(chr) = key {
|
if let Key::Layout(chr) = key {
|
||||||
log::info!("tfc_key_down_or_up: {:?}", chr);
|
|
||||||
if down {
|
if down {
|
||||||
TFC_CONTEXT.lock().unwrap().unicode_char_down(chr);
|
TFC_CONTEXT.lock().unwrap().unicode_char_down(chr);
|
||||||
}
|
}
|
||||||
@ -766,7 +758,6 @@ fn tfc_key_down_or_up(key: Key, down: bool, up: bool) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
log::info!("tfc_key_down_or_up: {:?}", key);
|
|
||||||
if down {
|
if down {
|
||||||
TFC_CONTEXT.lock().unwrap().key_down(key);
|
TFC_CONTEXT.lock().unwrap().key_down(key);
|
||||||
}
|
}
|
||||||
|
@ -1106,8 +1106,6 @@ impl Handler {
|
|||||||
|
|
||||||
if let Some(chars) = chars {
|
if let Some(chars) = chars {
|
||||||
for chr in chars {
|
for chr in chars {
|
||||||
dbg!(chr);
|
|
||||||
|
|
||||||
let mut key_event = KeyEvent::new();
|
let mut key_event = KeyEvent::new();
|
||||||
key_event.set_chr(chr as _);
|
key_event.set_chr(chr as _);
|
||||||
key_event.down = true;
|
key_event.down = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user