diff options
-rw-r--r-- | .emacs.d/rul-lisp/packages/rul-wm.el | 32 | ||||
-rwxr-xr-x | bin/gnome-set-config | 12 |
2 files changed, 44 insertions, 0 deletions
diff --git a/.emacs.d/rul-lisp/packages/rul-wm.el b/.emacs.d/rul-lisp/packages/rul-wm.el index cea3a76..59fc2f4 100644 --- a/.emacs.d/rul-lisp/packages/rul-wm.el +++ b/.emacs.d/rul-lisp/packages/rul-wm.el @@ -23,6 +23,38 @@ (set-face-attribute 'tab-bar nil :height 0.8) (tab-bar-mode 1) +;; Pop-up buffers +;; https://protesilaos.com/codelog/2024-09-19-emacs-command-popup-frame-emacsclient/ +(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) + ;; Placeholder for frame, otherwise it'll get autoclosed. + (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) + (use-package olivetti :ensure t :defer t diff --git a/bin/gnome-set-config b/bin/gnome-set-config index 5bfb476..b199378 100755 --- a/bin/gnome-set-config +++ b/bin/gnome-set-config @@ -1,4 +1,7 @@ #!/bin/sh +# Sets my preferred Gnome config. +# Find existing bindings with: +# for e in $(gsettings list-schemas | grep bind); do gsettings list-recursively $e; done NUM_WORKSPACES=9 @@ -10,3 +13,12 @@ for i in $(seq 1 $NUM_WORKSPACES); do gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-$i "['<Super>$i']" gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-$i "['<Shift><Super>$i']" done + +# This configuration is not present in gsettings; we need to fall back to dconf +dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding "'<Super>Return'" +dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command "'kgx'" +dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name "'Open terminal'" + +dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/binding "'<Shift><Super>o'" +dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/command "'emacsclient -e \"(prot-window-popup-org-capture)\"'" +dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/name "'org-capture'" |