From 5159d1e45a79f53ccf231897a14752b1f47c78f3 Mon Sep 17 00:00:00 2001 From: Almarhoon Ibraheem Date: Sat, 15 Jun 2024 19:10:21 +0300 Subject: [PATCH] fix general commander path --- keybindings.scm | 3 +-- modules/general.scm | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/keybindings.scm b/keybindings.scm index 5539fa4..4b756e7 100755 --- a/keybindings.scm +++ b/keybindings.scm @@ -17,9 +17,8 @@ (define (keybindings-init) (kbd-init) - ;; (configure-sway-keybinding-translator custom-sway-keybinding-translator) - (define general-module (resolve-module '(modules general))) (configure-sway-keybinding-translator custom-sway-keybinding-translator) + (configure-sway-commander-path "~/.config/sway/commander") ;; define root keybindings (sway-define-keys diff --git a/modules/general.scm b/modules/general.scm index 350c3d5..fa9e0c8 100755 --- a/modules/general.scm +++ b/modules/general.scm @@ -5,6 +5,8 @@ #:use-module (srfi srfi-18) #:use-module (ice-9 hash-table) #:export (sway-keybinding-translator + sway-commander-path + configure-sway-commander-path configure-sway-keybinding-translator sway-define-keys sway-define-key @@ -27,9 +29,17 @@ like key chords. The default implementation doesn't modify passed keybindings" key) +(define sway-commander-path + (if current-filename + (dirname (dirname current-filename)) + "commander")) + (define (configure-sway-keybinding-translator proc) (set! sway-keybinding-translator proc)) +(define (configure-sway-commander-path path) + (set! sway-commander-path path)) + (define (exp->string exp) (call-with-output-string (lambda (p) (write exp p)))) @@ -48,7 +58,7 @@ (car (reverse (string-split key #\+)))) (define (sway-command exp-str) - (string-append "exec '" (dirname (dirname (current-filename))) "/commander " + (string-append "exec '" sway-commander-path " " (exp->string exp-str) "'")) (define* (define-keybindings chord key exp wk submap) @@ -97,11 +107,12 @@ (map (lambda (arg) (when (list? arg) - (display "ARG: ") (display arg) (newline) - (display (car arg)) + (display (and + (symbol? (car arg)) + (equal? "sway-define-keys" (symbol->string (car arg))))) (newline) (if (and (symbol? (car arg))