-- Steve's ion3 bindings
-- Download from:
-- http://staticfree.info/projects/ion/
-- Discussion here:
-- http://staticfree.info/blog/linux/ion.comments
-- Choose your layout by commenting out the appropriate line:
LAYOUT="dvorak"
--LAYOUT="qwerty"
--[[
### OVERVIEW ###
By mapping the virtual desktops to a grid on the left hand, rapid
to specific desktops is not only possible, but becomes second nature.
These bindings are designed to be as comfortable as possible from
a Dvorak keyboard layout.
I have included a Qwerty version of the grid layout, with appropriate
modifications to the bindings such that they work with the grid.
(borrowed from a layout made by Christina Gleason
)
Select your layout above.
These bindings take into the principle that the most common tasks,
such as running programs, opening a new terminal, or
navigating around desktops should be as easy as possible and
require a minimum of finger travel. Only the most obscure actions
should be done through "F1-12" keys and other keys that are far
from the home row.
In order to achieve this, META is designed to be used solely for
Ion and no other applications. For my system, I use:
META="Mod4+"
ALTMETA="Control+Mod4+"
Where Mod4 is my "Windows" key (Or Meta_L in X11 terminology).
(In Debian, the above two lines are found in:
/etc/X11/ion3/cfg_debian.lua
Just copy that file to your ~/.ion3/ directory and modify it.)
WARNING: Debian's default for ALTMETA is an empty string, so many of
these bindings will break normal keyboard interaction.
**Make sure you set ALTMETA before using these bindings**
These bindings make heavy use of the BNPF style of navigation.
### INSTALLATION ###
In Debian, the default lua files are located in /etc/X11/ion3/
$ cp /etc/X11/ion3/cfg_ion.lua ~/.ion3/
Place this file in your ~/.ion3/ directory and append:
dopath("cfg_steve_bindings")
to your ~/.ion3/cfg_user.lua file.
Yes, this file is designed to override the default bindings.
### X-KEYBOARD CONFIG ###
I do a few more things to make my X configuration more comfortable
using XKB. The primary one is turning Caps Lock into an additional
Control.
'''
--]]
-- by Steve Pomeroy
-- MAIN BINDINGS
--[[
This is the physical layout of the grid layout. The number in the upper-
right hand corner represents the workspace number. Obviously on a Dvorak
keyboard, the actual letters are different, but they do not really
matter to us.
___________....
| 0| 1| 2| .
| 1 | 2 | 3 | 4 .
|___|___|___|....
| 3| 4| 5| .
| Q | W | E | R .
|___|___|___|____
| 6| 7| 8| 9|
| A | S | D | F |
|___|___|___|___|
--]]
-- Common between Qwerty and Dvorak
defbindings("WScreen", {
bdoc("Navigate to the left/right workspace."),
kpress(META.."Left", "WScreen.switch_prev(_)"),
kpress(META.."Right", "WScreen.switch_next(_)"),
-- Unbind the default key for the scratchpad so it can be
-- used for new terminals.
kpress(META.."space", nil),
bdoc("Toggle floating dock."),
kpress(META.."backslash", "mod_dock.set_floating_shown_on(_, 'toggle')"),
})
if LAYOUT=="dvorak" then
defbindings("WScreen", {
bdoc("Navigate workspaces using a Dvorak grid-based metaphor."),
kpress(META.."apostrophe", "WScreen.switch_nth(_, 3)"),
kpress(META.."comma", "WScreen.switch_nth(_, 4)"),
kpress(META.."period", "WScreen.switch_nth(_, 5)"),
kpress(META.."A", "WScreen.switch_nth(_, 6)"),
kpress(META.."O", "WScreen.switch_nth(_, 7)"),
kpress(META.."E", "WScreen.switch_nth(_, 8)"),
kpress(META.."U", "WScreen.switch_nth(_, 9)"),
bdoc("Toggle scratchpad."),
kpress(META.."S", "mod_sp.set_shown_on(_, 'toggle')"),
})
elseif LAYOUT=="qwerty" then
defbindings("WScreen", {
-- Qwerty version of the grid layout.
bdoc("Navigate workspaces using a Qwerty grid-based metaphor."),
kpress(META.."Q", "WScreen.switch_nth(_, 3)"),
kpress(META.."W", "WScreen.switch_nth(_, 4)"),
kpress(META.."E", "WScreen.switch_nth(_, 5)"),
kpress(META.."A", "WScreen.switch_nth(_, 6)"),
kpress(META.."S", "WScreen.switch_nth(_, 7)"),
kpress(META.."D", "WScreen.switch_nth(_, 8)"),
kpress(META.."Z", "WScreen.switch_nth(_, 9)"),
bdoc("Toggle scratchpad."),
kpress(META.."J", "mod_sp.set_shown_on(_, 'toggle')"),
})
end
-- Common between Qwerty and Dvorak
defbindings("WMPlex", {
bdoc("Toggle fullscreen mode of current client window."),
kpress(META.."Return",
"WGroup.set_fullscreen(_, 'toggle')"),
bdoc("Run a terminal emulator."),
kpress(META.."space", "ioncore.exec_on(_, 'x-terminal-emulator')"),
bdoc("Open a web browser window."),
kpress(ALTMETA.."space", "ioncore.exec_on(_, 'x-www-browser')"),
bdoc("Locks the screen."),
kpress(ALTMETA.."K", "ioncore.exec_on(_, ioncore.lookup_script('ion-lock'))"),
bdoc("Query for Lua code to execute."),
kpress(ALTMETA.."C", "mod_query.query_lua(_)"),
bdoc("Query for command line to execute."),
kpress(ALTMETA.."R", "mod_query.query_exec(_)"),
bdoc("Rename the current workspace"),
kpress(META.."I", "mod_query.query_renameworkspace(_)"),
})
defbindings("WFrame.toplevel", {
-- unbind this so it can be used for the grid layout
kpress(META.."A", nil),
})
if LAYOUT=="dvorak" then
defbindings("WMPlex", {
-- a more semantically-sane close.
bdoc("Close current object."),
kpress_wait(META.."C", nil),
kpress_wait(META.."W", "WRegion.rqclose_propagate(_, _sub)"),
bdoc("Query for host to connect to with SSH."),
kpress(ALTMETA.."S", "mod_query.query_ssh(_, ':ssh')"),
})
elseif LAYOUT=="qwerty" then
defbindings("WMPlex", {
bdoc("Close current object."),
kpress_wait(META.."X", "WRegion.rqclose_propagate(_, _sub)"),
bdoc("Query for host to connect to with SSH."),
-- "i" is for Infiltrate
kpress(ALTMETA.."I", "mod_query.query_ssh(_, ':ssh')"),
})
end
-- Common between Qwerty and Dvorak
defbindings("WFrame", {
bdoc("Tag current object within the frame."),
kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"),
bdoc("Switch to next/previous object within the frame."),
kpress(META.."Shift+F", "WFrame.switch_next(_)"),
kpress(META.."Shift+B", "WFrame.switch_prev(_)"),
})
if LAYOUT=="dvorak" then
defbindings("WFrame", {
bdoc("Attach tagged frames."),
kpress(META.."D", "ioncore.tagged_attach(_)"),
bdoc("Rename the current frame"),
kpress(ALTMETA.."I", "mod_query.query_renameframe(_)"),
})
elseif LAYOUT=="qwerty" then
defbindings("WFrame", {
bdoc("Attach tagged frames."),
kpress(META.."U", "ioncore.tagged_attach(_)")
})
end
-- All BNPF bindings are semantic and common between Dvoark and Qwerty
-- fix broken BF keys for resizing
defbindings("WMoveresMode", {
bdoc("Grow in specified direction."),
kpress("B", "WMoveresMode.resize(_, 1, 0, 0, 0)"),
kpress("F", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
bdoc("Shrink in specified direction."),
kpress("Shift+B", "WMoveresMode.resize(_,-1, 0, 0, 0)"),
kpress("Shift+F", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
bdoc("Move in specified direction."),
kpress(META.."B", "WMoveresMode.move(_,-1, 0)"),
kpress(META.."F", "WMoveresMode.move(_, 1, 0)"),
})
-- ionws
defbindings("WTiling", {
-- unbind S from the default binding
kpress(META.."S", nil),
bdoc("Split current frame vertically."),
kpress(ALTMETA.."N", "WTiling.split_at(_, _sub, 'bottom', true)"),
kpress(ALTMETA.."P", "WTiling.split_at(_, _sub, 'top', true)"),
bdoc("Split current frame horizontally."),
kpress(ALTMETA.."F", "WTiling.split_at(_, _sub, 'right', true)"),
kpress(ALTMETA.."B", "WTiling.split_at(_, _sub, 'left', true)"),
bdoc("Go to frame above/below/right/left of current frame."),
kpress(META.."P", "ioncore.goto_next(_sub, 'up', {no_ascend=_})"),
kpress(META.."N", "ioncore.goto_next(_sub, 'down', {no_ascend=_})"),
kpress(META.."B", "ioncore.goto_next(_sub, 'left', {no_ascend=_})"),
kpress(META.."F", "ioncore.goto_next(_sub, 'right', {no_ascend=_})")
})