19cm

19cm

V2EX 第 522781 号会员,加入于 2020-12-07 22:53:48 +08:00
今日活跃度排名 4410
19cm 最近回复了
@Autonomous 老哥, 这个能支持麦克风吗
@PbCopy111 老哥,可否发下快捷指令
@PbCopy111 脚本我做到了, 快捷指令硬是没做到
-- Hammerspoon: 切换音频输出设备( Headsets <-> Yamaha YVC-330 )
-- 将本文件保存为 ~/.hammerspoon/init.lua ,Reload Config 后按 F12 切换

-- 定义要切换的两个设备
local DEVICES = {
{name = "Headsets", icon = "🎧"}, -- 耳机
{name = "Yamaha YVC-330", icon = "🔈"} -- 雅马哈设备
}

-- 获取所有音频设备
local function getAllAudioDevices()
local devices = {}
for _, dev in ipairs(hs.audiodevice.allOutputDevices()) do
devices[dev:name()] = dev
end
return devices
end

-- 切换音频设备
local function toggleAudioOutput()
local allDevices = getAllAudioDevices()

-- 检查两个设备是否都存在
local device1 = allDevices[DEVICES[1].name]
local device2 = allDevices[DEVICES[2].name]

if not device1 or not device2 then
hs.alert.show("❌ 找不到音频设备")
return
end

-- 获取当前设备
local current = hs.audiodevice.defaultOutputDevice()

-- 决定切换到哪个设备
local target = nil
local targetIcon = ""

if current and current:name() == DEVICES[1].name then
target = device2
targetIcon = DEVICES[2].icon
else
target = device1
targetIcon = DEVICES[1].icon
end

-- 执行切换
if target:setDefaultOutputDevice() then
hs.alert.show(targetIcon .. " 已切换至: " .. target:name())
else
hs.alert.show("❌ 切换失败")
end
end




-- hs.hotkey.bind({"ctrl"}, "f1", toggleAudioOutput)

-- 绑定热键 F12 (没有修饰键)
hs.hotkey.bind({}, "f13", toggleAudioOutput)

-- 加载提示
print("🎧 音频切换脚本已加载")
print("📢 按 F12 切换设备:")
for i, device in ipairs(DEVICES) do
print(" " .. i .. ". " .. device.icon .. " " .. device.name)
end
17 小时 14 分钟前
回复了 fl2d 创建的主题 Apple macOS 下,能用快捷键切换音频输出设备么?
老哥你实现了吗,lua 脚本我倒是实现了,但快捷指令没搞定



-- Hammerspoon: 切换音频输出设备( Headsets <-> Yamaha YVC-330 )
-- 将本文件保存为 ~/.hammerspoon/init.lua ,Reload Config 后按 F12 切换

-- 定义要切换的两个设备
local DEVICES = {
{name = "Headsets", icon = "🎧"}, -- 耳机
{name = "Yamaha YVC-330", icon = "🔈"} -- 雅马哈设备
}

-- 获取所有音频设备
local function getAllAudioDevices()
local devices = {}
for _, dev in ipairs(hs.audiodevice.allOutputDevices()) do
devices[dev:name()] = dev
end
return devices
end

-- 切换音频设备
local function toggleAudioOutput()
local allDevices = getAllAudioDevices()

-- 检查两个设备是否都存在
local device1 = allDevices[DEVICES[1].name]
local device2 = allDevices[DEVICES[2].name]

if not device1 or not device2 then
hs.alert.show("❌ 找不到音频设备")
return
end

-- 获取当前设备
local current = hs.audiodevice.defaultOutputDevice()

-- 决定切换到哪个设备
local target = nil
local targetIcon = ""

if current and current:name() == DEVICES[1].name then
target = device2
targetIcon = DEVICES[2].icon
else
target = device1
targetIcon = DEVICES[1].icon
end

-- 执行切换
if target:setDefaultOutputDevice() then
hs.alert.show(targetIcon .. " 已切换至: " .. target:name())
else
hs.alert.show("❌ 切换失败")
end
end




-- hs.hotkey.bind({"ctrl"}, "f1", toggleAudioOutput)

-- 绑定热键 F12 (没有修饰键)
hs.hotkey.bind({}, "f13", toggleAudioOutput)

-- 加载提示
print("🎧 音频切换脚本已加载")
print("📢 按 F12 切换设备:")
for i, device in ipairs(DEVICES) do
print(" " .. i .. ". " .. device.icon .. " " .. device.name)
end
18 小时 1 分钟前
回复了 54xavier 创建的主题 iOS 豆包+快捷指令,实现邮件、短信每日摘要
老哥,方便留个联系方式吗,我想请教个脚本是否能用 mac 快捷指令实现
1 天前
回复了 quqivo 创建的主题 北京 北京在哪能买到真烟
烟草局门口有直属店的叫 666 好像
618 京东自营的 m4pro 满血 48g+1t 19200 给你参考
其实也挺好的,真小人比伪君子强, 人不为己天诛地灭
@tunggt #12 如果是员工干的,为啥不直接把把数据库用户表直接扒了就完了,不存在过滤出移动啊
@DendimoN #7 是客户都是移动卡吗
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2685 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 09:45 · PVG 17:45 · LAX 01:45 · JFK 04:45
♥ Do have faith in what you're doing.