Output emojis matching sound card profile
This commit is contained in:
parent
e09a8b41f6
commit
3af2b9d97d
1 changed files with 12 additions and 2 deletions
|
|
@ -40,6 +40,11 @@
|
|||
(map :name)
|
||||
)))
|
||||
|
||||
(defn profile->emoji [profile]
|
||||
(if (re-find #"a2dp" (name profile))
|
||||
"🎧"
|
||||
"🎤"))
|
||||
|
||||
(defn toggle-card-profile [card]
|
||||
(let [current (get-card-current-profile card)
|
||||
profiles (get-card-profiles card)]
|
||||
|
|
@ -47,7 +52,12 @@
|
|||
(if-let [next-profile (some->> profiles
|
||||
(remove (partial = current))
|
||||
first)]
|
||||
(sh "pactl" "set-card-profile" card (name next-profile))
|
||||
(do
|
||||
(sh "pactl" "set-card-profile" card (name next-profile))
|
||||
(profile->emoji next-profile))
|
||||
(prn "Error selecting next profile"))))
|
||||
|
||||
(toggle-card-profile (get-current-sink-name))
|
||||
(case (some->> *command-line-args*
|
||||
first)
|
||||
"get" (println (profile->emoji (get-card-current-profile (get-current-sink-name))))
|
||||
"toggle" (println (toggle-card-profile (get-current-sink-name))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue