Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

continuous gestures #205

Closed
Da-Viper opened this issue Sep 30, 2020 · 11 comments
Closed

continuous gestures #205

Da-Viper opened this issue Sep 30, 2020 · 11 comments

Comments

@Da-Viper
Copy link

Is your feature request related to a problem? Please describe.
using the gestures to increase or decrease volume / backlight. the volume is reduced/increased at a rate of 5.
what i want is for it to increase continously as i swipe up

Describe the solution you'd like
the current command i am running is with a keyboard modifier key SHIFT and a 3 swipe up gesture
if i hold the shift and continously swipe up the volume increases.

Describe alternatives you've considered
i have considered setting the intervall/ threshold to 0.1 / 0 but because the gesture is recognised as one gesture is recognised as one gesture, it will only perform it once .

Additional context
if the gestures has something like a timer to say how long the gesture should be

@iberianpig
Copy link
Owner

Are you using fusuma-plugin-keypress?
Could you paste your config.yml?

@Da-Viper
Copy link
Author

Da-Viper commented Oct 1, 2020

@iberianpig here it is

swipe:
  3:
    left:
      command: 'xdotool key alt+Right' # History forward
    right:
      command: 'xdotool key alt+Left' # History back
    up:
      command: 'qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "ShowDesktopGrid"' # Open DesktopGrid
      keypress:
        LEFTSHIFT:
          command: 'xdotool key --clearmodifiers ctrl+shift+t' # Open last closed tab
        LEFTCTRL:
          command: 'qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"' #Volume increase 
        threshold: 0.0
        interval: 0.0
    down:
      command: 'xdotool key ctrl+w' # Close tab
      keypress:
        LEFTCTRL:
          command: 'qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"'
        threshold: 0.0
        interval: 0.0
  4:
    left:
      workspace: 'next' # Switch to next workspace
      keypress:
        LEFTSHIFT: 
          command: 'qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window to Previous Desktop"' # Move window to next workspace
        LEFTMETA:
          command: 'xdotool key --clearmodifiers super+ctrl+Left' # Move window to left side
    right:
      workspace: 'prev' # Switch to previous workspace
      keypress:
        LEFTSHIFT: 
          command: 'qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "Window to Next Desktop"' # Move window to previous workspace
    up:
      command: 'qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "ShowDesktopGrid"' # Workspace overview
      keypress:
        LEFTMETA:
          window:
            maximized: 'toggle' # Toggle Maximize/Unmaximize Window
    down:
      window: 'close' # Close window
      keypress:
        LEFTCTRL:
          command: 'qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut "ExposeClass"' #aaaaa

pinch:
  2:
    in:
      command: 'xdotool keydown ctrl click 4 keyup ctrl' # Zoom in
    out:
      command: 'xdotool keydown ctrl click 5 keyup ctrl' # Zoom out
  4:
    in:
      command: 'xdotool key super+a' # Window overview
    out:
      command: 'xdotool key super+s' # Workspace overview

plugin: 
  inputs:
    libinput_command_input: # options for lib/plugin/inputs/libinput_command_input
      enable-tap: true # click to tap
      enable-dwt: true # disable tap while typing
      show-keycodes: true # https://github.com/iberianpig/fusuma-plugin-keypress#add-show-keycode-option

@HritwikSinghal
Copy link
Contributor

HritwikSinghal commented Oct 16, 2020

it would be great to increase volume/ backlight as we swipe left/right/up/down continiously and not in intervals. If i recall libinput only supports this type of behavior in wayland and not on Xorg. Still @iberianpig if you can implement this, it would be great.

Here is my config on Ubuntu 20.04.1 Wayland.

swipe:
  3:
    left:
      # sendkey: "LEFTALT+RIGHT" # history back
      keypress:
        LEFTCTRL:
          sendkey: "PREVIOUSSONG"
        # LEFTMETA+LEFTALT:
          # sendkey: 'BRIGHTNESSDOWN'

    right:
      # sendkey: "LEFTALT+LEFT" # history forward
      keypress:
        LEFTCTRL:
          sendkey: "NEXTSONG"
        # LEFTMETA+LEFTALT:
        #   sendkey: 'xdotool key --clearmodifiers XF86AudioLowerVolume'

    up:
      sendkey: "LEFTMETA" # Overview
      keypress:
        LEFTCTRL:
          sendkey: "LEFTCTRL+K" # open new tab
        LEFTCTRL+LEFTALT:
          sendkey: 'BRIGHTNESSUP'

    down:
      sendkey: "LEFTMETA" # Overview
      keypress:
        LEFTCTRL:
          sendkey: "LEFTCTRL+COMMA" # close tab
        LEFTCTRL+LEFTALT:
          sendkey: 'BRIGHTNESSDOWN'

  4:
    left:
      sendkey: "VOLUMEDOWN"
    right:
      sendkey: "VOLUMEUP"
#     up:
#       sendkey: "xdotool key ctrl+alt+Down" # Switch to next workspace
#     down:
#       sendkey: "xdotool key ctrl+alt+Up" # Switch to previous workspace
pinch:
  in:
    sendkey: "ZOOMOUT" # Zoom in
  out:
    sendkey: "ZOOMIN" # Zoom out


threshold:
  pinch: 0.4
  swipe: 0.2

interval:
  swipe: 0.8
  pinch: 0.5
  tap: 0.2

