fix general commander path

This commit is contained in:
Almarhoon Ibraheem 2024-06-15 19:10:21 +03:00
parent d6718c0f06
commit 5159d1e45a
2 changed files with 15 additions and 5 deletions

View file

@ -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

View file

@ -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))