mirror of
https://github.com/R0m1k3/TodoFlow.git
synced 2026-10-11 17:28:17 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e759a1a7d5 | ||
|
|
3b5ede5872 | ||
|
|
a635aa29a4 | ||
|
|
fcac504693 | ||
|
|
27d3fb7d50 |
No files matched your search
@@ -3,7 +3,9 @@ name: Release Tauri App
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
# Accept lowercase and uppercase tags, for example v1.1.0.0 or V1.1.0.0.
|
||||
- 'v*'
|
||||
- 'V*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -38,20 +40,37 @@ jobs:
|
||||
cd widget
|
||||
npm install
|
||||
|
||||
- name: Update version in tauri.conf.json
|
||||
- name: Update app version from tag
|
||||
shell: bash
|
||||
run: |
|
||||
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
if [[ ! "$TAG_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
TAG_VERSION="1.0.0"
|
||||
# Keep Tauri/Cargo on valid SemVer while allowing release tags like V1.1.0.0.
|
||||
RAW_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^[vV]//')
|
||||
APP_VERSION="1.1.0"
|
||||
if [[ "$RAW_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(\.[0-9]+)?$ ]]; then
|
||||
APP_VERSION="${BASH_REMATCH[1]}"
|
||||
fi
|
||||
echo "Updating tauri.conf.json version to $TAG_VERSION"
|
||||
echo "Updating app version to $APP_VERSION"
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const file = './widget/src-tauri/tauri.conf.json';
|
||||
const config = JSON.parse(fs.readFileSync(file, 'utf8'));
|
||||
config.package.version = '$TAG_VERSION';
|
||||
fs.writeFileSync(file, JSON.stringify(config, null, 2), 'utf8');
|
||||
|
||||
const updateJson = (file, update) => {
|
||||
const data = JSON.parse(fs.readFileSync(file, 'utf8'));
|
||||
update(data);
|
||||
fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n', 'utf8');
|
||||
};
|
||||
|
||||
updateJson('./widget/package.json', (pkg) => {
|
||||
pkg.version = '$APP_VERSION';
|
||||
});
|
||||
|
||||
updateJson('./widget/src-tauri/tauri.conf.json', (config) => {
|
||||
config.package.version = '$APP_VERSION';
|
||||
});
|
||||
|
||||
const cargoFile = './widget/src-tauri/Cargo.toml';
|
||||
const cargo = fs.readFileSync(cargoFile, 'utf8')
|
||||
.replace(/^version = \".*\"$/m, 'version = \"$APP_VERSION\"');
|
||||
fs.writeFileSync(cargoFile, cargo, 'utf8');
|
||||
"
|
||||
|
||||
- name: Build the Tauri app
|
||||
@@ -61,7 +80,10 @@ jobs:
|
||||
with:
|
||||
tagName: ${{ github.ref_name }}
|
||||
releaseName: 'TodoFlow ${{ github.ref_name }}'
|
||||
releaseBody: 'Release generated automatically by GitHub Actions.'
|
||||
releaseDraft: true
|
||||
releaseBody: |
|
||||
Installeur Windows de TodoFlow ${{ github.ref_name }}.
|
||||
|
||||
Telechargez le fichier `.exe` (NSIS) ou `.msi` ci-dessous pour installer l'application.
|
||||
releaseDraft: false
|
||||
prerelease: false
|
||||
projectPath: './widget'
|
||||
+1
-1
@@ -43,7 +43,7 @@ async def lifespan(app: FastAPI):
|
||||
app = FastAPI(
|
||||
title="TodoFlow API",
|
||||
description="API centralisée pour la Todo list, connectée au widget de bureau et pilotable par Agent IA.",
|
||||
version="1.0.0",
|
||||
version="1.1.0",
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "todoflow-widget",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"tauri": "tauri"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "todoflow"
|
||||
version = "1.0.0"
|
||||
version = "1.1.0"
|
||||
description = "Sleek Windows TodoFlow desktop widget"
|
||||
authors = ["Michael"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -67,6 +67,32 @@ fn get_autostart() -> Result<bool, String> {
|
||||
Ok(val.is_ok())
|
||||
}
|
||||
|
||||
// --- GESTION DE LA VISIBILITÉ DE LA FENÊTRE ---
|
||||
|
||||
fn toggle_window_visibility(app: &AppHandle) {
|
||||
// Bascule l'affichage du widget depuis l'icône de la barre d'état.
|
||||
// Comme la fenêtre est configurée avec skipTaskbar:true, l'icône du tray est le
|
||||
// seul point de restauration : il doit donc fonctionner dans tous les états.
|
||||
let window = match app.get_window("main") {
|
||||
Some(w) => w,
|
||||
None => return,
|
||||
};
|
||||
|
||||
// Une fenêtre réduite est toujours rapportée comme "visible" par Tauri. On la
|
||||
// considère donc comme masquée afin de la restaurer correctement (et non la re-masquer).
|
||||
let is_minimized = window.is_minimized().unwrap_or(false);
|
||||
let is_visible = window.is_visible().unwrap_or(false);
|
||||
|
||||
if is_visible && !is_minimized {
|
||||
let _ = window.hide();
|
||||
} else {
|
||||
// Restauration robuste : dé-minimiser, ré-afficher, puis ramener au premier plan.
|
||||
let _ = window.unminimize();
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
}
|
||||
|
||||
// --- CONTEXTE ET INITIALISATION ---
|
||||
|
||||
fn main() {
|
||||
@@ -84,26 +110,14 @@ fn main() {
|
||||
.on_system_tray_event(|app, event| match event {
|
||||
SystemTrayEvent::LeftClick { .. } => {
|
||||
// Un simple clic gauche sur l'icône de la barre des tâches bascule la visibilité
|
||||
let window = app.get_window("main").unwrap();
|
||||
if window.is_visible().unwrap() {
|
||||
window.hide().unwrap();
|
||||
} else {
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
}
|
||||
toggle_window_visibility(app);
|
||||
}
|
||||
SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
|
||||
"quit" => {
|
||||
std::process::exit(0);
|
||||
}
|
||||
"toggle" => {
|
||||
let window = app.get_window("main").unwrap();
|
||||
if window.is_visible().unwrap() {
|
||||
window.hide().unwrap();
|
||||
} else {
|
||||
window.show().unwrap();
|
||||
window.set_focus().unwrap();
|
||||
}
|
||||
toggle_window_visibility(app);
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "TodoFlow",
|
||||
"version": "1.0.0"
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
|
||||
+4
-1
@@ -88,7 +88,10 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||
|
||||
// Événements Tauri pour le contrôle de la fenêtre de bureau
|
||||
if (appWindow) {
|
||||
btnMinimize.addEventListener("click", () => appWindow.minimize());
|
||||
// La fenêtre utilise skipTaskbar:true : elle n'apparaît jamais dans la barre des tâches.
|
||||
// Un minimize() classique la rendrait donc irrécupérable. On masque plutôt vers le
|
||||
// system tray, d'où elle peut toujours être restaurée via l'icône de la barre d'état.
|
||||
btnMinimize.addEventListener("click", () => appWindow.hide());
|
||||
btnClose.addEventListener("click", () => appWindow.hide()); // Masquer vers le tray au clic sur 'Fermer'
|
||||
|
||||
// Récupération de l'état réel du démarrage automatique depuis le registre Windows
|
||||
|
||||
Reference in new issue
Block a user