From 7440c7e79ea2a93279383756c0a11f7b5d731bad Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:04:56 -0400 Subject: [PATCH 1/6] Finish linux start menu installer --- .../IStartMenuInstallerService.cs | 8 ++++ .../GlobalSettingsDialogViewModel.cs | 29 ++++++++++- .../Services/StartMenuInstallerService.cs | 48 +++++++++++++++++++ .../ServicesBootstrapper.cs | 2 + .../Views/Dialogs/GlobalSettingsDialog.axaml | 21 ++++++-- .../YMouseButtonControl.csproj | 2 +- 6 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs create mode 100644 YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs diff --git a/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs b/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs new file mode 100644 index 0000000..9e65dcb --- /dev/null +++ b/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs @@ -0,0 +1,8 @@ +namespace YMouseButtonControl.Core.Services.StartMenuInstaller; + +public interface IStartMenuInstallerService +{ + bool InstallStatus(); + void Install(); + void Uninstall(); +} \ No newline at end of file diff --git a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs index 863a55c..0013ab4 100644 --- a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs +++ b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs @@ -7,6 +7,7 @@ using ReactiveUI; using YMouseButtonControl.Core.Services.Logging; using YMouseButtonControl.Core.Services.Settings; +using YMouseButtonControl.Core.Services.StartMenuInstaller; using YMouseButtonControl.Core.Services.Theme; using YMouseButtonControl.Core.ViewModels.Models; using YMouseButtonControl.DataAccess.Models; @@ -19,18 +20,21 @@ public class GlobalSettingsDialogViewModel : DialogBase, IGlobalSettingsDialogVi { private SettingBoolVm _startMinimizedSetting; private bool _loggingEnabled; + private bool _startMenuEnabled; private SettingIntVm _themeSetting; private ObservableCollection _themeCollection; private ThemeVm _selectedTheme; private readonly ObservableAsPropertyHelper? _applyIsExec; public GlobalSettingsDialogViewModel( + IStartMenuInstallerService startMenuInstallerService, IEnableLoggingService enableLoggingService, ISettingsService settingsService, IThemeService themeService ) : base(themeService) { + _startMenuEnabled = startMenuInstallerService.InstallStatus(); _startMinimizedSetting = settingsService.GetSetting("StartMinimized") as SettingBoolVm ?? throw new Exception("Error retrieving StartMinimized setting"); @@ -54,16 +58,18 @@ IThemeService themeService x => x.LoggingEnabled, selector: val => val != enableLoggingService.GetLoggingState() ); + var startMenuChanged = this.WhenAnyValue(x => x.StartMenuEnabled, + selector: val => val != startMenuInstallerService.InstallStatus()); var themeChanged = this.WhenAnyValue( x => x.ThemeSetting.IntValue, selector: val => settingsService.GetSetting("Theme") is not SettingIntVm curVal || curVal.IntValue != val ); - var applyIsExecObs = this.WhenAnyValue(x => x.AppIsExec); var canSave = startMinimizedChanged .Merge(loggingChanged) + .Merge(startMenuChanged) .Merge(applyIsExecObs) .Merge(themeChanged); ApplyCommand = ReactiveCommand.Create( @@ -80,6 +86,19 @@ IThemeService themeService enableLoggingService.DisableLogging(); } } + + if (StartMenuEnabled != startMenuInstallerService.InstallStatus()) + { + if (StartMenuEnabled) + { + startMenuInstallerService.Install(); + } + else + { + startMenuInstallerService.Uninstall(); + } + } + using var trn = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled); settingsService.UpdateSetting(StartMinimized); settingsService.UpdateSetting(ThemeSetting); @@ -92,6 +111,12 @@ IThemeService themeService private bool AppIsExec => _applyIsExec?.Value ?? false; + public bool StartMenuEnabled + { + get => _startMenuEnabled; + set => this.RaiseAndSetIfChanged(ref _startMenuEnabled, value); + } + public SettingBoolVm StartMinimized { get => _startMinimizedSetting; @@ -123,4 +148,4 @@ public ObservableCollection ThemeCollection } public ReactiveCommand ApplyCommand { get; init; } -} +} \ No newline at end of file diff --git a/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs b/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs new file mode 100644 index 0000000..763b93f --- /dev/null +++ b/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs @@ -0,0 +1,48 @@ +using YMouseButtonControl.Core.Services.StartMenuInstaller; + +namespace YMouseButtonControl.Linux.Services; + +public class StartMenuInstallerService : IStartMenuInstallerService +{ + private const string DesktopFile = """ + [Desktop Entry] + Type=Application + Exec={0} + Path={1} + Hidden=false + NoDisplay=false + X-GNOME-Autostart-enabled=true + Name=YMouseButtonControl + Comment=YMouseButtonControl + """; + + private readonly string _localShare = Environment.GetFolderPath( + Environment.SpecialFolder.LocalApplicationData + ); + + private readonly string _desktopFilePath; + + public StartMenuInstallerService() + { + var applicationsDir = Path.Combine(_localShare, "applications"); + _desktopFilePath = Path.Combine(applicationsDir, "YMouseButtonControl.desktop"); + } + + public bool InstallStatus() => File.Exists(_desktopFilePath) && + File.ReadAllText(_desktopFilePath).Contains($"Exec={GetCurExePath()}"); + + public void Install() => + File.WriteAllText( + _desktopFilePath, + string.Format(DesktopFile, GetCurExePath(), GetCurExeParentPath()) + ); + + public void Uninstall() => File.Delete(_desktopFilePath); + + private static string GetCurExeParentPath() => + Path.GetDirectoryName(GetCurExePath()) + ?? throw new Exception("Error retrieving parent of process path"); + + private static string GetCurExePath() => + Environment.ProcessPath ?? throw new Exception("Error retrieving process path"); +} \ No newline at end of file diff --git a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs index 5447342..23f38cd 100644 --- a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs +++ b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs @@ -7,6 +7,7 @@ using YMouseButtonControl.Core.Services.Processes; using YMouseButtonControl.Core.Services.Profiles; using YMouseButtonControl.Core.Services.Settings; +using YMouseButtonControl.Core.Services.StartMenuInstaller; using YMouseButtonControl.Core.Services.StartupInstaller; using YMouseButtonControl.Core.Services.Theme; @@ -53,6 +54,7 @@ private static void RegisterLinuxServices(IServiceCollection services) { services .AddScoped() + .AddScoped() .AddScoped() .AddScoped(); if (Environment.GetEnvironmentVariable("XDG_SESSION_TYPE") == "x11") diff --git a/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml b/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml index e0b653a..c62fbb4 100644 --- a/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml +++ b/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml @@ -14,10 +14,21 @@ - - + - + + + Add YMouseButtonControl to the start menu + + + + @@ -25,7 +36,7 @@ - + - + diff --git a/YMouseButtonControl/YMouseButtonControl.csproj b/YMouseButtonControl/YMouseButtonControl.csproj index 1e0b871..e93bb78 100644 --- a/YMouseButtonControl/YMouseButtonControl.csproj +++ b/YMouseButtonControl/YMouseButtonControl.csproj @@ -6,7 +6,7 @@ copyused true - 10 + default 0.1.0 0.1.0 0.1.0 From 7d3d72ff5f57e2750001ae8cc6afe0cd0d1db7cd Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Sun, 20 Oct 2024 11:25:40 -0700 Subject: [PATCH 2/6] Add windows start menu installer --- .../Services/StartMenuInstallerService.cs | 70 +++++++++++++++++++ .../YMouseButtonControl.Windows.csproj | 1 + .../ServicesBootstrapper.cs | 1 + 3 files changed, 72 insertions(+) create mode 100644 YMouseButtonControl.Windows/Services/StartMenuInstallerService.cs diff --git a/YMouseButtonControl.Windows/Services/StartMenuInstallerService.cs b/YMouseButtonControl.Windows/Services/StartMenuInstallerService.cs new file mode 100644 index 0000000..2371ef2 --- /dev/null +++ b/YMouseButtonControl.Windows/Services/StartMenuInstallerService.cs @@ -0,0 +1,70 @@ +using System; +using System.IO; +using WindowsShortcutFactory; +using YMouseButtonControl.Core.Services.StartMenuInstaller; + +namespace YMouseButtonControl.Windows.Services; + +public class StartMenuInstallerService : IStartMenuInstallerService +{ + private readonly string _roamingAppDataFolder = Environment.GetFolderPath( + Environment.SpecialFolder.ApplicationData + ); + + private readonly string _roamingYMouseButtonsFolder; + + private readonly string _roamingYmouseButtonsShortcutPath; + + public StartMenuInstallerService() + { + _roamingYMouseButtonsFolder = Path.Combine( + _roamingAppDataFolder, + "Microsoft", + "Windows", + "Start Menu", + "Programs", + "YMouseButtonControl" + ); + _roamingYmouseButtonsShortcutPath = Path.Combine( + _roamingYMouseButtonsFolder, + "YMouseButtonControl.lnk" + ); + } + + public bool InstallStatus() + { + if (!File.Exists(_roamingYmouseButtonsShortcutPath)) + { + return false; + } + using var shortcut = WindowsShortcut.Load(_roamingYmouseButtonsShortcutPath); + return shortcut.Path == GetCurExePath(); + } + + public void Install() + { + if (File.Exists(_roamingYmouseButtonsShortcutPath)) + { + File.Delete(_roamingYmouseButtonsShortcutPath); + } + + if (!Directory.Exists(_roamingYMouseButtonsFolder)) + { + Directory.CreateDirectory(_roamingYMouseButtonsFolder); + } + + using var shortcut = new WindowsShortcut(); + shortcut.Path = GetCurExePath(); + shortcut.WorkingDirectory = GetCurExeParentPath(); + shortcut.Save(_roamingYmouseButtonsShortcutPath); + } + + public void Uninstall() => File.Delete(_roamingYmouseButtonsShortcutPath); + + private static string GetCurExeParentPath() => + Path.GetDirectoryName(GetCurExePath()) + ?? throw new Exception("Error retrieving parent of process path"); + + private static string GetCurExePath() => + Environment.ProcessPath ?? throw new Exception("Error retrieving process path"); +} diff --git a/YMouseButtonControl.Windows/YMouseButtonControl.Windows.csproj b/YMouseButtonControl.Windows/YMouseButtonControl.Windows.csproj index a67ba60..1cbe3f8 100644 --- a/YMouseButtonControl.Windows/YMouseButtonControl.Windows.csproj +++ b/YMouseButtonControl.Windows/YMouseButtonControl.Windows.csproj @@ -24,6 +24,7 @@ + diff --git a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs index 23f38cd..a4a2662 100644 --- a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs +++ b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs @@ -71,6 +71,7 @@ private static void RegisterLinuxServices(IServiceCollection services) private static void RegisterWindowsServices(IServiceCollection services) { services + .AddScoped() .AddScoped() .AddScoped() .AddScoped() From aabf1a32fb38b65309ec0fb79e57ae117d5b27de Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:46:45 -0400 Subject: [PATCH 3/6] Disable start menu installer for macos --- .../GlobalSettingsDialogViewModel.cs | 19 +++++++++++-------- .../Views/Dialogs/GlobalSettingsDialog.axaml | 7 +++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs index 0013ab4..bedd3cd 100644 --- a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs +++ b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs @@ -20,7 +20,7 @@ public class GlobalSettingsDialogViewModel : DialogBase, IGlobalSettingsDialogVi { private SettingBoolVm _startMinimizedSetting; private bool _loggingEnabled; - private bool _startMenuEnabled; + private bool _startMenuChecked; private SettingIntVm _themeSetting; private ObservableCollection _themeCollection; private ThemeVm _selectedTheme; @@ -34,7 +34,8 @@ IThemeService themeService ) : base(themeService) { - _startMenuEnabled = startMenuInstallerService.InstallStatus(); + StartMenuEnabled = !OperatingSystem.IsMacOS(); + _startMenuChecked = StartMenuEnabled && startMenuInstallerService.InstallStatus(); _startMinimizedSetting = settingsService.GetSetting("StartMinimized") as SettingBoolVm ?? throw new Exception("Error retrieving StartMinimized setting"); @@ -58,7 +59,7 @@ IThemeService themeService x => x.LoggingEnabled, selector: val => val != enableLoggingService.GetLoggingState() ); - var startMenuChanged = this.WhenAnyValue(x => x.StartMenuEnabled, + var startMenuChanged = this.WhenAnyValue(x => x.StartMenuChecked, selector: val => val != startMenuInstallerService.InstallStatus()); var themeChanged = this.WhenAnyValue( x => x.ThemeSetting.IntValue, @@ -87,9 +88,9 @@ IThemeService themeService } } - if (StartMenuEnabled != startMenuInstallerService.InstallStatus()) + if (StartMenuChecked != startMenuInstallerService.InstallStatus()) { - if (StartMenuEnabled) + if (StartMenuChecked) { startMenuInstallerService.Install(); } @@ -111,11 +112,13 @@ IThemeService themeService private bool AppIsExec => _applyIsExec?.Value ?? false; - public bool StartMenuEnabled + public bool StartMenuChecked { - get => _startMenuEnabled; - set => this.RaiseAndSetIfChanged(ref _startMenuEnabled, value); + get => _startMenuChecked; + set => this.RaiseAndSetIfChanged(ref _startMenuChecked, value); } + + public bool StartMenuEnabled { get; init; } public SettingBoolVm StartMinimized { diff --git a/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml b/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml index c62fbb4..6364560 100644 --- a/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml +++ b/YMouseButtonControl/Views/Dialogs/GlobalSettingsDialog.axaml @@ -20,10 +20,13 @@ IsChecked="{Binding StartMinimized.BoolValue}" /> + IsEnabled="{Binding StartMenuEnabled}" + IsChecked="{Binding StartMenuChecked}"> - Add YMouseButtonControl to the start menu + Add YMouseButtonControl to the start menu. + + Disabled for macOS. From 898bcb0e4c39072d5535bc9e51ffa8c1dd08670e Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:48:00 -0400 Subject: [PATCH 4/6] Include stub for macos start menu installer --- .../Services/StartMenuInstaller.cs | 21 +++++++++++++++++++ .../ServicesBootstrapper.cs | 1 + 2 files changed, 22 insertions(+) create mode 100644 YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs diff --git a/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs b/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs new file mode 100644 index 0000000..3363c64 --- /dev/null +++ b/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs @@ -0,0 +1,21 @@ +using YMouseButtonControl.Core.Services.StartMenuInstaller; + +namespace YMouseButtonControl.MacOS.Services; + +public class StartMenuInstaller : IStartMenuInstallerService +{ + public bool InstallStatus() + { + throw new System.NotImplementedException(); + } + + public void Install() + { + throw new System.NotImplementedException(); + } + + public void Uninstall() + { + throw new System.NotImplementedException(); + } +} \ No newline at end of file diff --git a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs index a4a2662..4660093 100644 --- a/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs +++ b/YMouseButtonControl/DependencyInjection/ServicesBootstrapper.cs @@ -82,6 +82,7 @@ private static void RegisterMacOsServices(IServiceCollection services) { services .AddScoped() + .AddScoped() .AddScoped() .AddScoped() .AddScoped(); From c9ab381c718cbc8a4b3a549ccd8ac92fb4648ae9 Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:50:34 -0400 Subject: [PATCH 5/6] Fix errors --- .../MainWindow/GlobalSettingsDialogViewModel.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs index bedd3cd..0653252 100644 --- a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs +++ b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs @@ -59,8 +59,10 @@ IThemeService themeService x => x.LoggingEnabled, selector: val => val != enableLoggingService.GetLoggingState() ); - var startMenuChanged = this.WhenAnyValue(x => x.StartMenuChecked, - selector: val => val != startMenuInstallerService.InstallStatus()); + var startMenuChanged = this.WhenAnyValue( + x => x.StartMenuChecked, + selector: val => StartMenuEnabled && val != startMenuInstallerService.InstallStatus() + ); var themeChanged = this.WhenAnyValue( x => x.ThemeSetting.IntValue, selector: val => @@ -88,7 +90,10 @@ IThemeService themeService } } - if (StartMenuChecked != startMenuInstallerService.InstallStatus()) + if ( + StartMenuEnabled + && StartMenuChecked != startMenuInstallerService.InstallStatus() + ) { if (StartMenuChecked) { @@ -117,7 +122,7 @@ public bool StartMenuChecked get => _startMenuChecked; set => this.RaiseAndSetIfChanged(ref _startMenuChecked, value); } - + public bool StartMenuEnabled { get; init; } public SettingBoolVm StartMinimized @@ -151,4 +156,4 @@ public ObservableCollection ThemeCollection } public ReactiveCommand ApplyCommand { get; init; } -} \ No newline at end of file +} From 509b42cc31ae9876a1cb2921e9fbbb748b473250 Mon Sep 17 00:00:00 2001 From: FaithBeam <32502411+FaithBeam@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:58:11 -0400 Subject: [PATCH 6/6] Csharpier --- .../IStartMenuInstallerService.cs | 2 +- .../GlobalSettingsDialogViewModel.cs | 10 ++++--- .../Services/StartMenuInstallerService.cs | 27 ++++++++++--------- .../Services/StartMenuInstaller.cs | 2 +- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs b/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs index 9e65dcb..ff2ad4a 100644 --- a/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs +++ b/YMouseButtonControl.Core/Services/StartMenuInstaller/IStartMenuInstallerService.cs @@ -5,4 +5,4 @@ public interface IStartMenuInstallerService bool InstallStatus(); void Install(); void Uninstall(); -} \ No newline at end of file +} diff --git a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs index bedd3cd..e75696c 100644 --- a/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs +++ b/YMouseButtonControl.Core/ViewModels/MainWindow/GlobalSettingsDialogViewModel.cs @@ -59,8 +59,10 @@ IThemeService themeService x => x.LoggingEnabled, selector: val => val != enableLoggingService.GetLoggingState() ); - var startMenuChanged = this.WhenAnyValue(x => x.StartMenuChecked, - selector: val => val != startMenuInstallerService.InstallStatus()); + var startMenuChanged = this.WhenAnyValue( + x => x.StartMenuChecked, + selector: val => val != startMenuInstallerService.InstallStatus() + ); var themeChanged = this.WhenAnyValue( x => x.ThemeSetting.IntValue, selector: val => @@ -117,7 +119,7 @@ public bool StartMenuChecked get => _startMenuChecked; set => this.RaiseAndSetIfChanged(ref _startMenuChecked, value); } - + public bool StartMenuEnabled { get; init; } public SettingBoolVm StartMinimized @@ -151,4 +153,4 @@ public ObservableCollection ThemeCollection } public ReactiveCommand ApplyCommand { get; init; } -} \ No newline at end of file +} diff --git a/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs b/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs index 763b93f..c2c57ad 100644 --- a/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs +++ b/YMouseButtonControl.Linux/Services/StartMenuInstallerService.cs @@ -5,16 +5,16 @@ namespace YMouseButtonControl.Linux.Services; public class StartMenuInstallerService : IStartMenuInstallerService { private const string DesktopFile = """ - [Desktop Entry] - Type=Application - Exec={0} - Path={1} - Hidden=false - NoDisplay=false - X-GNOME-Autostart-enabled=true - Name=YMouseButtonControl - Comment=YMouseButtonControl - """; + [Desktop Entry] + Type=Application + Exec={0} + Path={1} + Hidden=false + NoDisplay=false + X-GNOME-Autostart-enabled=true + Name=YMouseButtonControl + Comment=YMouseButtonControl + """; private readonly string _localShare = Environment.GetFolderPath( Environment.SpecialFolder.LocalApplicationData @@ -28,8 +28,9 @@ public StartMenuInstallerService() _desktopFilePath = Path.Combine(applicationsDir, "YMouseButtonControl.desktop"); } - public bool InstallStatus() => File.Exists(_desktopFilePath) && - File.ReadAllText(_desktopFilePath).Contains($"Exec={GetCurExePath()}"); + public bool InstallStatus() => + File.Exists(_desktopFilePath) + && File.ReadAllText(_desktopFilePath).Contains($"Exec={GetCurExePath()}"); public void Install() => File.WriteAllText( @@ -45,4 +46,4 @@ private static string GetCurExeParentPath() => private static string GetCurExePath() => Environment.ProcessPath ?? throw new Exception("Error retrieving process path"); -} \ No newline at end of file +} diff --git a/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs b/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs index 3363c64..26ddb0c 100644 --- a/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs +++ b/YMouseButtonControl.MacOS/Services/StartMenuInstaller.cs @@ -18,4 +18,4 @@ public void Uninstall() { throw new System.NotImplementedException(); } -} \ No newline at end of file +}