新闻详情

新闻详情

首页 / 资讯中心 / 详情

Multipass 的 Windows Terminal 集成设置:client.apps.windows-terminal.profiles 详解

发布时间:2026/9/26 2:52:19来源:尧图网络
Multipass 的 Windows Terminal 集成设置:client.apps.windows-terminal.profiles 详解
虚拟化开发工具云原生【免费下载链接】multipassMultipass orchestrates virtual Ubuntu instances项目地址https://gitcode.com/gh_mirrors/mu/multipass点击查看免费下载client.apps.windows-terminal.profiles是 Multipass 在 Windows 平台上控制 Windows Terminal终端应用集成的设置键。它决定 Multipass 是否会在 Windows Terminal 中注册一个名为 Multipass 的配置文件Profile从而让你打开一个终端标签页即可直接进入 primary 实例的 shell。读完本文你将掌握该设置键的可选值、默认行为、配置命令以及它在仓库源码层面的完整实现原理。设置键与作用范围该设置的完整键名为client.apps.windows-terminal.profiles从键名结构可以看出它属于client客户端命名空间下的apps.windows-terminalWindows Terminal 应用集成分组。在源码中该键被定义为常量winterm_key// include/multipass/constants.h constexpr auto winterm_key client.apps.windows-terminal.profiles;同时源码还定义了一个固定的 Profile GUID用于在 Windows Terminal 配置文件中标识 Multipass 专属的 profile// include/multipass/constants.h constexpr auto winterm_profile_guid {aaaa9e6d-1e09-4be6-b76c-82b4ba1885fb}; // identifies the primary Multipass profile in Windows Terminal这意味着 Multipass 写入 Windows Terminal 配置的 profile 具有稳定、唯一的标识符Multipass 可以据此查找、隐藏或删除它。可选值与生效行为该设置支持以下两个值值行为primary为primary实例启用一个 Windows Terminal 配置文件Profile。注意该值与client.primary-name配置的 primary 名称无关即使你改了 primary 实例的自定义名称此 profile 依然固定指向 Multipass 的 primary 实例。none禁用任何配置文件Multipass 会隐藏或移除已添加的 profile。值的校验逻辑源码对取值做了严格校验大小写不敏感会先转小写// src/platform/platform_win.cpp QString interpret_winterm_setting(const QString val) { static const auto acceptable QStringList{none, mp::petenv_default}; // none 与 primary auto ret val.toLower(); if (!acceptable.contains(ret)) throw mp::InvalidSettingException{ mp::winterm_key, val, QStringLiteral(Unknown value. Try one of these: %1.).arg(acceptable.join(, ))}; return ret; }如果传入primary、none之外的任何值Multipass 会抛出InvalidSettingException提示 Unknown value. Try one of these: none, primary.。这一校验行为有对应的单元测试覆盖见 tests/unit/windows/test_platform_win.cpp其中验证了合法值原样返回、非法值抛异常等分支。默认值默认值为primary即只要检测到系统安装了 Windows TerminalMultipass 就会尝试为其添加一个 primary 实例的 profile。该默认值在平台层的客户端扩展设置中注册并复用了 primary 实例的默认名常量// src/platform/platform_win.cpp auto mp::platform::Platform::extra_client_settings() const - SettingSpec::Set { SettingSpec::Set ret; ret.insert( std::make_uniqueCustomSettingSpec(winterm_key, petenv_default, [](const QString val) { return interpret_setting(winterm_key, val); })); return ret; }这里的petenv_default即primary见 include/multipass/constants.h。需要留意的是这是 Windows 平台特有的客户端设置——在 Linux、macOS 上该键不可用interpret_setting会因键不匹配抛出 Setting unavailable on Windows 异常相关限制可参考 docs/explanation/platform.md。配置示例查询与设置使用multipass get查询当前值multipass get client.apps.windows-terminal.profiles使用multipass set修改multipass set client.apps.windows-terminal.profilesprimary multipass set client.apps.windows-terminal.profilesnone提示get与set是 Multipass 的通用设置管理命令完整用法见 get 与 set。底层实现Multipass 如何修改 Windows Terminal 配置目标配置文件的位置Multipass 不会直接调用 Windows Terminal 的 API而是定位并修改其配置 JSON 文件$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json其中$env:LocalAppData通常为C:\Users\USER\AppData\Local。源码中通过locate_profiles_path()使用 Qt 的GenericConfigLocation标准路径定位该文件// src/platform/platform_win.cpp QString locate_profiles_path() { // The profiles file is expected in // $env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json return MP_STDPATHS.locate( mp::StandardPaths::GenericConfigLocation, Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/LocalState/settings.json); }生成的 profile 内容当设置为primary且目标 profile 不存在时Multipass 会向 Windows Terminal 的profiles列表追加一个名为 Multipass 的 profile// src/platform/platform_win.cpp Json::Value create_primary_profile() { Json::Value primary_profile{}; primary_profile[guid] mp::winterm_profile_guid; primary_profile[name] Multipass; primary_profile[commandline] multipass shell; primary_profile[background] #350425; primary_profile[cursorShape] filledBox; primary_profile[fontFace] Ubuntu Mono; primary_profile[historySize] 50000; primary_profile[icon] QDir{QCoreApplication::applicationDirPath()}.filePath(multipass_wt.ico).toStdString(); return primary_profile; }各字段的含义与效果guid固定值{aaaa9e6d-1e09-4be6-b76c-82b4ba1885fb}用于后续定位该 profilename显示在 Windows Terminal 新建标签页下拉菜单中的名称 Multipasscommandlinemultipass shell即打开该 profile 时执行的命令——进入 primary 实例的 shell如果 primary 实例未启动Multipass 会自动启动或拉起它background背景色#350425深紫色cursorShape光标形状filledBox实心方块fontFace等宽字体Ubuntu MonohistorySize滚动缓冲区 50000 行iconMultipass 随安装包提供的图标文件multipass_wt.ico。此外wt_patch_colors还会对cursorColor/foreground做兜底修补#FDFDFD解决白色显示成浅绿色的问题除非用户已有自定义值见src/platform/platform_win.cpp中的wt_patch_colors。添加、隐藏与移除的逻辑update_profiles()的核心逻辑是按 GUID 在现有 profiles 中查找 Multipass profile——若已存在且被标记为hidden或当前设置值为none则将该 profile 的hidden字段设为truenone时隐藏而不是删除条目若不存在且当前设置不是none则调用create_primary_profile()追加新 profile。// src/platform/platform_win.cpp auto primary_profile_it std::find_if(..., [](const auto profile) { return profile[guid] mp::winterm_profile_guid; }); ... else if (winterm_setting ! none) primary_profile_ptr profiles.append(create_primary_profile());写入时 Multipass 采用临时影子文件 原子替换的方式create_shadow_config_filesave_profiles避免直接破坏 Windows Terminal 正在读取的配置文件。同步触发的时机每次客户端启动完成后都会调用平台层的sync_winterm_profiles()来同步 Windows Terminal 的配置// src/client/common/client_common.cpp void mp::client::post_setup() { platform::sync_winterm_profiles(); }synchronize_winterm_profiles()的完整流程为定位settings.json读取当前设置值MP_SETTINGS.get(mp::winterm_key)读取并解析 Windows Terminal 配置 JSON根据设置值更新 profiles若内容有变化则写回文件对 未找到配置文件 / 解析失败 / 写入失败 等不同严重程度的问题分级记录日志debug/info/warning/error而不会直接崩溃见 src/platform/platform_win.cpp。也就是说只要你不手动修改该设置Multipass 每次客户端运行都会尝试补齐缺失的 Multipass profile若配置文件中缺少profiles节点等异常情况则以日志形式记录不影响 Multipass 主体功能。使用效果完成multipass set client.apps.windows-terminal.profilesprimary后在 Windows Terminal 中点击新建标签页的下拉菜单即可看到 Multipass profile选择它即自动进入 primary 实例的 shell撤销集成若想恢复原状将设置改回nonemultipass set client.apps.windows-terminal.profilesnoneMultipass 随后会在下次同步时隐藏而非删除已存在的 Multipass profile。更完整的启用、使用与撤销步骤可参考 How to integrate with Windows Terminal。相关参考命令参考get、set操作指南How to integrate with Windows Terminal平台能力说明docs/explanation/platform.md源码设置键定义 include/multipass/constants.h、Windows 平台实现 src/platform/platform_win.cpp、客户端启动同步入口 src/client/common/client_common.cpp测试设置值校验 tests/unit/windows/test_platform_win.cpp、全局设置键白名单 tests/unit/test_global_settings_handlers.cpp赞分享虚拟化开发工具云原生【免费下载链接】multipassMultipass orchestrates virtual Ubuntu instances项目地址https://gitcode.com/gh_mirrors/mu/multipass点击查看免费下载相关推荐Multipass与Windows Terminal的深度集成指南Multipass与Windows Terminal的深度集成指南 前言 Multipass作为一款轻量级虚拟机管理工具在Windows平台上与Windows虚拟化开发工具云原生Multipass 与 Windows Terminal 集成指南为 primary 实例一键生成 Multipass ProfileMultipass 与 Windows Terminal 集成指南为 primary 实例一键生成 Multipass Profile Multipass 是虚拟化开发工具云原生Windows Terminal 如何把系统默认终端设置为 Windows TerminalWindows Terminal 如何把系统默认终端设置为 Windows Terminal 在 Windows 上启动一个没有自带窗口的命令行程序从开始菜桌面应用上一篇如何快速掌握开源游戏助手5个实用技巧完整指南下一篇炉石传说HsMod插件终极指南55个功能全面提升游戏体验创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

