windows - 保存和恢复应用程序和布局

标签 windows macos desktop state

我正在寻找方法来减少打开所有需要的应用程序、定位窗口、打开 url/文件/更改目录/等所浪费的时间。在实际编码开始之前。

在完美的世界中,每个“项目”会有 2 个标记为“保存状态”和“恢复状态”的按钮。您在某些游戏中发现的那种功能。

我在 Mac 上花了几个小时用“Automator”(出于某种原因甚至无法从 Dock 打开 Firefox)和 applescript(这让我感觉我正在为长途跋涉)。

在网上搜索让我找到了这个脚本:

http://snipt.net/Fotinakis/applescript-to-save-and-restore-window-positions/

#!/usr/bin/osascript

-- Usage:
-- $ osacompile -o windowPositions.compiled.scpt windowPositions.scpt
-- $ osascript windowPositions.compiled.scpt --save
-- $ osascript windowPositions.compiled.scpt --restore

-- Change this to be the list of windows you want to save/restore
property affectedProcesses : {"Chrome", "Adium", "Eclipse", "Terminal"}
property windowRecord : {}

on run argv
 if (count of argv) is equal to 0 then
  log "Please specify one of --save or --restore."
  return
 end if

 tell application "System Events"
  if (item 1 of argv is equal to "--save") then
   set windowRecord to {}
   repeat with i from 1 to count affectedProcesses
    set end of windowRecord to {0, {}, {}}
   end repeat
   repeat with p from 1 to count affectedProcesses
    set processName to (item p of affectedProcesses)
    if exists process processName then
     log "Process '" & processName & "' exists"
     tell process processName
      set numWindows to count windows
      set item 1 of item p of windowRecord to numWindows
      repeat with i from 1 to numWindows
       set end of item 2 of item p of windowRecord to position of window i
       set end of item 3 of item p of windowRecord to size of window i
      end repeat
     end tell
    end if
   end repeat
  else
   repeat with p from 1 to count affectedProcesses
    set processName to (item p of affectedProcesses)
    if exists process processName then
     log "Process '" & processName & "' exists"
     tell process processName
      set numWindows to item 1 of item p of windowRecord
      repeat with i from 1 to numWindows
       set position of window i to (item i of item 2 of item p of windowRecord)
       set size of window i to (item i of item 3 of item p of windowRecord)
      end repeat
     end tell
    end if
   end repeat
  end if
 end tell
end run

它完成了一半的工作(调整当前窗口的大小和位置),但在多显示器多桌面设置上会分崩离析。没有原始作者寻求帮助或反馈的联系信息。

任何人都可以阐明保存和恢复应用程序和布局吗?感觉这是一个应该有一些辅助实用程序的常见任务。我拥有的最好的是“ sleep 模式”,但似乎我必须每隔一天完全重启一次,而且我有不同的应用程序和不同项目的布局。

最佳答案

这是一个 feature of Lion (Mac OS X 10.7) ...我不会因为 Apple 认为需要并且已经相当无缝地实现的功能而自杀...

Apple feature page describing feature

关于windows - 保存和恢复应用程序和布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3824065/

相关文章:

c++ - 在 LDAP 中添加 StartTLS 和 LDAPS 选项时验证客户端证书

C# Windows 服务 - 自动启动然后停止

javascript - Windows 10 本地主机请求 ECONNREFUSED

python - 线程中的pyGame

macos - Gradle exec commandLine无法按预期工作

macos - NSImage lockFocus unlockFocus 图像模糊

python - 如何检测我的 python 代码是否在 PowerShell 或命令提示符 (cmd) 中运行

javascript - 基于移动或桌面的 jQuery

c# - 如何在 C# 中启用第二个监视器?

c# - 如何在桌面右键菜单中添加项目