Giter Club home page Giter Club logo

mouse-actions's Introduction

Mouse actions

mouse_actions_logo.svg Build

mouse_actions allows to execute some commands from mouse events such as:

  • clicks / wheel on the side / corners of the screen,
  • or drawing shapes.

It's a mix between Easystroke and Compiz edge commands.

For instance, you can configure:

  • a click in the top left corner of the screen to go to the first desktop,
  • a middle click on the top side of the screen to play/pause the media,
  • scroll from the left side to increase/decrease the brightness of the screen,
  • scroll from the top-left corner to increase/decrease the volume,
  • draw a T with the mouse right button pressed to open a terminal,
  • draw a G with the mouse right button pressed to open a text editor (gedit),

mouse_actions_logo.gif

The GUI to configure the application :

Mouse Action Configuration Editor

Features

Bind command execution with mouse button/wheel events (this conditions bellow are optional):

  • Shape drawing with the mouse (like Easystroke)
  • Press/release only or click (don't propagate the press & release event)
  • With some modifiers : shift/Ctrl/Alt...
  • With screen edge : Top/Left...
  • Auto reload config on changes
  • Very low resource usage
    • Fast shape recognition : ~200µs (0.0002 sec) for a config with 30 shapes
    • Fast event without shape processing : ~30µs (0.00003 sec)
    • CPU : ~7 sec CPU usage per hour (~0.2%)
    • RAM : 5.6 Mo (GUI less version)
  • Works under Wayland but with limitations, see the "Platform compatibility" section below.

Project status

⚠️ Alpha version ⚠️

My feedback on Linux/X11 : after 10 month of daily use (since 15/05/2022) and 300'000 triggers, it's works well and X11 has not crashed (Unlike Easystroke which made X11 crash every day before on my laptop). With my usage, mouse_actions triggers commands about once/twice per minute, and half of which by shape bindings.

Known bugs

  • when a device (like mouse or bluetooth earphone) is added, the mouse/keyboard modifier are locked : if Ctrl is pressed during this plug, Ctrl keep pressed. A workaround for me is to switch : Ctrl+Alt+F1 & Ctrl+Alt+F7.
  • when a device (like mouse or bluetooth earphone ) is added, the cursor freeze while 2 seconds or the mouse_actions program may crash.

→ a fix (2023-07-07) disable the detection of new devices from rdev → no crash but new devices may not be usable with MA without restarting it

  • On PC suspend, the mouse_actions program may crash
  • On wayland, the gesture button event is not propagated if there are no detected gesture #8.

Install / run

Download the release, the 2 release binaries mouse-actions and mouse-actions-gui are standalone (but use the same configuration), the avantage of using GUI less version is the RAM usage : 5.6 Mo vs 34 Mo.

The gui unbundled standalone binary need this packages :

  • Debian/Ubuntu : libwebkit2gtk-4.0-37, libgtk-3-0
  • Arch : webkit2gtk, gtk3
  • Fedora : webkit2gtk3, gtk3

The AppImage and deb releases includes these dependencies.

Release types

  • mouse-actions-gui-vX.X.X.tar.gz (2 MB) : GUI version standalone binary
  • mouse-actions-gui_X.X.X_amd64.AppImage (69 MB) : GUI version AppImage, includes webkit2gtk & gtk3
  • mouse-actions-gui_X.X.X_amd64.deb (2.5 MB) : GUI deb package, includes webkit2gtk & gtk3 ref
  • mouse-actions-vX.X.X.tar.gz (1 MB) : GUI less version standalone binary

Build

  • GUI less version : cargo build --release
  • GUI version : cd config-editor && npm i && npm run tauri-build

Requirement :

To use the main feature "grab event", you need to have the read&write permission on /dev/input/event*. Check the group of /dev/input/event* files :

ls -al /dev/input/event*
# > crw-rw---- 1 root input /dev/input/event5
#                     ^^^^^

You need to add the current user to this group, usually input or plugdev :

sudo usermod -a -G plugdev $USER
# or
sudo usermod -a -G input $USER

Furthermore, you must have the read&write permission on /dev/uinput, you can check with:

getfacl /dev/uinput
# ...
# user:<the current user>:rw-
# ...

If this permission is not available on the user, to add it temporary : sudo setfacl -m u:$USER:rw /dev/uinput or persistent :

sudo tee /etc/udev/rules.d/80-mouse-actions.rules <<<'KERNEL=="uinput", SUBSYSTEM=="misc", TAG+="uaccess", OPTIONS+="static_node=uinput"'

You need to restart your desktop session to apply these changes.

To check the user groups and the ACL after the session restart or the reboot:

$ groups
... input ...
$ getfacl /dev/uinput
# ...
# user:<the current user>:rw-
# ...

⚠️ The changes introduced by this chapter may cause security problems: an application launched with your user can listen to your input events ⚠️

Platform compatibility

I only tested it on Linux + X11 and Linux + Wayland, but it should work on Mac, Windows.

The grab feature from rdev give an inaccurate mouse position, so Mouse_actions used the listen feature from rdev. This function not works on Wayland and the listen feature is used to detect edge of screen click, so this edge actions doesn't works on Wayland (no absolute mouse position).

Wayland

Notes:

  • Edge screen event doesn't work with Wayland.
  • but the mouse shape actions works !
  • #8 Gesture button is 'stolen' on Wayland, this bug should be fixed in the future
  • xdotool doesn't work on Wayland, use ydotool or other alternatives to simulate keyboard event.

Configuration

config editor

Run mouse-actions-gui to edit the configuration.

Configuration file format

The config file default path is ~/.config/mouse-actions.json

Structure

  • shape_button: the mouse button to use to draw shapes : Left | Right | Middle | Side | Extra | Forward | Back | Task | Trigger | Thumb | Thumb2 | WheelUp | WheelDown | Unknown | None

  • bindings : array of binding :

    • cmd_str : command line to exec
    • event: object :
      • button: Left | Right | Middle | Side | Extra | Forward | Back | Task | Trigger | Thumb | Thumb2 | WheelUp | WheelDown | Unknown | None
      • edges: array of : Top,Right,Bottom,Left,
      • event_type: Press | Release| Click
      • modifiers: array of : ShiftLeft, ShiftRight, ControlLeft, ControlRight, MetaLeft, Alt, AltGr
      • shapes_xy: the shapes, array of arrays of coordinates. The best shape match will be used.

CLI usage

Usage: mouse_actions [OPTIONS] [COMMAND]

Commands:
  show-gui        Default command with mouse-actions-gui, show Mouse Actions Config Editor
  start           Default command with mouse-actions, Start mouse_actions bindings
  trace           Trace events
  record          Start record mode to add some mouse bindings
  list-bindings   List the current config bindings
  grab-one-event  Grab one event, print it and exit
  stop            Stop mouse action
  status          Get mouse action status : exit 0 if running
  show-config     print the json config
  set-config      set the json config from stdin
  help            Print this message or the help of the given subcommand(s)

Options:
  -n, --no-listen                  don't run the listen thread (for Wayland), the edge bindings might not work
  -c, --config-path <CONFIG_PATH>  config path, default : ~/.config/mouse-actions.json
  -v, --version                    print version
  -l, --log-level <LOG_LEVEL>      log level : error, warn, info, debug, trace. [default=info]
  -h, --help                       Print help

LOG : RUST_LOG env var & --log-level option

The project use env_logger to log. The log levels : error, warn, info, debug, trace.

RUST_LOG=debug ./mouse_actions or ./mouse_actions --log-level debug output:

[DEBUG] Binding without shape found : Binding { comment: "Middle click in the top left corner → script: key ² → open Tilda", event: ClickEvent { button: Middle, edges: [Left, Top], event_type: Click}, cmd: ["xdotool", "key", "49"] }
[DEBUG] Process event duration : 39.74µs
[INFO ]      → cmd ["xdotool", "key", "49"]
[DEBUG] ----------------------------------------
[DEBUG] angles: 3.14, 3.14, -3.07, -3.07, -3.04, -3.04, -2.96, ...
[DEBUG] find_candidates_with_shape_with_offset duration : 81.714µs
[DEBUG] shape candidates=
[DEBUG]    75.29 %    0.50 : Draw G shape with the right button → launch gedit (text editor)                        ["gedit"]
[DEBUG]    56.13 %    0.66 : Draw S shape with the right button → Ctrl+S key (save)                                 ["xdotool", "key", "ctrl+s"]
[DEBUG]    25.80 %    0.86 : Draw D shape with the right button → Ctrl+Alt+D key (show the window on all desktops)  ["xdotool", "key", "ctrl+alt+d"]
[DEBUG]    11.70 %    0.94 : Draw H shape with the right button → Ctrl+H key (toggle hide)                          ["xdotool", "key", "ctrl+h"]
[DEBUG] Process event duration : 145.143µs
[INFO ]      → cmd ["gedit"]
[DEBUG] ----------------------------------------
[DEBUG] angles: 0.00, 0.13, 0.13, 0.20, 0.15, 0.15, 0.23, 0.23, ... 
[DEBUG] find_candidates_with_shape_with_offset duration : 113.35µs
[DEBUG] shape candidates=
[DEBUG]    84.78 %    0.39 : Draw T shape with the right button → launch the terminal                                        ["gnome-terminal"]
[DEBUG]    49.18 %    0.71 : Draw Z shape with the right button → Ctrl+Z key (undo)                                          ["xdotool", "key", "ctrl+z"]
[DEBUG]    18.31 %    0.90 : Draw ↘ (line to the bottom right) shape with the right button → Alt+F8 key (resize the window)  ["xdotool", "key", "alt+F8"]
[DEBUG]    13.46 %    0.93 : Draw n shape with the right button → launch nemo (file explorer)                                ["nemo"]
[DEBUG] Process event duration : 194.956µs
[INFO ]      → cmd ["gnome-terminal"]

→ 3 events :

  • Middle click in the top left corner
  • Draw G shape with the right button
  • Draw T shape with the right button

Exemple : big config

  • mouse button bindings:

    • Super+Left click → screenshot script
    • Side click → script: Alt + Left mouse down
    • Extra click → script: Alt + Tab
  • edges and corners bindings:

    • Middle click in the top left corner → script: key ² → open Tilda
    • Middle click in the top right corner → script: lock the screen
    • Middle click in the top edge → script: play/pause
    • Right click in the top left corner → script: go to the top left desktop
    • Right click in the top right corner → script: go to the top right desktop
    • Right click in the bottom left corner → script: go to the bottom left desktop
    • Right click in the bottom right corner → script: go to the bottom right desktop
    • Wheel up in the top left corner → script: increase volume
    • Wheel up in the top right corner → script: increase volume
    • Wheel up in the bottom left corner → script: increase volume
    • Wheel up in the bottom right corner → script: increase volume
    • Wheel down in the top left corner → script: decrease volume
    • Wheel down in the top right corner → script: decrease volume
    • Wheel down in the bottom left corner → script: decrease volume
    • Wheel down in the bottom right corner → script: decrease volume
    • Ctrl + Wheel up in the top edge → script: audio next
    • Ctrl + Wheel up in the top edge → script: audio previous
    • Wheel up in the left edge → script: increase brightness 1%
    • Ctrl + Wheel up in the top edge → script: increase brightness 10%
    • Wheel down in the left edge → script: decrease brightness 1%
    • Ctrl + Wheel down in the left edge → script: decrease brightness 10%
    • Right click in the left edge → script: go to desktop on the left
    • Right click in the top edge → script: go to desktop on the top
    • Right click in the right edge → script: go to desktop on the right
    • Right click in the bottom edge → script: go to desktop on the bottom
  • Shape biding with the right button :

    • Draw G shape → launch gedit (text editor)
    • Draw T shape → launch the terminal
    • Draw C shape → key Ctrl+C (Copy)
    • Draw V shape → key Ctrl+V (Paste)
    • Draw ↑ (vertical line to the top) shape → go to the desktop on the top
    • Draw ↓ (vertical line to the bottom) shape → go to the desktop on the top
    • Draw → (horizontal line to the right) shape → go to the desktop on the right
    • Draw ← (horizontal line to the left) shape → go to the desktop on the left
    • Draw N shape → open the Note tool
    • Draw ↗ (line to the top right) shape → F2 key (rename)
    • Draw ↖ (line to the top left) shape → F2 key (rename)
    • Draw ↙ (line to the left bottom) shape → Alt+Tab key
    • Draw n shape → launch nemo (file explorer)
    • Draw m shape → launch nautilus (file explorer)
    • Draw ↘ (line to the bottom right) shape → Alt+F8 key (resize the window)
    • Draw S shape → Ctrl+S key (save)
    • Draw ∝ (alpha) shape → Ctrl+X key (cut)
    • Draw ɣ (gamma) shape → Ctrl+X key (cut)
    • Draw ↵ (bottom then left) shape → Ctrl+X key (cut)
    • Draw ↶ (reverse n) shape → show/hide hamster time tracker
    • Draw Z shape → Ctrl+Z key (undo)
    • Draw F shape → Ctrl+F key (search)
    • Draw H shape → Ctrl+H key (toggle hide)
    • Draw D shape → Ctrl+Alt+D key (show the window on all desktops)
    • Draw B shape → script to remove the window decoration
    • Draw 2 shape → Shift+F9 key clear draw on screen (Gromit-MPX)
    • Draw 𝛥 shape (↗↘←) → F9 key toggle draw on screen (Gromit-MPX)

Development

This project use rdev crate that use Evdev to grab mouse Event.

Motivations

  • I used Easystroke a lot but its development stopped in 2014, and it causes my system to crash regularly.
  • Besides, I was also using a lot Compiz screen corner command bindings, and I wanted to have these bindings without necessarily using compiz.

The goal of this project is then to have these 2 features without having OS crash (X11 crash).

CCSM screenshot (Compiz Config Setting Manager) : ccsm.png

Easystoke screenshot : easystroke.png

Dev notes :

Shape recognition

Shape recognition : compare angles, get the average of the angles differences :

shape-recognition.svg

The calculated difference is approximately the area between the 2 curves of angles (mod 2𝜋) visible on the right of the above image.

Get the minimum difference by shifting a curve horizontally: try removing the beginning or the end, by +/- 10 % max offset (max 20 try).

upgrade

cargo update
cargo audit
cargo test
cargo build --release

cd config-editor
npm install @tauri-apps/cli@latest @tauri-apps/api@latest

cd src-tauri
cargo update
cargo audit

TODO

High

  • #8 Gesture button is 'stolen' on Wayland
  • config file for /dev/input/event* in /etc/udev/rules.d/? instead of the usermod if possible, script to create this file, add to the deb package, ...

Medium

  • CI: build the releases https://github.com/tauri-apps/tauri-action
  • change config : if shape → (no need button in binding) or (rm shape_btn : several button for shape event is then possible)
  • cancel shape if no move after few ms (400 ms ?)
  • fix TODO and FIXME
  • fix rdev
    • reset the modifiers/button state at root loop restart
    • fix rdev devices delete/update: the FIXME "inotify CREATE but not DELETE in grab::inotify_devices()" in rdev/src/linux/grab.rs:493
    • pull request/contribute/modify rdev without fork it in this repo ( mouse btn add & fix devices setup/Delete notify)
  • add ARM64 target #6

Low

  • re-enable the new device detection, disabled by the v0.4.4
  • support Windows & macOS
  • fix exec cmd not found error Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })
  • create ~/.config if it doesn't exist
  • use https://github.com/hoodie/notify-rust
  • a better Readme
  • improve shape recognition
  • refactor
    • don't use arrayvec ?
    • reduce clone() usages
    • handle errors correctly : remove panic, reduce unwrap
    • refactor Arc/Mutex usages
    • refactor/change the pressState usage
    • dev doc, tests
  • use rdev send() ? → cmd OR sendKeys in bindings (or autopilot-rs) : trigger keyboard event as action (avoid xdotool usage in cmd) : https://github.com/Narsil/rdev#sending-some-events

