Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Flow.Launcher.Core/Resource/Internationalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ public void ChangeLanguage(Language language)
{
language = language.NonNull();

Settings.Language = language.LanguageCode;

RemoveOldLanguageFiles();
if (language != AvailableLanguages.English)
{
LoadLanguage(language);
}
UpdatePluginMetadataTranslations();
Settings.Language = language.LanguageCode;

}

Expand Down
10 changes: 9 additions & 1 deletion Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ namespace Flow.Launcher.Infrastructure.UserSettings
{
public class Settings : BaseModel
{
private string language = "en";

public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
public bool ShowOpenResultHotkey { get; set; } = true;
public string Language { get; set; } = "en";
public string Language
{
get => language; set {
language = value;
OnPropertyChanged();
}
}
public string Theme { get; set; } = Constant.DefaultTheme;
public bool UseDropShadowEffect { get; set; } = false;
public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name;
Expand Down
31 changes: 24 additions & 7 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ private void OnClosing(object sender, CancelEventArgs e)

private void OnInitialized(object sender, EventArgs e)
{
// show notify icon when flowlauncher is hided
InitializeNotifyIcon();

}

private void OnLoaded(object sender, RoutedEventArgs _)
{
// show notify icon when flowlauncher is hidden
InitializeNotifyIcon();

// todo is there a way to set blur only once?
ThemeManager.Instance.SetBlurForWindow();
WindowsInteropHelper.DisableControlBox(this);
Expand Down Expand Up @@ -87,11 +89,17 @@ private void OnLoaded(object sender, RoutedEventArgs _)
};
_settings.PropertyChanged += (o, e) =>
{
if (e.PropertyName == nameof(Settings.HideNotifyIcon))
switch (e.PropertyName)
{
_notifyIcon.Visible = !_settings.HideNotifyIcon;
case nameof(Settings.HideNotifyIcon):
_notifyIcon.Visible = !_settings.HideNotifyIcon;
break;
case nameof(Settings.Language):
UpdateNotifyIconText();
break;
}
};

InitializePosition();
}

Expand All @@ -103,6 +111,18 @@ private void InitializePosition()
_settings.WindowLeft = Left;
}

private void UpdateNotifyIconText()
{
var menu = _notifyIcon.ContextMenuStrip;
var open = menu.Items[0];
var setting = menu.Items[1];
var exit = menu.Items[2];

open.Text = InternationalizationManager.Instance.GetTranslation("iconTrayOpen");
setting.Text = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
exit.Text = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
}

private void InitializeNotifyIcon()
{
_notifyIcon = new NotifyIcon
Expand Down Expand Up @@ -179,7 +199,6 @@ private void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e)
}
}


private void OnDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
Expand Down Expand Up @@ -294,7 +313,5 @@ private void OnTextChanged(object sender, TextChangedEventArgs e)
_viewModel.QueryTextCursorMovedToEnd = false;
}
}


}
}