我可以强制 Chrome 窗口名称保留吗?

问题描述 投票:0回答:1

我针对不同的用户配置文件同时使用许多不同的 Chrome 窗口。我每天使用名称窗口功能来快速识别我试图从 Dock 访问的用户。

我经常会不小心关闭整个窗口而不是一个选项卡,每次关闭 Chrome 时都必须重新命名所有内容,这是一种巨大的痛苦。

我已经进行了大量的挖掘并尝试了不同的扩展,以找到一种将窗口名称永久分配给特定用户配置文件的方法,但没有成功。有没有办法可以在(他们的个人资料数据?)中设置与用户关联的窗口名称并使其保留,即使在 Chrome 关闭后重新启动时也是如此?

macos google-chrome google-chrome-extension macos-ventura
1个回答
0
投票

您可以使用此脚本以

Default
用户配置文件和相同的窗口名称启动 Google Chrome :

#!/bin/bash

osascript << EOF
set userProfile to "Default"
set urlToOpen to "http://www.google.com" -- The URL to open in Chrome

set chromePath to "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
set commandToRun to quoted form of chromePath & " --profile-directory=" & quoted form of userProfile & " " & quoted form of urlToOpen
do shell script commandToRun
delay 1
tell application "Google Chrome"
    if not (exists window 1) then
        make new window
        set URL of active tab of window 1 to urlToOpen
        delay 1
    end if
    execute front window's active tab javascript "document.title = 'Default'"
end tell
EOF
© www.soinside.com 2019 - 2024. All rights reserved.