keybindings to move windows left or right in the win list
This commit is contained in:
parent
3d7559845e
commit
988d2f8ee4
1 changed files with 41 additions and 0 deletions
|
|
@ -183,6 +183,38 @@ os =
|
|||
newIndex = min (len osState.windows - 1) (osState.wm.focusedIndex + 1);
|
||||
{ state = state, emit = [focusWindow newIndex] };
|
||||
|
||||
handleMoveLeftEvent = state \
|
||||
idx = osState.wm.focusedIndex;
|
||||
idx == 0
|
||||
| True \ { state = state, emit = [] }
|
||||
| False \ (
|
||||
newIdx = idx - 1;
|
||||
windows = osState.windows;
|
||||
newWindows = [
|
||||
...take newIdx windows,
|
||||
nth idx windows ~ unwrapOr {},
|
||||
nth newIdx windows ~ unwrapOr {},
|
||||
...drop (idx + 1) windows
|
||||
];
|
||||
{ state = state, emit = [osState.windows := newWindows, focusWindow newIdx] }
|
||||
);
|
||||
|
||||
handleMoveRightEvent = state \
|
||||
idx = osState.wm.focusedIndex;
|
||||
idx == len osState.windows - 1
|
||||
| True \ { state = state, emit = [] }
|
||||
| False \ (
|
||||
newIdx = idx + 1;
|
||||
windows = osState.windows;
|
||||
newWindows = [
|
||||
...take idx windows,
|
||||
nth newIdx windows ~ unwrapOr {},
|
||||
nth idx windows ~ unwrapOr {},
|
||||
...drop (newIdx + 1) windows
|
||||
];
|
||||
{ state = state, emit = [osState.windows := newWindows, focusWindow newIdx] }
|
||||
);
|
||||
|
||||
ui.stateful {
|
||||
key = "os",
|
||||
autoFocus = True,
|
||||
|
|
@ -192,10 +224,19 @@ os =
|
|||
update = state event \ event
|
||||
| Key { key = "p", meta = True } \
|
||||
{ state = state, emit = [openPalette] }
|
||||
|
||||
| Key { key = "ArrowLeft", meta = True, shift = True } \ handleMoveLeftEvent state
|
||||
| Key { key = "h", meta = True, shift = True } \ handleMoveLeftEvent state
|
||||
|
||||
| Key { key = "ArrowRight", meta = True, shift = True } \ handleMoveRightEvent state
|
||||
| Key { key = "l", meta = True, shift = True } \ handleMoveRightEvent state
|
||||
|
||||
| Key { key = "ArrowLeft", meta = True } \ handleFocusLeftEvent state
|
||||
| Key { key = "h", meta = True } \ handleFocusLeftEvent state
|
||||
|
||||
| Key { key = "ArrowRight", meta = True } \ handleFocusRightEvent state
|
||||
| Key { key = "l", meta = True } \ handleFocusRightEvent state
|
||||
|
||||
| Key { key = "d", meta = True } \
|
||||
{ state = state, emit = [closeFocusedWindow 0] }
|
||||
| Key { key = "f", meta = True } \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue