#옴니 인터페이스의 일환이다. 이맥스 클라이언트 인터페이스 [2024-10-23 Wed 12:01] 완벽한 방법이다. 워크스페이스 가져가니까. ;;;; Run commands in a popup frame ;; i3config : bindsym $mod+$wm.binding.orgcapture exec --no-startup-id emacsclient -e '(progn (select-frame-set-input-focus (selected-frame)) (prot-window-popup-org-capture))' ;; myai.sh : emacsclient -e '(progn (select-frame-set-input-focus (selected-frame)) (ad/ai-from-anywhere))' ;;;;; prot's emacs-command-popup-frame ;; https://protesilaos.com/codelog/2024-09-19-emacs-command-popup-frame-emacsclient/ ;; The emacsclient call depends on the daemon or `server-mode' (I use the latter) ;; The emacsclient calls that need ot be bound to system-wide keys ;; emacsclient -e '(prot-window-popup-org-capture)' ;; emacsclient -e '(prot-window-popup-tmr)' (defun prot-window-delete-popup-frame (&rest _) "Kill selected selected frame if it has parameter `prot-window-popup-frame'. Use this function via a hook." (when (frame-parameter nil 'prot-window-popup-frame) (delete-frame))) (defmacro prot-window-define-with-popup-frame (command) "Define interactive function which calls COMMAND in a new frame. Make the new frame have the `prot-window-popup-frame' parameter." `(defun ,(intern (format "prot-window-popup-%s" command)) () ,(format "Run `%s' in a popup frame with `prot-window-popup-frame' parameter. Also see `prot-window-delete-popup-frame'." command) (interactive) (let ((frame (make-frame '((prot-window-popup-frame . t))))) (select-frame frame) (switch-to-buffer " prot-window-hidden-buffer-for-popup-frame") (condition-case nil (call-interactively ',command) ((quit error user-error) (delete-frame frame)))))) (declare-function org-capture "org-capture" (&optional goto keys)) (defvar org-capture-after-finalize-hook) ;;;###autoload (autoload 'prot-window-popup-org-capture "prot-window") (prot-window-define-with-popup-frame org-capture) (add-hook 'org-capture-after-finalize-hook #'prot-window-delete-popup-frame) (when (locate-library "tmr") (require 'tmr) (declare-function tmr "tmr" (time &optional description acknowledgep)) (defvar tmr-timer-created-functions) ;;;###autoload (autoload 'prot-window-popup-tmr "prot-window") (prot-window-define-with-popup-frame tmr) (add-hook 'tmr-timer-created-functions #'prot-window-delete-popup-frame)) ;;;;; gptel: ai-from-anywhare ;; https://www.armindarvish.com/post/use_emacs_as_a_chatgpt_client/ (when (locate-library "gptel") ;;;###autoload (defun my/ai-from-anywhere () (interactive) (let* ((screen-width (display-pixel-width)) (screen-height (display-pixel-height)) (frame-width (/ screen-width 3)) (frame-height screen-height) (frame-left (- screen-width frame-width)) (frame-top 0) (chat-frame (make-frame `((window-system . x) ; macOS use "ns" (top . ,frame-top) (left . ,frame-left) (width . (text-pixels . ,frame-width)) (heigth . (text-pixels . ,frame-height)) (minibuffer . t) )))) (select-frame chat-frame) ) (add-hook 'gptel-post-response-hook (lambda () (goto-char (point-max)))) (gptel "My:AI Chat" gptel-api-key nil) (switch-to-buffer "My:AI Chat") (delete-other-windows) )) 레골리스 i3wm 설정 [2024-10-23 Wed 22:18] /usr/share/regolith/common/config.d/15_base_launchers ## Launch // Emacs (OrgCapture) // <> c ## set_from_resource $wm.binding.orgcapture wm.binding.orgcapture c bindsym $mod+$wm.binding.orgcapture exec --no-startup-id emacsclient -e '(progn (select-frame-set-input-focus (selected-frame)) (prot-window-popup-org-capture))' ## Launch // Emacs (AI Chat) // <> Space ## set_from_resource $wm.binding.aichat wm.binding.aichat space bindsym $mod+$wm.binding.aichat exec --no-startup-id emacsclient -e '(progn (select-frame-set-input-focus (selected-frame)) (my/ai-from-anywhere))' ~/mydotfiles/local/.local/bin/myai.sh #!/bin/bash emacsclient -e '(progn (select-frame-set-input-focus (selected-frame)) (my/ai-from-anywhere))' # emacsclient -e '(progn (select-frame-set-input-focus (selected-frame)) (prot-window-popup-org-capture))' Related-Notes #이맥스 #팝업 #레이아웃 #창관리 References