Skip to content

Commit

Permalink
replace seticon Python script with AppleScript
Browse files Browse the repository at this point in the history
  • Loading branch information
rveznaver committed Jan 17, 2025
1 parent dafb6d6 commit fddd206
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Config *global setting* `split_type` is now categorized as a *space setting* instead [#2479](https://github.com/koekeishiya/yabai/issues/2479)
- Additional options `x-axis` and `y-axis` can now be used with `config auto_balance` command [#190](https://github.com/koekeishiya/yabai/issues/190)
- Minor adjustment to screen-padding and window-gap [#2502](https://github.com/koekeishiya/yabai/issues/2502)
- Replace seticon script with AppleScript implementation instead of Python

## [7.1.5] - 2024-11-01
### Changed
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ man:
asciidoctor -b manpage $(DOC_PATH)/yabai.asciidoc -o $(DOC_PATH)/yabai.1

icon:
python3 $(SCRIPT_PATH)/seticon.py $(ASSET_PATH)/icon/2x/icon-512px@2x.png $(BUILD_PATH)/yabai
osascript $(SCRIPT_PATH)/seticon.scpt $(ASSET_PATH)/icon/2x/icon-512px@2x.png $(BUILD_PATH)/yabai

publish:
sed -i '' "60s/^VERSION=.*/VERSION=\"$(shell $(BUILD_PATH)/yabai --version | cut -d "v" -f 2)\"/" $(SCRIPT_PATH)/install.sh
Expand Down
11 changes: 0 additions & 11 deletions scripts/seticon.py

This file was deleted.

27 changes: 27 additions & 0 deletions scripts/seticon.scpt
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

0 comments on commit fddd206

Please sign in to comment.