branch: externals/ivy-hydra
commit 066ed7bd1f6d6070258e1b1d703350bc23286057
Author: Valentin Herrmann <[email protected]>
Commit: Basil L. Contovounesios <[email protected]>
Added pretty counsel-linux-app-format-function
* counsel.el (counsel-linux-app-format-function-name-pretty): New
function.
(counsel-linux-app-format-function): Offer it as a choice.
Copyright-paperwork-exempt: yes
Closes #2741.
---
counsel.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/counsel.el b/counsel.el
index f690cc6..8a5df31 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5904,6 +5904,7 @@ as arguments."
(const :tag "Command : Name - Comment"
counsel-linux-app-format-function-default)
(const :tag "Name - Comment (Command)"
counsel-linux-app-format-function-name-first)
(const :tag "Name - Comment"
counsel-linux-app-format-function-name-only)
+ (const :tag "Name - Comment (Pretty)"
counsel-linux-app-format-function-name-pretty)
(const :tag "Command" counsel-linux-app-format-function-command-only)
(function :tag "Custom")))
@@ -6007,6 +6008,16 @@ EXEC is the command to launch the application."
"Display only the command EXEC when formatting Linux application names."
exec)
+(defun counsel-linux-app-format-function-name-pretty (name comment _exec)
+ "Format Linux application names with the NAME (and COMMENT) only, but
pretty."
+ (format "% -45s%s"
+ (propertize
+ (ivy--truncate-string name 45)
+ 'face 'counsel-application-name)
+ (if comment
+ (concat ": " comment)
+ "")))
+
(defun counsel-linux-apps-list-desktop-files ()
"Return an alist of all Linux applications.
Each list entry is a pair of (desktop-name . desktop-file).