From 71325465627c916d771b39a7f6d96e4ff0465248 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 10 Jan 2023 09:06:23 -0800 Subject: [PATCH 1/2] fix switch-audio --- macos/swift-bar/switch-audio.30s.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/macos/swift-bar/switch-audio.30s.rb b/macos/swift-bar/switch-audio.30s.rb index dfd9bc9..cc4371a 100755 --- a/macos/swift-bar/switch-audio.30s.rb +++ b/macos/swift-bar/switch-audio.30s.rb @@ -20,10 +20,12 @@ unless ARGV.empty? .lines(chomp: true) .map {|x| JSON.parse(x) } - SOURCES.fetch(ARGV.shift.to_sym).each do |type, name| - src = audio_sources.find {|src| src.values_at("type", "name") == [type.to_s, name] } + source = SOURCES.fetch(ARGV.shift.to_sym) + %i[input output].each do |xput| + name = source.fetch(xput) + src = audio_sources.find {|src| src.values_at("type", "name") == [xput.to_s, name] } id = src.fetch("id") - `#{SWITCH_AUDIO_SOURCE} -t #{type} -i #{id}` + `#{SWITCH_AUDIO_SOURCE} -t #{xput} -i #{id}` end end From 3e1b41cd437e49c0c129878e4d651ebb64a2dab2 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Thu, 12 Jan 2023 11:04:53 -0800 Subject: [PATCH 2/2] mu --- macos/swift-bar/switch-audio.30s.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/macos/swift-bar/switch-audio.30s.rb b/macos/swift-bar/switch-audio.30s.rb index cc4371a..22018cc 100755 --- a/macos/swift-bar/switch-audio.30s.rb +++ b/macos/swift-bar/switch-audio.30s.rb @@ -46,6 +46,7 @@ SOURCES.each do |name, sources| bash: __FILE__, terminal: false, param0: name, + refresh: true, } icon = sources.fetch(:icon)