@@ -1158,39 +1158,35 @@ void attachRename(ToolStripMenuItem item, string presetKey) {
11581158 menu . Items . Add ( floatingBarMenu ) ;
11591159 ToolStripMenuItem omenKeyMenu = new ToolStripMenuItem ( Strings . OmenKeyMenu ) ;
11601160 omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyDefault , "omenKeyGroup" , ( s , e ) => {
1161- omenKey = "default" ;
11621161 tooltipUpdateTimer . Enabled = false ;
1163- OmenKeyOff ( ) ;
1164- OmenKeyOn ( omenKey ) ;
1165- SaveConfig ( "OmenKey" ) ;
1162+ ApplyOmenKeyAction ( OmenKeyActions . Default ) ;
11661163 } , true ) ) ;
11671164 omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyToggle , "omenKeyGroup" , ( s , e ) => {
1168- omenKey = "custom" ;
1169- checkFloatingTimer . Enabled = true ;
1170- OmenKeyOff ( ) ;
1171- OmenKeyOn ( omenKey ) ;
1172- SaveConfig ( "OmenKey" ) ;
1165+ ApplyOmenKeyAction ( OmenKeyActions . Overlay ) ;
11731166 } , false ) ) ;
11741167 omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeySwitchPreset , "omenKeyGroup" , ( s , e ) => {
1175- omenKey = "preset" ;
1176- checkFloatingTimer . Enabled = true ;
1177- OmenKeyOff ( ) ;
1178- OmenKeyOn ( omenKey ) ;
1179- SaveConfig ( "OmenKey" ) ;
1168+ ApplyOmenKeyAction ( OmenKeyActions . Preset ) ;
11801169 } , false ) ) ;
11811170 omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyLaunchApp , "omenKeyGroup" , ( s , e ) => {
1182- if ( string . IsNullOrWhiteSpace ( omenKeyAppPath ) || ! File . Exists ( omenKeyAppPath ) ) {
1171+ if ( ! IsOmenKeyAppTargetAvailable ( ) ) {
11831172 if ( ! SelectOmenKeyApp ( ) ) {
11841173 skipCheckedUpdate = true ;
11851174 return ;
11861175 }
11871176 SaveConfig ( "OmenKeyAppPath" ) ;
1177+ SaveConfig ( "OmenKeyAppName" ) ;
11881178 }
1189- omenKey = "app" ;
1190- checkFloatingTimer . Enabled = true ;
1191- OmenKeyOff ( ) ;
1192- OmenKeyOn ( omenKey ) ;
1193- SaveConfig ( "OmenKey" ) ;
1179+ ApplyOmenKeyAction ( OmenKeyActions . App ) ;
1180+ } , false ) ) ;
1181+ omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyShortcut , "omenKeyGroup" , ( s , e ) => {
1182+ if ( string . IsNullOrWhiteSpace ( omenKeyShortcut ) ) {
1183+ if ( ! SelectOmenKeyShortcut ( ) ) {
1184+ skipCheckedUpdate = true ;
1185+ return ;
1186+ }
1187+ SaveConfig ( "OmenKeyShortcut" ) ;
1188+ }
1189+ ApplyOmenKeyAction ( OmenKeyActions . Shortcut ) ;
11941190 } , false ) ) ;
11951191 omenKeyMenu . DropDownItems . Add ( new ToolStripSeparator ( ) ) ;
11961192
@@ -1245,37 +1241,50 @@ void attachRename(ToolStripMenuItem item, string presetKey) {
12451241 omenKeyMenu . DropDownItems . Add ( omenKeyPresetCandidatesMenu ) ;
12461242 omenKeyMenu . DropDownItems . Add ( new ToolStripSeparator ( ) ) ;
12471243
1248- string appDisplayName = string . IsNullOrWhiteSpace ( omenKeyAppPath )
1249- ? Strings . OmenKeyNoAppSelected
1250- : Path . GetFileName ( omenKeyAppPath ) ;
1251- omenKeyMenu . DropDownItems . Add ( new ToolStripMenuItem ( $ "{ Strings . OmenKeyCurrentApp } : { appDisplayName } ") { Enabled = false } ) ;
1252- omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeySelectApp , null , ( s , e ) => {
1244+ omenKeyMenu . DropDownItems . Add ( new ToolStripMenuItem ( $ "{ Strings . OmenKeyCurrentApp } : { GetOmenKeyAppDisplayName ( ) } ") { Enabled = false } ) ;
1245+ omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeySelectDesktopApp , null , ( s , e ) => {
12531246 if ( ! SelectOmenKeyApp ( ) ) return ;
12541247 SaveConfig ( "OmenKeyAppPath" ) ;
1255- omenKey = "app" ;
1256- checkFloatingTimer . Enabled = true ;
1257- OmenKeyOff ( ) ;
1258- OmenKeyOn ( omenKey ) ;
1259- SaveConfig ( "OmenKey" ) ;
1248+ SaveConfig ( "OmenKeyAppName" ) ;
1249+ ApplyOmenKeyAction ( OmenKeyActions . App ) ;
1250+ RefreshMenu ( ) ;
1251+ } , false ) ) ;
1252+ omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeySelectUwpApp , null , ( s , e ) => {
1253+ if ( ! SelectOmenKeyUwpApp ( ) ) return ;
1254+ SaveConfig ( "OmenKeyAppPath" ) ;
1255+ SaveConfig ( "OmenKeyAppName" ) ;
1256+ ApplyOmenKeyAction ( OmenKeyActions . App ) ;
12601257 RefreshMenu ( ) ;
12611258 } , false ) ) ;
12621259 omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyClearApp , null , ( s , e ) => {
12631260 omenKeyAppPath = "" ;
1261+ omenKeyAppName = "" ;
12641262 SaveConfig ( "OmenKeyAppPath" ) ;
1265- if ( omenKey == "app" ) {
1266- omenKey = "none" ;
1267- checkFloatingTimer . Enabled = false ;
1268- OmenKeyOff ( ) ;
1269- SaveConfig ( "OmenKey" ) ;
1263+ SaveConfig ( "OmenKeyAppName" ) ;
1264+ if ( omenKey == OmenKeyActions . App ) {
1265+ ApplyOmenKeyAction ( OmenKeyActions . None ) ;
1266+ }
1267+ RefreshMenu ( ) ;
1268+ } , false ) ) ;
1269+ omenKeyMenu . DropDownItems . Add ( new ToolStripSeparator ( ) ) ;
1270+ omenKeyMenu . DropDownItems . Add ( new ToolStripMenuItem ( $ "{ Strings . OmenKeyCurrentShortcut } : { FormatOmenKeyShortcut ( omenKeyShortcut ) } ") { Enabled = false } ) ;
1271+ omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeySetShortcut , null , ( s , e ) => {
1272+ if ( ! SelectOmenKeyShortcut ( ) ) return ;
1273+ SaveConfig ( "OmenKeyShortcut" ) ;
1274+ ApplyOmenKeyAction ( OmenKeyActions . Shortcut ) ;
1275+ RefreshMenu ( ) ;
1276+ } , false ) ) ;
1277+ omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyClearShortcut , null , ( s , e ) => {
1278+ omenKeyShortcut = "" ;
1279+ SaveConfig ( "OmenKeyShortcut" ) ;
1280+ if ( omenKey == OmenKeyActions . Shortcut ) {
1281+ ApplyOmenKeyAction ( OmenKeyActions . None ) ;
12701282 }
12711283 RefreshMenu ( ) ;
12721284 } , false ) ) ;
12731285 omenKeyMenu . DropDownItems . Add ( new ToolStripSeparator ( ) ) ;
12741286 omenKeyMenu . DropDownItems . Add ( CreateMenuItem ( Strings . OmenKeyNone , "omenKeyGroup" , ( s , e ) => {
1275- omenKey = "none" ;
1276- checkFloatingTimer . Enabled = false ;
1277- OmenKeyOff ( ) ;
1278- SaveConfig ( "OmenKey" ) ;
1287+ ApplyOmenKeyAction ( OmenKeyActions . None ) ;
12791288 } , false ) ) ;
12801289 menu . Items . Add ( omenKeyMenu ) ;
12811290
0 commit comments