tmux 会话中的“say”命令不会更改系统默认语音
System default voice doesn't change on `say` command within tmux sessions
最近我通过 "System Preferences > Dictation & Speech > Text to Speech > System Voice" 更改了我的默认系统语音。如果我打开一个新终端 window 并使用 say
命令,则会使用正确的语音。但是,如果我在 tmux 会话中使用 say
命令,仍然会使用以前的声音。
我已经尝试重新启动,完全关闭 tmux,并使用 tmux new-session -s foobar
打开一个全新的 tmux 会话,但它仍然没有选择新的首选语音。
这确实是一个小问题,但我不知道为什么会这样。有任何想法吗?
我很确定这与 that other issue 的根本原因相同:许多需要与 UI 交互的工具(图形、声音...)在 tmux 会话中失败: say
、pbcopy/pbpaste
、nohup
、launchctl export|getenv|setenv
、subl
(Sublime Text 命令行工具)、在 tmux 下启动的应用程序的 Retina 渲染、尝试访问 KeyChain 的工具(curl
, ssh
...), 等等
我记得 GNU screen
曾经有过同样的问题,但 Apple 给它打了补丁,现在可以正常使用了,但是 tmux
仍然有问题。
解决方案 (2017-05)
借用链接问题中的答案,对于 tmux
如果你有 Homebrew,你可以这样做:
brew install reattach-to-user-namespace
然后将以下内容放入您的 ~/.tmux.conf
:
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
我在 macOS 10.11.4 上重现了你的问题,上面的问题已经解决了。
See here 了解有关问题性质及其解决方法的更多信息(使用未记录的 macOS API)
很快就会有更好的解决方案?
如评论中所述,tmux 的未来版本可能会原生执行此舞蹈,至少 it's being worked on, and current master has the fix。
最近我通过 "System Preferences > Dictation & Speech > Text to Speech > System Voice" 更改了我的默认系统语音。如果我打开一个新终端 window 并使用 say
命令,则会使用正确的语音。但是,如果我在 tmux 会话中使用 say
命令,仍然会使用以前的声音。
我已经尝试重新启动,完全关闭 tmux,并使用 tmux new-session -s foobar
打开一个全新的 tmux 会话,但它仍然没有选择新的首选语音。
这确实是一个小问题,但我不知道为什么会这样。有任何想法吗?
我很确定这与 that other issue 的根本原因相同:许多需要与 UI 交互的工具(图形、声音...)在 tmux 会话中失败: say
、pbcopy/pbpaste
、nohup
、launchctl export|getenv|setenv
、subl
(Sublime Text 命令行工具)、在 tmux 下启动的应用程序的 Retina 渲染、尝试访问 KeyChain 的工具(curl
, ssh
...), 等等
我记得 GNU screen
曾经有过同样的问题,但 Apple 给它打了补丁,现在可以正常使用了,但是 tmux
仍然有问题。
解决方案 (2017-05)
借用链接问题中的答案,对于 tmux
如果你有 Homebrew,你可以这样做:
brew install reattach-to-user-namespace
然后将以下内容放入您的 ~/.tmux.conf
:
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
我在 macOS 10.11.4 上重现了你的问题,上面的问题已经解决了。
See here 了解有关问题性质及其解决方法的更多信息(使用未记录的 macOS API)
很快就会有更好的解决方案?
如评论中所述,tmux 的未来版本可能会原生执行此舞蹈,至少 it's being worked on, and current master has the fix。