Maybe

  • use https://crates.io/crates/deno_task_shell to execute commands ?
  • release a debug version and a gui-less version ?
  • options
    • dry-run option
    • min diff shape config option
    • min score shape config option
  • find a better project name and icon
  • notif/sound/cursor change on action trigger success/failure ( configurable) ? https://crates.io/crates/rodio
  • mouse move edge event ?
  • hide/freeze cursor while shape drawing ?
  • Ctrl alias for ControlLeft & ControlRight, Shift for ShiftLeft & ShiftRight,

mouse-actions's People

Contributors

dependabot[bot] avatar jersou 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

mouse-actions's Issues

Confusion over Mouse Buttons.

At the top 'Shape button:' (set to middle, assuming I can test with middle mouse click).

Further down, 'Press, Release, Click, Shape' - assuming 'shape' is correct here.
Then to the right, there's ANOTHER setting (set to 'Middle') . Now I'm unsure of the meaning or reasoning of having TWO selections for mouse buttons.

So then enter Comment : dolphin and Command: dolphin, then draw a shape (letter 'e' for 'explore').

Then underneath another row of keys - none selected. Do they put the gesture event behind a modifier? e.g. 'Shift Left' means you must press this key, then press Middle Mouse and draw the 'e'?

Ok, so now I'm set... SAVE, then STOP, then START - or just SAVE,RELOAD CONFIG.

