@@ -43,45 +43,72 @@ struct LauncherListView: View {
4343
4444 try ? process. run ( )
4545 }
46-
46+
4747 var body : some View {
48- ForEach ( launcherRepos) { LauncherRepo in
49-
50- let i = launcherRepos. firstIndex ( of: LauncherRepo) ?? 0
51-
52- HStack {
53- Text ( LauncherRepo . title ?? " Unknown Title " )
48+ VStack {
49+ ForEach ( launcherRepos) { LauncherRepo in
5450
55- Spacer ( )
51+ let i = launcherRepos . firstIndex ( of : LauncherRepo ) ?? 0
5652
57- Menu {
58- Button {
59- if launcherRepos. isEmpty { return }
60-
61- for i in 0 ... launcherRepos. count - 1 {
62- launcherRepos [ i] . isEditing = false
63- }
64-
65- openWindow ( id: " regular-log " , value: i)
66-
67- print ( LauncherRepo . path ?? " " )
68- } label: {
69- Label ( " Log " , systemImage: " play.fill " )
70- . labelStyle ( . titleAndIcon)
71- }
53+ HStack {
54+ Text ( LauncherRepo . title ?? " Unknown Title " )
7255
73- Button {
74- if launcherRepos. isEmpty { return }
56+ Spacer ( )
57+
58+ Menu {
59+ Button {
60+ if launcherRepos. isEmpty { return }
61+
62+ for i in 0 ... launcherRepos. count - 1 {
63+ launcherRepos [ i] . isEditing = false
64+ }
65+
66+ openWindow ( id: " regular-log " , value: i)
67+
68+ print ( LauncherRepo . path ?? " " )
69+ } label: {
70+ Label ( " Log " , systemImage: " play.fill " )
71+ . labelStyle ( . titleAndIcon)
72+ }
7573
76- for iEdit in 0 ... launcherRepos. count - 1 {
77- launcherRepos [ iEdit] . isEditing = false
74+ Button {
75+ if launcherRepos. isEmpty { return }
76+
77+ for iEdit in 0 ... launcherRepos. count - 1 {
78+ launcherRepos [ iEdit] . isEditing = false
79+ }
80+
81+ launcherRepos [ i] . isEditing = true
82+ } label: {
83+ Label ( " Edit " , systemImage: " pencil " )
84+ . labelStyle ( . titleAndIcon)
7885 }
7986
80- launcherRepos [ i] . isEditing = true
87+ Button {
88+ if launcherRepos. isEmpty { return }
89+
90+ for i in 0 ... launcherRepos. count - 1 {
91+ launcherRepos [ i] . isEditing = false
92+ }
93+
94+ let launcherRepo = launcherRepos [ i]
95+
96+ moc. delete ( launcherRepo)
97+
98+ do {
99+ try moc. save ( )
100+ reloadMenuBarLauncher = true
101+ }
102+ catch {
103+ print ( " Error: its broken: \( error) " )
104+ }
105+ } label: {
106+ Label ( " Trash " , systemImage: " trash " )
107+ . labelStyle ( . titleAndIcon)
108+ }
81109 } label: {
82- Label ( " Edit " , systemImage: " pencil " )
83- . labelStyle ( . titleAndIcon)
84- }
110+ Text ( " Options " )
111+ } . frame ( idealWidth: 80 , maxWidth: 80 )
85112
86113 Button {
87114 if launcherRepos. isEmpty { return }
@@ -90,42 +117,17 @@ struct LauncherListView: View {
90117 launcherRepos [ i] . isEditing = false
91118 }
92119
93- let launcherRepo = launcherRepos [ i]
94-
95- moc. delete ( launcherRepo)
120+ launcherShell ( " \( LauncherRepo . path ?? " its broken " ) \( LauncherRepo . args ?? " " ) " )
96121
97- do {
98- try moc. save ( )
99- reloadMenuBarLauncher = true
100- }
101- catch {
102- print ( " Error: its broken: \( error) " )
103- }
122+ print ( LauncherRepo . path ?? " " )
104123 } label: {
105- Label ( " Trash " , systemImage: " trash " )
124+ Label ( " Play " , systemImage: " play.fill " )
106125 . labelStyle ( . titleAndIcon)
107126 }
108- } label: {
109- Text ( " Options " )
110- } . frame ( idealWidth: 80 , maxWidth: 80 )
111-
112- Button {
113- if launcherRepos. isEmpty { return }
114-
115- for i in 0 ... launcherRepos. count - 1 {
116- launcherRepos [ i] . isEditing = false
117- }
118-
119- try ? launcherShell ( " \( LauncherRepo . path ?? " its broken " ) \( LauncherRepo . args ?? " " ) " )
120-
121- print ( LauncherRepo . path ?? " " )
122- } label: {
123- Label ( " Play " , systemImage: " play.fill " )
124- . labelStyle ( . titleAndIcon)
127+ } . sheet ( isPresented: . constant( LauncherRepo . isEditing) ) {
128+ LauncherEditView ( i: i, existingRepo: $existingRepo, reloadMenuBarLauncher: $reloadMenuBarLauncher)
125129 }
126- } . sheet ( isPresented: . constant( LauncherRepo . isEditing) ) {
127- LauncherEditView ( i: i, existingRepo: $existingRepo, reloadMenuBarLauncher: $reloadMenuBarLauncher)
128130 }
129- }
131+ } . padding ( [ . top , . horizontal ] , 5 )
130132 }
131133}
0 commit comments