diff options
author | kitty piapiac <kcp@bsd.computer> | 2020-08-07 21:17:54 -0700 |
---|---|---|
committer | kitty piapiac <kcp@bsd.computer> | 2020-08-07 21:17:54 -0700 |
commit | bd129d47e4fb75e7e680cd65b97e807f9bee900d (patch) | |
tree | 6c7765c3da8ab64d0c39c15797344fe848ef87fc /src | |
parent | 986002e778d7591e75014fd1e439bade35cdd627 (diff) |
(・ω・)b set master
ctrl + fullstop
by default will set the current focused window to the master one
Diffstat (limited to 'src')
-rw-r--r-- | src/config.def.nim | 6 | ||||
-rw-r--r-- | src/keys.nim | 1 | ||||
-rw-r--r-- | src/windowmanager.nim | 15 |
3 files changed, 20 insertions, 2 deletions
diff --git a/src/config.def.nim b/src/config.def.nim index 638b04b..c72d8e6 100644 --- a/src/config.def.nim +++ b/src/config.def.nim @@ -31,6 +31,12 @@ const nextWindow, key = "Tab", mods = modifier), + + # alt + . will set the focused window to the master window + initKey( + setMaster, + key = "period", + mods = modifier), # alt + return will open st, you can replace this with whatever your preferred terminal is initKey( diff --git a/src/keys.nim b/src/keys.nim index bfe79aa..a56412a 100644 --- a/src/keys.nim +++ b/src/keys.nim @@ -2,6 +2,7 @@ type KeyFunc* = enum closeWindow, nextWindow, + setMaster, spawnCustom Key* = object diff --git a/src/windowmanager.nim b/src/windowmanager.nim index 7f5c111..0ccbe87 100644 --- a/src/windowmanager.nim +++ b/src/windowmanager.nim @@ -152,6 +152,16 @@ proc λnextWindow (wm: WindowManager) = tileWindows wm lvlDebug.log $wm.focused +proc λsetMaster (wm: WindowManager) = + var n = wm.focused + if n != 0: + let temp = wm.clients[n] + wm.clients[n] = wm.clients[0] + wm.clients[0] = temp + wm.focused = 0 + tileWindows wm + lvlDebug.log $wm.focused + proc λspawnCustom (wm: WindowManager, key: keys.Key) = if fork() == 0: discard execvp(key.command, nil) @@ -267,8 +277,9 @@ proc onKeyPress (wm: WindowManager, e: PXKeyEvent) = lvlDebug.log "key event " & $e.keycode let key = wm.keys[e.keycode] case key.keyfunc: - of closeWindow: wm.λcloseWindow() - of nextWindow: wm.λnextWindow() + of closeWindow: wm.λcloseWindow + of nextWindow: wm.λnextWindow + of setMaster: wm.λsetMaster of spawnCustom: wm.λspawnCustom key proc onKeyRelease (wm: WindowManager, e: PXKeyEvent) = return |