Coder Social home page Coder Social logo

wstroke's Introduction

wstroke

Port of Easystroke mouse gestures as a plugin for Wayfire. Mouse gestures are shapes drawn on the screen while holding down one of the buttons (typically the right or middle button). This plugin allows associating such gestures with various actions. See the Wiki for more explanations and examples.

Packages for the upcoming Ubuntu 24.04 release are available here: https://launchpad.net/~kondor-dani/+archive/ubuntu/ppa-wstroke

Note: this branch requires a recent version of Wayfire and wlroots (see below). For older versions, use the wayfire-0.7 branch.

Dependencies

  • Wayfire at least version 0.8.0 (see below for compiling for older Wayfire versions)
  • wlroots at least version 0.16 (tested with 0.16.2).
  • Development libraries for GTK, GDK, glib, gtkmm, gdkmm and boost-serialization (Ubuntu packages: libglib2.0-dev, libgtk-3-dev, libgtkmm-3.0-dev, libboost-serialization-dev)
  • glib-compile-resources (Ubuntu package: libglib2.0-dev-bin)
  • nlohmann_json, recommended to use the same version that Wayfire uses (currently version 3.9.1)
  • Vala compiler (for building, Ubuntu package: valac; or use the no_vala branch instead)
  • Optional, but highly recommended: WCM for basic configuration
  • Optionally libinput version 1.17 or higher for improved touchpad support (to allow tap-and-drag for the right and middle buttons, required for drawing gestures without physical buttons)

Building and installing

meson build
ninja -C build
sudo ninja -C build install

If you get build errors, your Wayfire version might be too old (or too new). For older Wayfire versions, try the following:

  • For version 0.7.0, use the wayfire-0.7 branch (run git checkout wayfire-0.7 before building).
  • For older Wayfire versions of the 0.8.0 series (between commits 3cca6c9 and d1f33e5), use this state (run git checkout 4f2e8f0 before building). If using multiple monitors, you can separately apply the fix to issue #5: git cherry-pick 1c02905a4e
  • For moderately old versions of Wayfire (between commits d1f33e5 and 3ac0284), use this state (run git checkout 0401b4f before building). If using multiple monitors, you can separately apply the fix to issue #5: git cherry-pick 1c02905a4e
  • For recent versions of Wayfire, use this branch (and report issues for build failures).

Running

If correctly installed, it will show up as "Mouse Gestures" plugin in WCM and can be enabled from there, or with adding wstroke to the list of plugins (in [core]) in ~/.config/wayfire.ini.

Configuration

Basic options such as the button used for gestures, or the target of gestures can be changed with WCM as the "Mouse Gestures" plugin, or by manually editing the [wstroke] section in ~/.config/wayfire.ini. Note: trying to set a button will likely make WCM to show a warning (e.g. "Attempting to bind BTN_RIGHT without modifier"); it is safe to ignore this, since wstroke will forward button clicks when needed.

Gestures can be configured by the standalone program wstroke-config. Recommended ways to obtain an initial configuration:

  • If you have Easystroke installed, wstroke-config will attempt to import gestures from it, by looking for any of the actions* files under ~/.easystroke. Even without Easystroke installed, copying the content of this directory from a previous installation can be used to import gestures. It is recommended to check that importing is done correctly.
  • An example configuration file is under example/actions-wstroke-2. This is installed automatically and will be used by wstroke-config as default if no other configuration exists. You can copy this file to ~/.config/wstroke manually as well.

Gestures are stored under wstroke/actions-wstroke-2 in the directory given by the XDG_CONFIG_HOME environment variable (~/.config by default). It is recommended not to edit this file manually, but it can be copied between different computers, or backed up and restored manually.

Focus settings

For a better experience, it is recommended to diable the "click-to-focus" feature in Wayfire for the mouse button used for gestures. This will allow wstroke to manage focus when using this button and set the target of the gesture as requested by the user.

To do this, under the "Core" tab of WCM, change the option "Mouse button to focus views" to not include the button used for gestures. E.g. if the right button is used, the setting here should not contain BTN_RIGHT, so it might look like BTN_LEFT | BTN_MIDDLE (note: it is best to set this by clicking on the edit button on the right of the setting and manually editing the text that corresponds to this setting). Don't be alarmed by the warning that appears ("Attempting to bind BTN_LEFT | BTN_MIDDLE without modifier"); this is exactly the intended behavior in this case.

The same can be achieved by editing the option focus_buttons in the [core] section of ~/.config/wayfire.ini.

What works

  • Importing saved strokes from "actions" files created with Easystroke (just run wstroke-config).
  • Drawing and recognizing strokes.
  • Actions on the active view: close, minimize, (un)maximize, move, resize (select "WM Action" and the appropriate action).
  • Actions to activate another Wayfire plugin (typical desktop interactions are under "Global Action"; "Custom Plugin" can be used with giving the plugin activator name directly), only supported for some plugins, see here.
  • Generating keypresses ("Key" action).
  • Generating mouse clicks ("Button" action).
  • Generating modifiers ("Ignore" action -- only works in combination with mouse clicks, not the keyboard).
  • Emulating touchpad "gestures" with mouse movement, such as scrolling or pinch zoom in apps that support it ("Touchpad Gesture" action; "Scroll" action from Easystroke will be converted to this).
  • Running commands as a gesture action.
  • Getting keybindings and mouse button bindings in the configuration for actions.
  • Recording strokes (slight change: these have to be recorded on a "canvas", cannot be drawn anywhere like with Easystroke; also, recording strokes requires using a different mouse button).
  • Identifying views and using application specific gestures or excluding certain apps completely; setting these in wstroke-config by interactively grabbing the app-id of an open view.
  • Option to target either the view under the mouse when starting the gesture (original Easystroke behavior) or the currently active one.
  • Option to change focus to the view under the mouse after a gesture.
  • Basic timeouts (move the mouse after clicking to have a gesture / end the gesture if not moving within a timeout).

What does not work

  • SendText action (removed from settings, will be converted to Global)
  • Ignore in combination with keyboard keypresses.
  • Individual settings (which button, timeout) for each pointing device
  • Advanced gestures
  • Touchscreen and pen / stylus support

wstroke's People

Contributors

dkondor avatar

Stargazers

yukine8 avatar Justin Tirrell avatar Georgios K. avatar Luke Simmons avatar 飘尘 avatar vi|vi|vi avatar Robert Barat avatar callmejoe avatar  avatar  avatar  avatar  avatar  avatar Jason Miller avatar RaitaroHikami avatar Brandon Dowdy avatar Damian Ivanov avatar A. Tammy avatar

Watchers

James Cloos avatar  avatar  avatar

wstroke's Issues

error when building

getting an error on ninja -C build. this is the first error of several.

ninja -C build

got a couple of NO;s on meson build. not sure if important
meson build

would be great to get this to build. i do miss easystroke not working on wayland

mouse gestures not drawn on second monitor

This has been happening since June. I thought I reported it but I guess not.

If I try to draw a gesture on my second monitor it just displays a straight line across the monitor.

PXL_20231003_023302633

wlroots ver 17

hello, i am trying to re-rebuild this against wlroots 17 which was updated recently. doesnt want to build. i've been having issues with wayfire outside of wlroots so not sure if this is my issue or because of the new wlroots version

here is a partial build output...

2023-11-27_15:30:36

can't record stroke with the button assigned to gestures

i've been using wstroke for about 4 months. using imported gestures from easystroke. today is the first time i actually had to record a stroke with wstroke-config. I cant get it to accept any gesture i draw.

any help troubleshooting?

in on wayfire commit 0de95a42. wstroke commit 481e2d2

new updates to wayfire break wstroke

can't build wstroke against latest wayfire master branch

error details

