Giter VIP home page Giter VIP logo

hyprgrass's Introduction

Hyprland Touch Gestures

Tip

I don't have a touch device at the moment so I can't really work on this plugin. I'll try to fix critical bugs but there's only so much I can do.

Warning

Even though hyprgrass is mostly stable now, there used to be some bugs that render your touch device unusable until you unload the plugin/close Hyprland (horriblename#27), keep a keyboard in hand the first time you try this. This plugin is still in alpha, expect breakable changes!

Please open an issue if you find any bugs. Feel free to make a feature request if you have a suggestion.

Features/Roadmap

  • Workspace Swipe
  • Custom commands
  • Swipe From Edge
  • Multi-finger swipe

Installation

Dependencies

Asides from Hyprland (duh), this plugin has the following dependencies:

glm

# build dependencies
meson
ninja

Install via hyprpm

First, install all dependencies. Then, run these commands:

hyprpm add https://github.com/horriblename/hyprgrass
hyprpm enable hyprgrass

You can add exec-once = hyprpm reload -n to your hyprland config to have plugins loaded at startup. -n will make hyprpm send a notification if anything goes wrong (e.g. update needed)

see hyprland wiki for more info

Install via Hyprload

(hyprload is deprecated, please use hyprpm instead)

  1. install all dependencies

  2. install hyprload by following the instructions here

  3. put this in ~/.config/hypr/hyprload.toml:

    plugins = [
        "horriblename/hyprgrass",
    ]
    
  4. run this command:

    # install the plugins
    hyprctl dispatch hyprload install
    
    # load plugins
    hyprctl dispatch hyprload load

Manual compilation

meson setup build
ninja -C build

Install via nix

Flakes are highly recommended (because I don't know how to do anything without them)

Put this in your flake.nix file:

{
   inputs = {
      # ...
      hyprland.url = "github:hyprwm/Hyprland";
      hyprgrass = {
         url = "github:horriblename/hyprgrass";
         inputs.hyprland.follows = "hyprland"; # IMPORTANT
      };
   };
}

and in your home-manager module:

wayland.windowManager.hyprland = {
   plugins = [
      inputs.hyprgrass.packages.${pkgs.system}.default
   ];
};

Configuration

Configuration options:

plugin:touch_gestures {
  # The default sensitivity is probably too low on tablet screens,
  # I recommend turning it up to 4.0
  sensitivity = 1.0

  # must be >= 3
  workspace_swipe_fingers = 3

  # switching workspaces by swiping from an edge, this is separate from workspace_swipe_fingers
  # and can be used at the same time
  # possible values: l, r, u, or d
  # to disable it set it to anything else
  workspace_swipe_edge = d

  # in milliseconds
  long_press_delay = 400

  experimental {
    # send proper cancel events to windows instead of hacky touch_up events,
    # NOT recommended as it crashed a few times, once it's stabilized I'll make it the default
    send_cancel = 0
  }
}

Other options

I also recommend that you adjust the settings for the built-in gesture to make it easier to switch workspaces:

gestures {
  workspace_swipe = true
  workspace_swipe_cancel_ratio = 0.15
}

Custom Commands

You can also bind gesture events to dispatchers, it currently uses the built-in bind keyword like keybinds. This will likely change in the future.

Syntax

bind = , <gesture_name>, <dispatcher>, <args>

where (skip to examples if this is confusing):

  • gesture_name is one of:
    1. swipe:<finger_count>:<direction>
      • finger_count must be >= 3
      • direction is one of l, r, u, d, or ld, rd, lu, ru for diagonal directions.
        (l, r, u, d stand for left, right, up, down)
    2. tap:<finger_count>
      • finger_count must be >= 3
    3. edge:<from_edge>:<direction>
      • <from_edge> is from which edge to start from (l/r/u/d)
      • <direction> is in which direction to swipe (l/r/u/d/lu/ld/ru/rd)
    4. longpress:<finger_count>

Examples

# swipe left from right edge
bind = , edge:r:l, workspace, +1

# swipe up from bottom edge
bind = , edge:d:u, exec, firefox

# swipe down from left edge
bind = , edge:l:d, exec, pactl set-sink-volume @DEFAULT_SINK@ -4%

# swipe down with 4 fingers
# NOTE: swipe events only trigger for finger count of >= 3
bind = , swipe:4:d, killactive

# swipe diagonally left and down with 3 fingers
# l (or r) must come before d and u
bind = , swipe:3:ld, exec, foot

# tap with 3 fingers
# NOTE: tap events only trigger for finger count of >= 3
bind = , tap:3, exec, foot

# longpress can trigger mouse binds:
bindm = , longpress:2, movewindow
bindm = , longpress:3, resizewindow

Acknowledgements

Special thanks to wayfire for the awesome wf-touch library!

hyprgrass's People

Contributors

horriblename avatar github-actions[bot] avatar duckonaut avatar nine7nine avatar samuelefacenda avatar technotechnoduck avatar iamgiga avatar

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.