summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-09-27 02:10:56 +0300
committerThanos Apollo <[email protected]>2023-09-27 02:10:56 +0300
commite52384090f3011cdbcc8ec8aa8d84a4389128e56 (patch)
tree6c6751e067b941e38d7b8ff4d3af09aba82b9607
parent47b73144d1b30514df003560851de3bd06e88b81 (diff)
stumpwm: Add defnyxt-search macro & rewrite nyxt functions
-rw-r--r--.stumpwm.d/commands.lisp31
-rw-r--r--.stumpwm.d/keybindings.lisp6
2 files changed, 16 insertions, 21 deletions
diff --git a/.stumpwm.d/commands.lisp b/.stumpwm.d/commands.lisp
index da88a18..e5c25b8 100644
--- a/.stumpwm.d/commands.lisp
+++ b/.stumpwm.d/commands.lisp
@@ -25,6 +25,19 @@
(make-web-jump "searxng" "nyxt https://search.thanosapollo.com/?q=")
(make-web-jump "Invidious" "firefox https://yewtu.be/search?q=")
+(defmacro defnyxt-search (name search-url command)
+ `(stumpwm:defcommand ,(intern (concatenate 'string "nyxt-" name)) (query)
+ ((:string "Search: "))
+ (stumpwm:run-shell-command
+ (concatenate 'string "nyxt -r -e '(" ,command "\"" ,search-url query "\"" ")'"))))
+
+(defvar thanos-searxng "https://search.thanosapollo.com/?q=")
+
+(defnyxt-search "searxng" thanos-searxng "buffer-load")
+(defnyxt-search "searxng-newb" thanos-searxng "set-url-new-buffer :url")
+(defnyxt-search "http" "http://" "buffer-load")
+
+;; Sly setup
(ql:quickload :slynk)
(defcommand sly-start-server () ()
@@ -35,24 +48,6 @@
"Stop current slynk server for sly."
(sb-thread:make-thread (lambda () (slynk:stop-server 4005))))
-(defcommand nyxt-buffer-search (search)
- ((:string "Search for: "))
- (let ((url "https://search.thanosapollo.com/?q="))
- (run-shell-command
- (concatenate 'string "nyxt -r -e '(buffer-load" "\"" url search "\"" ")'" ))))
-
-(stumpwm:defcommand nyxt-buffer-url (search)
- ((:string "Set URL: "))
- (let ((url "https://search.thanosapollo.com/?q="))
- (stumpwm:run-shell-command
- (concatenate 'string "nyxt -r -e '(buffer-load" "\"" search "\"" ")'" ))))
-
-(defcommand nyxt-new-buffer-search (search)
- ((:string "New Buffer Search for: "))
- (let ((url "https://search.thanosapollo.com/?q="))
- (run-shell-command
- (concatenate 'string "nyxt -r -e '(set-url-new-buffer :url" "\"" url search "\"" ")'" ))))
-
(defcommand firefox () ()
"Run or raise Firefox."
diff --git a/.stumpwm.d/keybindings.lisp b/.stumpwm.d/keybindings.lisp
index f59a004..9bc1a92 100644
--- a/.stumpwm.d/keybindings.lisp
+++ b/.stumpwm.d/keybindings.lisp
@@ -76,9 +76,9 @@
(define-key *root-map* (kbd "M-f") "move-window right")
(define-key *root-map* (kbd "M-n") "move-window down")
;; Nyxt
-(define-key *root-map* (kbd "s") "nyxt-buffer-search")
-(define-key *root-map* (kbd "M-s") "nyxt-new-buffer-search")
-(define-key *root-map* (kbd "C-s") "nyxt-buffer-url")
+(define-key *root-map* (kbd "s") "nyxt-searxng")
+(define-key *root-map* (kbd "M-s") "nyxt-searxng-newb")
+(define-key *root-map* (kbd "C-s") "nyxt-http")
;; Productivity
(load-module "productivity")
(define-key *top-map* (kbd "F7") "productivity-mode-toggle")