Skip to content

Commit c557031

Browse files
committed
Show notification when failing to enable/disable autostartup
1 parent bde85c8 commit c557031

28 files changed

+89
-15
lines changed

Flow.Launcher/App.xaml.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,21 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
106106

107107
private void AutoStartup()
108108
{
109+
// we try to enable auto-startup on first launch, or reenable if it was removed
110+
// but the user still has the setting set
109111
if (_settings.StartFlowLauncherOnSystemStartup && !Helper.AutoStartup.IsEnabled)
110112
{
111-
Helper.AutoStartup.Enable();
113+
try
114+
{
115+
Helper.AutoStartup.Enable();
116+
}
117+
catch (Exception e)
118+
{
119+
// but if it fails (permissions, etc) then don't keep retrying
120+
// this also gives the user a visual indication in the Settings widget
121+
_settings.StartFlowLauncherOnSystemStartup = false;
122+
Notification.Show(InternationalizationManager.Instance.GetTranslation("registerAutoStartFailed"), e.Message);
123+
}
112124
}
113125
}
114126

Flow.Launcher/Helper/AutoStartup.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static bool IsEnabled
2525
}
2626
catch (Exception e)
2727
{
28-
Log.Error("AutoStartup", $"Ignoring non-critical registry error (user permissions?): {e}");
28+
Log.Error("AutoStartup", $"Ignoring non-critical registry error (querying if enabled): {e}");
2929
}
3030

3131
return false;
@@ -41,7 +41,8 @@ public static void Disable()
4141
}
4242
catch (Exception e)
4343
{
44-
Log.Error("AutoStartup", $"Ignoring non-critical registry error (user permissions?): {e}");
44+
Log.Error("AutoStartup", $"Failed to disable auto-startup: {e}");
45+
throw;
4546
}
4647
}
4748

@@ -54,9 +55,9 @@ internal static void Enable()
5455
}
5556
catch (Exception e)
5657
{
57-
Log.Error("AutoStartup", $"Ignoring non-critical registry error (user permissions?): {e}");
58+
Log.Error("AutoStartup", $"Failed to enable auto-startup: {e}");
59+
throw;
5860
}
59-
6061
}
6162
}
6263
}

Flow.Launcher/Languages/da.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Portable Mode</system:String>
2929
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">Start Flow Launcher ved system start</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Skjul Flow Launcher ved mistet fokus</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">Vis ikke notifikationer om nye versioner</system:String>
3335
<system:String x:Key="rememberLastLocation">Husk seneste position</system:String>

Flow.Launcher/Languages/de.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Portabler Modus</system:String>
2929
<system:String x:Key="portableModeToolTIp">Speichern Sie alle Einstellungen und Benutzerdaten in einem Ordner (nützlich bei Verwendung mit Wechseldatenträgern oder Clouddiensten).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">Starte Flow Launcher bei Systemstart</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Verstecke Flow Launcher wenn der Fokus verloren geht</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">Zeige keine Nachricht wenn eine neue Version vorhanden ist</system:String>
3335
<system:String x:Key="rememberLastLocation">Merke letzte Ausführungsposition</system:String>

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<system:String x:Key="portableMode">Portable Mode</system:String>
3131
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
3232
<system:String x:Key="startFlowLauncherOnSystemStartup">Start Flow Launcher on system startup</system:String>
33+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
34+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3335
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
3436
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
3537
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>

Flow.Launcher/Languages/es-419.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Modo portable</system:String>
2929
<system:String x:Key="portableModeToolTIp">Almacena todos los ajustes y datos de usuario en una sola carpeta (útil cuando se utiliza con unidades extraíbles o servicios en la nube).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">Iniciar Flow Launcher al arrancar el sistema</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Ocultar Flow Launcher cuando se pierde el enfoque</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">No mostrar notificaciones de nuevas versiones</system:String>
3335
<system:String x:Key="rememberLastLocation">Recordar última ubicación de inicio</system:String>

Flow.Launcher/Languages/es.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Modo Portable</system:String>
2929
<system:String x:Key="portableModeToolTIp">Guarda toda la configuración y datos de usuario en una carpeta (Útil cuando se utiliza con unidades extraíbles o servicios en la nube).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">Cargar Flow Launcher al iniciar el sistema</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Ocultar Flow Launcher cuando se pierda el foco</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">No mostrar notificaciones de nuevas versiones</system:String>
3335
<system:String x:Key="rememberLastLocation">Recordar última posición de Flow Launcher</system:String>

Flow.Launcher/Languages/fr.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Mode Portable</system:String>
2929
<system:String x:Key="portableModeToolTIp">Stocker tous les paramètres et données utilisateur dans un seul dossier (Pratique en cas d'utilisation de disques amovibles ou de services cloud).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">Lancer Flow Launcher au démarrage du système</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Cacher Flow Launcher lors de la perte de focus</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">Ne pas afficher les notifications lors d'une nouvelle version</system:String>
3335
<system:String x:Key="rememberLastLocation">Se souvenir du dernier emplacement de la fenêtre</system:String>

Flow.Launcher/Languages/it.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Portable Mode</system:String>
2929
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">Avvia Wow all'avvio di Windows</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Nascondi Flow Launcher quando perde il focus</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">Non mostrare le notifiche per una nuova versione</system:String>
3335
<system:String x:Key="rememberLastLocation">Ricorda l'ultima posizione di avvio del launcher</system:String>

Flow.Launcher/Languages/ja.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<system:String x:Key="portableMode">Portable Mode</system:String>
2929
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
3030
<system:String x:Key="startFlowLauncherOnSystemStartup">スタートアップ時にFlow Launcherを起動する</system:String>
31+
<system:String x:Key="registerAutoStartFailed">Error enabling launch on startup</system:String>
32+
<system:String x:Key="deregisterAutoStartFailed">Error disabling launch on startup</system:String>
3133
<system:String x:Key="hideFlowLauncherWhenLoseFocus">フォーカスを失った時にFlow Launcherを隠す</system:String>
3234
<system:String x:Key="dontPromptUpdateMsg">最新版が入手可能であっても、アップグレードメッセージを表示しない</system:String>
3335
<system:String x:Key="rememberLastLocation">前回のランチャーの位置を記憶</system:String>

0 commit comments

Comments
 (0)