@@ -22,14 +22,13 @@ package main
2222import (
2323 _ "embed"
2424 "fmt"
25- "strconv"
2625 "time"
2726
2827 "github.com/MiracleOS-Team/desktoplib/batteryHandler"
2928 "github.com/MiracleOS-Team/desktoplib/foreignToplevel"
3029 "github.com/MiracleOS-Team/desktoplib/networkManagerHandler"
3130 "github.com/MiracleOS-Team/desktoplib/volumeHandler"
32- "github.com/MiracleOS-Team/libxdg-go/notificationDaemon "
31+ "github.com/MiracleOS-Team/libxdg-go/desktopFiles "
3332 "github.com/dlasky/gotk3-layershell/layershell"
3433 "github.com/gotk3/gotk3/gdk"
3534 "github.com/gotk3/gotk3/glib"
@@ -56,7 +55,7 @@ func getDateInfo() (string, string) {
5655 return curDayCal , curTimeInString
5756}
5857
59- func createSidestuff (nDaemon * notificationDaemon. Daemon ) * gtk.Box {
58+ func createSidestuff () * gtk.Box {
6059 sideBox , _ := gtk .BoxNew (gtk .ORIENTATION_HORIZONTAL , 0 )
6160 sideBox .SetHAlign (gtk .ALIGN_END )
6261 sc , _ := sideBox .GetStyleContext ()
@@ -165,48 +164,48 @@ func createSidestuff(nDaemon *notificationDaemon.Daemon) *gtk.Box {
165164 sc , _ = notificationBox .GetStyleContext ()
166165 sc .AddClass ("notification-bell-wrapper" )
167166
168- notificationBar := createNotificationBar (nDaemon )
169- notificationButton .Connect ("clicked" , func () {
170- if notificationBar .IsVisible () {
171- notificationBar .Hide ()
172- } else {
173- if len (nDaemon .Notifications ) != 0 {
174- notificationBar .ShowAll ()
175- }
167+ // notificationBar := createNotificationBar(nDaemon)
168+ // notificationButton.Connect("clicked", func() {
169+ // if notificationBar.IsVisible() {
170+ // notificationBar.Hide()
171+ // } else {
172+ // if len(nDaemon.Notifications) != 0 {
173+ // notificationBar.ShowAll()
174+ // }
176175
177- }
178- })
176+ // }
177+ // })
179178
180179 ntStack , _ := gtk .StackNew ()
181180
182181 notificationImage , _ := gtk .ImageNewFromIconName ("preferences-system-notifications-symbolic" , gtk .ICON_SIZE_BUTTON )
183182 sc , _ = notificationImage .GetStyleContext ()
184183 sc .AddClass ("notification-bell" )
185184
186- notificationText , _ := gtk .LabelNew (strconv .Itoa (len (nDaemon .Notifications )))
187- sc , _ = notificationText .GetStyleContext ()
188- sc .AddClass ("h2" )
185+ // notificationText, _ := gtk.LabelNew(strconv.Itoa(len(nDaemon.Notifications)))
186+ // sc, _ = notificationText.GetStyleContext()
187+ // sc.AddClass("h2")
189188
190189 ntStack .Add (notificationImage )
191- ntStack .Add (notificationText )
190+ // ntStack.Add(notificationText)
192191
193192 notificationBox .PackStart (ntStack , false , false , 0 )
194193 notificationButton .Add (notificationBox )
195194
196- glib .TimeoutAdd (uint (100 ), func () bool {
197- // Get new date/time info.
198- notificationText .SetText (strconv .Itoa (len (nDaemon .Notifications )))
199- if len (nDaemon .Notifications ) == 0 {
200- ntStack .SetVisibleChild (notificationImage )
201- ntStack .SetTransitionType (gtk .STACK_TRANSITION_TYPE_SLIDE_LEFT )
202- } else {
203- ntStack .SetVisibleChild (notificationText )
204- ntStack .SetTransitionType (gtk .STACK_TRANSITION_TYPE_SLIDE_RIGHT )
205- }
206-
207- // Return true to keep the timeout active.
208- return true
209- })
195+ // glib.TimeoutAdd(uint(100), func() bool {
196+ // // Get new date/time info.
197+ // notificationText.SetText(strconv.Itoa(len(nDaemon.Notifications)))
198+ // if len(nDaemon.Notifications) == 0 {
199+ // ntStack.SetVisibleChild(notificationImage)
200+ // ntStack.SetTransitionType(gtk.STACK_TRANSITION_TYPE_SLIDE_LEFT)
201+ // } else {
202+ // ntStack.SetVisibleChild(notificationText)
203+ // ntStack.SetTransitionType(gtk.STACK_TRANSITION_TYPE_SLIDE_RIGHT)
204+ // }
205+
206+ // // Return true to keep the timeout active.
207+ // return true
208+ // })
210209
211210 sideBox .PackStart (otherIcons , false , false , 0 )
212211 sideBox .PackStart (statusBox , false , false , 0 )
@@ -217,7 +216,7 @@ func createSidestuff(nDaemon *notificationDaemon.Daemon) *gtk.Box {
217216 return sideBox
218217}
219218
220- func createWorkspaces () * gtk.Box {
219+ func createWorkspaces (apps []desktopFiles. DesktopFile ) * gtk.Box {
221220 box , _ := gtk .BoxNew (gtk .ORIENTATION_HORIZONTAL , 10 )
222221 box .SetHAlign (gtk .ALIGN_START )
223222 sc , _ := box .GetStyleContext ()
@@ -234,7 +233,7 @@ func createWorkspaces() *gtk.Box {
234233 sc , _ := imgButton .GetStyleContext ()
235234 sc .AddClass ("app" )
236235
237- pathn , err := foreignToplevel .GetIconFromToplevel (k , 16 , 1 )
236+ pathn , err := foreignToplevel .GetIconFromToplevel (k , 16 , 1 , apps )
238237 if err == nil {
239238
240239 pixb , _ := gdk .PixbufNewFromFile (pathn )
@@ -254,7 +253,7 @@ func createWorkspaces() *gtk.Box {
254253 return box
255254}
256255
257- func createMainIcons () * gtk.Box {
256+ func createMainIcons (apps []desktopFiles. DesktopFile ) * gtk.Box {
258257 box , _ := gtk .BoxNew (gtk .ORIENTATION_HORIZONTAL , 10 )
259258 box .SetHAlign (gtk .ALIGN_CENTER )
260259
@@ -267,7 +266,7 @@ func createMainIcons() *gtk.Box {
267266 customButton , _ := gtk .ButtonNew ()
268267 customButton .Add (customIcon )
269268
270- mm := createMainMenu ()
269+ mm := createMainMenu (apps )
271270
272271 customButton .Connect ("clicked" , func () {
273272 if mm .IsVisible () {
@@ -285,7 +284,7 @@ func createMainIcons() *gtk.Box {
285284 return box
286285}
287286
288- func createBar (nDaemon * notificationDaemon. Daemon ) * gtk.Window {
287+ func createBar (apps []desktopFiles. DesktopFile ) * gtk.Window {
289288 win , _ := gtk .WindowNew (gtk .WINDOW_TOPLEVEL )
290289 win .SetTitle ("Main Bar" )
291290 win .SetDecorated (false )
@@ -325,15 +324,15 @@ func createBar(nDaemon *notificationDaemon.Daemon) *gtk.Window {
325324 box , _ := gtk .BoxNew (gtk .ORIENTATION_HORIZONTAL , 10 )
326325 sc , _ := box .GetStyleContext ()
327326 sc .AddClass ("bar" )
328- box .PackStart (createWorkspaces (), false , false , 0 )
329- box .SetCenterWidget (createMainIcons ())
330- box .PackEnd (createSidestuff (nDaemon ), false , false , 0 )
327+ box .PackStart (createWorkspaces (apps ), false , false , 0 )
328+ box .SetCenterWidget (createMainIcons (apps ))
329+ box .PackEnd (createSidestuff (), false , false , 0 )
331330
332331 glib .TimeoutAdd (uint (500 ), func () bool {
333332 chil := box .GetChildren ()
334333 chil .NthData (uint (0 )).(* gtk.Widget ).Destroy ()
335334
336- wspaces := createWorkspaces ()
335+ wspaces := createWorkspaces (apps )
337336 box .PackStart (wspaces , false , false , 0 )
338337
339338 box .ShowAll ()
0 commit comments