diff options
author | bd <bdunahu@gmail.com> | 2024-01-05 21:55:29 -0700 |
---|---|---|
committer | bd <bdunahu@gmail.com> | 2024-01-05 21:55:29 -0700 |
commit | 1e4a002f480925683ce0aedf39adf42cfc60381a (patch) | |
tree | ada7208a9d105788caddd51230fe617306eed2eb /.config/emacs/bd-wm.el | |
parent | 553a287b4ff7d8129870075acfb8422882dc3395 (diff) |
Replaced previous dmenu prompt with an Emacs equivalent.
Diffstat (limited to '.config/emacs/bd-wm.el')
-rw-r--r-- | .config/emacs/bd-wm.el | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/.config/emacs/bd-wm.el b/.config/emacs/bd-wm.el index 021decb..068d180 100644 --- a/.config/emacs/bd-wm.el +++ b/.config/emacs/bd-wm.el @@ -21,6 +21,29 @@ dedicated buffer will never be automatically orphaned." (if dedicated "no longer " "") (buffer-name)))) +(defun insert-bookmark () + "Inserts a url or string from permanent +bookmark file." + (interactive) + (insert (car (last (split-string (choose-line-from-file "~/Personal/scripts/bookmarks.txt")))))) + +(defun choose-line-from-file (file) + "Uses completion-framework to allow user to +select a line from a file." + (let* ((choices (read-file-into-list file))) + (completing-read "Choose one: " choices))) + +(defun read-file-into-list (file) + (with-current-buffer + (find-file-noselect file) + (split-string + (save-restriction + (widen) + (buffer-substring-no-properties + (point-min) + (point-max))) + "\n" t))) + (use-package pinentry :init @@ -44,7 +67,6 @@ dedicated buffer will never be automatically orphaned." (dolist (k '(("s-L" "slock") ("s-B" "icecat") - ("s-O" "xdotool type $(grep -v '^#' /home/bdunahu/Personal/scripts/bookmarks.txt | dmenu -i -l 12 | awk '{print $NF}')") ("s-P" "passmenu --type") ("<f2>" "brightnessctl set 1%-") ("<f3>" "brightnessctl set 1%+") @@ -80,6 +102,7 @@ dedicated buffer will never be automatically orphaned." ([?\s-p] . (lambda () (interactive) (other-window -1))) + ([?\s-O] . insert-bookmark) ([?\s-r] . exwm-reset) ([?\s-d] . toggle-current-window-dedication) ([?\s-q] . kill-current-buffer) |