;; Functions (defun feh-set-wallpaper (wallpaper-name) "Set wallpaper using feh" (let ((wallpaper-dir "~/wallpapers/")) (format t "Setting wallpaper: ~a~%" wallpaper-name) (run-shell-command (format nil "feh --bg-scale ~a~a" wallpaper-dir wallpaper-name)))) (defun thanos/set-wallpapers () "Set wallpapers depending on hostname." (cond ((equal (asdf:hostname) "zeus") (feh-set-wallpaper "anime-night-mountains.jpg")) ((equal (asdf:hostname) "hermes") (feh-set-wallpaper "library-old-house.jpg")))) ;; Web jump (works for DuckDuckGo) (defmacro make-web-jump (name prefix) `(defcommand ,(intern name) (search) ((:rest ,(concatenate 'string "Search with " name ": "))) (nsubstitute #\+ #\Space search) (run-shell-command (concatenate 'string ,prefix search)))) ;; (defcommand nyxt () (search) ((:rest ,(concatenate 'string "Search with " name ": "))) ;; (nsubstitute #\+ #\Space search) ;; (run-shell-command (concatenate 'string "nyxt -r -e" "" search))) (make-web-jump "searxng" "nyxt https://search.thanosapollo.com/?q=") (make-web-jump "Invidious" "firefox https://yewtu.be/search?q=") (ql:quickload :slynk) (defcommand sly-start-server () () "Start a slynk server for sly." (sb-thread:make-thread (lambda () (slynk:create-server :dont-close t)))) (defcommand sly-stop-server () () "Stop current slynk server for sly." (sb-thread:make-thread (lambda () (slynk:stop-server 4005)))) (defcommand nyxt-buffer-load (search) ((:string "Search for: ")) (let ((url "https://search.thanosapollo.com/?q=")) (run-shell-command (concatenate 'string "nyxt -r -e '(buffer-load" "\"" url search "\"" ")'" )))) (defcommand nyxt-new-buffer-load (search) ((:string "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." (sb-thread:make-thread (lambda () (run-or-raise "firefox" '(:class "firefox") t nil)))) (defcommand delete-window-and-frame () () "Delete the current frame with its window." (delete-window) (remove-split)) (defcommand hsplit-and-focus () () "Create a new frame on the right and focus it." (hsplit) (move-focus :right)) (defcommand vsplit-and-focus () () "Create a new frame below and move focus to it." (vsplit) (move-focus :down)) (defcommand term (&optional program) () "Invoke a terminal, possibly with a @arg{program}." (sb-thread:make-thread (lambda () (run-shell-command (if program (format nil "kitty ~A" program) "kitty"))))) (when *initializing* (mapc #'run-shell-command '("picom" "transmission-daemon" "xsetroot -cursor_name left_ptr")) (thanos/set-wallpapers))