在 Mac OS X 中将所有窗口移至单个显示器(连接两个显示器)?

发布于 2024-07-04 19:49:49 字数 1571 浏览 14 评论 0原文

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

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

发布评论

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

评论(6

盛装女皇 2024-07-11 19:49:49

正如您所说,最好的答案似乎是再次打开和关闭“镜像显示”。 之后,所有窗口将被收集在主屏幕上,并且辅助屏幕将是空的。

screenshot

这有点麻烦,但在 Lion 中没有其他方法对我有用。

As you said, the best answer seems to be turning "Mirror Displays" on and off again. Afterwards, all windows will have been collected on the main screen, and the secondary screen will be empty.

screenshot

This is a bit cumbersome, but nothing else has worked for me in Lion.

风蛊 2024-07-11 19:49:49

有一篇关于使用 AppleScript 执行此操作的文章 macosxtips.co.uk,另一个位于 macosxhints.com

There is an article on using AppleScript to do this at macosxtips.co.uk, and another at macosxhints.com.

淡淡離愁欲言轉身 2024-07-11 19:49:49

Cmd+F1 似乎是 Snow Leopard 中的镜像显示快捷方式。 不过不知道狮子等。

只需点击两次,看看会发生什么(-:

对于那些喜欢将功能键设置为老式方式(而不是亮度/声音控制等)的人,它将是 Cmd+Fn +F1

Cmd+F1 appears to be a Mirror Displays shortcut in Snow Leopard. Don't know about Lion, etc, though.

Just tap it twice and see what happens (-:

For the people who prefer to set up their function keys to act in the old-fashioned way (not as brightness/sound controls etc.), it will be Cmd+Fn+F1

花开半夏魅人心 2024-07-11 19:49:49

在 Lion 上,您可以使用 fn+Cmd+F1 切换镜像显示(前提是您默认使用媒体控制键)。

这也适用于 Snow Leopard 以及可能介于两者之间的所有内容,也可能更早。

On Lion you can toggle Mirror Displays using fn+Cmd+F1 (provided you are using the media control keys as default).

This also works on Snow Leopard and likely everything in between, also possibly further back.

時窥 2024-07-11 19:49:49

您可以单击“显示”首选项窗格中的“收集窗口”按钮。

You can click the "Gather Windows" button in the Displays preference pane.

鲸落 2024-07-11 19:49:49

这是一个命令行脚本来执行此操作: http://zach.in.tu -clausthal.de/software/

它位于页面下方的“将屏幕外窗口移至主屏幕”下方。


-- Source: http://www.jonathanlaliberte.com/2007/10/19/move-all-windows-to-your-main-screen/
-- and: http://www.macosxhints.com/article.php?story=2007102012424539
--
-- Improvements:
-- +  code is more efficient and more elegant now
-- + windows are moved also, if they are "almost" completely off-screen 
--      (in the orig. version, they would be moved only if they were completely off-screen)
-- + windows are moved (if they are moved) to their closest position on-screen
--     (in the orig. version, they would be moved to a "home position" (0,22) )
-- Gabriel Zachmann, Jan 2008

-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {"Typinator"}

-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
    set _b to bounds of window of desktop
    set screen_width to item 3 of _b
    set screen_height to item 4 of _b
end tell

tell application "System Events"
    set allProcesses to application processes
    repeat with i from 1 to count allProcesses
        --display dialog (name of (process i)) as string
        if not (processesToIgnore contains ((name of (process i)) as string)) then
            try
                tell process i
                    repeat with x from 1 to (count windows)
                        set winPos to position of window x
                        set _x to item 1 of winPos
                        set _y to item 2 of winPos
                        set winSize to size of window x
                        set _w to item 1 of winSize
                        set _h to item 2 of winSize
                        --display dialog (name as string) & " - width: " & (_w as string) & " height: " & (_h as string)
                        
                        if (_x + _w < 40 or _y + _h < 50 or _x > screen_width - 40 or _y > screen_height - 40) then
                            
                            if (_x + _w < 40) then set _x to 0
                            if (_y + _h < 50) then set _y to 22
                            if (_x > screen_width - 40) then
                                set _x to screen_width - _w
                                if (_x < 0) then set _x to 0
                            end if
                            if (_y > screen_height - 40) then
                                set _y to screen_height - _h
                                if (_y < 22) then set _y to 22
                            end if
                            set position of window x to {_x, _y}
                            
                        end if
                    end repeat
                    
                end tell
            end try
        end if
    end repeat
end tell

Here is a command-line script to do just that: http://zach.in.tu-clausthal.de/software/.

It's a little down the page under "Move Off-Screen Windows to the Main Screen".


-- Source: http://www.jonathanlaliberte.com/2007/10/19/move-all-windows-to-your-main-screen/
-- and: http://www.macosxhints.com/article.php?story=2007102012424539
--
-- Improvements:
-- +  code is more efficient and more elegant now
-- + windows are moved also, if they are "almost" completely off-screen 
--      (in the orig. version, they would be moved only if they were completely off-screen)
-- + windows are moved (if they are moved) to their closest position on-screen
--     (in the orig. version, they would be moved to a "home position" (0,22) )
-- Gabriel Zachmann, Jan 2008

-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {"Typinator"}

-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
    set _b to bounds of window of desktop
    set screen_width to item 3 of _b
    set screen_height to item 4 of _b
end tell

tell application "System Events"
    set allProcesses to application processes
    repeat with i from 1 to count allProcesses
        --display dialog (name of (process i)) as string
        if not (processesToIgnore contains ((name of (process i)) as string)) then
            try
                tell process i
                    repeat with x from 1 to (count windows)
                        set winPos to position of window x
                        set _x to item 1 of winPos
                        set _y to item 2 of winPos
                        set winSize to size of window x
                        set _w to item 1 of winSize
                        set _h to item 2 of winSize
                        --display dialog (name as string) & " - width: " & (_w as string) & " height: " & (_h as string)
                        
                        if (_x + _w < 40 or _y + _h < 50 or _x > screen_width - 40 or _y > screen_height - 40) then
                            
                            if (_x + _w < 40) then set _x to 0
                            if (_y + _h < 50) then set _y to 22
                            if (_x > screen_width - 40) then
                                set _x to screen_width - _w
                                if (_x < 0) then set _x to 0
                            end if
                            if (_y > screen_height - 40) then
                                set _y to screen_height - _h
                                if (_y < 22) then set _y to 22
                            end if
                            set position of window x to {_x, _y}
                            
                        end if
                    end repeat
                    
                end tell
            end try
        end if
    end repeat
end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文