Giter Site home page Giter Site logo

jaclu / tmux-mouse-swipe Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 70 KB

Tmux plugin, uses mouse horizontal swipe to switch window and vertical to switch session

License: MIT License

Shell 100.00%
tmux tmux-plugins tpm shell posix-sh mouse-tracking ish-app

tmux-mouse-swipe's Introduction

Tmux-Mouse-Swipe

Right click and swipe left or right in any pane to switch window in that direction or swipe up or down to switch session.

As always any suggestions for improvements are welcome!

Purpose

When you are at the keyboard obviously a key sequence is both faster and more natural to switch sessions or windows. I use this tool mostly just getting a quick overview when having the terminal on a side screen, in such cases mouse swiping is handy.

The reason I wrote it as a posix script is that since it gets run multiple times in quick sequence, on my iPad running iSH, there is a noticeable performance boost not having to repeatedly start bash scripts.

Installation

Comparability: tmux version 3.0 or higher

With Tmux Plugin Manager (recommended)

Add plugin to the list of TPM plugins in .tmux.conf:

set -g @plugin 'jaclu/tmux-mouse-swipe'

Hit <prefix> + I to fetch the plugin and source it.

Manual Installation

Clone the repository:

git clone https://github.com/jaclu/tmux-mouse-swipe.git ~/clone/path

Add this line to the bottom of .tmux.conf:

run-shell ~/clone/path/mouse_swipe.tmux

From the terminal, reload TMUX environment:

tmux source-file ~/.tmux.conf

Usage

Once installed, try pressing down right button and swipe up, down, left or right on any pane.

Once you release the button, tmux should switch window after horizontal swipe and session after vertical.

If you only have one Window or Session, a message will be displayed that the requested action can not be performed, depending on swipe direction.

Minimal movement

Since drag isn't registered until you move one character cell, and at least one more cell of movement is needed to detect direction, minimal movement distance is two characters.

Not purely vertical / horizontal swipes

If both vertical and horizontal swiping is detected, the axis with the most delta is assumed to be the intended direction. Risk for miss-interpertaion is reduced by making a slightly longer swipe.

Pane borders

tmux sends mouse coordinates relative to the pane that the mouse is over, so if you cross a pane border during the swipe, the direction of movement will most likely not be the intended.

Basic modifications

If you want to bind this to another mouse event, search for the MOUSE SUPPORT section in the tmux man page for details on how to bind mouse events. Change the binds towards the end of mouse_swipe.tmux in the top directory of this repository.

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

The best way to send feedback is to file an issue at tmux-mouse-swipe/issues

License

MIT

tmux-mouse-swipe's People

Contributors

jaclu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.