Skip to content

Commit

Permalink
Closes #23 Closes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
krisdb2009 committed Sep 23, 2024
1 parent 3fc7693 commit f546093
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 22 deletions.
6 changes: 3 additions & 3 deletions CommonProperties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<ApplicationIcon>..\SuperLauncherAssets\logo.ico</ApplicationIcon>
<Product>Super Launcher</Product>
<AssemblyTitle>Super Launcher</AssemblyTitle>
<AssemblyVersion>2.1.3.0</AssemblyVersion>
<FileVersion>2.1.3.0</FileVersion>
<AssemblyVersion>2.1.4.0</AssemblyVersion>
<FileVersion>2.1.4.0</FileVersion>
<NeutralLanguage>en-US</NeutralLanguage>
<RepositoryUrl>https://github.com/belowaverage-org/SuperLauncher</RepositoryUrl>
<RepositoryType>GIT</RepositoryType>
<PackageProjectUrl>https://github.com/belowaverage-org/SuperLauncher</PackageProjectUrl>
<PackageLicenseFile>..\LICENSE</PackageLicenseFile>
<Copyright>below average © 2024</Copyright>
<Company>Dylan Bickerstaff; Adam Cunningham</Company>
<Version>2.1.3.0</Version>
<Version>2.1.4.0</Version>
<Description>🚀 Super Launcher is an admin launcher that persists in the system tray that can launch programs quickly; optionally, with administrator rights, as another user, or both.</Description>
<PlatformTarget>x64</PlatformTarget>
<Platforms>x64</Platforms>
Expand Down
5 changes: 3 additions & 2 deletions SuperLauncher/AutoStartHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public static class AutoStartHelper
{
private const string SuperLauncherPath = "C:\\Users\\Public\\below average\\Super Launcher\\SuperLauncherBootstrap.exe";
private const string RelativeRunKeyPath = "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
public static AutoStartStatus Status {
public static AutoStartStatus Status
{
get => GetStatus();
set
{
Expand Down Expand Up @@ -35,7 +36,7 @@ private static void Enable()
key.Close();
}
}
private static void Disable()
private static void Disable()
{
if (Status == AutoStartStatus.Disabled) return;
RegistryKey key = Registry.Users.OpenSubKey(RunKeyPath, true);
Expand Down
2 changes: 1 addition & 1 deletion SuperLauncher/ModernLauncherContextMenuIcon.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void Page_Loaded(object sender, System.Windows.RoutedEventArgs e)
}
private void BtnRename_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{

new ModernLauncherRenameUI(Icon).ShowDialog();
}
}
}
33 changes: 22 additions & 11 deletions SuperLauncher/ModernLauncherIcon.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,26 @@ public partial class ModernLauncherIcon : UserControl
public bool rFilterFocus = false;
public ModernLauncherBadge Badge;
public bool IsMouseDown = false;
public string Title = null;
private string rTitle = "";
public string Title
{
get
{
return rTitle;
}
set
{
if (string.IsNullOrEmpty(value))
{
rTitle = Shared.ExtRemover(rFilePath);
}
else
{
rTitle = value;
}
NameText.Text = rTitle;
}
}
public Timer BadgeTimer = new()
{
Interval = 1000,
Expand All @@ -35,14 +54,6 @@ public string FilePath
{
rFilePath = value;
Icon icon = Icon.ExtractAssociatedIcon(rFilePath);
if (Title == null)
{
NameText.Text = Shared.ExtRemover(rFilePath);
}
else
{
NameText.Text = Title;
}
LIcon.Source = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
}
}
Expand All @@ -68,8 +79,8 @@ public bool FilterFocus
public ModernLauncherIcon(string FilePath, string Title = null)
{
InitializeComponent();
this.Title = Title;
this.FilePath = FilePath;
this.Title = Title;
}
private readonly DoubleAnimation To1 = new()
{
Expand Down Expand Up @@ -143,7 +154,7 @@ private void UserControl_MouseUp(object sender, MouseButtonEventArgs e)
private void Menu_MouseUp(object sender, MouseButtonEventArgs e)
{
ModernLauncherContextMenuIcon menu = (ModernLauncherContextMenuIcon)sender;
if (e.Source == menu.BtnUnpin)
if (e.Source == menu.BtnUnpin || e.Source == menu.BtnRename)
{
PWindow.Focus();
}
Expand Down
16 changes: 11 additions & 5 deletions SuperLauncher/ModernLauncherIcons.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ public void PopulateIcons()
foreach (XmlNode app in apps)
{
if (!File.Exists(app.InnerText)) continue;

ModernLauncherIcon mli = new(app.InnerText);
string name = null;
if (app.Attributes["Name"] != null)
{
name = app.Attributes["Name"].InnerText;
}
ModernLauncherIcon mli = new(app.InnerText, name);
IconPanel.Children.Add(mli);
}
}
Expand All @@ -73,14 +77,16 @@ public void PopulateIcons()
IconPanel.Children.Add(new ModernLauncherIcon(@"C:\Windows\System32\cmd.exe", "Command Prompt"));
}
}
private void CommitIconsToFile()
public void CommitIconsToFile()
{
Settings.Default.FileList.Clear();
foreach (ModernLauncherIcon mli in IconPanel.Children)
{
Settings.Default.FileList.Add(mli.FilePath);
//XmlNode node = Settings.Default.XDoc.SelectSingleNode("/SuperLauncher/AppList/App[. = \"" + mli.FilePath + "\"]");
//node.Attributes.
XmlNode node = Settings.Default.XDoc.SelectSingleNode("/SuperLauncher/AppList/App[. = \"" + mli.FilePath + "\"]");
XmlAttribute name = Settings.Default.XDoc.CreateAttribute("Name");
name.InnerText = mli.Title;
node.Attributes.Append(name);
}
Settings.Default.Save();
}
Expand Down
42 changes: 42 additions & 0 deletions SuperLauncher/ModernLauncherRenameUI.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Window x:Class="SuperLauncher.ModernLauncherRenameUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SuperLauncher"
mc:Ignorable="d"
Title="Super Launcher - Rename Shortcut"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
FontFamily="{DynamicResource Font}"
Loaded="Window_Loaded"
Height="260"
Width="345"
Topmost="True" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Themes/WinUI.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome
CaptionHeight="0"
GlassFrameThickness="-1"
ResizeBorderThickness="0"
UseAeroCaptionButtons="true"
/>
</WindowChrome.WindowChrome>
<Grid Background="{DynamicResource PanelColorBrush}">
<Grid x:Name="Grid" Background="{DynamicResource AcrylicNoise}">
<Label Content="Rename shortcut" Foreground="{DynamicResource TextColorBrush}" FontSize="20" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="17,46,0,0" />
<Label Content="Super Launcher" Foreground="{DynamicResource TextColorBrush}" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="32,6,0,0" />
<Label Content="Please enter a new shortcut name" Foreground="{DynamicResource TextColorBrush}" FontWeight="Normal" FontStyle="Normal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="18,93,0,0" />
<Label Content="" Foreground="{DynamicResource TextColorBrush}" FontFamily="{DynamicResource Icons}" FontWeight="Normal" FontStyle="Normal" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,6,0,0" />
<TextBox x:Name="TBName" KeyDown="TBName_KeyDown" Tag="" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,138,0,0" Width="298" Height="34" />
<Button x:Name="BtnOK" Content="Apply" HorizontalAlignment="Left" Margin="23,200,0,0" VerticalAlignment="Top" Height="35" Width="141" Click="BtnOK_Click" />
<Button x:Name="BtnCancel" Content="Cancel" HorizontalAlignment="Left" Margin="180,200,0,0" VerticalAlignment="Top" Height="35" Width="141" Click="BtnCancel_Click" />
</Grid>
</Grid>
</Window>
40 changes: 40 additions & 0 deletions SuperLauncher/ModernLauncherRenameUI.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Windows;
using System.Windows.Input;

namespace SuperLauncher
{
/// <summary>
/// Interaction logic for ModernLauncherRenameUI.xaml
/// </summary>
public partial class ModernLauncherRenameUI : Window
{
private ModernLauncherIcon MLI;
public ModernLauncherRenameUI(ModernLauncherIcon Icon)
{
MLI = Icon;
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Shared.EnableAcrylic(this);
Shared.SetWindowColor(this);
TBName.Focus();
TBName.Text = MLI.Title;
TBName.SelectAll();
}
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void BtnOK_Click(object sender, RoutedEventArgs e)
{
MLI.Title = TBName.Text;
((ModernLauncher)Program.ModernApplication.MainWindow).MLI.CommitIconsToFile();
Close();
}
private void TBName_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter) BtnOK_Click(null, null);
}
}
}

0 comments on commit f546093

Please sign in to comment.