tvl-depot/configs/shared/.emacs.d/wpc/playback.el
William Carroll 5785a5d126 Support prelude/start-process
If you refer to the previous commit where I change shell-command usages to
start-process function calls, you'll see the rationale for why I prefer
start-process.

This commit introduces a more ergonomic API for start-process that fits most of
my current use-cases of it. This cleans up the code. I have introduced a bug in
the way that I'm tokenizing the COMMAND value. I've tracked that with a
TODO. For now it only affects the `xmodmap -e '<command-string>'` calls, which
isn't too disruptive.
2020-01-06 15:25:25 +00:00

41 lines
1.1 KiB
EmacsLisp

;;; playback.el --- Control playback with Elisp -*- lexical-binding: t -*-
;; Author: William Carroll <wpcarro@gmail.com>
;;; Commentary:
;; As you know, my whole universe is turning Elisp, so this should too!
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'prelude)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun playback/prev ()
"Move to the previous song."
(interactive)
(prelude/start-process
:name "playback/prev"
:command "playerctl previous"))
(defun playback/next ()
"Move to the next song."
(interactive)
(prelude/start-process
:name "playback/next"
:command "playerctl next"))
(defun playback/play-pause ()
"Play or pause the current song."
(interactive)
(prelude/start-process
:name "playback/play-pause"
:command "playerctl play-pause"))
(provide 'playback)
;;; playback.el ends here