However, unlike last year when I tried this on X11 - the gesture seems to fail.

GUI window is blank

image

AcceleratedSurfaceDMABuf was unable to construct a complete framebuffer

% mouse-actions-gui
    no_listen: false,
    config_path: None,
    command: None,
    version: false,
    log_level: None,
}

** (mouse-actions-gui:453380): WARNING **: 18:10:04.619: webkit_settings_set_enable_offline_web_application_cache is deprecated and does nothing.
AcceleratedSurfaceDMABuf was unable to construct a complete framebuffer

I just wanted to say thank you

Truly. I NEED mouse gestures because of hand problems, and I have been stuck on Windows (with strokesplus) for nearly 10 years waiting for this app (and nvidia drivers ahem) to happen so that I could go Linux/Wayland. I've been here since 0 stars, using it in a VM, in conjunction with ydotool, to make sure it would all behave, and have spent the past two weeks making the heavily customised bare-metal Linux machine a reality - enough to be able to create a github account and write this! hahaha.

All the while, I have been harbouring a deep gratitude toward you for having made this app happen. Thank you so much, you've made a disabled old linux dev very happy, and filled a gaping void in accessibility on Wayland.

I'm working on packaging this (and related tools such as ydotool) using OBS for OpenSUSE (Tumbleweed specifically, but it should build for any OS after that is working), which turns out to be quite the challenge since OpenSUSE/RPM packages in a non-networked sandbox, so neither npm nor cargo are straightforward, so it is..... a learning experience ;) But I have had some success, and hope to be able to return the favour to you through this packaging/repository/distribution method at least, and also I have a few FRs and potentially PRs, if you are interested in collaboration? I would really like to help out if I can in any way, and there are a couple of features I'd really like to add if you are interested :)

