From 05eabdbd0ac216566bcde4141e3b3ceea2ed07f2 Mon Sep 17 00:00:00 2001 From: Toxblh Date: Fri, 20 Apr 2018 22:54:38 +0100 Subject: [PATCH] Added Button mute `{ "type": "mute", "width": 40, "align": "right" },` #23 --- MTMR/ItemsParsing.swift | 4 ++++ MTMR/KeyPress.swift | 2 ++ 2 files changed, 6 insertions(+) diff --git a/MTMR/ItemsParsing.swift b/MTMR/ItemsParsing.swift index a01af0c..17cee83 100644 --- a/MTMR/ItemsParsing.swift +++ b/MTMR/ItemsParsing.swift @@ -60,6 +60,10 @@ class SupportedTypesHolder { let imageParameter = GeneralParameter.image(source: NSImage(named: .touchBarVolumeUpTemplate)!) return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_SOUND_UP), parameters: [.image: imageParameter]) }, + "mute": { _ in + let imageParameter = GeneralParameter.image(source: NSImage(named: .touchBarAudioOutputMuteTemplate)!) + return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_MUTE), parameters: [.image: imageParameter]) + }, "previous": { _ in let imageParameter = GeneralParameter.image(source: NSImage(named: .touchBarRewindTemplate)!) return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_PREVIOUS), parameters: [.image: imageParameter]) diff --git a/MTMR/KeyPress.swift b/MTMR/KeyPress.swift index 5421d97..fe0f109 100644 --- a/MTMR/KeyPress.swift +++ b/MTMR/KeyPress.swift @@ -58,6 +58,7 @@ func HIDPostAuxKey(_ key: Int) { // hidsystem/ev_keymap.h let NX_KEYTYPE_SOUND_UP = 0 let NX_KEYTYPE_SOUND_DOWN = 1 +let NX_KEYTYPE_MUTE = 7 let NX_KEYTYPE_BRIGHTNESS_UP = 2 let NX_KEYTYPE_BRIGHTNESS_DOWN = 3 @@ -69,3 +70,4 @@ let NX_KEYTYPE_PREVIOUS = 18 +