如何从Objective-C添加OSX Finder文件夹背景颜色/图像?

时间:2015-10-20 14:24:10

标签: objective-c macos finder

显然有一个applescript允许人们改变取景器窗口的背景颜色。是否有任何objective-c API可以调用以更改颜色和/或设置与路径相关的Finder文件夹以显示特定的背景图像?我想创建一个git hook,在特定分支上将目录的finder文件夹更改为红色(以可视方式显示我不应对该分支进行更改)。

2 个答案:

答案 0 :(得分:1)

在这里,我找到了如何在选择的文件夹中更改所有finder窗口,请在此处使用:

tell application "Finder"
set ChosenFolder to (choose folder)
set TheseFolders to (every folder of entire contents of ChosenFolder)
repeat with CounterA from 1 to (count of TheseFolders)
    set background color of icon view options of window of item CounterA of TheseFolders to (choose color)
end repeat
end tell

希望这有帮助!

答案 1 :(得分:0)

我很抱歉,但我只知道如何在Applescript中做到这一点:

带图像

tell application "Finder" to set the desktop picture to (choose file of type "png")

以下是如何使用纯色进行

tell application "Finder" to set the desktop picture to "Library:Desktop Pictures:Solid Colors:(Color Name)"

颜色名称列表:

  1. " Solid Aqua Blue.png"
  2. " Solid Aqua Dark Blue.png"
  3. " Solid Aqua Graphite.png"
  4. " Solid Grey Dark.png"
  5. " Solid Grey Light.png"
  6. " Solid Grey Medium.png"
  7. " Solid Grey Pro Dark.png"
  8. " Solid Grey Pro Ultra Dark.png"
  9. " Solid Kelp.png"
  10. " Solid Lavender.png"
  11. " Solid Mint.png"
  12. " Solid White.png"