ubuntu 22.04, 0.2.0 binary Bulid from Releases: Grab Error: IoError

Hi, thanks for making this application, higly appreciated !

I made

sudo usermod -a -G plugdev $USER
sudo usermod -a -G input $USER

I get this message when I try to start it.

./mouse_actions
[2023-04-06T15:42:04Z ERROR mouse_actions] Grab Error: IoError(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })

Per application gesture

I cant find any way to add a per application gesture. I Like to set different functions to same gestures for different applications, like easystroke can do.
Is that possible with this app or need to be implemented?

mouse-actions blocks meta+right_click

I use meta+right_click to resize windows via dragging. Mouse-actions blocks the window manager (Plasma) from seeing this key-combo. (Easystroke does not)

Grab IoError - Interrupted Syscall on Wayland

Hi, thanks for developing this. The ability to have a program like EasyStroke for Wayland is invaluable when it comes to setting up a heavily touchscreen-driven, yet minimal setup.
Unfortunately, the program (latest AppImage) does not work for me under wayland (sway wm specifically).

After having setup the requirements and a simple stroke command within the GUI, I call
mouse-actions-gui --no-listen start

This does indeed start mouse-actions and upon entering my stroke it is correctly detected:

[2023-06-10T22:58:44Z INFO mouse_actions::process_event]       -> cmd ["bash', '-c', 'htop"]

