Skip to content

Commit 7d0cf1f

Browse files
committed
Add plugin hotkey type
1 parent 698fe79 commit 7d0cf1f

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ public enum HotkeyType
110110
SelectPrevItemHotkey,
111111
SelectPrevItemHotkey2,
112112
SelectNextItemHotkey,
113-
SelectNextItemHotkey2
113+
SelectNextItemHotkey2,
114+
// Plugin hotkeys
115+
GlobalPluginHotkey,
116+
WindowPluginHotkey,
114117
}
115118

116119
// We can initialize settings in static field because it has been constructed in App constuctor
@@ -142,6 +145,9 @@ public string Hotkey
142145
HotkeyType.SelectPrevItemHotkey2 => _settings.SelectPrevItemHotkey2,
143146
HotkeyType.SelectNextItemHotkey => _settings.SelectNextItemHotkey,
144147
HotkeyType.SelectNextItemHotkey2 => _settings.SelectNextItemHotkey2,
148+
// Plugin hotkeys
149+
HotkeyType.GlobalPluginHotkey => hotkey,
150+
HotkeyType.WindowPluginHotkey => hotkey,
145151
_ => throw new System.NotImplementedException("Hotkey type not set")
146152
};
147153
}
@@ -201,6 +207,17 @@ public string Hotkey
201207
case HotkeyType.SelectNextItemHotkey2:
202208
_settings.SelectNextItemHotkey2 = value;
203209
break;
210+
// Plugin hotkeys
211+
case HotkeyType.GlobalPluginHotkey:
212+
// We should not save it to settings here because it is a custom plugin hotkey
213+
// and it will be saved in the plugin settings
214+
hotkey = value;
215+
break;
216+
case HotkeyType.WindowPluginHotkey:
217+
// We should not save it to settings here because it is a custom plugin hotkey
218+
// and it will be saved in the plugin settings
219+
hotkey = value;
220+
break;
204221
default:
205222
throw new System.NotImplementedException("Hotkey type not set");
206223
}

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ private void PluginHotkeySettings_Loaded(object sender, RoutedEventArgs e)
8080
{
8181
var hotkeyControl = new HotkeyControl
8282
{
83-
Type = HotkeyControl.HotkeyType.CustomQueryHotkey,
83+
Type = hotkey.HotkeyType == HotkeyType.Global ?
84+
HotkeyControl.HotkeyType.GlobalPluginHotkey : HotkeyControl.HotkeyType.WindowPluginHotkey,
8485
DefaultHotkey = hotkey.DefaultHotkey,
8586
ValidateKeyGesture = true
8687
};

0 commit comments

Comments
 (0)