### Fusuma Local Development Gemfile Example Source: https://github.com/iberianpig/fusuma/wiki/fusuma.service-for-local-development An example Gemfile.local for Fusuma, specifying dependencies and loading local Fusuma plugins from a specified path. This file customizes the plugins used by the Fusuma service during development. ```ruby source "https://rubygems.org" # Specify your gem's dependencies in fusuma.gemspec gemspec gem "bump" gem "bundler" gem "github_changelog_generator", "~> 1.16" gem "debug" gem 'rdbg' gem "rake", "~> 13.0" gem "rblineprof" gem "rblineprof-report" gem "reek" gem "rspec", "~> 3.0" gem "rspec-debug" gem "rspec-parameterized" gem "rubocop" gem "simplecov" gem "standard", require: false gem "yard" gem "attractor" gem "attractor-ruby" # additional gem "solargraph" # fusuma plugins for local development [ "iberianpig/fusuma-plugin-sendkey", "iberianpig/fusuma-plugin-wmctrl", "iberianpig/fusuma-plugin-keypress", "iberianpig/fusuma-plugin-appmatcher", "iberianpig/fusuma-plugin-remap", "iberianpig/fusuma-plugin-thumbsense" ].each do |repo| name = repo.split("/").last gem name, path: "~/.ghq/github.com/#{repo}" # Load local plugins from specified path end ``` -------------------------------- ### Run Fusuma (Shell) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Starts the Fusuma gesture recognition service. Once installed and configured, running this command activates Fusuma to monitor and interpret touchpad gestures. ```sh fusuma ``` -------------------------------- ### Install Ruby (Arch Linux) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the Ruby programming language interpreter on Arch-based systems. Fusuma is a Ruby gem, so Ruby must be installed before Fusuma can be installed and used. Gems are typically installed per-user by default on Arch. ```sh sudo pacman -Syu ruby ``` -------------------------------- ### Serve Fusuma Documentation Locally - Shell Source: https://github.com/iberianpig/fusuma/blob/main/CONTRIBUTING.md Starts a local server to preview the generated Fusuma documentation. This allows developers to check how the documentation will appear before deployment. ```sh bundle exec yard server ``` -------------------------------- ### Install Fusuma and Dependencies (Bash) Source: https://context7.com/iberianpig/fusuma/llms.txt Installs Fusuma and its required dependencies on Ubuntu/Debian systems. This includes adding the user to the 'input' group for touchpad access, installing libinput-tools and ruby, and then installing the Fusuma gem. Optional installation of 'xdotool' for keyboard shortcuts and creation of the configuration directory are also included. ```bash sudo gpasswd -a $USER input newgrp input sudo apt-get install libinput-tools ruby sudo gem install fusuma sudo apt-get install xdotool mkdir -p ~/.config/fusuma libinput --version ``` -------------------------------- ### Example Gesture Configuration with Threshold and Interval (YAML) Source: https://github.com/iberianpig/fusuma/blob/main/README.md This YAML example demonstrates how to configure gesture sensitivity (threshold) and timing (interval) for swipe and pinch gestures. It shows both individual gesture settings and global overrides for threshold and interval. ```yaml swipe: 3: left: command: 'xdotool key alt+Right' # threshold: 0.5, interval: 0.75 threshold: 0.5 right: command: 'xdotool key alt+Left' # threshold: 0.5, interval: 0.75 threshold: 0.5 up: command: 'xdotool key super' # threshold: 1, interval: 0.75 down: command: 'xdotool key super' # threshold: 1, interval: 0.75 pinch: 2: in: command: "xdotool keydown ctrl click 4 keyup ctrl" # threshold: 0.5, interval: 0.5 out: command: "xdotool keydown ctrl click 5 keyup ctrl" # threshold: 0.5, interval: 0.5 threshold: pinch: 0.5 interval: swipe: 0.75 pinch: 0.5 ``` -------------------------------- ### Install Fusuma Gem (Shell) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the Fusuma gem using RubyGems. This is the primary method for installing Fusuma on most Linux distributions. Ensure Ruby is installed first. ```sh sudo gem install fusuma ``` -------------------------------- ### Install Project Dependencies - Shell Source: https://github.com/iberianpig/fusuma/blob/main/CONTRIBUTING.md Installs the top-level project dependencies using Bundler. This command reads the project's Gemfile and installs all required gems. ```sh bundle install ``` -------------------------------- ### Install Fusuma Plugin with Gem Source: https://github.com/iberianpig/fusuma/blob/main/README.md This command-line snippet illustrates how to install a specific Fusuma plugin using the RubyGems package manager. Replace `XXXXX` with the actual plugin name. ```sh # install fusuma-plugin-XXXX sudo gem install fusuma-plugin-XXXXX ``` -------------------------------- ### Install Ruby (Fedora) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the Ruby programming language interpreter on Fedora systems. Fusuma is a Ruby gem, so Ruby must be installed before Fusuma can be installed and used. ```sh sudo dnf install ruby ``` -------------------------------- ### Install libinput Dependencies (Bash) Source: https://github.com/iberianpig/fusuma/wiki/Use-latest-libinput-on-fusuma Installs the required packages for building libinput from source on Debian-based systems using apt. This includes build tools like ninja-build and meson, along with development headers for libudev, libevdev, and libmtdev. ```bash sudo apt install ninja-build meson libudev-dev libevdev-dev libmtdev-dev ``` -------------------------------- ### Fusuma CLI Usage Examples (Bash) Source: https://context7.com/iberianpig/fusuma/llms.txt Demonstrates various command-line options for running Fusuma. Includes running in the foreground, as a daemon with logging, using custom configuration files, listing devices, showing configuration, verbose debugging, and checking the version. ```bash # Run Fusuma in foreground fusuma # Run as daemon with log file fusuma -d --log=/tmp/fusuma.log # Use custom config file fusuma -c /path/to/custom/config.yml # List available input devices fusuma -l # Show loaded configuration fusuma --show-config # Verbose output for debugging fusuma -v # Check version fusuma --version ``` -------------------------------- ### Autostart Fusuma via Systemd User Service (Bash) Source: https://context7.com/iberianpig/fusuma/llms.txt Details how to set up Fusuma to start automatically at login using a systemd user service. This involves creating a .service file and using systemctl commands to enable and start the service. ```bash # Method 2: Systemd user service cat > ~/.config/systemd/user/fusuma.service <<'EOF' [Unit] Description=Fusuma multitouch gesture recognizer After=graphical-session.target [Service] Type=simple ExecStart=/usr/local/bin/fusuma Restart=on-failure [Install] WantedBy=graphical-session.target EOF systemctl --user enable fusuma.service systemctl --user start fusuma.service systemctl --user status fusuma ``` -------------------------------- ### Install libinput (Fedora) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the 'libinput' library on Fedora. This is a prerequisite for Fusuma, ensuring proper input device handling, specifically requiring libinput version 1.0 or later. ```sh sudo dnf install libinput ``` -------------------------------- ### Update All Fusuma Plugins with Gem Source: https://github.com/iberianpig/fusuma/blob/main/README.md This command-line snippet demonstrates how to update all installed Fusuma plugins. It lists all installed plugins starting with 'fusuma-plugin-', extracts their names, and then updates them using `gem update`. ```sh # update sudo gem list fusuma-plugin- | cut -d' ' -f1 | xargs --no-run-if-empty sudo gem update ``` -------------------------------- ### Install Ruby (Debian/Ubuntu) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the Ruby programming language interpreter on Debian-based systems. Fusuma is a Ruby gem, so Ruby must be installed before Fusuma can be installed and used. ```sh sudo apt-get install ruby ``` -------------------------------- ### Fusuma Systemd User Service Configuration Source: https://github.com/iberianpig/fusuma/wiki/fusuma.service-for-local-development The systemd unit file content for configuring the Fusuma service. It specifies the service description, execution command with rbenv and bundler, working directory, and environment variables for the Gemfile. ```ini [Unit] Description=Fusuma for development After=default.target [Service] # Use bundler (bundler is installed in ~/.rbenv/shims with rbenv) ExecStart=%h/.rbenv/shims/bundle exec fusuma --verbose # Directory where Gemfile is located WorkingDirectory=%h/.ghq/github.com/iberianpig/fusuma/ # Specify BUNDLE_GEMFILE for customized Gemfile Environment="BUNDLE_GEMFILE=Gemfile.local" [Install] WantedBy=default.target ``` -------------------------------- ### Install libinput-tools (Debian/Ubuntu) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the 'libinput-tools' package on Debian-based distributions like Ubuntu. This is a prerequisite for Fusuma, ensuring proper input device handling, specifically requiring libinput version 1.0 or later. ```sh sudo apt-get install libinput-tools ``` -------------------------------- ### Systemd User Service Management for Fusuma Source: https://github.com/iberianpig/fusuma/wiki/fusuma.service-for-local-development Commands to manage the fusuma.service systemd user service, including enabling, disabling, reloading, and restarting. These commands are essential for controlling the Fusuma development service. ```shell mkdir -p ~/.config/systemd/user/ systemctl --user enable fusuma.service systemctl --user daemon-reload && systemctl --user restart fusuma.service journalctl --user -u fusuma.service -f systemctl --user disable fusuma.service rm ~/.config/systemd/user/fusuma.service ``` -------------------------------- ### Install Bundler - Shell Source: https://github.com/iberianpig/fusuma/blob/main/CONTRIBUTING.md Installs the Bundler gem, a dependency manager for Ruby projects. This is a prerequisite for managing project dependencies. ```sh gem install bundler ``` -------------------------------- ### Example Gesture Mapping Configuration for Ubuntu (YAML) Source: https://github.com/iberianpig/fusuma/blob/main/README.md This YAML configuration maps swipe and pinch gestures to specific xdotool commands for desktop actions on Ubuntu. It shows how to define commands for different finger counts and directions, including zoom actions. ```yaml swipe: 3: left: command: "xdotool key alt+Right" # History forward right: command: "xdotool key alt+Left" # History back up: command: "xdotool key super" # Activity down: command: "xdotool key super" # Activity 4: left: command: "xdotool key ctrl+alt+Down" # Switch to next workspace right: command: "xdotool key ctrl+alt+Up" # Switch to previous workspace up: command: "xdotool key ctrl+alt+Down" # Switch to next workspace down: command: "xdotool key ctrl+alt+Up" # Switch to previous workspace pinch: in: command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in out: command: "xdotool keydown ctrl click 5 keyup ctrl" # Zoom out hold: 4: command: "xdotool key super" # Activity ``` -------------------------------- ### Install xdotool (Arch Linux) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the 'xdotool' utility on Arch-based systems. This is an optional dependency useful for sending keyboard shortcuts and performing other X11 window manipulation tasks, often used in conjunction with Fusuma. ```sh sudo pacman -Syu xdotool ``` -------------------------------- ### Install libinput (Arch Linux) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the 'libinput' library on Arch-based distributions like Manjaro. This is a prerequisite for Fusuma, ensuring proper input device handling, specifically requiring libinput version 1.0 or later. This package is often pre-installed. ```sh sudo pacman -Syu libinput ``` -------------------------------- ### Install xdotool (Fedora) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the 'xdotool' utility on Fedora. This is an optional dependency useful for sending keyboard shortcuts and performing other X11 window manipulation tasks, often used in conjunction with Fusuma. ```sh sudo dnf install xdotool ``` -------------------------------- ### Fusuma Gesture Threshold and Interval Settings (YAML) Source: https://context7.com/iberianpig/fusuma/llms.txt Illustrates how to configure gesture sensitivity (threshold) and delay (interval) in Fusuma. This example shows specific settings for 3-finger left swipe and global settings for swipe, pinch, and rotate gestures, allowing fine-tuning of gesture recognition. ```yaml swipe: 3: left: command: 'xdotool key alt+Right' threshold: 0.5 # Half the default sensitivity interval: 0.75 # Shorter delay between gestures right: command: 'xdotool key alt+Left' threshold: 0.5 # Global threshold and interval settings threshold: swipe: 1.0 # Default multiplier pinch: 0.5 # More sensitive pinch rotate: 0.8 interval: swipe: 0.75 # 75% of default interval pinch: 0.5 # Faster pinch repetition hold: 1.5 # Longer hold delay ``` -------------------------------- ### Install xdotool (Debian/Ubuntu) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Installs the 'xdotool' utility on Debian-based systems. This is an optional dependency useful for sending keyboard shortcuts and performing other X11 window manipulation tasks, often used in conjunction with Fusuma. ```sh sudo apt-get install xdotool ``` -------------------------------- ### Hold Gesture Detection Configuration (Ruby) Source: https://context7.com/iberianpig/fusuma/llms.txt Provides an example of configuring the HoldDetector for press-and-hold gestures. It outlines the parameters for threshold and finger count, and includes comments on timer integration and status events. ```ruby require 'fusuma/plugin/detectors/hold_detector' # HoldDetector configuration # BASE_THRESHOLD = 0.7 (seconds) # FINGERS = [1, 2, 3, 4] (requires libinput 1.19+) # Status: begin, end, cancelled, timer # Example configuration for hold gestures # hold: # 2: # threshold: 1.5 # 1.05 seconds (0.7 * 1.5) # command: "notify-send 'Two finger hold'" # 4: # threshold: 0.8 # 0.56 seconds (0.7 * 0.8) # command: "xdotool key super" # Timer integration for hold duration # The detector uses TimerInput to track holding time # and triggers when threshold is exceeded ``` -------------------------------- ### Configure Fusuma Swipe Gestures for KDE Source: https://github.com/iberianpig/fusuma/wiki/KDE-to-mimic-MacOS This configuration maps multi-finger swipe gestures to common desktop actions in KDE, such as navigating history, managing tabs, switching workspaces, and manipulating windows. It utilizes xdotool for command execution. Ensure necessary plugins like fusuma-plugin-wmctrl and fusuma-plugin-keypress are installed. ```yaml swipe: 4: right: command: 'xdotool key alt+Right' # History forward left: command: 'xdotool key alt+Left' # History back up: command: 'xdotool key ctrl+t' # Open new tab keypress: LEFTSHIFT: command: 'xdotool key --clearmodifiers ctrl+shift+t' # Open last closed tab down: command: 'xdotool key ctrl+w' # Close tab 3: left: workspace: 'next' # Switch to next workspace keypress: LEFTSHIFT: window: 'next' # 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: window: 'prev' # Move window to previous workspace LEFTMETA: command: 'xdotool key --clearmodifiers super+ctrl+Right' # Move window to right side up: command: 'xdotool key Control_L+F10' # Workspace overview keypress: LEFTMETA: window: maximized: 'toggle' # Toggle Maximize/Unmaximize Window down: command: 'xdotool key Control_L+F12' #minimise all windows keypress: LEFTMETA: window: 'close' # Close window ``` -------------------------------- ### Check Code Style with Rubocop - Shell Source: https://github.com/iberianpig/fusuma/blob/main/CONTRIBUTING.md Runs Rubocop, a static code analyzer, to check the code against the established Ruby style guide. This helps maintain consistent code quality across the project. ```sh bundle exec rubocop ``` -------------------------------- ### Fusuma Plugin System - Base Plugin Class (Ruby) Source: https://context7.com/iberianpig/fusuma/llms.txt Provides the starting point for creating custom plugins for Fusuma using Ruby. It defines the structure of a base plugin class, intended to be extended for specific functionalities. ```ruby class Fusuma::Plugin::Base # ... plugin implementation ... end ``` -------------------------------- ### Create Fusuma Desktop Entry in INI Source: https://github.com/iberianpig/fusuma/blob/main/README.md This snippet shows how to create a `.desktop` file to autostart Fusuma. It specifies the application name, comment, the command to execute (including daemonize and log file options), icon, and enables GNOME autostart. The `{path_to_fusuma}` placeholder needs to be replaced with the actual path to the fusuma executable. ```ini [Desktop Entry] Name=fusuma Comment=run fusuma Exec={path_to_fusuma} -d --log=/tmp/fusuma.log Icon=input-touchpad X-GNOME-Autostart-enabled=true Type=Application ``` -------------------------------- ### Autostart Fusuma via Desktop Entry (Bash) Source: https://context7.com/iberianpig/fusuma/llms.txt Provides instructions on how to configure Fusuma to run automatically at login using a desktop entry file. This method involves creating a .desktop file in the autostart directory and setting execute permissions. ```bash # Method 1: Using desktop entry cat > ~/.config/autostart/fusuma.desktop <<'EOF' [Desktop Entry] Name=fusuma Comment=Multitouch gesture recognition Exec=/usr/local/bin/fusuma -d --log=/tmp/fusuma.log Icon=input-touchpad X-GNOME-Autostart-enabled=true Type=Application EOF chmod +x ~/.config/autostart/fusuma.desktop ``` -------------------------------- ### Create Fusuma Configuration Directory and File Source: https://github.com/iberianpig/fusuma/blob/main/README.md This snippet demonstrates the shell commands to create the necessary directory for Fusuma's configuration and to open the configuration file in the nano editor. It ensures that the configuration directory exists before attempting to edit the file. ```shell mkdir -p ~/.config/fusuma # create config directory nano ~/.config/fusuma/config.yml # edit config file. ``` -------------------------------- ### Clone libinput Repository (Bash) Source: https://github.com/iberianpig/fusuma/wiki/Use-latest-libinput-on-fusuma Clones the official libinput Git repository from its GitLab instance and navigates into the newly created directory. This is the first step in obtaining the source code for building. ```bash git clone https://gitlab.freedesktop.org/libinput/libinput cd libinput ``` -------------------------------- ### Advanced Gesture Configuration with Contextual Commands (YAML) Source: https://context7.com/iberianpig/fusuma/llms.txt Demonstrates advanced gesture configuration using YAML, specifically for swipe gestures. It shows how to define actions (commands) for different stages of a gesture: begin, update, and end, allowing for context-aware command execution. ```yaml swipe: 3: left: begin: command: "notify-send 'Swipe started'" update: command: "echo 'Swiping...'" # Called repeatedly during swipe end: command: "xdotool key alt+Right" # Final action ``` -------------------------------- ### Build Specific libinput Version (Bash) Source: https://github.com/iberianpig/fusuma/wiki/Use-latest-libinput-on-fusuma Builds a specific version of libinput from source. It checks out the desired tag, creates a build directory, configures the build using meson with specific options (disabling libwacom, debug GUI, tests, and documentation), and then compiles the code using ninja. Finally, it verifies the build by checking the version. ```bash version=1.28.1 git clone https://gitlab.freedesktop.org/libinput/libinput cd libinput git checkout $version mkdir builddir/$version meson --prefix=/usr builddir/$version/ -Dlibwacom=false -Ddebug-gui=false -Dtests=false -Ddocumentation=false --reconfigure ninja -C builddir/$version/ builddir/$version/libinput --version # 1.28.1 ``` -------------------------------- ### Configure Fusuma Plugin Inputs Source: https://github.com/iberianpig/fusuma/wiki/Another-setup-for-KDE Enable and configure plugin inputs, such as libinput. Options include showing keycodes, enabling tap-to-click, disabling tap while typing, and enabling verbose logging. ```yaml plugin: inputs: libinput_command_input: show-keycodes: true enable-tap: true # click to tap enable-dwt: true # disable tap while typing verbose: true ``` -------------------------------- ### Fusuma General Thresholds and Intervals Configuration (YAML) Source: https://github.com/iberianpig/fusuma/wiki/Ubuntu-Gnome-(Wayland) Sets global thresholds and intervals for swipe and pinch gestures in Fusuma. These parameters control the sensitivity and timing of gesture recognition. ```yaml threshold: swipe: 0.3 pinch: 1 interval: swipe: 1 pinch: 1 ``` -------------------------------- ### Control+Shift Swipe for DeepL Translation Source: https://github.com/iberianpig/fusuma/wiki/Open-DeepL-with-3-fingers-drag-while-holding-down-Ctrl-and-Shift Sets up a key combination (LEFTCTRL+LEFTSHIFT) that, after a mouse button is released, captures selected text using `xsel`, URL-encodes it using Ruby's ERB module, and opens a new incognito Google Chrome window with the text translated on DeepL. ```yaml swipe: 3: end: keypress: LEFTSHIFT+LEFTCTRL: &deepl command: | xdotool mouseup 1 text=$(xsel -p | ruby -r 'erb' -ne 'puts ERB::Util.url_encode $_') google-chrome --incognito --app=deepl.com "https://www.deepl.com/translator#en/ja/$text" LEFTCTRL+LEFTSHIFT: <<: *deepl ``` -------------------------------- ### Configure Fusuma Input Plugin (YAML) Source: https://github.com/iberianpig/fusuma/wiki/Use-latest-libinput-on-fusuma Configures the fusuma input plugin to use a custom-built libinput binary. This involves specifying the path to the libinput executable within the plugin's configuration file, typically ~/.config/fusuma/config.yml. Ensure the provided path accurately points to the compiled binary. ```yaml plugin: inputs: libinput_command_input: libinput-command: /path/to/libinput/builddir/1.28.1/libinput ``` -------------------------------- ### Configure Fusuma Pinch Gestures for KDE Source: https://github.com/iberianpig/fusuma/wiki/KDE-to-mimic-MacOS This configuration defines actions for pinch gestures on a touchpad, including zooming in/out of applications and opening different overview modes. It relies on xdotool for executing the specified commands. Note the use of keydown/keyup for modifier keys during zoom actions. ```yaml 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 ``` -------------------------------- ### Configure Hold Gestures for Overview and Refresh - Fusuma Configuration Source: https://github.com/iberianpig/fusuma/wiki/(Workspace|Chrome-tab|Window)-Management Sets up hold gestures for accessing different system overviews and refreshing tabs using xdotool. A hold gesture can bring up the window overview, workspace overview, or refresh the current tab. ```yaml hold: 2: command: "xdotool key super" # Window overview 3: command: "xdotool keydown super keyup super keydown super keyup super" # Workspace overview 4: command: "xdotool key F5" # Refresh the tab ``` -------------------------------- ### Configure Fusuma libinput Command Input Options Source: https://github.com/iberianpig/fusuma/wiki/KDE-to-mimic-MacOS This snippet shows how to configure input options for the libinput command input plugin within Fusuma. These settings control tap-to-click behavior and disabling taps while typing, enhancing touchpad usability. The `show-keycodes` option is useful for debugging. ```yaml 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 ``` -------------------------------- ### LibinputCommand Wrapper for CLI Interaction (Ruby) Source: https://context7.com/iberianpig/fusuma/llms.txt This Ruby code demonstrates how to use the `Fusuma::LibinputCommand` class to interact with libinput command-line tools. It includes functionalities for checking version compatibility, listing devices, and monitoring events. ```ruby require 'fusuma/libinput_command' # Create libinput command wrapper libinput = Fusuma::LibinputCommand.new( libinput_options: ['--enable-tap', '--enable-dwt'], commands: { libinput_command: 'libinput', debug_events_command: 'libinput debug-events', list_devices_command: 'libinput list-devices' } ) # Check version compatibility puts "Libinput version: #{libinput.version}" puts "New CLI available: #{libinput.new_cli_option_available?}" # List available devices libinput.list_devices do |line| puts line if line.include?("Device:") end # Start monitoring events (creates subprocess) reader, writer = IO.pipe libinput.debug_events(writer) # Read gesture events reader.each_line do |line| puts "Event: #{line}" if line.include?("GESTURE") end ``` -------------------------------- ### Fusuma Plugin Manager (Ruby) Source: https://context7.com/iberianpig/fusuma/llms.txt Details the functionality of the Plugin Manager for discovering and loading Fusuma plugins. It shows how to list registered plugins, require base plugins, check loaded paths, and explains the automatic registration process. ```ruby require 'fusuma/plugin/manager' require 'fusuma/plugin/base' # Automatically loads plugins from: # 1. lib/fusuma/plugin/*/ (built-in plugins) # 2. Gem paths matching fusuma-plugin-* (external plugins) # List all registered plugins Fusuma::Plugin::Manager.plugins # => { # "Fusuma::Plugin::Inputs::Input" => [...], # "Fusuma::Plugin::Detectors::Detector" => [SwipeDetector, PinchDetector, ...], # "Fusuma::Plugin::Executors::Executor" => [CommandExecutor, ...] # } # Load base plugins Fusuma::Plugin::Manager.require_base_plugins # Check loaded paths Fusuma::Plugin::Manager.load_paths # => ["/path/to/fusuma/lib/fusuma/plugin/inputs/input.rb", ...] # Plugin registration happens automatically via inherited callback # When a class inherits from Plugin::Base, it's registered automatically ``` -------------------------------- ### Migrating from shortcut to command Property (Diff) Source: https://github.com/iberianpig/fusuma/blob/main/README.md This diff shows the migration from the deprecated `shortcut:` property to the current `command:` property in Fusuma configuration files. It illustrates how to update gesture mappings to use the new syntax, ensuring compatibility with newer versions. ```diff swipe: 3: left: - shortcut: 'alt+Left' + command: 'xdotool key alt+Left' right: - shortcut: 'alt+Right' + command: 'xdotool key alt+Right' ``` -------------------------------- ### Configure Swipe Gestures for Workspace Switching - Fusuma Configuration Source: https://github.com/iberianpig/fusuma/wiki/(Workspace|Chrome-tab|Window)-Management Defines swipe gestures on touchpad to switch between workspaces using xdotool. Swipe left switches to the next workspace, and swipe right switches to the previous one. Up and down swipes adjust window layouts. ```yaml swipe: 3: left: command: "xdotool key super+Page_Down" # Switch to next workspace right: command: "xdotool key super+Page_Up" # Switch to previous workspace up: command: "xdotool key super+Left" # Window layout left down: command: "xdotool key super+Right" # Window layout right ``` -------------------------------- ### Configure Swipe and Pinch Gestures in YAML Source: https://github.com/iberianpig/fusuma/wiki/Ubuntu-OS-to-mimic-Mac-a-little This snippet defines touchpad gestures for Fusuma using YAML. It maps swipe gestures (3 and 4 fingers) and pinch gestures (in/out) to specific shell commands, such as 'xdotool key' for simulating key presses. It also includes settings for gesture thresholds and intervals. ```yaml swipe: 3: left: command: 'xdotool key alt+Shift+Tab' right: command: 'xdotool key alt+Tab' up: command: 'xdotool key super' down: command: 'xdotool key super' 4: up: command: 'xdotool key super+m' down: command: 'xdotool key super+m' pinch: in: command: 'xdotool key super+a' threshold: 0.1 out: command: 'xdotool key super' threshold: 0.1 threshold: swipe: 1 pinch: 1 interval: swipe: 1 pinch: 1 ``` -------------------------------- ### Basic Fusuma Gesture Configuration (YAML) Source: https://context7.com/iberianpig/fusuma/llms.txt Defines a basic gesture configuration file for Fusuma, mapping multitouch gestures (3-finger swipes, 4-finger swipes, 2-finger pinch, 4-finger hold) to specific shell commands, often using 'xdotool' for key presses or window actions. ```yaml # ~/.config/fusuma/config.yml # 3-finger swipe gestures swipe: 3: left: command: "xdotool key alt+Right" # Browser forward right: command: "xdotool key alt+Left" # Browser back up: command: "xdotool key super" # Show activities down: command: "xdotool key super" # Show activities # 4-finger workspace switching 4: left: command: "xdotool key ctrl+alt+Down" right: command: "xdotool key ctrl+alt+Up" # Pinch gestures for zoom pinch: 2: in: command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in out: command: "xdotool keydown ctrl click 5 keyup ctrl" # Zoom out # Hold gestures (requires libinput 1.19+) hold: 4: command: "xdotool key super" # Show activities on 4-finger hold ``` -------------------------------- ### Run Fusuma Tests - Shell Source: https://github.com/iberianpig/fusuma/blob/main/CONTRIBUTING.md Executes the project's tests using RSpec. Contributions should include tests to ensure code behaves as expected. ```sh bundle exec rspec ``` -------------------------------- ### Configure Fusuma Plugin Input for libinput Source: https://github.com/iberianpig/fusuma/wiki/configuration-for-max-efficiency This snippet shows how to configure the input for a Fusuma plugin, specifically for `libinput_command_input`. It includes an option to enable the display of keycodes, which can be useful for debugging and understanding input events. ```yaml plugin: inputs: libinput_command_input: show-keycodes: true ``` -------------------------------- ### Configure Pinch Gestures for Window Management - Fusuma Configuration Source: https://github.com/iberianpig/fusuma/wiki/(Workspace|Chrome-tab|Window)-Management Defines pinch gestures for window manipulation using xdotool. Pinch in maximizes the current window, and pinch out minimizes it. These actions are mapped to specific key combinations. ```yaml pinch: 3: in: command: "xdotool key super+Up" # Maximize window out: command: "xdotool key super+Down" # Minimize window ``` -------------------------------- ### Fusuma Swipe Gestures Configuration (YAML) Source: https://github.com/iberianpig/fusuma/wiki/Ubuntu-Gnome-(Wayland) Defines swipe gestures for Fusuma, mapping three-finger swipes (left, right, up, down) to specific 'sendkey' commands. These commands simulate keyboard shortcuts. ```yaml swipe: 3: left: sendkey: 'LEFTALT+RIGHT' right: sendkey: 'LEFTALT+LEFT' up: sendkey: 'LEFTCTRL+T' down: sendkey: 'LEFTCTRL+W' ``` -------------------------------- ### Generate Fusuma Documentation - Shell Source: https://github.com/iberianpig/fusuma/blob/main/CONTRIBUTING.md Generates documentation for the Fusuma project using YARD. The `--fail-on-warning` flag ensures that documentation generation fails if any warnings are encountered. ```sh bundle exec yard --fail-on-warning ``` -------------------------------- ### Command Executor for Gestures (Ruby) Source: https://context7.com/iberianpig/fusuma/llms.txt Shows how to use the CommandExecutor to run shell commands based on detected gestures. It includes checking if an event is executable and executing commands with gesture data passed as environment variables. ```ruby require 'fusuma/plugin/executors/command_executor' require 'fusuma/plugin/events/event' require 'fusuma/plugin/events/records/index_record' executor = Fusuma::Plugin::Executors::CommandExecutor.new # Check if event is executable index = Fusuma::Config::Index.new(['swipe', 3, 'left']) record = Fusuma::Plugin::Events::Records::IndexRecord.new( index: index, trigger: :oneshot, args: { move_x: 150, move_y: 20 } ) event = Fusuma::Plugin::Events::Event.new( tag: 'swipe_detector', record: record ) # Execute command with environment variables # Command receives gesture data as environment variables: # - move_x, move_y (for swipe) # - zoom (for pinch) # - rotate (for rotate) executor.execute(event) if executor.executable?(event) # Acceleration multiplier # accel: 2.0 # Doubles gesture parameter values ``` -------------------------------- ### Fusuma Config Class for Loading and Searching Settings (Ruby) Source: https://context7.com/iberianpig/fusuma/llms.txt This Ruby snippet shows how to use the `Fusuma::Config` and `Fusuma::Config::Index` classes to manage application settings. It covers setting custom configuration paths, searching for specific configuration values by index, and reloading the configuration. ```ruby require 'fusuma/config' require 'fusuma/config/index' # Set custom config path Fusuma::Config.custom_path = '/path/to/config.yml' # Search for specific configuration index = Fusuma::Config::Index.new(['swipe', 3, 'left', 'command']) command = Fusuma::Config.search(index) # => "xdotool key alt+Right" # Search threshold threshold_index = Fusuma::Config::Index.new(['threshold', 'swipe']) threshold = Fusuma::Config.search(threshold_index) # => 1.0 # Find execute key for index gesture_index = Fusuma::Config::Index.new(['swipe', 3, 'left']) execute_key = Fusuma::Config.instance.find_execute_key(gesture_index) # => :command # Reload configuration Fusuma::Config.instance.reload ``` -------------------------------- ### Configure Swipe Gestures with xdotool Commands Source: https://github.com/iberianpig/fusuma/wiki/configuration-for-max-efficiency This snippet configures swipe gestures on a touchpad using the Fusuma tool. It maps swipe actions (e.g., left, right, up, down) to specific shell commands executed via `xdotool`. This allows for custom window management and application switching. ```yaml swipe: 3: left: command: "xdotool key alt+Shift+Tab" right: command: "xdotool key alt+Tab" up: window: maximized: toggle down: command: "xdotool key super+h" #hide 4: left: command: "xdotool key super+Left" # Move window to left side keypress: LEFTSHIFT: window: 'prev' # nove window to prev right: command: "xdotool key super+Right" # Move window to right side keypress: LEFTSHIFT: window: 'next' # Move window to next up: command: "xdotool key ctrl+alt+Up" # Switch to prev down: command: "xdotool key ctrl+alt+Down" # Switch to next ``` -------------------------------- ### Configure Fusuma Input Plugin Settings Source: https://github.com/iberianpig/fusuma/wiki/Gnome-to-Mimic-ChromeOS-a-little-&-Extras This section outlines the settings for the libinput command input plugin in Fusuma. It enables features like showing keycodes, tap-to-click, and disabling tap while typing, along with verbose logging. ```yaml plugin: inputs: libinput_command_input: show-keycodes: true enable-tap: true # click to tap enable-dwt: true # disable tap while typing verbose: true# ``` -------------------------------- ### Fusuma Pinch Gestures Configuration (YAML) Source: https://github.com/iberianpig/fusuma/wiki/Ubuntu-Gnome-(Wayland) Configures pinch gestures for Fusuma, including two-finger pinch-in and pinch-out mapped to zoom commands, and four-finger gestures mapped to GNOME Shell D-Bus commands for managing the overview. ```yaml pinch: 2: in: sendkey: 'LEFTCTRL+EQUAL' threshold: 0.1 out: sendkey: 'LEFTCTRL+MINUS' threshold: 0.1 4: in: command: "dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'if (Main.overview.visible && Main.overview.viewSelector._showAppsButton.checked) { Main.overview.hide();Main.overview.viewSelector._showAppsButton.checked=false;} else {Main.overview.show()}'" threshold: 1 interval: 2 out: command: "dbus-send --session --type=method_call --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'if (Main.overview.visible && !Main.overview.viewSelector._showAppsButton.checked) {Main.overview.hide()} else { Main.overview.viewSelector._showAppsButton.checked = true;Main.overview.show();}'" threshold: 1 interval: 2 ``` -------------------------------- ### Fusuma Swipe Gestures Configuration (YAML) Source: https://github.com/iberianpig/fusuma/wiki/elementary-OS Defines configurations for swipe gestures in Fusuma. It maps different swipe directions (left, right, up, down) with varying finger counts (3, 4) to specific shell commands using 'xdotool' or workspace/window actions. Includes sub-configurations for keypress modifiers like LEFTCTRL, LEFTSHIFT, and LEFTMETA. ```yaml swipe: 3: left: command: 'xdotool key alt+Right' # History forward keypress: LEFTCTRL: command: 'xdotool key ctrl+Tab' # Next tab right: command: 'xdotool key alt+Left' # History back keypress: LEFTCTRL: command: 'xdotool key ctrl+shift+Tab' # Prev tab up: command: 'xdotool key ctrl+t' # Open new tab keypress: LEFTSHIFT: command: 'xdotool key --clearmodifiers ctrl+shift+t' # Open last closed tab down: command: 'xdotool key ctrl+w' # Close tab 4: left: workspace: 'next' # Switch to next workspace keypress: LEFTSHIFT: window: 'next' # 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: window: 'prev' # Move window to previous workspace LEFTMETA: command: 'xdotool key --clearmodifiers super+ctrl+Right' # Move window to right side up: command: 'xdotool key super+s' # Workspace overview keypress: LEFTMETA: window: maximized: 'toggle' # Toggle Maximize/Unmaximize Window down: command: 'xdotool key super+a' # Window overview keypress: LEFTMETA: window: 'close' # Close window ``` -------------------------------- ### Fusuma Plugin Input Configuration (libinput) Source: https://github.com/iberianpig/fusuma/wiki/KDE-with-kwin-tiling Configures input settings for the libinput command input plugin. This includes options for enabling tap-to-click, disabling taps while typing, showing keycodes for debugging, and enabling verbose output for troubleshooting. ```yaml 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 verbose: true ``` -------------------------------- ### Fusuma Rotate Gestures Configuration (YAML) Source: https://github.com/iberianpig/fusuma/wiki/elementary-OS Sets up rotate gestures in Fusuma. It maps clockwise and counterclockwise rotations with 2 or 3 fingers to volume control and screen brightness adjustments using 'xdotool' commands. ```yaml rotate: 2: clockwise: command: 'xdotool key XF86AudioRaiseVolume' # Volume up counterclockwise: command: 'xdotool key XF86AudioLowerVolume' # Volume down 3: clockwise: command: 'xdotool key XF86MonBrightnessUp' # Brightness up counterclockwise: command: 'xdotool key XF86MonBrightnessDown' # Brightness down ``` -------------------------------- ### Configure Fusuma Global Settings Source: https://github.com/iberianpig/fusuma/wiki/Another-setup-for-KDE Set global thresholds and intervals for swipe gestures to control sensitivity and prevent accidental triggers. Thresholds determine the distance for a gesture to be recognized, while intervals define the minimum time between gestures. ```yaml threshold: swipe: 0.45 interval: swipe: 0.45 ``` -------------------------------- ### Configure Swipe Gestures for Tab Management - Fusuma Configuration Source: https://github.com/iberianpig/fusuma/wiki/(Workspace|Chrome-tab|Window)-Management Configures swipe gestures for managing browser tabs using xdotool. Swipe up opens a new tab, and swipe down closes the current tab. Swipe left and right, with begin, update, and end states, navigate through tabs. ```yaml swipe: 4: left: begin: command: "xdotool keydown ctrl" update: command: "xdotool key ctrl+Page_Up" # Switch to previous tab interval: 0.8 end: command: "xdotool keyup ctrl" right: begin: command: "xdotool keydown ctrl" update: command: "xdotool key ctrl+Page_Down" # Switch to next tab interval: 0.8 end: command: "xdotool keyup ctrl" up: command: "xdotool key ctrl+t" # Open new tab down: command: "xdotool key ctrl+w" # Close the tab ``` -------------------------------- ### Configure Pinch Gestures for Zooming with xdotool Source: https://github.com/iberianpig/fusuma/wiki/configuration-for-max-efficiency This configuration defines pinch gestures for zooming in and out using Fusuma. It maps the 'pinch in' and 'pinch out' actions to specific `xdotool` commands that simulate holding the Ctrl key and using the mouse wheel (button 4 for zoom in, button 5 for zoom out). ```yaml pinch: in: command: "xdotool keydown ctrl click 4 keyup ctrl" # Zoom in out: command: "xdotool keydown ctrl click 5 keyup ctrl" # Zoom out ``` -------------------------------- ### Fusuma Tap Gesture for Menu Activation (xdotool) Source: https://github.com/iberianpig/fusuma/wiki/KDE-with-kwin-tiling Sets a two-finger tap gesture to activate the application menu or a similar overlay. This command uses xdotool to simulate the Super (Windows) key press, which typically opens the application launcher or menu in Linux environments. ```yaml tap: 2: command: "xdotool key super" # Menu ``` -------------------------------- ### Run Fusuma Type Checks Source: https://github.com/iberianpig/fusuma/blob/main/README.md Commands to generate RBS signatures, perform type checking, validate RBS files, and generate inline RBS from code comments using the Fusuma project's development tools. ```shell # Generate RBS signatures and run type checking bundle exec rake rbs:generate && bundle exec steep check # Validate RBS files bundle exec rake rbs:validate # Generate inline RBS from code comments bundle exec rbs-inline --opt-out lib --output --base . ``` -------------------------------- ### Configure GNOME Touchpad (Shell) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Ensures that touchpad events are being sent to the GNOME desktop environment. This command is useful for troubleshooting if the touchpad is not working correctly within GNOME. ```sh gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled ``` -------------------------------- ### Fusuma Device Filtering Configuration (YAML) Source: https://context7.com/iberianpig/fusuma/llms.txt Shows how to use the libinput_device_filter plugin in Fusuma to specify which input devices gesture recognition should be applied to. The 'keep_device_names' option allows listing specific touchpad names to include. ```yaml plugin: filters: libinput_device_filter: keep_device_names: - "SynPS/2 Synaptics TouchPad" - "ELAN Touchscreen" ``` -------------------------------- ### Configure Tap Gestures in Fusuma Source: https://github.com/iberianpig/fusuma/wiki/Another-setup-for-KDE Set up tap gestures for a specific number of fingers (e.g., 4 fingers) to trigger actions like copying text using a key combination. ```yaml tap: 4: sendkey: "LEFTCTRL+C" # Copy ``` -------------------------------- ### Update Fusuma Gem (Shell) Source: https://github.com/iberianpig/fusuma/blob/main/README.md Updates the Fusuma gem to the latest available version using RubyGems. This command ensures you have the most recent features and bug fixes for Fusuma. ```sh sudo gem update fusuma ```