ninja: Entering directory `build'
[12/37] Compiling C object toplevel-grabber/tl_grabber_test.p/toplevel-grabber-test.c.o
../toplevel-grabber/toplevel-grabber-test.c: In function ‘tl_cb’:
../toplevel-grabber/toplevel-grabber-test.c:29:25: warning: unused parameter ‘data’ [-Wunused-parameter]
29 | static void tl_cb(void* data, struct tl_grabber* gr) {
| ~~~~~~^~~~
[29/37] Compiling C++ object libwstroke.so.p/easystroke_gestures.cpp.o
FAILED: libwstroke.so.p/easystroke_gestures.cpp.o
c++ -Ilibwstroke.so.p -I. -I.. -I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/pixman-1 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/libdrm -I/usr/include/libevdev-1.0 -I/usr/include/libxml2 -I/usr/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++17 -O0 -g -fPIC -pthread -DBOOST_ALL_NO_LIB -Wno-unused-parameter -Wno-format-security -DWAYFIRE_PLUGIN -DWLR_USE_UNSTABLE -MD -MQ libwstroke.so.p/easystroke_gestures.cpp.o -MF libwstroke.so.p/easystroke_gestures.cpp.o.d -o libwstroke.so.p/easystroke_gestures.cpp.o -c ../easystroke_gestures.cpp
../easystroke_gestures.cpp: In member function ‘virtual void wstroke::visit(const View*)’:
../easystroke_gestures.cpp:309:54: error: ‘class wf::view_interface_t’ has no member named ‘minimize_request’
309 | target_view->minimize_request(true);
| ^~~~~~~~~~~~~~~~
../easystroke_gestures.cpp:313:57: error: ‘class wf::view_interface_t’ has no member named ‘tiled_edges’
313 | if(target_view->tiled_edges == wf::TILED_EDGES_ALL)
| ^~~~~~~~~~~
../easystroke_gestures.cpp:313:76: error: ‘TILED_EDGES_ALL’ is not a member of ‘wf’
313 | if(target_view->tiled_edges == wf::TILED_EDGES_ALL)
| ^~~~~~~~~~~~~~~
../easystroke_gestures.cpp:314:62: error: ‘class wf::view_interface_t’ has no member named ‘tile_request’
314 | target_view->tile_request(0);
| ^~~~~~~~~~~~
../easystroke_gestures.cpp:315:59: error: ‘class wf::view_interface_t’ has no member named ‘tile_request’
315 | else target_view->tile_request(wf::TILED_EDGES_ALL);
| ^~~~~~~~~~~~
../easystroke_gestures.cpp:315:76: error: ‘TILED_EDGES_ALL’ is not a member of ‘wf’
315 | else target_view->tile_request(wf::TILED_EDGES_ALL);
| ^~~~~~~~~~~~~~~
../easystroke_gestures.cpp:318:54: error: ‘class wf::view_interface_t’ has no member named ‘move_request’
318 | target_view->move_request();
| ^~~~~~~~~~~~
../easystroke_gestures.cpp:326:54: error: ‘class wf::view_interface_t’ has no member named ‘resize_request’
326 | target_view->resize_request(WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT);
| ^~~~~~~~~~~~~~
[35/37] Compiling C++ object wstroke-config.p/actiondb.cc.o
ninja: build stopped: subcommand failed.

cursor moving with open window after gesture

Hello, i'm not sure if the issue comes from the wstroke plugin or the follow-focus plugin.

I have dual monitors. if i draw a gesture on output 2 which opens a GUI program on output 1, then the mouse will move to output 1.

if i draw a gesture on output 2 and the program's GUI windows also opens on output 2 then the cursor will stay on output 2.

it's not really a terribly big deal. just takes some getting used to. takes me a second to figure out where my cursor is.
i've tried changing some settings in wcm for follow-focus and wstroke but couldn't change the behavior

EDIT: well it's not wstroke. i opened a web link from thunderbird and the cursor moved to my second monitor where firefox opened.

Is Wayfire compatibility close to Wayland compatibiltiy?

Hey just seen your work. Very nice development here. Using easy stroke like a lunatic I'm looking for a possibility to have a mouse gesture app on Wayland?

Is what you created here close to a Wayland compatibility? I didn'T use Wayfire yet and couldn't tell how far a Wayland compatibility is from there?

In any way could you make it Wayland compatible? All coffee on me for this one.

Sending love and blessings. Keep the good work up

build fails against latest wayfire master branch

hello, wayfire updated to wlroots version 0.17.4 recently. maybe that is the cause?

ninja: Entering directory `build'
[14/40] Compiling C object toplevel-grabber/tl_grabber_test.p/toplevel-grabber-test.c.o
../toplevel-grabber/toplevel-grabber-test.c: In function ‘tl_cb’:
../toplevel-grabber/toplevel-grabber-test.c:29:25: warning: unused parameter ‘data’ [-Wunused-parameter]
29 | static void tl_cb(void* data, struct tl_grabber* gr) {
| ~~~~~~^~~~
[20/40] Compiling C object src/libcellib.a.p/cellrenderertextish.c.o
FAILED: src/libcellib.a.p/cellrenderertextish.c.o
cc -Isrc/libcellib.a.p -Isrc -I../src -Iinput-inhibitor -I../input-inhibitor -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/cloudproviders -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/fribidi -I/usr/include/gio-unix-2.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -O0 -g -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -pthread -w -MD -MQ src/libcellib.a.p/cellrenderertextish.c.o -MF src/libcellib.a.p/cellrenderertextish.c.o.d -o src/libcellib.a.p/cellrenderertextish.c.o -c ../src/cellrenderertextish.c
../src/cellrenderertextish.c: In function ‘cell_renderer_textish_class_init’:
../src/cellrenderertextish.c:821:57: error: assignment to ‘GtkCellEditable * (*)(GtkCellRenderer *, GdkEvent *, GtkWidget *, const gchar *, const GdkRectangle *, const GdkRectangle , GtkCellRendererState)’ {aka ‘struct _GtkCellEditable * ()(struct _GtkCellRenderer *, union _GdkEvent *, struct _GtkWidget *, const char *, const struct _cairo_rectangle_int *, const struct _cairo_rectangle_int , GtkCellRendererState)’} from incompatible pointer type ‘GtkCellEditable * ()(GtkCellRenderer *, GdkEvent *, GtkWidget *, const gchar , GdkRectangle , GdkRectangle , GtkCellRendererState)’ {aka ‘struct _GtkCellEditable * ()(struct _GtkCellRenderer , union _GdkEvent , struct _GtkWidget , const char , struct _cairo_rectangle_int , struct _cairo_rectangle_int , GtkCellRendererState)’} [-Wincompatible-pointer-types]
821 | ((GtkCellRendererClass ) klass)->start_editing = (GtkCellEditable (
) (GtkCellRenderer
, GdkEvent
, GtkWidget
, const gchar
, GdkRectangle
, GdkRectangle
, GtkCellRendererState)) cell_renderer_textish_real_start_editing;
| ^
../src/cellrenderertextish.c:822:50: error: assignment to ‘void (
)(GtkCellRenderer *, cairo_t *, GtkWidget *, const GdkRectangle *, const GdkRectangle , GtkCellRendererState)’ {aka ‘void ()(struct _GtkCellRenderer *, struct _cairo *, struct _GtkWidget *, const struct _cairo_rectangle_int *, const struct _cairo_rectangle_int , GtkCellRendererState)’} from incompatible pointer type ‘void ()(GtkCellRenderer *, cairo_t *, GtkWidget *, GdkRectangle , GdkRectangle , GtkCellRendererState)’ {aka ‘void ()(struct _GtkCellRenderer , struct _cairo , struct _GtkWidget , struct _cairo_rectangle_int , struct _cairo_rectangle_int , GtkCellRendererState)’} [-Wincompatible-pointer-types]
822 | ((GtkCellRendererClass ) klass)->render = (void () (GtkCellRenderer
, cairo_t
, GtkWidget
, GdkRectangle
, GdkRectangle
, GtkCellRendererState)) cell_renderer_textish_real_render;
| ^
../src/cellrenderertextish.c:823:52: error: assignment to ‘void (
)(GtkCellRenderer *, GtkWidget *, const GdkRectangle *, gint *, gint *, gint *, gint )’ {aka ‘void ()(struct _GtkCellRenderer *, struct _GtkWidget *, const struct _cairo_rectangle_int *, int *, int *, int *, int )’} from incompatible pointer type ‘void ()(GtkCellRenderer *, GtkWidget *, GdkRectangle *, gint *, gint *, gint *, gint )’ {aka ‘void ()(struct _GtkCellRenderer , struct _GtkWidget , struct _cairo_rectangle_int , int , int , int , int )’} [-Wincompatible-pointer-types]
823 | ((GtkCellRendererClass ) klass)->get_size = (void () (GtkCellRenderer
, GtkWidget
, GdkRectangle
, gint
, gint
, gint
, gint
)) cell_renderer_textish_real_get_size;
| ^
[29/40] Compiling C++ object src/wstroke-config.p/actiondb.cc.o
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().

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.