From 42dd1caecaf7b8aaf3cfa83c8e75d8e286c1bf44 Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Thu, 1 Jan 2026 17:40:54 -0600 Subject: [PATCH] Experimenting with using Emacs as a Rofi replacement; not working correctly--YET! --- .config/emacs/config.el | 29 +++++++++++++++++++------- .config/emacs/config.org | 12 +++++++++++ .config/emacs/scripts/app-launchers.el | 24 +++++++++++++++------ .config/qtile/README.org | 2 ++ .config/qtile/config.py | 2 ++ 5 files changed, 55 insertions(+), 14 deletions(-) diff --git a/.config/emacs/config.el b/.config/emacs/config.el index e478f65..b9e8f2f 100644 --- a/.config/emacs/config.el +++ b/.config/emacs/config.el @@ -34,6 +34,7 @@ :ensure t :init (setq initial-buffer-choice 'dashboard-open) + (setq initial-scratch-message nil) (setq dashboard-set-heading-icons t) (setq dashboard-set-file-icons t) (setq dashboard-banner-logo-title "Emacs Is More Than A Text Editor!") @@ -50,6 +51,18 @@ :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)))) + (use-package diminish) (use-package dired-open @@ -577,14 +590,14 @@ (eval-after-load 'org-indent '(diminish 'org-indent-mode)) - (custom-set-faces - '(org-level-1 ((t (:inherit outline-1 :height 1.7)))) - '(org-level-2 ((t (:inherit outline-2 :height 1.6)))) - '(org-level-3 ((t (:inherit outline-3 :height 1.5)))) - '(org-level-4 ((t (:inherit outline-4 :height 1.4)))) - '(org-level-5 ((t (:inherit outline-5 :height 1.3)))) - '(org-level-6 ((t (:inherit outline-5 :height 1.2)))) - '(org-level-7 ((t (:inherit outline-5 :height 1.1))))) +(custom-set-faces + '(org-level-1 ((t (:inherit outline-1 :height 1.7)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.6)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.5)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.4)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.3)))) + '(org-level-6 ((t (:inherit outline-5 :height 1.2)))) + '(org-level-7 ((t (:inherit outline-5 :height 1.1))))) (require 'org-tempo) diff --git a/.config/emacs/config.org b/.config/emacs/config.org index 4b0b89f..e7e990e 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -125,6 +125,7 @@ Emacs Dashboard is an extensible startup screen showing you recent files, bookma :ensure t :init (setq initial-buffer-choice 'dashboard-open) + (setq initial-scratch-message nil) (setq dashboard-set-heading-icons t) (setq dashboard-set-file-icons t) (setq dashboard-banner-logo-title "Emacs Is More Than A Text Editor!") @@ -141,6 +142,17 @@ 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))) + +;; 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 diff --git a/.config/emacs/scripts/app-launchers.el b/.config/emacs/scripts/app-launchers.el index 067bffa..d7d2f91 100644 --- a/.config/emacs/scripts/app-launchers.el +++ b/.config/emacs/scripts/app-launchers.el @@ -23,7 +23,6 @@ (counsel-linux-app) (delete-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. @@ -50,6 +49,10 @@ (app-launcher-run-app) (delete-frame)))) +;; NEW LAUNCHERS +(require 'json) ;; for bookmarks and screenshots +(require 'cl-lib) ;; for screenshots + (defun dt/emacs-generic-launcher (options prompt action-fn) "Create a minibuffer-only frame to select from OPTIONS with PROMPT. ACTION-FN is a function that takes the selected string as an argument." @@ -66,11 +69,20 @@ ACTION-FN is a function that takes the selected string as an argument." (funcall action-fn selection)) (delete-frame)))) - -;; NEW LAUNCHERS - -(require 'json) ;; for bookmarks and screenshots -(require 'cl-lib) ;; for screenshots +(defun dt/emacs-command-launcher () + "A global M-x launcher that runs in a dedicated minibuffer frame." + (interactive) + (with-selected-frame + (make-frame '((name . "emacs-command-launcher") + (minibuffer . only) + (undecorated . t) + (width . 80) + (height . 15) + (internal-border-width . 10))) + (unwind-protect + ;; execute-extended-command is the built-in M-x + (call-interactively #'execute-extended-command) + (delete-frame)))) (defun dt/get-brave-bookmarks () "Parse Brave bookmarks and return an alist of (name . url)." diff --git a/.config/qtile/README.org b/.config/qtile/README.org index 47ecaa4..e3e8208 100644 --- a/.config/qtile/README.org +++ b/.config/qtile/README.org @@ -137,6 +137,7 @@ A list of available commands that can be bound to keys can be found at: https:// keys = [ # The essentials Key([mod], "Return", lazy.spawn(myTerm), desc="Terminal"), + # Use 'rofi' as a run launcher. Key([mod, "shift"], "Return", lazy.spawn("rofi -show drun -show-icons"), desc='Run Launcher'), Key([mod], "w", lazy.spawn(myBrowser), desc='Web browser'), Key([mod], "b", lazy.hide_show_bar(position='all'), desc="Toggles the bar to show/hide"), @@ -235,6 +236,7 @@ keys = [ ]), # Dmenu/rofi scripts launched using the key chord SUPER+p followed by 'key' KeyChord([mod], "p", [ + Key([], "Return", lazy.spawn("emacsclient -cF \"(visibility . nil)\" -e \"(dt/emacs-command-launcher)\""), desc='Emacs command launcher'), Key([], "h", lazy.spawn("dm-hub -r"), desc='List all dmscripts'), Key([], "a", lazy.spawn("dm-sounds -r"), desc='Choose ambient sound'), Key([], "b", lazy.spawn("dm-setbg -r"), desc='Set background'), diff --git a/.config/qtile/config.py b/.config/qtile/config.py index d54cfd9..a8420d9 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -61,6 +61,7 @@ def maximize_by_switching_layout(qtile): keys = [ # The essentials Key([mod], "Return", lazy.spawn(myTerm), desc="Terminal"), + # Use 'rofi' as a run launcher. Key([mod, "shift"], "Return", lazy.spawn("rofi -show drun -show-icons"), desc='Run Launcher'), Key([mod], "w", lazy.spawn(myBrowser), desc='Web browser'), Key([mod], "b", lazy.hide_show_bar(position='all'), desc="Toggles the bar to show/hide"), @@ -159,6 +160,7 @@ keys = [ ]), # Dmenu/rofi scripts launched using the key chord SUPER+p followed by 'key' KeyChord([mod], "p", [ + Key([], "Return", lazy.spawn("emacsclient -cF \"(visibility . nil)\" -e \"(dt/emacs-command-launcher)\""), desc='Emacs command launcher'), Key([], "h", lazy.spawn("dm-hub -r"), desc='List all dmscripts'), Key([], "a", lazy.spawn("dm-sounds -r"), desc='Choose ambient sound'), Key([], "b", lazy.spawn("dm-setbg -r"), desc='Set background'),