Skip to content

Commit 2cbdbdf

Browse files
committed
Merge branch 'dev' for release v3.1.1 (rebuild)
2 parents def1e38 + c178cf5 commit 2cbdbdf

3 files changed

Lines changed: 82 additions & 9 deletions

File tree

build-linux.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ if command -v linuxdeploy >/dev/null 2>&1; then
5252
rm -rf "$APPDIR"
5353
mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/share/applications" "$APPDIR/usr/share/icons/hicolor/512x512/apps"
5454
cp "$BIN_PATH" "$APPDIR/usr/bin/resultv"
55-
cp build/linux/resultv.desktop "$APPDIR/usr/share/applications/resultv.desktop"
55+
# AppImage requires Exec= to be a relative command (just "resultv"),
56+
# not the absolute /usr/bin/resultv used by the .deb/.rpm packages.
57+
sed 's|^Exec=.*|Exec=resultv %u|' build/linux/resultv.desktop \
58+
> "$APPDIR/usr/share/applications/resultv.desktop"
5659
cp public/logo.png "$APPDIR/usr/share/icons/hicolor/512x512/apps/resultv.png"
5760
ARCH=x86_64 linuxdeploy --appdir "$APPDIR" --output appimage --desktop-file "$APPDIR/usr/share/applications/resultv.desktop"
5861
mv ResultV*.AppImage "$OUT_DIR/" 2>/dev/null || true

internal/getlantern_systray/systray_darwin.go

Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,95 @@ import (
2626
"unsafe"
2727
)
2828

29+
func registerSystray() {
30+
C.registerSystray()
31+
}
2932

33+
func nativeLoop() {
34+
C.nativeLoop()
35+
}
3036

37+
func quit() {
38+
C.quit()
39+
}
3140

41+
func SetIcon(iconBytes []byte) {
42+
cstr := (*C.char)(unsafe.Pointer(&iconBytes[0]))
43+
C.setIcon(cstr, (C.int)(len(iconBytes)), false)
44+
}
3245

33-
func SetTemplateIcon(templateIconBytes []byte, regularIconBytes []byte) {
34-
cstr := (*C.char)(unsafe.Pointer(&templateIconBytes[0]))
35-
C.setIcon(cstr, (C.int)(len(templateIconBytes)), true)
46+
func SetTitle(title string) {
47+
C.setTitle(C.CString(title))
3648
}
3749

50+
func SetTooltip(tooltip string) {
51+
C.setTooltip(C.CString(tooltip))
52+
}
3853

54+
func addOrUpdateMenuItem(item *MenuItem) {
55+
var disabled C.short
56+
if item.disabled {
57+
disabled = 1
58+
}
59+
var checked C.short
60+
if item.checked {
61+
checked = 1
62+
}
63+
var isCheckable C.short
64+
if item.isCheckable {
65+
isCheckable = 1
66+
}
67+
var parentID uint32 = 0
68+
if item.parent != nil {
69+
parentID = item.parent.id
70+
}
71+
C.add_or_update_menu_item(
72+
C.int(item.id),
73+
C.int(parentID),
74+
C.CString(item.title),
75+
C.CString(item.tooltip),
76+
disabled,
77+
checked,
78+
isCheckable,
79+
)
80+
}
3981

40-
func (item *MenuItem) SetIcon(iconBytes []byte) {
41-
cstr := (*C.char)(unsafe.Pointer(&iconBytes[0]))
42-
C.setMenuItemIcon(cstr, (C.int)(len(iconBytes)), C.int(item.id), false)
82+
func addSeparator(id uint32) {
83+
C.add_separator(C.int(id))
4384
}
4485

86+
func hideMenuItem(item *MenuItem) {
87+
C.hide_menu_item(C.int(item.id))
88+
}
4589

90+
func showMenuItem(item *MenuItem) {
91+
C.show_menu_item(C.int(item.id))
92+
}
4693

94+
//export systray_ready
95+
func systray_ready() {
96+
systrayReady()
97+
}
98+
99+
//export systray_on_exit
100+
func systray_on_exit() {
101+
systrayExit()
102+
}
103+
104+
//export systray_menu_item_selected
105+
func systray_menu_item_selected(cID C.int) {
106+
systrayMenuItemSelected(uint32(cID))
107+
}
108+
109+
func SetTemplateIcon(templateIconBytes []byte, regularIconBytes []byte) {
110+
cstr := (*C.char)(unsafe.Pointer(&templateIconBytes[0]))
111+
C.setIcon(cstr, (C.int)(len(templateIconBytes)), true)
112+
}
47113

114+
func (item *MenuItem) SetIcon(iconBytes []byte) {
115+
cstr := (*C.char)(unsafe.Pointer(&iconBytes[0]))
116+
C.setMenuItemIcon(cstr, (C.int)(len(iconBytes)), C.int(item.id), false)
117+
}
48118

49119
func (item *MenuItem) SetTemplateIcon(templateIconBytes []byte, regularIconBytes []byte) {
50120
cstr := (*C.char)(unsafe.Pointer(&templateIconBytes[0]))

internal/getlantern_systray/systray_nonwindows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1515

16-
// +build !windows
17-
16+
// +build !windows,!darwin
17+
//go:build !windows && !darwin
1818

1919
package systray
2020

0 commit comments

Comments
 (0)