Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

Commit

Permalink
(/・・)ノ better default config
Browse files Browse the repository at this point in the history
  • Loading branch information
ktiy committed Aug 11, 2020
1 parent ccdfe72 commit 2664ef0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 35 deletions.
36 changes: 6 additions & 30 deletions src/config.def.nim
Original file line number Diff line number Diff line change
@@ -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")]
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
8 changes: 3 additions & 5 deletions src/windowmanager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ proc createWindowManager*: WindowManager =
root: display.DefaultRootWindow(),

clients: @[],
focused: 0,
focused: -1,
keys: initTable[cuint, objects.Key](1))

# Run window manager
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2664ef0

Please sign in to comment.