Skip to content

Commit a4ef56c

Browse files
authored
Merge pull request #34 from gdziedzic/enhance-mod+num-launching
Enhance modifier + num launching
2 parents 8677421 + 69158b9 commit a4ef56c

29 files changed

+163
-16
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Flow.Launcher.Infrastructure
2+
{
3+
public static class KeyConstant
4+
{
5+
public const string Ctrl = nameof(Ctrl);
6+
public const string Alt = nameof(Alt);
7+
public const string Space = nameof(Space);
8+
}
9+
}

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings
99
{
1010
public class Settings : BaseModel
1111
{
12-
public string Hotkey { get; set; } = "Alt + Space";
12+
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
13+
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
14+
public bool ShowOpenResultHotkey { get; set; } = true;
1315
public string Language { get; set; } = "en";
1416
public string Theme { get; set; } = "Dark";
1517
public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Text;
5+
using System.Windows;
6+
using System.Windows.Controls;
7+
using System.Windows.Data;
8+
9+
namespace Flow.Launcher.Converters
10+
{
11+
[ValueConversion(typeof(bool), typeof(Visibility))]
12+
public class OpenResultHotkeyVisibilityConverter : IValueConverter
13+
{
14+
private const int MaxVisibleHotkeys = 9;
15+
16+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
17+
{
18+
var hotkeyNumber = int.MaxValue;
19+
20+
if (value is ListBoxItem listBoxItem)
21+
{
22+
ListBox listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
23+
hotkeyNumber = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
24+
}
25+
26+
return hotkeyNumber <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed;
27+
}
28+
29+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
30+
}
31+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System.Globalization;
2+
using System.Windows.Controls;
3+
using System.Windows.Data;
4+
5+
namespace Flow.Launcher.Converters
6+
{
7+
public class OrdinalConverter : IValueConverter
8+
{
9+
public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value is ListBoxItem listBoxItem)
12+
{
13+
ListBox listBox = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;
14+
return listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
15+
}
16+
17+
return 0;
18+
}
19+
20+
public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();
21+
}
22+
}

Flow.Launcher/Languages/da.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
<!--Setting Hotkey-->
5252
<system:String x:Key="hotkey">Genvejstast</system:String>
5353
<system:String x:Key="flowlauncherHotkey">Flow Launcher genvejstast</system:String>
54+
<system:String x:Key="openResultModifiers">Åbn resultatmodifikatorer</system:String>
5455
<system:String x:Key="customQueryHotkey">Tilpasset søgegenvejstast</system:String>
56+
<system:String x:Key="showOpenResultHotkey">Vis hotkey</system:String>
5557
<system:String x:Key="delete">Slet</system:String>
5658
<system:String x:Key="edit">Rediger</system:String>
5759
<system:String x:Key="add">Tilføj</system:String>

Flow.Launcher/Languages/de.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
<!--Setting Hotkey-->
5252
<system:String x:Key="hotkey">Tastenkombination</system:String>
5353
<system:String x:Key="flowlauncherHotkey">Flow Launcher Tastenkombination</system:String>
54+
<system:String x:Key="openResultModifiers">Öffnen Sie die Ergebnismodifikatoren</system:String>
5455
<system:String x:Key="customQueryHotkey">Benutzerdefinierte Abfrage Tastenkombination</system:String>
56+
<system:String x:Key="showOpenResultHotkey">Hotkey anzeigen</system:String>
5557
<system:String x:Key="delete">Löschen</system:String>
5658
<system:String x:Key="edit">Bearbeiten</system:String>
5759
<system:String x:Key="add">Hinzufügen</system:String>

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
<!--Setting Hotkey-->
6161
<system:String x:Key="hotkey">Hotkey</system:String>
6262
<system:String x:Key="flowlauncherHotkey">Flow Launcher Hotkey</system:String>
63+
<system:String x:Key="openResultModifiers">Open Result Modifiers</system:String>
64+
<system:String x:Key="showOpenResultHotkey">Show Hotkey</system:String>
6365
<system:String x:Key="customQueryHotkey">Custom Query Hotkey</system:String>
6466
<system:String x:Key="delete">Delete</system:String>
6567
<system:String x:Key="edit">Edit</system:String>

Flow.Launcher/Languages/fr.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
<!--Setting Hotkey-->
5656
<system:String x:Key="hotkey">Raccourcis</system:String>
5757
<system:String x:Key="flowlauncherHotkey">Ouvrir Flow Launcher</system:String>
58+
<system:String x:Key="openResultModifiers">Modificateurs de résultats ouverts</system:String>
5859
<system:String x:Key="customQueryHotkey">Requêtes personnalisées</system:String>
60+
<system:String x:Key="showOpenResultHotkey">Afficher le raccourci clavier</system:String>
5961
<system:String x:Key="delete">Supprimer</system:String>
6062
<system:String x:Key="edit">Modifier</system:String>
6163
<system:String x:Key="add">Ajouter</system:String>

Flow.Launcher/Languages/it.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
<!--Setting Hotkey-->
5656
<system:String x:Key="hotkey">Tasti scelta rapida</system:String>
5757
<system:String x:Key="flowlauncherHotkey">Tasto scelta rapida Flow Launcher</system:String>
58+
<system:String x:Key="openResultModifiers">Apri modificatori di risultato</system:String>
5859
<system:String x:Key="customQueryHotkey">Tasti scelta rapida per ricerche personalizzate</system:String>
60+
<system:String x:Key="showOpenResultHotkey">Mostra tasto di scelta rapida</system:String>
5961
<system:String x:Key="delete">Cancella</system:String>
6062
<system:String x:Key="edit">Modifica</system:String>
6163
<system:String x:Key="add">Aggiungi</system:String>

Flow.Launcher/Languages/ja.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
<!--Setting Hotkey-->
5959
<system:String x:Key="hotkey">ホットキー</system:String>
6060
<system:String x:Key="flowlauncherHotkey">Flow Launcher ホットキー</system:String>
61+
<system:String x:Key="openResultModifiers">結果修飾子を開く</system:String>
6162
<system:String x:Key="customQueryHotkey">カスタムクエリ ホットキー</system:String>
63+
<system:String x:Key="showOpenResultHotkey">ホットキーを表示</system:String>
6264
<system:String x:Key="delete">削除</system:String>
6365
<system:String x:Key="edit">編集</system:String>
6466
<system:String x:Key="add">追加</system:String>

0 commit comments

Comments
 (0)