Skip to content

Commit 6153efa

Browse files
committed
added new app version
1 parent 81233de commit 6153efa

5 files changed

Lines changed: 117 additions & 14 deletions

File tree

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ riderModule.iml
66
.idea/
77
*.DotSettings.user
88

9-
# Ignore all shell scripts
10-
*.sh
9+
# Build and publish output
10+
publish/
11+
1112

1213
# Ignore all markdown files except README.md and .github folder
1314
*.md

ProductivityCake/ProductivityCake.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424

2525
<ItemGroup>
2626
<AvaloniaResource Include="Assets\**" Exclude="Assets\alarm.mp3;Assets\Icons.axaml"/>
27-
<Resource Include="Assets\alarm.mp3" CopyToOutputDirectory="PreserveNewest" />
27+
<Content Include="Assets\alarm.mp3">
28+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
29+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
30+
</Content>
2831
</ItemGroup>
2932

3033
<!-- Trimmer Configuration for Native AOT -->
@@ -44,6 +47,5 @@
4447
</PackageReference>
4548
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1"/>
4649
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.8" />
47-
<PackageReference Include="ScottPlot.Avalonia" Version="5.0.47" />
4850
</ItemGroup>
4951
</Project>

ProductivityCake/ViewModels/TimerViewModel.cs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -476,22 +476,36 @@ private void SendNotification()
476476
{
477477
try
478478
{
479-
// Try to find the sound file in the source directory (for development)
480-
var soundPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets", "alarm.mp3");
479+
// Try multiple possible locations for the sound file
480+
var possiblePaths = new[]
481+
{
482+
// Published version (alarm.mp3 in same directory as executable)
483+
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "alarm.mp3"),
484+
// Development version (in Assets folder)
485+
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets", "alarm.mp3"),
486+
// Source directory (for development)
487+
System.IO.Path.Combine(
488+
System.IO.Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory)?.Parent?.Parent?.Parent?.FullName ?? "",
489+
"Assets", "alarm.mp3")
490+
};
481491

482-
if (!System.IO.File.Exists(soundPath))
492+
string? soundPath = null;
493+
foreach (var path in possiblePaths)
483494
{
484-
// Try looking in the source directory
485-
var sourceDir = System.IO.Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory)?.Parent?.Parent?.Parent?.FullName;
486-
if (sourceDir != null)
495+
if (System.IO.File.Exists(path))
487496
{
488-
soundPath = System.IO.Path.Combine(sourceDir, "Assets", "alarm.mp3");
497+
soundPath = path;
498+
break;
489499
}
490500
}
491501

492-
if (!System.IO.File.Exists(soundPath))
502+
if (soundPath == null)
493503
{
494-
Console.WriteLine($"Sound file not found at: {soundPath}");
504+
Console.WriteLine($"Sound file not found. Tried paths:");
505+
foreach (var path in possiblePaths)
506+
{
507+
Console.WriteLine($" - {path}");
508+
}
495509
return null;
496510
}
497511

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ A modern, lightweight desktop application for managing projects, tasks, and time
113113
### Prerequisites
114114

115115
- [.NET 9.0 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)
116-
- Linux: `clang` and `zlib1g-dev` (for AOT compilation)
116+
- **Linux**:
117+
- `clang` and `zlib1g-dev` (for AOT compilation)
118+
- `libnotify-bin` (for desktop notifications)
119+
```bash
120+
sudo apt install clang zlib1g-dev libnotify-bin
121+
```
117122

118123
### Clone & Build
119124

@@ -129,6 +134,29 @@ dotnet build
129134
dotnet run --project ProductivityCake/ProductivityCake.csproj
130135
```
131136

137+
### Publish for Linux (Native AOT)
138+
139+
**Option 1: Using the publish script (recommended)**
140+
```bash
141+
chmod +x publish-linux.sh
142+
./publish-linux.sh
143+
```
144+
145+
**Option 2: Manual publish**
146+
```bash
147+
# Publish optimized native binary for Linux x64
148+
dotnet publish ProductivityCake/ProductivityCake.csproj \
149+
-c Release \
150+
-r linux-x64 \
151+
--self-contained \
152+
-o ./publish/linux-x64
153+
154+
# The executable will be at: ./publish/linux-x64/ProductivityCake
155+
# Create a distributable archive
156+
cd publish/linux-x64
157+
tar -czf ProductivityCake-linux-x64.tar.gz ProductivityCake alarm.mp3
158+
```
159+
132160

133161
## 🏗️ Technology Stack
134162

publish-linux.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# ProductivityCake Linux Build Script
4+
# This script builds a native AOT binary for Linux x64
5+
6+
set -e # Exit on error
7+
8+
echo "🎂 Building ProductivityCake for Linux..."
9+
echo ""
10+
11+
# Clean previous builds
12+
if [ -d "./publish/linux-x64" ]; then
13+
echo "🧹 Cleaning previous build..."
14+
rm -rf ./publish/linux-x64
15+
fi
16+
17+
# Publish the application
18+
echo "📦 Publishing native AOT binary..."
19+
dotnet publish ProductivityCake/ProductivityCake.csproj \
20+
-c Release \
21+
-r linux-x64 \
22+
--self-contained \
23+
-o ./publish/linux-x64
24+
25+
echo ""
26+
echo "✅ Build completed successfully!"
27+
echo ""
28+
echo "📍 Output location: ./publish/linux-x64/ProductivityCake"
29+
echo ""
30+
31+
# Check if alarm.mp3 was copied
32+
if [ ! -f "./publish/linux-x64/alarm.mp3" ]; then
33+
echo "⚠️ Warning: alarm.mp3 not found in output directory"
34+
echo " Checking Assets folder..."
35+
if [ -f "./publish/linux-x64/Assets/alarm.mp3" ]; then
36+
echo " Found in Assets folder, copying to root..."
37+
cp ./publish/linux-x64/Assets/alarm.mp3 ./publish/linux-x64/
38+
fi
39+
fi
40+
41+
# Create distributable archive
42+
echo "📦 Creating distributable archive..."
43+
cd publish/linux-x64
44+
if [ -f "alarm.mp3" ]; then
45+
tar -czf ProductivityCake-linux-x64-v1.1.0.tar.gz ProductivityCake alarm.mp3
46+
else
47+
echo "⚠️ Creating archive without alarm.mp3 (file not found)"
48+
tar -czf ProductivityCake-linux-x64-v1.1.0.tar.gz ProductivityCake
49+
fi
50+
cd ../..
51+
52+
echo ""
53+
echo "✅ Archive created: ./publish/linux-x64/ProductivityCake-linux-x64-v1.1.0.tar.gz"
54+
echo ""
55+
echo "🚀 To run the application:"
56+
echo " cd publish/linux-x64"
57+
echo " ./ProductivityCake"
58+
echo ""

0 commit comments

Comments
 (0)