Skip to content

Commit e962d7b

Browse files
committed
Remove Xorg code, embed assets in the binaries
1 parent 814a6b6 commit e962d7b

6 files changed

Lines changed: 32 additions & 555 deletions

File tree

bar.go

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
package main
2121

2222
import (
23+
_ "embed"
2324
"fmt"
24-
"log"
2525
"strconv"
2626
"time"
2727

28-
"github.com/BurntSushi/xgb/xproto"
29-
"github.com/BurntSushi/xgbutil"
3028
"github.com/MiracleOS-Team/desktoplib/batteryHandler"
3129
"github.com/MiracleOS-Team/desktoplib/foreignToplevel"
3230
"github.com/MiracleOS-Team/desktoplib/networkManagerHandler"
@@ -38,6 +36,9 @@ import (
3836
"github.com/gotk3/gotk3/gtk"
3937
)
4038

39+
//go:embed images/pp.png
40+
var ppData []byte
41+
4142
func getDateInfo() (string, string) {
4243
hours, minutes, _ := time.Now().Clock()
4344
curTimeInString := fmt.Sprintf("%d:%02d", hours, minutes)
@@ -259,7 +260,10 @@ func createMainIcons() *gtk.Box {
259260

260261
desktopImage, _ := gtk.ImageNewFromIconName("preferences-system-windows-symbolic", gtk.ICON_SIZE_LARGE_TOOLBAR)
261262
searchImage, _ := gtk.ImageNewFromIconName("system-search-symbolic", gtk.ICON_SIZE_LARGE_TOOLBAR)
262-
customIcon, _ := gtk.ImageNewFromFile("images/pp.png")
263+
264+
ppPbuff, _ := gdk.PixbufNewFromBytesOnly(ppData)
265+
266+
customIcon, _ := gtk.ImageNewFromPixbuf(ppPbuff)
263267
customButton, _ := gtk.ButtonNew()
264268
customButton.Add(customIcon)
265269

@@ -337,27 +341,6 @@ func createBar(nDaemon *notificationDaemon.Daemon) *gtk.Window {
337341
return true
338342
})
339343

340-
glib.TimeoutAdd(100, func() bool {
341-
gdkwin, _ := win.GetWindow()
342-
if gdkwin == nil {
343-
return true
344-
}
345-
_, height := win.GetSize()
346-
xid := uint32(gdkwin.GetXID())
347-
348-
// Setup X connection
349-
X, err := xgbutil.NewConn()
350-
if err != nil {
351-
log.Fatal(err)
352-
}
353-
354-
screen, _ := gdk.ScreenGetDefault()
355-
rw, _ := screen.GetRootWindow()
356-
setStrutPartial(X, xproto.Window(xid), uint(height), uint(rw.WindowGetWidth()))
357-
win.Move((sc_width-width)/2, sc_height-height)
358-
return false
359-
})
360-
361344
win.Add(box)
362345
return win
363346
}

go.mod

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,22 @@ module github.com/MiracleOS-Team/desktop
33
go 1.24.0
44

55
require (
6-
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc
7-
github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046
8-
github.com/MiracleOS-Team/desktoplib v0.0.0-20250415145054-8dbe3c9c607b
9-
github.com/MiracleOS-Team/libxdg-go v0.0.0-20250525172408-a1deb8978aaf
6+
github.com/MiracleOS-Team/desktoplib v0.0.0-20250825133335-a752d18a2ba1
7+
github.com/MiracleOS-Team/libxdg-go v0.0.0-20250612171904-bbe9fb77c7a2
108
github.com/dlasky/gotk3-layershell v0.0.0-20240515133811-5c5115f0d774
11-
github.com/go-git/go-git/v5 v5.16.0
129
github.com/gotk3/gotk3 v0.6.5-0.20240618185848-ff349ae13f56
13-
golang.org/x/text v0.25.0
10+
golang.org/x/text v0.28.0
1411
)
1512

1613
require (
17-
dario.cat/mergo v1.0.2 // indirect
18-
github.com/BurntSushi/freetype-go v0.0.0-20160129220410-b763ddbfe298 // indirect
19-
github.com/BurntSushi/graphics-go v0.0.0-20160129215708-b43f31a4a966 // indirect
20-
github.com/Microsoft/go-winio v0.6.2 // indirect
21-
github.com/ProtonMail/go-crypto v1.3.0 // indirect
22-
github.com/cli/safeexec v1.0.1 // indirect
23-
github.com/cloudflare/circl v1.6.1 // indirect
24-
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
2514
github.com/distatus/battery v0.11.0 // indirect
26-
github.com/emirpasic/gods v1.18.1 // indirect
27-
github.com/gdamore/encoding v1.0.0 // indirect
28-
github.com/gdamore/tcell v1.4.0 // indirect
29-
github.com/gek64/displayController v1.0.2 // indirect
30-
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
31-
github.com/go-git/go-billy/v5 v5.6.2 // indirect
3215
github.com/go-ole/go-ole v1.3.0 // indirect
3316
github.com/godbus/dbus/v5 v5.1.0 // indirect
34-
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
3517
github.com/itchyny/volume-go v0.2.2 // indirect
36-
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
3718
github.com/jfreymuth/pulse v0.1.1 // indirect
38-
github.com/kevinburke/ssh_config v1.2.0 // indirect
39-
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
40-
github.com/mattn/go-runewidth v0.0.7 // indirect
4119
github.com/moutend/go-wca v0.3.0 // indirect
42-
github.com/pjbgf/sha1cd v0.3.2 // indirect
43-
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
44-
github.com/skeema/knownhosts v1.3.1 // indirect
45-
github.com/xanzy/ssh-agent v0.3.3 // indirect
46-
golang.org/x/crypto v0.38.0 // indirect
47-
golang.org/x/net v0.40.0 // indirect
48-
golang.org/x/sys v0.33.0 // indirect
49-
google.golang.org/protobuf v1.36.4 // indirect
20+
github.com/stretchr/testify v1.10.0 // indirect
21+
golang.org/x/sys v0.35.0 // indirect
5022
gopkg.in/ini.v1 v1.67.0 // indirect
51-
gopkg.in/warnings.v0 v0.1.2 // indirect
5223
howett.net/plist v1.0.1 // indirect
5324
)

0 commit comments

Comments
 (0)