summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/config.def.nim36
-rw-r--r--src/windowmanager.nim8
2 files changed, 9 insertions, 35 deletions
diff --git a/src/config.def.nim b/src/config.def.nim
index 39de9e5..c9f46f9 100644
--- a/src/config.def.nim
+++ b/src/config.def.nim
@@ -1,45 +1,21 @@
import objects, x11/x
-# config
const
- # default mod key, run xmodmap to see what the mod keys are on your current keyboard layout
- # Mod1 is alt and Mod4 is super
- modifier* = Mod1Mask
+ MOD* = Mod1Mask
+ SHIFT* = ShiftMask
- # if it isn't obvious, hex values go here
colours* = (
focused: "#fbfdff",
unfocused: "#295eb3",
background: "#232323")
- # in pixels
frameWidth* = 2
init* = [
"xsetroot -solid \"" & colours.background & "\""]
- # store keybindings here
keybindings* = [
- # alt + shift + q will close the focused window
- initKey( closeWindow,
- key = "q",
- mods = modifier or ShiftMask),
-
- # alt + tab will cycle the focus through the windows
- initKey(
- 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(
- spawnCustom,
- key = "Return",
- mods = modifier,
- command = "st")] \ No newline at end of file
+ key( MOD or SHIFT, "q", closeWindow ), # alt + shift + q will close the focused window
+ key( MOD, "Tab", nextWindow ), # alt + tab will cycle the focus through the windows
+ key( MOD, "period", setMaster ), # alt + period will set the focused window to the master window
+ key( MOD, "Return", spawnCustom, "st")] # alt + return will open st, you can replace this with whatever your preferred terminal is \ No newline at end of file
diff --git a/src/windowmanager.nim b/src/windowmanager.nim
index 2eb947e..c67223b 100644
--- a/src/windowmanager.nim
+++ b/src/windowmanager.nim
@@ -53,7 +53,7 @@ proc createWindowManager*: WindowManager =
root: display.DefaultRootWindow(),
clients: @[],
- focused: 0,
+ focused: -1,
keys: initTable[cuint, objects.Key](1))
# Run window manager
@@ -175,10 +175,8 @@ proc onXError (display: PDisplay, e: PXErrorEvent): cint{.cdecl.} =
" request: " & $e.request_code & "\n" &
" error code: " & $e.error_code & " - " & errorText & "\n" &
" resource id: " & $e.resourceid)
-
return 0
-
proc addWindow (wm: WindowManager, w: Window) =
wm.clients.add w
discard wm.display.XSetInputFocus(w, RevertToParent, CurrentTime)
@@ -234,8 +232,8 @@ proc onUnmapNotify (wm: WindowManager, e: PXUnmapEvent) =
if wm.focused > -1:
discard wm.display.XSetInputFocus(wm.clients[wm.focused], RevertToParent, CurrentTime)
- let index = wm.clients.find(e.window)
- if index > -1: wm.clients.delete index
+ let ti = wm.clients.find(e.window)
+ if ti > -1: wm.clients.delete ti
wm.tileWindows()
proc onConfigureNotify (wm: WindowManager, e: PXConfigureEvent) = return