However it then throws an error:

[2023-06-10T22:58:46Z ERROR mouse_actions::process_args]  Grab Error: IoError(
    Os {
        code: 4,
        kind: Interrupted,
        message: "Interrupted system call",
        },
    )

And ultimately whatever command I set is not executed.

Output spam when stopping mouse-actions[-gui]

When stopping the app, as it exits, it seems to spam a lot of Ctrl+C messages. This occurs slightly differently in the CLI and GUI version.

[2023-06-28T07:44:40Z DEBUG mouse_actions::process_event] Process event duration : 10.885132ms
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

Note the multiple ^C - I did not type those, I pressed Ctrl+C one time. When using the GUI version it does this too. As an example:

pallaswept@Pallas:~> mouse-actions-gui -n -l trace stop
Args {
    no_listen: true,
    config_path: None,
    command: Some(
        Stop,
    ),
    version: false,
    log_level: Some(
        "trace",
    ),
}
[2023-06-28T08:01:17Z DEBUG mouse_actions::process_args] log_level=trace
[2023-06-28T08:01:17Z TRACE mouse_actions::process_args] version : 0.4.2-VERGEN_IDEMPOTENT_OUTPUT (2023-06-28)
[2023-06-28T08:01:17Z TRACE mouse_actions::process_args] args = Args {
        no_listen: true,
        config_path: None,
        command: Some(
            Stop,
        ),
        version: false,
        log_level: Some(
            "trace",
        ),
    }!
[2023-06-28T08:01:17Z TRACE users::base] Running getuid
[2023-06-28T08:01:17Z TRACE users::base] Running getpwuid_r for user #1000
[2023-06-28T08:01:17Z TRACE users::base] Loading user with uid 1000
[2023-06-28T08:01:17Z INFO  mouse_actions::single_instance] killing the old instance with pid 17825
[2023-06-28T08:01:17Z TRACE users::base] Running getuid
[2023-06-28T08:01:17Z TRACE users::base] Running getpwuid_r for user #1000
[2023-06-28T08:01:17Z TRACE users::base] Loading user with uid 1000
[2023-06-28T08:01:17Z INFO  mouse_actions::process_args] mouse_actions successfully stopped
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 
pallaswept@Pallas:~> 

In the case of the GUI app, this sometimes causes the (assumedly ctrl+c but it could be enter or something else?) to be passed into the next GUI app, for example I once did this and the next active window was my browser, which blinked a few times before crashing.

Slightly offtopic but some good news is that I have managed to develop a working fedora/opensuse compliant build script. This was no mean feat, as RPMs are built in a virtualised environment with no network access (to ensure the source really can be built from source without further sources), so naturally neither npm or cargo could function. The solution in brief is to parse the source code from the development workstation, to generate local copies of all of the online dependencies, which are then archived and those archives included as part of the package source (along with the git sources), extracted, and the npm and cargo invocations are altered to use the local sources for the build.

I also had to overcome a number of bugs with the private instance of opensuse's appliance for this, so it's taken several weeks to overcome the npm and cargo challenges without a working build environment. But as of today, I have the solution at hand, which means I will now be able to focus on developing the app itself. My next steps are to author a systemd service file for the CLI version, and a .desktop file for the GUI, which will also need modifications to the start/stop functions, to make it compatible with the CLI acting as the daemon (but of course retain their current function if the daemon is not enabled), and then I will focus on allowing mouse buttons as modifiers as this is the greatest issue I'm facing personally. If there's anything in particular you would prefer me to work on first, please do let me know, as my real first priority with this project is to support you.

Sudden build errors from nowhere

So, nothing changed here, nothing changed on my build, but now my build fails. I'm guessing some upstream node.js dependency got updated and broke this:


[   94s] failed to load config from /home/abuild/rpmbuild/BUILD/mouse-actions/config-editor/vite.config.ts
[   94s] error during build:
[   94s] TypeError: Cannot redefine property: File
[   94s]     at Function.defineProperty (<anonymous>)
[   94s]     at Object.<anonymous> (/home/abuild/rpmbuild/BUILD/mouse-actions/config-editor/node_modules/@babel/core/lib/index.js:7:8)
[   94s]     at Module._compile (node:internal/modules/cjs/loader:1241:14)
[   94s]     at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
[   94s]     at Module.load (node:internal/modules/cjs/loader:1091:32)
[   94s]     at Module._load (node:internal/modules/cjs/loader:938:12)
[   94s]     at Module.require (node:internal/modules/cjs/loader:1115:19)
[   94s]     at require (node:internal/modules/helpers:130:18)
[   94s]     at Object.<anonymous> (/home/abuild/rpmbuild/BUILD/mouse-actions/config-editor/node_modules/@babel/core/lib/config/helpers/config-api.js:16:9)
[   94s]     at Module._compile (node:internal/modules/cjs/loader:1241:14)
[   94s]        Error beforeBuildCommand `npm run build` failed with exit code 1
[   94s] error: Bad exit status from /var/tmp/rpm-tmp.Cj577C (%build)