语言引导的目标预测:机器人动态分组决策方法 2026/9/26 3:25:43

语言引导的目标预测:机器人动态分组决策方法

1. 项目概述:让机器人“听懂人话”来决定加入哪个团队你有没有试过在一群正在协作的机器人中间,突然喊一句“小蓝,去帮右边那组把箱子搬上货架”,结果它愣在原地、转头看你、甚至跑错方向?这不是科幻片里的故障镜头&am…

阅读更多 →
2026年8款降论文AI率工具横评:从原理到实操 2026/9/26 3:25:43

2026年8款降论文AI率工具横评:从原理到实操

上个月帮一位学弟改硕士论文,他在群里发了一张截图:知网AIGC检测报告,AI率37%,学院红线是20%。这意味着他花了两个月写出来的初稿,连外审都送不进去。这已经不是个例——2026年,越来越多高校和期刊同步加测…

阅读更多 →
大模型提示词工程模板框架:解耦API、标准化接口、支持多模型 2026/9/26 3:25:43

大模型提示词工程模板框架:解耦API、标准化接口、支持多模型

1. 这不是“Claude官方CLI”,而是一套可复用的代码生成骨架模板 “claude-code-templates”这个名称,乍看容易让人误以为是Anthropic官方推出的命令行工具——毕竟关键词里反复出现 claude cli 、 codex cli 、 anthropic ,再加上大量…

阅读更多 →
IP地址查询会泄露隐私吗?安全工具评估与使用指南 2026/9/26 3:25:43

IP地址查询会泄露隐私吗?安全工具评估与使用指南

上周有个朋友发我一张截图,说有人在论坛上用IP地址查询工具查到了他所在的城市,甚至连区名都打出来了。他有点慌,问我:这种工具是不是能直接定位到我家门口?有没有可能反过来把我自己的隐私也套走?我第一反…

阅读更多 →
opencode v2 架构解析:Effect Agent 循环、session_input 收件箱与 EventV2 事件核心 2026/9/26 3:25:36

opencode v2 架构解析:Effect Agent 循环、session_input 收件箱与 EventV2 事件核心

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

阅读更多 →
低光图像增强实战:Python代码包实现噪声抑制与细节重建 2026/9/26 3:25:36

低光图像增强实战:Python代码包实现噪声抑制与细节重建

简介:本资源是一套基于深度学习的低光图像增强Python实现方案,面向图像处理工程师、计算机视觉初学者及科研人员,解决夜间、隧道、监控等弱光场景下图像细节丢失、噪声显著、对比度不足等核心问题。代码以LLNet模型为核心,集成模型…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞 ✉