-
Notifications
You must be signed in to change notification settings - Fork 0
Extension for https://github.com/way-cooler/way-cooler/ for modal key-bindings
License
z33ky/wc-apreggio
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
wc-apreggio This is a proof of concept implementation for an extension for the [way-cooler compositor](https://github.com/way-cooler/way-cooler). This extension enables easy addition of modal key-bindings inspired by Vi. Instead of carrying out an action after hitting a key-combination, a mode may be entered instead where new key-combinations are made available. You could set `Alt+m` to enter `move`-mode for instance, where the arrow keys can be used to move the current window until you press `return` or `escape`. `escape` exits to `normal`-mode by default. When starting to enter keys of chain-bindings, `escape` resets the state to the beginning of the current mode, i.e. in the example below after pressing `Alt+s` to enter `spawn`-mode and then pressing `f` followed by `escape` returns to `spawn`-mode proper. A second `escape` would return to `normal`-mode. It basically works, but needs proper documentation, testing and should probably come with more complete sample bindings. The project is currently in hibernation, as the machine I am planning to run Way-Cooler on is rather weak and the compositor runs quite slow compared to Awesome, my current WM of choice. I am hoping the planned port to [wlroots](https://github.com/swaywm/wlroots-rs) will improve this. To use this extension, add the following to your `init.lua`: ``` --load apreggio local apreggio = require("apreggio") --create some shortcuts and convenience functions local Mode = apreggio.Mode local key = apreggio.key local chain = apreggio.chain local spawn_once = util.program.spawn_once --return back to normal mode after spawning a program local function spawn_return(prg) return function() util.program.spawn(prg) normal:mode()() end end --add some modes local normal = Mode.new() local spawn = Mode.new("spawn") local move = Mode.new("move") --add respective key bindings normal:add({ key({ mod }, "s", spawn:mode()), key({ mod }, "return", spawn_once("termite")), key({ mod }, "m", move:mode()), }) spawn:add({ key("s", spawn_return("termite")), chain({ "f", "x" }, spawn_return("firefox")), chain( { { { "shift" }, "f", }, "x" }, spawn_return("firefox") ), }) move:add({ key("left", "move_active_left"), key("down", "move_active_down"), key("up", "move_active_up"), key("right", "move_active_right"), key("return", normal:mode()), }) normal:enter() ```
About
Extension for https://github.com/way-cooler/way-cooler/ for modal key-bindings
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published