Skip to content

Commit 57cfe66

Browse files
committed
feat: aseprite wakatime
1 parent cdf82dc commit 57cfe66

16 files changed

Lines changed: 1099 additions & 142 deletions

.github/workflows/build.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Unity WakaTime
1+
name: Build Creative WakaTime
22

33
on:
44
pull_request:
@@ -72,8 +72,8 @@ jobs:
7272
shell: msys2 {0}
7373
run: |
7474
echo "✅ Ninja build test completed!"
75-
if [ -f "build/unity_wakatime.exe" ]; then
76-
echo "📦 Executable created: $(stat -c%s build/unity_wakatime.exe) bytes"
75+
if [ -f "build/creative_wakatime.exe" ]; then
76+
echo "📦 Executable created: $(stat -c%s build/creative_wakatime.exe) bytes"
7777
echo "🥷 Ninja build test passed - ready for production!"
7878
else
7979
echo "❌ Ninja build test failed!"
@@ -135,36 +135,49 @@ jobs:
135135
- name: Build Production Release (Ninja)
136136
shell: msys2 {0}
137137
run: |
138-
echo "🥷 Building Unity WakaTime with Ninja v${{ env.RELEASE_VERSION }}..."
138+
echo "🥷 Building Creative WakaTime with Ninja v${{ env.RELEASE_VERSION }}..."
139139
cmake --build build --config $BUILD_TYPE --parallel $(nproc)
140140
141141
- name: Verify Production Build
142142
shell: msys2 {0}
143143
run: |
144-
if [ -f "build/unity_wakatime.exe" ]; then
144+
if [ -f "build/creative_wakatime.exe" ]; then
145145
echo "✅ Ninja production build successful!"
146-
echo "📦 Final executable size: $(stat -c%s build/unity_wakatime.exe) bytes"
146+
echo "📦 Final executable size: $(stat -c%s build/creative_wakatime.exe) bytes"
147147
else
148148
echo "❌ Ninja production build failed!"
149149
exit 1
150150
fi
151151
- name: Create Release Package
152152
shell: msys2 {0}
153153
run: |
154-
PACKAGE_NAME="Unity-Wakatime_v${{ env.RELEASE_VERSION }}"
154+
PACKAGE_NAME="Creative-Wakatime_v${{ env.RELEASE_VERSION }}"
155+
EXTENSION_NAME="creative-wakatime"
155156
echo "📦 Creating release package: $PACKAGE_NAME"
156157
157158
mkdir -p "release-package/$PACKAGE_NAME"
158-
cp build/unity_wakatime.exe "release-package/$PACKAGE_NAME/"
159+
cp build/creative_wakatime.exe "release-package/$PACKAGE_NAME/"
159160
cp build/logo_32.png "release-package/$PACKAGE_NAME/"
160161
161162
[ -f README.md ] && cp README.md "release-package/$PACKAGE_NAME/" || echo "README.md not found"
162163
[ -f LICENSE ] && cp LICENSE "release-package/$PACKAGE_NAME/" || echo "LICENSE not found"
163164
165+
# Aseprite extension은 별도 설치 가능한 .aseprite-extension(zip)으로 패키징
166+
if [ -d aseprite-extension ]; then
167+
mkdir -p release-package/aseprite-extension-build
168+
cp aseprite-extension/package.json release-package/aseprite-extension-build/
169+
cp aseprite-extension/wakatime.lua release-package/aseprite-extension-build/
170+
(cd release-package/aseprite-extension-build && 7z a "../${EXTENSION_NAME}.aseprite-extension" package.json wakatime.lua)
171+
else
172+
echo "aseprite-extension not found"
173+
fi
174+
164175
echo "📋 Release package contents:"
165176
ls -la "release-package/$PACKAGE_NAME/"
177+
ls -lh release-package/*.aseprite-extension || true
166178
167179
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
180+
echo "EXTENSION_NAME=$EXTENSION_NAME" >> $GITHUB_ENV
168181
169182
- name: Create ZIP Archive
170183
shell: msys2 {0}
@@ -180,12 +193,16 @@ jobs:
180193
uses: actions/upload-artifact@v4
181194
with:
182195
name: ${{ env.PACKAGE_NAME }}
183-
path: release-package/${{ env.PACKAGE_NAME }}/
196+
path: |
197+
release-package/${{ env.PACKAGE_NAME }}/
198+
release-package/${{ env.EXTENSION_NAME }}.aseprite-extension
184199
retention-days: 90
185200

186201
- name: Upload ZIP to Release
187202
uses: softprops/action-gh-release@v1
188203
env:
189204
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190205
with:
191-
files: release-package/${{ env.PACKAGE_NAME }}.zip
206+
files: |
207+
release-package/${{ env.PACKAGE_NAME }}.zip
208+
release-package/${{ env.EXTENSION_NAME }}.aseprite-extension

CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.23)
2-
project(unity_wakatime)
2+
project(creative_wakatime)
33

44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -11,6 +11,7 @@ set(SOURCES
1111
src/process_monitor.cpp
1212
src/file_watcher.cpp
1313
src/wakatime_client.cpp
14+
src/inbox_bridge.cpp
1415
src/tray_icon.cpp
1516
src/windows_dark_mode.cpp
1617
src/unity_focus_detector.cpp
@@ -21,15 +22,16 @@ set(HEADERS
2122
include/process_monitor.h
2223
include/file_watcher.h
2324
include/wakatime_client.h
25+
include/inbox_bridge.h
2426
include/tray_icon.h
2527
include/windows_dark_mode.h
2628
include/unity_focus_detector.h
2729
)
2830

29-
add_executable(unity_wakatime ${SOURCES} ${HEADERS})
31+
add_executable(creative_wakatime ${SOURCES} ${HEADERS})
3032

3133
if(WIN32)
32-
target_compile_definitions(unity_wakatime PRIVATE
34+
target_compile_definitions(creative_wakatime PRIVATE
3335
WINVER=0x0601
3436
_WIN32_WINNT=0x0601
3537
UNICODE=1
@@ -38,15 +40,15 @@ if(WIN32)
3840
)
3941

4042
if(MINGW)
41-
target_link_options(unity_wakatime PRIVATE
43+
target_link_options(creative_wakatime PRIVATE
4244
-static-libgcc
4345
-static-libstdc++
4446
-static
4547
-mwindows
4648
-Wl,--enable-stdcall-fixup
4749
)
4850

49-
target_link_libraries(unity_wakatime
51+
target_link_libraries(creative_wakatime
5052
winhttp
5153
shell32
5254
psapi
@@ -58,7 +60,7 @@ if(WIN32)
5860
)
5961
else()
6062
# MSVC용 설정
61-
target_link_libraries(unity_wakatime
63+
target_link_libraries(creative_wakatime
6264
winhttp
6365
shell32
6466
psapi
@@ -74,20 +76,20 @@ if(WIN32)
7476
if(CMAKE_BUILD_TYPE STREQUAL "Release")
7577
if(MSVC)
7678
# MSVC: Windows 서브시스템 설정
77-
set_property(TARGET unity_wakatime PROPERTY WIN32_EXECUTABLE TRUE)
78-
target_link_options(unity_wakatime PRIVATE
79+
set_property(TARGET creative_wakatime PROPERTY WIN32_EXECUTABLE TRUE)
80+
target_link_options(creative_wakatime PRIVATE
7981
/SUBSYSTEM:WINDOWS
8082
/ENTRY:mainCRTStartup
8183
)
8284
elseif(MINGW)
8385
# MinGW: 크기 최적화 (-Os), LTO, 미사용 섹션 제거 (Resident Set Size 최소화)
84-
target_compile_options(unity_wakatime PRIVATE
86+
target_compile_options(creative_wakatime PRIVATE
8587
-Os
8688
-flto
8789
-ffunction-sections
8890
-fdata-sections
8991
)
90-
target_link_options(unity_wakatime PRIVATE
92+
target_link_options(creative_wakatime PRIVATE
9193
-Os # LTO 링크 단계 최적화도 크기 우선으로
9294
-s # Strip symbols for smaller file size
9395
-flto

README.md

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,110 @@
11
<div align="center">
22

3-
## Unity - WakaTime
3+
## Creative - WakaTime
44

55
[![License: MIT](https://img.shields.io/badge/License-MIT-skyblue.svg?style=for-the-badge&logo=github)](LICENSE)
6-
![GitHub Repo stars](https://img.shields.io/github/stars/snow0406/Unity-Wakatime?style=for-the-badge&logo=github&color=%23ef8d9d)
6+
![GitHub Repo stars](https://img.shields.io/github/stars/snow0406/creative-wakatime?style=for-the-badge&logo=github&color=%23ef8d9d)
77

8-
🎯 Automatic Unity project detection and time tracking for WakaTime
8+
🎯 Automatic time tracking for **Unity** and **Aseprite** via WakaTime
99

1010
---
1111

1212
</div>
1313

1414
### 🚀 Features
1515

16-
- **Automatic Detection**: Finds Unity projects automatically
17-
- **Real-time Monitoring**: Tracks file changes as you code
16+
- **Unity**: Automatic project detection + real-time file change tracking
17+
- **Aseprite**: Editing & saving activity tracking via a lightweight Lua extension
1818
- **Version Support**: Detects Unity editor versions (e.g., "Unity 2022.3")
1919
- **System Tray**: Runs quietly in background with right-click menu
2020
- **Smart Notifications**: Shows project start/stop alerts
21+
- **Separate dashboards**: Unity and Aseprite are reported as distinct editors on WakaTime
2122

2223
### 🔧 System Requirements
2324

2425
- **OS**: Windows
2526
- **API key**: WakaTime API KEY (free at wakatime.com)
27+
- **Aseprite** (optional): for sprite/pixel-art tracking
2628

2729
### 📦 Installation
2830

29-
1. Go to [Releases](https://github.com/Snow0406/Unity-Wakatime/releases)
30-
2. Download the latest `Unity-Wakatime_vX.X.X.zip`
31+
1. Go to [Releases](https://github.com/Snow0406/creative-wakatime/releases)
32+
2. Download the latest `Creative-Wakatime_vX.X.X.zip`
3133
3. Extract to your preferred location
32-
4. Run `unity_wakatime.exe`
34+
4. Run `creative_wakatime.exe`
3335

3436
### ⚙️ Setup
3537

3638
1. **Get WakaTime API Key**:
3739
- Visit https://wakatime.com/api-key
3840
- Copy your API key
3941

40-
2. **Configure Unity WakaTime**:
42+
2. **Configure Creative WakaTime**:
4143
- Right-click the system tray icon
4244
- Click "🔑 Setup API Key"
4345
- The WakaTime website will open automatically
4446
- Copy your API key and click OK
4547
- Wait for validation ✅
48+
- The API key is stored at `%APPDATA%/creative-wakatime/wakatime_config.txt`
4649

47-
3. **Start Unity and Code!**
50+
3. **Unity** — Start and Code!
4851
- Open any Unity project
49-
- The app will automatically detect and start tracking
52+
- The app automatically detects and starts tracking
53+
54+
4. **Aseprite** — Install the extension (optional):
55+
- Download `creative-wakatime.aseprite-extension` from the same release.
56+
- Double-click it, or install it from Aseprite via
57+
**Edit > Preferences > Extensions > Add Extension**.
58+
- Restart Aseprite.
59+
- The extension writes local event files to `%APPDATA%/creative-wakatime/events/`.
60+
- Creative WakaTime watches that folder and forwards heartbeats.
61+
62+
### 🧩 How Aseprite tracking works
63+
64+
Aseprite cannot be hooked directly from C++, so a small Aseprite **Lua extension**
65+
emits local JSON event files on edit/save. The tray app watches
66+
`%APPDATA%/creative-wakatime/events/` (event-driven, no polling) and converts each
67+
event into a WakaTime heartbeat, then deletes the file.
68+
69+
```
70+
Unity -> ProcessMonitor / FileWatcher -> WakaTimeClient -> WakaTime API
71+
Aseprite -> Lua extension -> events/*.json -> Inbox bridge -> WakaTimeClient -> WakaTime API
72+
```
73+
74+
Aseprite events are intentionally optional. If the extension is not installed,
75+
Creative WakaTime only watches an empty local inbox and no Aseprite heartbeat is
76+
created.
77+
78+
#### Aseprite extension behavior
79+
80+
- **Edit activity** (`sitechange`): active sprite/layer/frame changes are reported
81+
as `is_write=false` with a 2-minute per-file debounce.
82+
- **Save activity** (`aftercommand``SaveFile`/`SaveFileAs`/`SaveFileCopyAs`):
83+
reported immediately as `is_write=true`.
84+
- Unsaved sprites without a file path are ignored.
85+
- `project` is the parent folder name of the sprite file.
86+
- The extension does not call the WakaTime API directly; it only writes local
87+
`.json` event files for the tray app to consume.
88+
89+
#### Manual Aseprite extension install
90+
91+
If you are building from source instead of using the release asset, zip the
92+
contents of `aseprite-extension/` so that `package.json` and `wakatime.lua` are at
93+
the root of the archive, then rename the archive to
94+
`creative-wakatime.aseprite-extension`.
95+
96+
You can also copy the folder manually:
97+
98+
```text
99+
%APPDATA%/Aseprite/extensions/creative-wakatime/
100+
```
101+
102+
The folder must contain both `package.json` and `wakatime.lua`.
50103

51104
## License
52105

53106
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
54107

55108
---
56109

57-
Made with ♥ by hy
110+
Made with ♥ by hy

aseprite-extension/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "creative-wakatime",
3+
"displayName": "Creative WakaTime",
4+
"description": "Tracks Aseprite editing/saving activity for Creative WakaTime (WakaTime). Writes local event files consumed by the Creative WakaTime tray app.",
5+
"version": "2.0.0",
6+
"author": {
7+
"name": "hy"
8+
},
9+
"contributes": {
10+
"scripts": [
11+
{ "path": "./wakatime.lua" }
12+
]
13+
}
14+
}

0 commit comments

Comments
 (0)