From 45873bd7a1115783549a546a114e6b208b031e89 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 6 Jun 2025 09:56:39 -0700 Subject: pop-os: Add command that lists .desktop applications --- oni/home/services/stumpwm/pop-os-config.lisp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/oni/home/services/stumpwm/pop-os-config.lisp b/oni/home/services/stumpwm/pop-os-config.lisp index fbada5e..7651aed 100644 --- a/oni/home/services/stumpwm/pop-os-config.lisp +++ b/oni/home/services/stumpwm/pop-os-config.lisp @@ -40,3 +40,22 @@ (add-hook *screen-locking-hook* 'pause-notifications) (add-hook *screen-unlocked-hook* 'resume-notifications) + +(defvar *applications* nil) + +(defun pop-os-load-applications () + (mapcar (lambda (s) (split-string s " ")) + (split-string (with-output-to-string (mystr) + (sb-ext:run-program "/home/tomwillemsen/sources/10-diamond-interactive/chanced-scripts/list-desktop-files" '() :output mystr))))) + +(define-stumpwm-type :application (input prompt) + (or (argument-pop input) + (let ((applications (setf *applications* (or *applications* (pop-os-load-applications))))) + (cadr (assoc (completing-read (current-screen) prompt (mapcar #'car applications) :require-match t) + applications :test 'string=))))) + +(defcommand run-application (application) + ((:application "Application: ")) + (sb-ext:run-program "/usr/bin/gtk-launch" (list application) :wait nil)) + +(define-key *user-bindings* (kbd "a") "run-application") -- cgit v1.3-2-g0d8e