-
-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace seticon Python script with AppleScript
- Loading branch information
Showing
4 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env osascript | ||
|
||
use framework "AppKit" | ||
|
||
-------------------------------------------------------------------------------- | ||
# PROPERTY DECLARATIONS: | ||
property this : a reference to current application | ||
property NSWorkspace : a reference to NSWorkspace of this | ||
property NSImage : a reference to NSImage of this | ||
|
||
-------------------------------------------------------------------------------- | ||
# IMPLEMENTATION: | ||
on run argv | ||
set icon to item 1 of argv | ||
set target to item 2 of argv | ||
|
||
setIcon to icon for target | ||
end run | ||
-------------------------------------------------------------------------------- | ||
# HANDLERS: | ||
to setIcon to iconPath for filePath | ||
set sharedWorkspace to NSWorkspace's sharedWorkspace() | ||
set newImage to NSImage's alloc() | ||
set icon to newImage's initWithContentsOfFile:iconPath | ||
|
||
set success to sharedWorkspace's setIcon:icon forFile:filePath options:0 | ||
end setIcon |