11using System . Collections . Generic ;
2+ using Flow . Launcher . Localization . Attributes ;
23
34namespace Flow . Launcher . Plugin . Shell
45{
5- public class Settings
6+ public class Settings : BaseModel
67 {
7- public Shell Shell { get ; set ; } = Shell . Cmd ;
8+ private Shell _shell = Shell . Cmd ;
9+ public Shell Shell
10+ {
11+ get => _shell ;
12+ set
13+ {
14+ if ( _shell != value )
15+ {
16+ _shell = value ;
17+ OnPropertyChanged ( ) ;
18+ }
19+ }
20+ }
821
9- public bool ReplaceWinR { get ; set ; } = false ;
22+ private bool _replaceWinR = false ;
23+ public bool ReplaceWinR
24+ {
25+ get => _replaceWinR ;
26+ set
27+ {
28+ if ( _replaceWinR != value )
29+ {
30+ _replaceWinR = value ;
31+ OnPropertyChanged ( ) ;
32+ }
33+ }
34+ }
1035
11- public bool CloseShellAfterPress { get ; set ; } = false ;
36+ private bool _closeShellAfterPress = false ;
37+ public bool CloseShellAfterPress
38+ {
39+ get => _closeShellAfterPress ;
40+ set
41+ {
42+ if ( _closeShellAfterPress != value )
43+ {
44+ _closeShellAfterPress = value ;
45+ OnPropertyChanged ( ) ;
46+ }
47+ }
48+ }
1249
13- public bool LeaveShellOpen { get ; set ; }
50+ private bool _leaveShellOpen ;
51+ public bool LeaveShellOpen
52+ {
53+ get => _leaveShellOpen ;
54+ set
55+ {
56+ if ( _leaveShellOpen != value )
57+ {
58+ _leaveShellOpen = value ;
59+ OnPropertyChanged ( ) ;
60+ }
61+ }
62+ }
1463
15- public bool RunAsAdministrator { get ; set ; } = true ;
64+ private bool _runAsAdministrator = true ;
65+ public bool RunAsAdministrator
66+ {
67+ get => _runAsAdministrator ;
68+ set
69+ {
70+ if ( _runAsAdministrator != value )
71+ {
72+ _runAsAdministrator = value ;
73+ OnPropertyChanged ( ) ;
74+ }
75+ }
76+ }
1677
17- public bool UseWindowsTerminal { get ; set ; } = false ;
78+ private bool _useWindowsTerminal = false ;
79+ public bool UseWindowsTerminal
80+ {
81+ get => _useWindowsTerminal ;
82+ set
83+ {
84+ if ( _useWindowsTerminal != value )
85+ {
86+ _useWindowsTerminal = value ;
87+ OnPropertyChanged ( ) ;
88+ }
89+ }
90+ }
1891
19- public bool ShowOnlyMostUsedCMDs { get ; set ; }
92+ private bool _showOnlyMostUsedCMDs ;
93+ public bool ShowOnlyMostUsedCMDs
94+ {
95+ get => _showOnlyMostUsedCMDs ;
96+ set
97+ {
98+ if ( _showOnlyMostUsedCMDs != value )
99+ {
100+ _showOnlyMostUsedCMDs = value ;
101+ OnPropertyChanged ( ) ;
102+ }
103+ }
104+ }
20105
21- public int ShowOnlyMostUsedCMDsNumber { get ; set ; }
106+ private int _showOnlyMostUsedCMDsNumber = 5 ;
107+ public int ShowOnlyMostUsedCMDsNumber
108+ {
109+ get => _showOnlyMostUsedCMDsNumber ;
110+ set
111+ {
112+ if ( _showOnlyMostUsedCMDsNumber != value )
113+ {
114+ _showOnlyMostUsedCMDsNumber = value ;
115+ OnPropertyChanged ( ) ;
116+ }
117+ }
118+ }
22119
23120 public Dictionary < string , int > CommandHistory { get ; set ; } = [ ] ;
24121
@@ -31,11 +128,19 @@ public void AddCmdHistory(string cmdName)
31128 }
32129 }
33130
131+ [ EnumLocalize ]
34132 public enum Shell
35133 {
134+ [ EnumLocalizeValue ( "CMD" ) ]
36135 Cmd = 0 ,
136+
137+ [ EnumLocalizeValue ( "PowerShell" ) ]
37138 Powershell = 1 ,
139+
140+ [ EnumLocalizeValue ( "RunCommand" ) ]
38141 RunCommand = 2 ,
142+
143+ [ EnumLocalizeValue ( "Pwsh" ) ]
39144 Pwsh = 3 ,
40145 }
41146}
0 commit comments