summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitty piapiac <kcp@bsd.computer>2020-07-29 09:06:19 -0700
committerkitty piapiac <kcp@bsd.computer>2020-07-29 09:06:19 -0700
commite95ea8a8535f05f7647e86af6a7fc326c3bda3af (patch)
tree798c72c3b1d160adc505b33f44cf97078692a39e
parent7c42a04d66df733594283c440a3025c6c8f3071f (diff)
(。ヘ°) init commands
ILL WORK ON TILING AFTER THIS I PROMISE
-rw-r--r--src/config.nim9
-rw-r--r--src/windowmanager.nim8
2 files changed, 13 insertions, 4 deletions
diff --git a/src/config.nim b/src/config.nim
index 4c4fb2f..628a4ff 100644
--- a/src/config.nim
+++ b/src/config.nim
@@ -8,9 +8,12 @@ const
# if it isn't obvious, hex values go here
colours* = (
- focused: 0xFBFDFF,
- unfocused: 0x9BCDFF,
- background: 0x232323)
+ focused: "#FBFDFF",
+ unfocused: "#9BCDFF",
+ background: "#232323")
+
+ init* = @[
+ "xsetroot -solid \"" & colours.background & "\""]
# in pixels
frameWidth* = 2
diff --git a/src/windowmanager.nim b/src/windowmanager.nim
index df00b6c..a4e2058 100644
--- a/src/windowmanager.nim
+++ b/src/windowmanager.nim
@@ -2,7 +2,7 @@ import
x11/[x, xlib],
config, /types,
logging, /logger,
- tables
+ tables, os
type
WindowManager* = ref object
@@ -16,6 +16,7 @@ type
# Initialiazation stuff
proc initKeybindings (wm: WindowManager)
proc initButtons (wm: WindowManager)
+proc initCommands (wm: WindowManager)
# KeyFunc Handlers
proc procFromFunc (wm: WindowManager, keyfunc: KeyFunc): proc (wm: WindowManager)
@@ -66,6 +67,7 @@ proc createWindowManager*: WindowManager =
proc run* (wm: WindowManager) =
initKeybindings wm
initButtons wm
+ initCommands wm
discard XSetErrorHandler onWMDetected # Temporary error handler if there is another window manager running
@@ -129,6 +131,10 @@ proc initButtons (wm: WindowManager) =
None,
None)
+proc initCommands (wm: WindowManager) =
+ for cmd in config.init:
+ discard execShellCmd cmd
+
# KeyFunc Handlers
proc procFromFunc (wm: WindowManager, keyfunc: KeyFunc): proc (wm: WindowManager) =
let procFuncTable = {