summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuel@nihil.ws>2022-12-21 22:37:36 +0100
committerSamuel Fadel <samuel@nihil.ws>2022-12-21 22:37:36 +0100
commit475f4dc3d514edef85633999809bb028aff01b97 (patch)
tree0e44a699c02670cca0732b7eeac9a07fbed32e16
parente48ed1e15400fcc42c513870f84bca5277cc1579 (diff)
Fix border drawing in tile toggling functions & launcher impl.
* init.scm: Launcher impl and helpers * wm.scm: Launcher with fork & execlp (execvp) * schewm.c: Fix border by explicitly calling border drawing proc after restoring window size
-rw-r--r--init.scm19
-rw-r--r--schewm.c5
-rw-r--r--wm.scm5
3 files changed, 25 insertions, 4 deletions
diff --git a/init.scm b/init.scm
index b712add..b24432d 100644
--- a/init.scm
+++ b/init.scm
@@ -19,12 +19,27 @@
"#0d131a" ; outer-color
))
-(define (make-callback proc arg)
- (lambda () (proc arg)))
+(define (make-callback proc . args)
+ (lambda () (apply proc args)))
+
+(define terminal-cmd "xterm")
+
+(define menu-raw-callback
+ (make-callback wm-exec-cmd "bemenu" "-b" "-s" "-l" "10" "-p" ">>>"))
+
+(define menu-callback
+ (make-callback
+ wm-exec-cmd
+ "j4-dmenu-desktop"
+ "--dmenu=bemenu -b -i -s -l 10 -p >>>"
+ (string-append "--term=" terminal-cmd)))
(define wm-keybindings
`((,(make-shift-key "q") . ,wm-quit)
(,(make-key "q") . ,wm-focus-close)
+ (,(make-shift-key "p") . ,menu-raw-callback)
+ (,(make-key "p") . ,menu-callback)
+ (,(make-key "Enter") . ,(make-callback wm-exec-cmd terminal-cmd))
;; Focus
(,(make-key "Tab") . ,wm-focus-prev)
(,(make-shift-key "Tab") . ,wm-focus-next)
diff --git a/schewm.c b/schewm.c
index bcbcb62..82392a2 100644
--- a/schewm.c
+++ b/schewm.c
@@ -2475,7 +2475,7 @@ enum TileType {
TILE_BOTTOM_RIGHT,
};
-void
+static void
wm_toggle_tile(enum TileType tile_type) {
if (wm.focus == NULL) {
return;
@@ -2485,7 +2485,8 @@ wm_toggle_tile(enum TileType tile_type) {
if (wm.focus->has_old_size) {
client_restore_size(wm.focus);
dpy_update_window_geometry(wm.focus);
- } else {
+ dpy_draw_focused_borders(wm.focus);
+ } else {
struct Rect rect;
// Start with monitor size, then reduce to appropriate target size
wm_client_monitor_size(wm.focus, true, &rect);
diff --git a/wm.scm b/wm.scm
index d178770..40b5d1d 100644
--- a/wm.scm
+++ b/wm.scm
@@ -11,6 +11,7 @@
wm-grab-key-with-mod
wm-grab-key-with-mod-shift
wm-set-key-press-handler!
+ wm-exec-cmd
wm-focus-prev
wm-focus-next
wm-focus-close
@@ -240,3 +241,7 @@
(procedure->pointer void
handler
(list uint16 uint32))))
+
+(define (wm-exec-cmd . args)
+ (when (eq? (primitive-fork) 0)
+ (apply execlp (cons (car args) args))))