Giter Site home page Giter Site logo

mreppen / kakoune-sway Goto Github PK

View Code? Open in Web Editor NEW

This project forked from delapouite/kakoune-i3

4.0 2.0 2.0 216 KB

Commands to integrate kakoune with the Sway Wayland compositor

Home Page: https://kakoune.org

KakouneScript 100.00%
kakoune swaywm sway plugin

kakoune-sway's Introduction

kakoune-sway

kakoune plugin to create predictable clients with the Sway Wayland compositor (WM).

This is a fork of kakoune-i3 with improvements specific to Sway. For compatibility, the i3-commands will be available to the extent possible.

Install

Add sway.kak to your autoload dir: ~/.config/kak/autoload/. It depends on x11.kak and x11-repl for send-text-functionality.

Or via plug.kak:

plug 'mreppen/kakoune-sway' %{
  # Suggested mapping
  map global user 3 ': enter-user-mode sway<ret>' -docstring 'Sway mode'
}

As it depends on the x11 module, add this line to your kakrc:

set-option global windowing_modules 'x11'

Usage

Window creation

5 window commands available:

  • sway-new new window in the current container
  • sway-new-left ← new window on the left
  • sway-new-right → new window on the right
  • sway-new-up ↑ new window above
  • sway-new-down ↓ new window below

New windows display a cloned view: same buffer, same line.

A sway user-mode is also declared. With the mapping in the Install section above:

,3k will open a new window above the current one.

send-text

If the module x11-repl is loaded, a sway-send-text command is defined to provide the functionality of x11-send-text, and the alias send-text is set to sway-send-text. This requires the packages jq, wl-clipboard, and wtype.

The method for sending text mirrors that of x11-repl, which means copying to the primary clipboard and pasting (wl-clipboard) with emulated shift+insert (wtype). jq is used for parsing Sway data. Any suggestions for improving this are welcome.

Note: just like x11-repl, this finds the correct window by the window name. Some applications, like fish will rename the window by default, and thus break this. Therefore, run the repl with :repl <repl-executable> to avoid this.

Switch Description
-send-enter Send a keystroke of <enter> after the text. NOTE: Could be replaced if a similar feature is adopted in default plugins.

Screenshots

kakoune-sway

See also

Licence

MIT

kakoune-sway's People

Contributors

delapouite avatar jnturton avatar mreppen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jnturton hardy7cc

kakoune-sway's Issues

Need to set windowing modules

I tried to use your plugin today, and initially tried with the config as suggested in the README, i.e.:

plug 'mreppen/kakoune-sway' %{
  # Suggested mapping
  map global user 3 ': enter-user-mode sway<ret>' -docstring 'Sway…'
}

This gave me the error termcmd not set when trying to use any of the commands. When adding the line suggested in kakoune-i3's README, the plugin works, i.e.:

set-option global windowing_modules 'x11'

Is this the expected behaviour? Anyway, sweet plugin!

Race condition when getting the id of the new REPL window

On my machine, this runs a little bit before Sway has updated the focus and I had to hack in a sleep 0.1s in front of it.

winid=$(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .id')

I looked for a while for better ways than using focused==true to get winid but I couldn't come up with anything good using things like $PPID in the shell script to try get the terminal emulator pid for use in a different jq query.

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.