Closed ces42 closed 2 years ago
Hi @ces42, thank you so much for your nice pull request!
The failing RSpec, it should probably pass your tests with the following code
diff --git a/spec/lib/libinput_command_spec.rb b/spec/lib/libinput_command_spec.rb
index 949184f..3ecc8f1 100644
--- a/spec/lib/libinput_command_spec.rb
+++ b/spec/lib/libinput_command_spec.rb
@@ -132,8 +132,12 @@ module Fusuma
end
it 'should call dummy events' do
- expect(Process).to receive(:spawn).with('dummy_debug_events',
- { out: @dummy_io, in: '/dev/null' }).once
+ th = double(Thread, pid: 'dummy pid')
+ expect(Open3).to receive(:pipeline_start).with(
+ ['dummy_debug_events'],
+ ['grep -v POINTER_ --line-buffered'],
+ { out: @dummy_io, in: '/dev/null' }
+ ).once.and_return([th])
subject
end
end
I think this is ready now
@ces42 Thank you for your contribution!
On my computer moving the cursor with the touchpad or scrolling would generated quite high (~10%) cpu usage from fusuma. It seems like this is due to the large amount of output generated by
libinput debug-events
. Removing all of thePOINTER_MOTION
andPOINTER_SCROLL_FINGER
events with grep fixed that for me (I guess grep is much more cpu-efficient than ruby...).I already wrote this code for use on my computer so I wasn't sure it was necessary to open an issue before creating this PR
[ ] Follow the instructions in CONTRIBUTING. Most importantly, ensure the tests and linter pass by running
bundle exec rspec
andbundle exec rubocop
.This doesn't introduce any rubocop complaints but rspec needs to be updated (I don't know ruby and don't really have an idea how to do it)
[X] Update code documentation if necessary. Not necessary (I think)