tap:
  # 1:
  #   sendkey: "echo ----------------tap1----------------------------"
  # 2:
  #   sendkey: "echo ----------------tap2----------------------------"
  # 3:
  #   sendkey: "echo ----------------tap3----------------------------"
  # 4:
    # sendkey: "PLAYPAUSE"

hold:
#   1:
#     command: "echo ----------------hold1----------------------------"
#   2:
#     command: "echo ----------------hold2----------------------------"
#   3:
#     command: "echo ----------------hold3----------------------------"
  4:
    sendkey: "PLAYPAUSE"

plugin: 
  inputs:
    libinput_command_input:
      enable-tap: true
      verbose: true
      show-keycodes: true

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 19, 2020
@stale stale bot removed the wontfix label Apr 12, 2021
@iberianpig
Copy link
Owner

@Da-Viper @HritwikSinghal

I've implemented continuous gestures. #224

I'm using the following settings on my laptop.

  • 3 fingers rotate
    • => Sound Volume Up/Down
  • pressing LEFT ALT key + 3 fingers rotate
    • => Brightness Up/Down
rotate:
  3:
    clockwise:
      update:
        sendkey: VOLUMEUP
        LEFTALT:
          command: gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.gnome.SettingsDaemon.Power.Screen.StepUp
    counterclockwise:
      update:
        sendkey: VOLUMEDOWN
        LEFTALT:
          command: gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.gnome.SettingsDaemon.Power.Screen.StepDown

@HritwikSinghal
Copy link
Contributor

HritwikSinghal commented Apr 13, 2021

@Da-Viper @HritwikSinghal

I've implemented continuous gestures. #224

I tried continuous gestures for volume and they work flawlessly. Thanks for this update!

Edit: How can i have continuous gesture only when holding special key (like left ctrl) and not for normal gesture?

Also for brightness, i am using sendkey and it is not working. the command fusuma-sendkey BRIGHTNESSDOWN works on terminal ( but first prints out fatal: not a git repository (or any of the parent directories): .git and then lowers brightness) but sendkey: "BRIGHTNESSDOWN" does nothing (it logs that [2021-04-13T09:57:55.125914 #1690119] INFO -- : {:sendkey=>"BRIGHTNESSDOWN"} but does nothing.

This is all on latest versions that were pushed on 12-Apr-2021

@iberianpig
Copy link
Owner

iberianpig commented Apr 13, 2021

fatal: not a git repository (or any of the parent directories): .git

I released fixed versions. This message occurs when loading each plugin's gemspec.

it logs that [2021-04-13T09:57:55.125914 #1690119] INFO -- : {:sendkey=>"BRIGHTNESSDOWN"} but does nothing.

I think that it does not work.
Please press the BRIGHTNESSDOWN and LEFTALT keys on your real keyboard simultaneously. It should not work.
This means that it cannot use "BRIGHTNESSDOWN" and "modifier keys" simultaneously.

@ahmed2m
Copy link

ahmed2m commented Apr 20, 2021

I've a concerns with this approach that I hope there is a way around for them.
If I have my virtual desktops switch on swipe left<->right with 3 fingers and volume on swipe up<->down with 3 fingers like this:

swipe:
  3:
    left:
      update:
          command: 'xdotool key super+Left'
    right:
      update:
        command: 'xdotool key super+Right'

    up:
      update:
        command: 'xdotool key XF86AudioRaiseVolume'
    down:
      update:
        command: 'xdotool key XF86AudioLowerVolume'

This setup implicitly triggers both when I start my gesture as volume control (y-axis) but my fingers go ever slightly to the right I trigger the x-axis combination.

Also I thought about using the new begin, end but I couldn't figure how to only apply them on one section but not the other?
Like with this the up, down don't function (because of the alt press with begin)

swipe:
  3:
    begin:
      command: xdotool keydown super
    right:
      update:
        command: xdotool key Right
        interval: 5
    left:
      update:
        command: xdotool key Left
        interval: 5
    end:
      command: xdotool keyup super+ctrl

    up:
      update:
        command: 'xdotool key XF86AudioRaiseVolume'
    down:
      update:
        command: 'xdotool key XF86AudioLowerVolume'

@iberianpig
Copy link
Owner

Hi @ahmed2m

virtual desktops switch on swipe left<->right with 3 fingers and volume on swipe up<->down with 3 fingers like this:

I don't think continuous gestures that are triggered frequently are suitable for switching virtual desktops. Please use normal one-shot gestures.

swipe:
  3:
    right:
      command: 'xdotool key super+Right'
    left:
      command: 'xdotool key super+Left'
    up:
      update:
        command: 'xdotool key XF86AudioRaiseVolume'
    down:
      update:
        command: 'xdotool key XF86AudioLowerVolume'

@iberianpig
Copy link
Owner

Also I thought about using the new "begin"/"end" but I couldn't figure how to only apply them on one section but not the other?
Like with this the up, down don't function (because of the alt press with begin

As shown in the example below, begin / end can also be used under the direction (right/left/up/down).

swipe:
  3:
    right:
      command: 'xdotool key Right'
      begin:
        command: 'xdotool keydown super'
    left:
      command: 'xdotool key super+Left'
      begin:
        command: 'xdotool keydown super'
    up:
      update:
        command: 'xdotool key XF86AudioRaiseVolume'
    down:
      update:
        command: 'xdotool key XF86AudioLowerVolume'
    end:
      command: 'xdotool keyup super'

Note that keys used with begin will be kept pressed.
To ensure that keys are released at end, it is a good idea to set keyup to the parent property (set to whole).

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

4 participants