@@ -203,31 +203,34 @@ class Preferences {
203203
204204    private  static  func  updateToNewPreferences( _ versionInPlist:  String )  { 
205205        // x.compare(y) is .orderedDescending if x > y
206-         if  versionInPlist. compare ( " 7.8.0 " ,  options:  . numeric)  !=  . orderedDescending { 
207-             migrateMenubarIconWithNewShownToggle ( ) 
208-             if  versionInPlist. compare ( " 7.0.0 " ,  options:  . numeric)  !=  . orderedDescending { 
209-                 migratePreferencesIndexes ( ) 
210-                 if  versionInPlist. compare ( " 6.43.0 " ,  options:  . numeric)  !=  . orderedDescending { 
211-                     migrateBlacklists ( ) 
212-                     if  versionInPlist. compare ( " 6.28.1 " ,  options:  . numeric)  !=  . orderedDescending { 
213-                         migrateMinMaxWindowsWidthInRow ( ) 
214-                         if  versionInPlist. compare ( " 6.27.1 " ,  options:  . numeric)  !=  . orderedDescending { 
215-                             // "Start at login" new implem doesn't use Login Items; we remove the entry from previous versions
216-                             ( Preferences . self as  AvoidDeprecationWarnings . Type) . migrateLoginItem ( ) 
217-                             if  versionInPlist. compare ( " 6.23.0 " ,  options:  . numeric)  !=  . orderedDescending { 
218-                                 // "Show windows from:" got the "Active Space" option removed
219-                                 migrateShowWindowsFrom ( ) 
220-                                 if  versionInPlist. compare ( " 6.18.1 " ,  options:  . numeric)  !=  . orderedDescending { 
221-                                     // nextWindowShortcut used to be able to have modifiers already present in holdShortcut; we remove these
222-                                     migrateNextWindowShortcuts ( ) 
223-                                     // dropdowns preferences used to store English text; now they store indexes
224-                                     migrateDropdownsFromTextToIndexes ( ) 
225-                                     // the "Hide menubar icon" checkbox was replaced with a dropdown of: icon1, icon2, hidden
226-                                     migrateMenubarIconFromCheckboxToDropdown ( ) 
227-                                     // "Show minimized/hidden/fullscreen windows" checkboxes were replaced with dropdowns
228-                                     migrateShowWindowsCheckboxToDropdown ( ) 
229-                                     // "Max size on screen" was split into max width and max height
230-                                     migrateMaxSizeOnScreenToWidthAndHeight ( ) 
206+         if  versionInPlist. compare ( " 7.13.1 " ,  options:  . numeric)  !=  . orderedDescending { 
207+             migrateGestures ( ) 
208+             if  versionInPlist. compare ( " 7.8.0 " ,  options:  . numeric)  !=  . orderedDescending { 
209+                 migrateMenubarIconWithNewShownToggle ( ) 
210+                 if  versionInPlist. compare ( " 7.0.0 " ,  options:  . numeric)  !=  . orderedDescending { 
211+                     migratePreferencesIndexes ( ) 
212+                     if  versionInPlist. compare ( " 6.43.0 " ,  options:  . numeric)  !=  . orderedDescending { 
213+                         migrateBlacklists ( ) 
214+                         if  versionInPlist. compare ( " 6.28.1 " ,  options:  . numeric)  !=  . orderedDescending { 
215+                             migrateMinMaxWindowsWidthInRow ( ) 
216+                             if  versionInPlist. compare ( " 6.27.1 " ,  options:  . numeric)  !=  . orderedDescending { 
217+                                 // "Start at login" new implem doesn't use Login Items; we remove the entry from previous versions
218+                                 ( Preferences . self as  AvoidDeprecationWarnings . Type) . migrateLoginItem ( ) 
219+                                 if  versionInPlist. compare ( " 6.23.0 " ,  options:  . numeric)  !=  . orderedDescending { 
220+                                     // "Show windows from:" got the "Active Space" option removed
221+                                     migrateShowWindowsFrom ( ) 
222+                                     if  versionInPlist. compare ( " 6.18.1 " ,  options:  . numeric)  !=  . orderedDescending { 
223+                                         // nextWindowShortcut used to be able to have modifiers already present in holdShortcut; we remove these
224+                                         migrateNextWindowShortcuts ( ) 
225+                                         // dropdowns preferences used to store English text; now they store indexes
226+                                         migrateDropdownsFromTextToIndexes ( ) 
227+                                         // the "Hide menubar icon" checkbox was replaced with a dropdown of: icon1, icon2, hidden
228+                                         migrateMenubarIconFromCheckboxToDropdown ( ) 
229+                                         // "Show minimized/hidden/fullscreen windows" checkboxes were replaced with dropdowns
230+                                         migrateShowWindowsCheckboxToDropdown ( ) 
231+                                         // "Max size on screen" was split into max width and max height
232+                                         migrateMaxSizeOnScreenToWidthAndHeight ( ) 
233+                                     } 
231234                                } 
232235                            } 
233236                        } 
@@ -237,6 +240,19 @@ class Preferences {
237240        } 
238241    } 
239242
243+     // we split gestures from disabled, 3-finger, 4-finger to: disabled, 3-finger-horizontal, 3-finger-vertical, 4-finger-horizontal, 4-finger-vertical
244+     // no need to map 0 -> 0 (disabled -> disabled)
245+     // no need to map 1 -> 1 (3-finger -> 3-finger-horizontal)
246+     // we need to map 2 -> 3 (4-finger -> 4-finger-horizontal)
247+     private  static  func  migrateGestures( )  { 
248+         if  let  old =  UserDefaults . standard. string ( forKey:  " nextWindowGesture " )  { 
249+             if  old ==  " 2 "  {  // 2 (4-finger) -> 3 (4-finger-horizontal)
250+                 UserDefaults . standard. set ( " 3 " ,  forKey:  " nextWindowGesture " ) 
251+             } 
252+         } 
253+     } 
254+ 
255+ 
240256    // we added the new menubarIconShown toggle. It replaces menubarIcon having value "3" which would hide the icon
241257    // there are now 2 preferences : menubarIconShown is a boolean, and menubarIcon has values 0, 1, 2
242258    private  static  func  migrateMenubarIconWithNewShownToggle( )  { 
@@ -506,16 +522,28 @@ enum MenubarIconPreference: CaseIterable, MacroPreference {
506522
507523enum  GesturePreference :  CaseIterable ,  MacroPreference  { 
508524    case  disabled
509-     case  threeFingerSwipe
510-     case  fourFingerSwipe
525+     case  threeFingerHorizontalSwipe
526+     case  threeFingerVerticalSwipe
527+     case  fourFingerHorizontalSwipe
528+     case  fourFingerVerticalSwipe
511529
512530    var  localizedString :  LocalizedString  { 
513531        switch  self  { 
514532            case  . disabled:  return  NSLocalizedString ( " Disabled " ,  comment:  " " ) 
515-             case  . threeFingerSwipe:  return  NSLocalizedString ( " Swipe with Three Fingers " ,  comment:  " " ) 
516-             case  . fourFingerSwipe:  return  NSLocalizedString ( " Swipe with Four Fingers " ,  comment:  " " ) 
533+             case  . threeFingerHorizontalSwipe:  return  NSLocalizedString ( " Horizontal Swipe with Three Fingers " ,  comment:  " " ) 
534+             case  . threeFingerVerticalSwipe:  return  NSLocalizedString ( " Vertical Swipe with Three Fingers " ,  comment:  " " ) 
535+             case  . fourFingerHorizontalSwipe:  return  NSLocalizedString ( " Horizontal Swipe with Four Fingers " ,  comment:  " " ) 
536+             case  . fourFingerVerticalSwipe:  return  NSLocalizedString ( " Vertical Swipe with Four Fingers " ,  comment:  " " ) 
517537        } 
518538    } 
539+ 
540+     func  isHorizontal( )  ->  Bool  { 
541+         return  self  ==  . threeFingerHorizontalSwipe || self  ==  . fourFingerHorizontalSwipe
542+     } 
543+ 
544+     func  isThreeFinger( )  ->  Bool  { 
545+         return  self  ==  . threeFingerHorizontalSwipe || self  ==  . threeFingerVerticalSwipe
546+     } 
519547} 
520548
521549enum  LanguagePreference :  CaseIterable ,  MacroPreference  { 
0 commit comments