Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ jobs:
args: "--target aarch64-apple-darwin"
- platform: "macos-13" # for Intel
args: "--target x86_64-apple-darwin"
# Uncomment if you want to build for Windows/Linux
# - platform: 'ubuntu-22.04'
# args: ''
# - platform: 'windows-latest'
# args: ''
- platform: "ubuntu-22.04"
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: setup node
uses: actions/setup-node@v4
with:
Expand All @@ -40,7 +45,6 @@ jobs:
- name: install rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so node-gyp doesn't have to be installed
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin' || matrix.platform == 'macos-13' && 'x86_64-apple-darwin' || '' }}

- name: Rust cache
Expand All @@ -56,7 +60,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
tagName: app-v__VERSION__
releaseName: "Timlyzer v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Timlyzer Makefile

.PHONY: all dev build clean check lint help
.PHONY: all dev build run clean check lint help

# Default target
all: help
Expand All @@ -19,6 +19,11 @@ build: ## Build the application for production
build-debug: ## Build in debug mode
pnpm tauri build --debug

run: ## Build, kill old instance, and launch the app for quick testing
pnpm tauri build
-pkill -x Timlyzer 2>/dev/null; sleep 1
open src-tauri/target/release/bundle/macos/Timlyzer.app

# Quality Checks
check: ## Check Rust code for errors
cd src-tauri && cargo check
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"tailwind-merge": "^3.4.0",
"zustand": "^5.0.9"
},
"pnpm": {
"onlyBuiltDependencies": ["esbuild"]
},
"devDependencies": {
"@tailwindcss/vite": "^4.1.18",
"@tauri-apps/cli": "^2",
Expand Down
80 changes: 73 additions & 7 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tauri-build = { version = "2", features = [] }
tauri = { version = "2", features = ["tray-icon", "image-png"] }
tauri-plugin-opener = "2"
tauri-plugin-dialog = "2"
tauri-plugin-autostart = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
rusqlite = { version = "0.31", features = ["bundled"] }
Expand Down
5 changes: 4 additions & 1 deletion src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"windows": ["main"],
"permissions": [
"core:default",
"opener:default"
"opener:default",
"autostart:allow-enable",
"autostart:allow-disable",
"autostart:allow-is-enabled"
]
}
24 changes: 24 additions & 0 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,30 @@ pub fn export_to_json(
file_path,
})
}
// ============================================================================
// Autostart Commands
// ============================================================================

/// Get autostart enabled status
#[tauri::command]
pub fn get_autostart(app: tauri::AppHandle) -> Result<bool, String> {
use tauri_plugin_autostart::ManagerExt;
let manager = app.autolaunch();
manager.is_enabled().map_err(|e: tauri_plugin_autostart::Error| e.to_string())
}

/// Set autostart enabled status
#[tauri::command]
pub fn set_autostart(app: tauri::AppHandle, enabled: bool) -> Result<(), String> {
use tauri_plugin_autostart::ManagerExt;
let manager = app.autolaunch();
if enabled {
manager.enable().map_err(|e: tauri_plugin_autostart::Error| e.to_string())
} else {
manager.disable().map_err(|e: tauri_plugin_autostart::Error| e.to_string())
}
}

// ============================================================================
// System Commands
// ============================================================================
Expand Down
7 changes: 7 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_autostart::init(
tauri_plugin_autostart::MacosLauncher::LaunchAgent,
Some(vec!["--minimized"]),
))
.setup(|app| {
// Get app data directory
let app_dir = app
Expand Down Expand Up @@ -106,6 +110,9 @@ pub fn run() {
commands::export_to_csv,
commands::export_to_json,
commands::update_tray_menu,
// Autostart commands
commands::get_autostart,
commands::set_autostart,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/services/active_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const KNOWN_BROWSERS: &[&str] = &[

/// Check if an app is a known browser
fn is_browser(app_name: &str) -> bool {
KNOWN_BROWSERS.iter().any(|&b| app_name == b)
KNOWN_BROWSERS.contains(&app_name)
}

/// Get the URL from a browser using AppleScript (macOS only)
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/services/state_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn get_idle_time_iokit() -> Option<Duration> {
}

unsafe {
let matching = IOServiceMatching(b"IOHIDSystem\0".as_ptr() as *const i8);
let matching = IOServiceMatching(c"IOHIDSystem".as_ptr());
if matching.is_null() {
log::warn!("Failed to create IOHIDSystem matching dictionary");
return None;
Expand Down
16 changes: 0 additions & 16 deletions src-tauri/src/services/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@ impl Default for TrackerConfig {
}
}

/// Current tracking state
#[derive(Debug, Clone, Default)]
struct TrackingState {
/// Currently tracked window
current_window: Option<WindowInfo>,
/// Current AppTrackItem being built
current_app_item: Option<TrackItem>,
/// Current StatusTrackItem being built
current_status_item: Option<TrackItem>,
/// Last tracking time
last_track_time: i64,
}

/// Tracker service for automatic time tracking
pub struct TrackerService {
/// Reference to database
Expand All @@ -50,8 +37,6 @@ pub struct TrackerService {
state_monitor: Arc<StateMonitor>,
/// Tracker configuration
config: RwLock<TrackerConfig>,
/// Current tracking state
state: RwLock<TrackingState>,
/// Whether tracking is running
is_running: Arc<AtomicBool>,
/// Whether tracking is paused
Expand All @@ -70,7 +55,6 @@ impl TrackerService {
db,
state_monitor,
config: RwLock::new(config),
state: RwLock::new(TrackingState::default()),
is_running: Arc::new(AtomicBool::new(false)),
is_paused: Arc::new(AtomicBool::new(false)),
}
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/locales/en-US/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"title": "Appearance",
"theme": "Theme",
"language": "Language",
"autostart": "Start on boot",
"autostartDesc": "Automatically start Timlyzer when you log in",
"closeAction": "When closing window",
"minimize": "Minimize to tray",
"ask": "Ask every time",
Expand Down Expand Up @@ -44,7 +46,8 @@
"db": {
"title": "Database",
"location": "Location",
"size": "Size"
"size": "Size",
"openLocation": "Open File Location"
},
"clear": {
"title": "Clear Data",
Expand Down
Loading