From bd129d47e4fb75e7e680cd65b97e807f9bee900d Mon Sep 17 00:00:00 2001 From: kitty piapiac Date: Fri, 7 Aug 2020 21:17:54 -0700 Subject: =?UTF-8?q?(=EF=BD=A5=CF=89=EF=BD=A5)b=20set=20master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ctrl + fullstop by default will set the current focused window to the master one --- src/windowmanager.nim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/windowmanager.nim') 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 -- cgit v1.2.3