windows.lisp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. (in-package :stumpwm)
  2. (defvar *windows-volume-current*
  3. 100)
  4. (defvar *windows-volume-increment*
  5. 20)
  6. (defcommand windows-volume-current-update (value) ()
  7. (sb-thread:make-thread
  8. (lambda ()
  9. (setq *windows-volume-current* value))
  10. :name "windows-volume-current-update"))
  11. (defcommand windows-volume-decrease () ()
  12. (when (> *windows-volume-current* 0)
  13. (let ((value (- *windows-volume-current*
  14. *windows-volume-increment*)))
  15. (run-shell-command (format nil "windows volume ~a" value))
  16. (windows-volume-current-update value))))
  17. (defcommand windows-volume-increase () ()
  18. (when (< *windows-volume-current* 100)
  19. (let ((value (+ *windows-volume-current*
  20. *windows-volume-increment*)))
  21. (run-shell-command (format nil "windows volume ~a" value))
  22. (windows-volume-current-update value))))
  23. (defvar *windows-username*
  24. "vagrant")
  25. (defun windows-password ()
  26. (string-trim '(#\Newline)
  27. (password-store-show "windows.local/vagrant")))
  28. (defcommand windows-xfreerdp () ()
  29. (run-shell-command
  30. (join
  31. (append (list "xfreerdp"
  32. "/v:windows.local"
  33. (concat "/u:" *windows-username*)
  34. (concat "/p:" (windows-password)))
  35. (if (current-window)
  36. (split-string (format-expand '((#\h window-height)
  37. (#\w window-width))
  38. "/w:%w /h:%h"
  39. (current-window))
  40. " ")
  41. '())))))