如果我想修改 OSX 中的任务切换

发布于 2024-12-09 20:44:17 字数 242 浏览 0 评论 0原文

我希望修改 OSX 上任务切换的方式,以便我可以将两个窗口链接在一起。主要原因是我使用的是 Cinch,它允许 Windows 7 像 OS X 上的 snap 一样。

当我并排设置两个窗口时,通常是因为我想同时看到它们。我希望能够将这两个窗口链接在一起,以便当我任务切换到一个窗口时,另一个窗口也会被带到前面。

我可以通过 applescript 来完成此操作吗?或者我需要制作一个类似于 Cinch 的程序吗?

谢谢!

I am looking to modify the way that task switching happens on OSX so that I can link two windows together. The main reason for this is that I am using Cinch, which allows for Windows 7 like snap on OS X.

When I setup two windows side by side, it is usually because I want to see both of them at the same time. I want to be able to link those two windows together so that when I task switch to one, the other is also brought to the front.

Can I accomplish this through an applescript or will I need to make a program similar to Cinch?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守望孤独 2024-12-16 20:44:17

如果你想纯粹使用Applescript,你会这样做:

set app1 to "Google Chrome"
set app2 to "TextEdit"
repeat
    tell application "System Events"
        set a to name of first process whose frontmost is true
        if a is equal to app1 then
            tell application app2 to activate
            tell application app1 to activate

        end if
    end tell
    delay 0.5
end repeat

但是,这不是很有效。您将需要在后台持续运行它。尽管它不会占用太多(如果有的话)资源,因为它非常简单。

为了使其在后台运行,您需要编辑其 .plist 文件并添加:
应用程序是代理(UIElement) => true

您的替代方案是制作 Cocoa-Applescript 或实际的 Cocoa-Obj-C 应用程序。这会有点困难,但这是最好的方法。

If you wanted to purely use Applescript you would do something like this :

set app1 to "Google Chrome"
set app2 to "TextEdit"
repeat
    tell application "System Events"
        set a to name of first process whose frontmost is true
        if a is equal to app1 then
            tell application app2 to activate
            tell application app1 to activate

        end if
    end tell
    delay 0.5
end repeat

However, this is not very efficient. You will need to continuously run this in the background. Although it wouldn't take up much, if any, resources since it's so simple.

For it to run in the background you will need to edit its .plist file and add :
Application is agent (UIElement) => true

Your alternative is to make a Cocoa-Applescript or actual Cocoa-Obj-C app. This would be a little harder, but would be the best way to do it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文