Experimenting with using Emacs as a Rofi replacement; not working correctly--YET!

This commit is contained in:
Derek Taylor
2026-01-01 18:47:59 -06:00
parent 42dd1caeca
commit b316fddf3e
5 changed files with 89 additions and 82 deletions

View File

@@ -51,17 +51,12 @@
:config
(dashboard-setup-startup-hook))
(add-to-list 'display-buffer-alist
'("\\*launcher\\*" ;; Adjust to match your launcher's buffer name
(display-buffer-same-window)
(inhibit-same-window . nil)))
;; Force the frame to strictly have one window
(add-hook 'server-after-make-frame-hook
(lambda ()
(when (equal (frame-parameter nil 'name) "launcher")
(set-window-dedicated-p (selected-window) t)
(delete-other-windows))))
;; IMPORTANT: This allows us to use our custom Emacs launchers
;; without getting the annoying second window created.
(setq display-buffer-alist
'(("^\\(\\*.*\\*\\|Dashboard\\)$"
(display-buffer-no-window)
(allow-no-window . t))))
(use-package diminish)

View File

@@ -142,17 +142,13 @@ Emacs Dashboard is an extensible startup screen showing you recent files, bookma
:config
(dashboard-setup-startup-hook))
(add-to-list 'display-buffer-alist
'("\\*launcher\\*" ;; Adjust to match your launcher's buffer name
(display-buffer-same-window)
(inhibit-same-window . nil)))
;; IMPORTANT: This allows us to use our custom Emacs launchers
;; without getting the annoying second window created.
(setq display-buffer-alist
'(("^\\(\\*.*\\*\\|Dashboard\\)$"
(display-buffer-no-window)
(allow-no-window . t))))
;; Force the frame to strictly have one window
(add-hook 'server-after-make-frame-hook
(lambda ()
(when (equal (frame-parameter nil 'name) "launcher")
(set-window-dedicated-p (selected-window) t)
(delete-other-windows))))
#+end_src
* DIMINISH

View File

@@ -5,23 +5,18 @@
;; Counsel-Linux-App
;; Since we have counsel installed, we can use 'counsel-linux-app' to launch our Linux apps. It list the apps by their executable command, so it's kind of tricky to use.
(defun dt/emacs-counsel-launcher ()
"Create and select a frame called emacs-counsel-launcher which consists only of a minibuffer and has specific dimensions. Runs counsel-linux-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(defun dt/emacs-run-launcher ()
"Launcher that works with the frame created by emacsclient."
(interactive)
(with-selected-frame
(make-frame '((name . "emacs-run-launcher")
(minibuffer . only)
(fullscreen . 0) ; no fullscreen
(undecorated . t) ; remove title bar
;;(auto-raise . t) ; focus on this frame
;;(tool-bar-lines . 0)
;;(menu-bar-lines . 0)
(internal-border-width . 10)
(width . 80)
(height . 11)))
(unwind-protect
(counsel-linux-app)
(delete-frame))))
(let ((frame (selected-frame)))
(modify-frame-parameters frame
'((undecorated . t)
(internal-border-width . 10)
(menu-bar-lines . 0)
(tool-bar-lines . 0)))
(unwind-protect
(app-launcher-run-app)
(delete-frame frame))))
;; App-Launcher
;; The 'app-launcher' is a better run launcher since it reads the desktop applications on your system and you can search them by their names as defined in their desktop file. This means that sometimes you have to search for a generic term rather than the actual binary command of the program.
@@ -31,7 +26,7 @@
;; create a global keyboard shortcut with the following code
;; emacsclient -cF "((visibility . nil))" -e "(emacs-run-launcher)"
(defun dt/emacs-run-launcher ()
(defun dt/emacs-run-launcher-old ()
"Create and select a frame called emacs-run-launcher which consists only of a minibuffer and has specific dimensions. Runs app-launcher-run-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited"
(interactive)
(with-selected-frame
@@ -49,6 +44,21 @@
(app-launcher-run-app)
(delete-frame))))
(defun dt/emacs-run-launcher ()
"Launcher that works with the frame created by emacsclient."
(interactive)
(let ((frame (selected-frame)))
(modify-frame-parameters frame
'((undecorated . t)
(width . 80)
(height . 11)
(internal-border-width . 10)
(menu-bar-lines . 0)
(tool-bar-lines . 0)))
(unwind-protect
(app-launcher-run-app)
(delete-frame frame))))
;; NEW LAUNCHERS
(require 'json) ;; for bookmarks and screenshots
(require 'cl-lib) ;; for screenshots