I guess this just needs either babel or cjs to be resricted to an older version or something? I'm a node.js idiot so I've not a lot of clue here. All I know is it's been fine for months, I changed nothing and you changed nothing, and it broke.

Any ideas?

Grab Error when trying to start to listen for gestures

I tried to run the elf executable downloaded from the releases in the terminal.

I am running nobara linux on a surface book 2 with the surface-linux kernel patch

[2023-06-30T09:11:34Z ERROR mouse_actions::process_args] Grab Error: IoError(
        Os {
            code: 22,
            kind: InvalidInput,
            message: "Invalid argument",
        },
    )

Grab error 13 pemissiondenied - even though requirements are met

First of all thank you for your work on this very interesting tool.
Nice to read all you wrote in the README and the effort you are putting in polishing all of it and make it understandable and usable for anyone.

I'm actually not a very "GUI person" and spend most of my time in the Linux Console. Only boot X11 when needed. Bu always very curious about these cute tools on x11.

I knew about easystroke so decided to give a try to mouse-actions.
I like the possibilities it opens.

I'm on Archlinux and someone just made an AUR package for it, https://aur.archlinux.org/packages/mouse-actions. You can add that info to the README as well.

I've tested both that and the AppImage you release on github. They both install and run fine on Archlinux.

I've started the program and made some config. I then hit the "save" button and it did save every thing nicely in ~/.config/mouse-actions/.

The problem is when I try to hit the button "Start".

It seems to start fine


   $ mouse-actions-gui_0.4.4_amd64.AppImage
Args {
    no_listen: false,
    config_path: None,
    command: None,
    version: false,
    log_level: None,
}
Args {
    no_listen: false,
    config_path: None,
    command: Some(
        Start,
    ),
    version: false,
    log_level: None,
}
[2023-08-17T07:03:30Z INFO  mouse_actions::config] Watch the config "/home/a1/.config/mouse-actions.json" !
root_loop

but then when I hit the "START" button,

[2023-08-17T07:03:31Z ERROR mouse_actions::process_args] Grab Error: IoError(
        Os {
            code: 13,
            kind: PermissionDenied,
            message: "Permission denied",
        },
    )
[2023-08-17T07:03:31Z ERROR mouse_actions::process_args] The user must be in the file group of /dev/input files, usually 'input' or 'plugdev' :
[2023-08-17T07:03:31Z ERROR mouse_actions::process_args]   $ sudo usermod -a -G input $USER
[2023-08-17T07:03:31Z ERROR mouse_actions::process_args]   $ sudo usermod -a -G plugdev $USER
[2023-08-17T07:03:31Z ERROR mouse_actions::process_args]   $ sudo tee /etc/udev/rules.d/80-mouse-actions.rules <<<'KERNEL=="uinput", SUBSYSTEM=="misc", TAG+="uaccess", OPTIONS+="static_node=uinput"'
[2023-08-17T07:03:31Z ERROR mouse_actions::process_args] Then restart to apply this user modifications.
[2023-08-17T07:03:31Z ERROR mouse_actions::process_args] See https://github.com/jersou/mouse-actions#requirement-

** (mouse-actions-gui:248331): WARNING **: 08:03:52.291: atk-bridge: get_device_events_reply: unknown signature

Hhhm very strange.

jersou commented

do you apply the requirements ? https://github.com/jersou/mouse-actions#requirement-

Of course I did. I'm an experienced Linux user and I've tested many many tools that similarly force me to have special permissions in input/serial/etc.

groups

wheel uucp lock video input a1

getfacl /dev/uinput

# file: dev/uinput
# owner: root
# group: root
user::rw-
group::---
other::---

can you share your config ?

https://paste.ottertelecom.com/?9b839afbaa06d0b6#5aU4B9xt7M7vbkuQFaUNntfxqhkyvC3DCUen4HCoz9Dv

I'm not sure about that part of the log error message,

/etc/udev/rules.d/80-mouse-actions.rules

Not very clear in the README. Should I be messing or adding up something extra in /etc/udev/rules.d/ ?. Is that something extra to do ? Is it necessary to do if having checked "groups" and "getfacl" are OK ?

I'm running out of ideas of what could be causing this permission error .
Do you have any suggestion ?

Thanks in advance.

PS: What is this group "plugdev" ?

You need to add the current user to this group, usually input or plugdev :

sudo usermod -a -G plugdev $USER

or

sudo usermod -a -G input $USER

Never heard about it. On Archlinux it doest exist.

Gesture button is 'stolen' on Wayland

