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

Interval and threshold specific for a trigger #92

Merged
merged 3 commits into from Aug 14, 2018

Conversation

irq
Copy link
Contributor

@irq irq commented Aug 14, 2018

I want to be able to use this project for controlling the volume on my computer with a 3 finger swipe, so I added the possibility to add a custom interval and threshold for a trigger.

With this code I can setup my config like below and it will be possible to smoothly control the volume on the touchpad.

swipe:
  3: 
    left: 
      command: 'xdotool key alt+Left'
    right: 
      command: 'xdotool key alt+Right'
    up: 
      command: 'xdotool key XF86AudioRaiseVolume'
      interval: 0.1
      threshold: 0.1
    down: 
      command: 'xdotool key XF86AudioLowerVolume'
      interval: 0.1
      threshold: 0.1
  4:
    left: 
      command: 'xdotool key ctrl+alt+Up'
    right: 
      command: 'xdotool key ctrl+alt+Down'
    up: 
      command: 'xdotool key super'
    down: 
      command: 'xdotool key super'
pinch:
  in:
#    command: 'xdotool key ctrl+plus'
  out:
#    command: 'xdotool key ctrl+minus'

threshold:
  swipe: 0.1
  pinch: 0.4

interval:
  swipe: 1.0
  pinch: 0.1

Let me know what you think. I don't have any experience with Ruby, but I hope it looks good.


context 'when threshold is set on the trigger' do
before do
allow(YAML).to receive(:load_file).and_return keymap_with_trigger_threshold
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[RuboCop]

Metrics/LineLength: Line is too long. [85/80]

{
'swipe' => {
4 => {
'right' => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[RuboCop]

Layout/SpaceAroundOperators: Operator => should be surrounded by a single space.


context 'when interval is set on the trigger' do
before do
allow(YAML).to receive(:load_file).and_return keymap_with_trigger_interval
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[RuboCop]

Metrics/LineLength: Line is too long. [84/80]

'right' => {
'shortcut' => 'alt+Right',
'interval' => 0.3
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[RuboCop]

Style/TrailingCommaInHashLiteral: Avoid comma after the last item of a hash.

'left' => {
'shortcut' => 'alt+Left',
'threshold' => 0.8
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[RuboCop]

Style/TrailingCommaInHashLiteral: Avoid comma after the last item of a hash.

@iberianpig
Copy link
Owner

Perfect! 💯
Thanks for your contribution!

BTW, I will add pinch rotation to fusuma.
I think your improvement will be perfectly fit it.

@iberianpig iberianpig merged commit 326c581 into iberianpig:master Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants