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

This commit is contained in:
Derek Taylor
2026-01-01 17:40:54 -06:00
parent a1707fd9d1
commit 42dd1caeca
5 changed files with 55 additions and 14 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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)."

View File

@@ -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'),

View File

@@ -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'),