I use right button as my gesture button (although I do dream of one day selecting the gesture button per-command, rather than globally, but that's a story for another time), and I have noticed that while mouse-actions is working, I cannot right-click (such as to open a context menu)

It turns out that the click is detected, determined too small to be a gesture, but not propagated as a normal click. Trace logs:

load start:

Start grab
root_loop
[2023-06-28T07:44:09Z TRACE rdev::linux::grab] setup_devices

left-click:

[2023-06-28T07:44:13Z TRACE mouse_actions::process_event] event=ClickEvent { button: Left, edges: [], modifiers: [], event_type: Press, shapes_angles: [], shapes_xy: [] }
[2023-06-28T07:44:13Z TRACE mouse_actions::process_event] candidates=[]
[2023-06-28T07:44:13Z TRACE mouse_actions::process_event] propagate = true
[2023-06-28T07:44:13Z TRACE mouse_actions::grab] normalized_points = PointHistory([])
[2023-06-28T07:44:13Z TRACE mouse_actions::process_event] event=ClickEvent { button: Left, edges: [], modifiers: [], event_type: Release, shapes_angles: [[]], shapes_xy: [PointHistory([])] }
[2023-06-28T07:44:13Z TRACE mouse_actions::process_event] candidates=[]
[2023-06-28T07:44:13Z TRACE mouse_actions::process_event] propagate = true

right-click

[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] event=ClickEvent { button: Right, edges: [], modifiers: [], event_type: Press, shapes_angles: [], shapes_xy: [] }
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] candidates=[]
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] propagate = true
[2023-06-28T07:44:40Z TRACE mouse_actions::grab] normalized_points = PointHistory([])
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] event=ClickEvent { button: Right, edges: [], modifiers: [], event_type: Release, shapes_angles: [[]], shapes_xy: [PointHistory([Point { x: 10, y: 10 }])] }
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] candidates=[Binding {...long list of points from my bindings removed for clarity...]
[2023-06-28T07:44:40Z DEBUG mouse_actions::process_event] ----------------------------------------
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] shape size(0) <= 8 → ignore this event
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] simulate
[2023-06-28T07:44:40Z TRACE mouse_actions::process_event] propagate = false
[2023-06-28T07:44:40Z DEBUG mouse_actions::process_event] Process event duration : 10.885132ms
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

Note that second propagate = false, I guess this is the culprit. It appears that neither the mousedown nor mouseup event are forwarded past mouse-actions in this case. I've tested it with middle button and the behaviour is the same.

Note also the multiple ^C - I did not type those, I pressed Ctrl+C one time. I am about to log a separate issue for that.

How to get started?

I'm on MX Linux 21 (Debian 11). The .deb gui installed fine, but I can't get it to do anything.

I created an action using a "C" shape, with the command "kill". It does nothing, and as soon as I try the action a context menu opens on the program.

I want to do things like pass keystrokes, minimize/maximize windows, close programs, etc - basically what I use Easystroke for. But like the author, I find it crashes the session much too often, so I have to look for an alternative such as this.

Thanks.

Keyboard input - e.g. Gesture for Ctrl_W

I tried this software, and discovered it works for drawing an 'f' to execute the command 'firefox -p' to launch Firefox - that's great.

I can see also that it would work for launching scripts, so
a script to check/kill or launch an application should be easy to enter as a Command ~/Admin/strawberry.sh

However, many 'gestures' I use are simply keyboard shortcuts... like Tab: Close Ctrl_W Reopen Sh_Ctrl_N Overview Alt+F11 set in shortcuts etc. and I cannot figure out how to change 'command' to 'keyboard'.

mouse-actions not recording shapes

This is my first time using mouse-actions.

The gui would not compile using the versions of npm and nodejs that are included with ubuntu 22. So, I'm using the command line instead. I ran 'mouse-actions record' and then swiped from the center of the screen to the right edge with the right mouse button held down. Unfortunately,
mouse-actions seems not to record the point history required for the gesture.

Also, I have a question about use of the left mouse button -- if point histories can be made to work, can mouse-actions be told to trigger when a shape is drawn using the left mouse button?

command to bind (empty to stop the record) : 
xcalc
comment : 
xcalc
[(date-time) INFO  mouse_actions::record] push : Binding {
        comment: "xcalc",
        event: ClickEvent {
            button: Right,
            edges: [],
            modifiers: [],
            event_type: Shape,
            shapes_angles: [
                [],
            ],
            shapes_xy: [
                PointHistory(
                    [],
                ),
            ],
        },
        cmd: [
            "xcalc",
        ],
        cmd_str: "",
    }

Documentation for install on armhf plattform (Raspberry pi)

Thank you so much for your great work. I hope this post is fine here. I would appreciate some documentation on how to install the mouse-action programm on a different platform.
I loved easystroke on the raspberry pi 32 bit, your mouse-actions-gui works great on my amd64 ubuntu/debian machine. I am not able to get this to work on the 64 bit raspberry pi 4 now.
Sorry for the inconvenience. Any way to contact you in another way?

Looking for a manual

I have used easystroke for years, but I couldn't make this software work for simple keypresses.

For example, I'd like to assign the mouse gesture "down" (with the BACK button) to pressing F11 and another gesture (BACK-right) to CTRL-W (close Tab).

But nothing has been worked so far. I tried xdotool commands like

/usr/bin/xdotool key F11

in the "Commands" field, or

xdotool key ctrl-w

But both have no effect at all.
Is there a step-by-step manual that shows how to make this software work?

Editor does not render content

I downloaded mouse-actions-gui-v0.4.4.tar.gz and installed sudo apt install libwebkit2gtk-4.0-37 libgtk-3-0 and when I execute ./mouse-actions-gui I got the following:

Args {
    no_listen: false,
    config_path: None,
    command: None,
    version: false,
    log_level: None,
}
successfully wrote to /home/user/.config/mouse-actions.json

A window showed ("Mouse Actions Config Editor [...] (2023-07-06)") but the content stays white.

When I move the mouse horizontally over the top 20-30 px range I see that it turns into a hand, signaling that I can press something, but I can't see what. When I center the mouse in the window and press the right button, a context menu pops up with "Back", "Forward" and "Stop" greyed out and "Reload" enabled. Clicking "Reload" closes the popup and nothing else happens, with the exception that the buttons seem to have disappeared (no more cursor change on hover) and the right mouse button no longer shows the context menu.

Judging from the screenshots it might be the "Right" Dropdown and the button row. Yup, when I click on the first object, then I can move downward and it still shows the hand, probably the dropdown. And I can click on the "Stop" button and get INFO mouse_actions::single_instance] killing the old instance with pid 4019

Maybe it's required to run with a GPU or something?

This is on Kubuntu 22.04 in a VM hosted by VirtualBox.

[Feature Request]: Wacom Tablet Support

I would like to be able to map my wacom tablet and express keys to the program. I want to be able to push an express key on the tablet or pen to be able to switch between keyboard mode and regular tablet mode so I can "type" by writing characters out on the tablet. I would like to be able to add my own custom characters as well as use latin based characters

Run start command on system load

Hi, first of all thank you for creating this library, I am a huge fan of easystroke but it stopped working on Debian 12 (gnome 43). So because of that I found your library and it is awesome.

I have a question if it is possible to launch the start command on system load so user can use mouse actions without starting any script.
I tried to create custom service in systemd but I got KeyboardError.

Thank you for your work and have a nice day!

Warnings of deprecated npm modules during build

FTI

npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.

Grab Error: IoError

Running Linux Mint Cinnamon 21.3 with 6.5.0-26-generic kernel. When I have mouse-actions-gui running and try to do my first gesture (drag to the left with my right mouse button to perform the keystroke Alt+Left) the following occurs and no more gestures are detected:

[2024-03-19T23:11:59Z INFO  mouse_actions::config] Watch the config "/home/steve/.config/mouse-actions.json" !
root_loop
[2024-03-19T23:12:02Z INFO  mouse_actions::process_event]      → cmd ["Alt+Left"]
[2024-03-19T23:12:05Z ERROR mouse_actions::process_args] Grab Error: IoError(
        Os {
            code: 4,
            kind: Interrupted,
            message: "Interrupted system call",
        },
    )

I believe that I have met all the requirements listed. Any idea why it doesn't work? What do you need to help troubleshoot this?

Grab error when using keyd

I was just doing some testing on a build that I have had working in the past, but every time I clicked the gesture button I'd get the following error:


[2023-08-03T15:26:23Z ERROR mouse_actions::process_args] Grab Error: IoError(
        Os {
            code: 16,
            kind: ResourceBusy,
            message: "Device or resource busy",
        },
    )

I was briefly baffled as to why this known-good copy of mouse-actions was suddenly failing, and after some testing realised that the problem was that I had recently enabled keyd. When I stopped the keyd service, mouse-actions instantly worked as per normal.

I'm honestly unsure if this is a keyd bug or a mouse-actions bug, or both, but I do know they are both indispensable tools for accessibility for disabled users, and we very much need them to coexist, so I'm filing issues in both places. Here is a link to the keyd issue: rvaiya/keyd#548

[Request] Add README, Changelog, docs, etc to the tar.gz binary released on github

Currently mouse-actions doesnt have a man page.

That's OK, the source code tar.gz or zip released on github contains a lot of stuff like

  • the README
  • the Changelog
  • example config files
  • etc.

This is not fluff. It is important doc and stuff for a complex tool like this. It should be offline on the end user PC. Not just online to read on the Internet.

Unfortunatelly the tar.gz releases of the gui and non gui binaries do not contain any of these.

Please bundle them as well. Thanks in advance.

Command text entry is disabled

I am a big fan of easystroke on Linux (Ubuntu). But unfortunately it's not updated.
From time to time I encounter some issues with easystroke. For that reason I kept looking for alternatives. But found nothing satisfy me.

When I noticed mouse-actions developer is also easystroke user, I felt excited and wanted to try it.

The GUI starts normally but, I couldn't manage to enter "Command" in the text box. It looks like read-only. I can enter comment but not the command.

I tried it on Ubuntu 20.04 and also on Arch Linux. Both have the same problem.

What should I do?

image

Complex actions supported?

In Easystroke I have a guesture like this:

38 0 10 Gesture 14 5
39
40 1 1 10
41 0 1 5 0 0 32768 14
42
43 0 65366 0 21 3+wheeldown=page down 5
44
45 1 1 10
46 0 1 1 0 0 32768 14
47
48 67108864 65289 0 3 3+1 5
49
50 1 1 10
51 0 1 2 0 0 32768 14

Which if I hold right_click and use the mouse wheel, it'll send page_up and page_down events. I can not find anyway to replicate this behavior in mouse-actions.

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.