Skip to content

Commit

Permalink
启动时不再创建桌面;
Browse files Browse the repository at this point in the history
可以部署作为启动项的静默启动快捷方式.
  • Loading branch information
liziyu0714 committed Jul 28, 2024
1 parent 14e66ee commit 6925c63
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/FDNRBox/DesktopManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public static class DesktopManager

public static int NowDesktop = 0;

public static bool Inited = false;

public static WindowsDesktop? GetInputDesktop()
{
WindowsDesktop windowsDesktop;

Check warning on line 18 in src/FDNRBox/DesktopManager.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The variable 'windowsDesktop' is declared but never used

Check warning on line 18 in src/FDNRBox/DesktopManager.cs

View workflow job for this annotation

GitHub Actions / build (Release)

The variable 'windowsDesktop' is declared but never used
Expand All @@ -33,11 +35,15 @@ public static void RefreshDesktops()

public static void InitDesktops(List<string> DesktopNames)
{
RefreshDesktops();
foreach (string desktopName in DesktopNames)
if(!Inited)
{
InitNormalDesktop(desktopName);
RefreshDesktops();
foreach (string desktopName in DesktopNames)
{
InitNormalDesktop(desktopName);
}
}

}

public static void DestroyDesktops()
Expand Down
1 change: 0 additions & 1 deletion src/FishDeskNextReborn/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ private void Application_Startup(object sender, StartupEventArgs e)
else
{
mutexHelper.CreateMutex();
DesktopManager.InitDesktops(["FDNR1","FDNR2","FDNR3","FDNR4","FDNR5"]);
}
}
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
Expand Down
1 change: 1 addition & 0 deletions src/FishDeskNextReborn/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void ChangeToggleMode()
if (togglemode == ToggleDesktopMode.TaskView)
{
togglemode = ToggleDesktopMode.Win32;
DesktopManager.InitDesktops(["FDNR1", "FDNR2", "FDNR3", "FDNR4", "FDNR5"]);
Growl.InfoGlobal("已切换到Win32模式");
}

Expand Down
2 changes: 2 additions & 0 deletions src/FishDeskNextReborn/Register.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static void RegistAll()
private static void RegistMessage()
{
broadcastHelper.Regist("Show window", (sender) => { sender.Visibility = System.Windows.Visibility.Visible; return 0; });
broadcastHelper.Regist("Hide window", (sender) => { sender.Visibility = System.Windows.Visibility.Hidden; return 0; });
broadcastHelper.Regist("Previous Desktop", (sender) => { sender.PreviousDesktop(); return 0; });
broadcastHelper.Regist("Next Desktop", (sender) => { sender.NextDesktop(); return 0; });
broadcastHelper.Regist("Open Deploy", (sender) => { sender.deployWindow.ShowDialog(); return 0; });
Expand All @@ -28,6 +29,7 @@ private static void RegistArgs()
argResolver.Register("-S", () => { broadcastHelper.Broadcast("Show window"); });
argResolver.Register("-T", () => { broadcastHelper.Broadcast("Toggle Mode"); });
argResolver.Register("--OpenDesktopMgmt", () => { });
argResolver.Register("--Silent", () => { broadcastHelper.Broadcast("Hide window"); });
}
}
}
1 change: 1 addition & 0 deletions src/FishDeskNextReborn/window/DeployWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private void GenerateLinkBtn_Click(object sender, RoutedEventArgs e)
CreateShortcut(path.DirectoryName!, "FDNR Previous", path.FullName, "Go to previous desktop", path.FullName, "-P");
CreateShortcut(path.DirectoryName!, "FDNR Deploy", path.FullName, "Open FDNR Deploy Tool", path.FullName, "-D");
CreateShortcut(path.DirectoryName!, "FDNR Config", path.FullName, "Open FDNR Config", path.FullName, "");
CreateShortcut(path.DirectoryName!, "FDNR Silent Start", path.FullName, "Startup FDNR without window", path.FullName, "--Silent");
Growl.Info("部署快捷方式完成");
}
}
Expand Down

0 comments on commit 6925c63

Please sign in to comment.