Comments (6)
I'm getting the following warnings
# github.com/getlantern/systray
systray_darwin.m:128:22: warning: 'NSOnState' is deprecated: first deprecated in macOS 10.14 [-Wdeprecated-declarations]
systray_darwin.m:9:33: note: expanded from macro 'NSControlStateValueOn'
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:80:34: note: 'NSOnState' has been explicitly marked deprecated here
systray_darwin.m:130:22: warning: 'NSOffState' is deprecated: first deprecated in macOS 10.14 [-Wdeprecated-declarations]
systray_darwin.m:5:34: note: expanded from macro 'NSControlStateValueOff'
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:79:34: note: 'NSOffState' has been explicitly marked deprecated here
from systray.
I may have solved this with the following wrapper code to replace lines 4
-10
of systray_darwin.m
.
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_14
#ifndef NSControlStateValueOff
#define NSControlStateValueOff NSOffState
#endif
#ifndef NSControlStateValueOn
#define NSControlStateValueOn NSOnState
#endif
#endif
I will be submit a pull request with this code.
from systray.
@artheus I had the same issue which was resolved by adding
runtime.LockOSThread()
as per #20
from systray.
I am getting the same warnings as @raunaqrox.
In addition to this, my app will panic whenever I use systray.Run(onReady, onExit)
, this is the panic error message:
2019-06-02 10:44:41.745 ___go_build_main_go[22553:5250230] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /BuildRoot/Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1570.16/Foundation/Misc.subproj/NSUndoManager.m:361
2019-06-02 10:44:41.746 ___go_build_main_go[22553:5250230] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2e1a8cf9 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff58d38a17 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2e1c3a16 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff30455e11 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 Foundation 0x00007fff30388e7c +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 473
5 AppKit 0x00007fff2b771f89 -[NSApplication run] + 916
6 ___go_build_main_go 0x0000000004280170 nativeLoop + 128
7 ___go_build_main_go 0x000000000427f67a _cgo_67d7e7d56c36_Cfunc_nativeLoop + 26
8 ___go_build_main_go 0x0000000004058e60 runtime.asmcgocall + 112
)
libc++abi.dylib: terminating with uncaught exception of type NSException
SIGABRT: abort
PC=0x7fff5a6a12c6 m=6 sigcode=0
signal arrived during cgo execution
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x427f660, 0xc0000e9e88, 0xc000000101)
/usr/local/Cellar/go/1.12.4/libexec/src/runtime/cgocall.go:128 +0x5b fp=0xc0000e9e58 sp=0xc0000e9e20 pc=0x40051bb
github.com/getlantern/systray._Cfunc_nativeLoop(0x0)
_cgo_gotypes.go:107 +0x49 fp=0xc0000e9e88 sp=0xc0000e9e58 pc=0x427eab9
github.com/getlantern/systray.nativeLoop(...)
/Users/artheus/go/pkg/mod/github.com/getlantern/[email protected]/systray_nonwindows.go:19
github.com/getlantern/systray.Run(0x4330db8, 0x4330db0)
/Users/artheus/go/pkg/mod/github.com/getlantern/[email protected]/systray.go:81 +0x7f fp=0xc0000e9ec0 sp=0xc0000e9e88 pc=0x427e7ff
main.main()
/Users/artheus/go/src/github.com/artheus/gopdate/main.go:16 +0x20d fp=0xc0000e9f98 sp=0xc0000e9ec0 pc=0x427f3bd
runtime.main()
/usr/local/Cellar/go/1.12.4/libexec/src/runtime/proc.go:200 +0x20c fp=0xc0000e9fe0 sp=0xc0000e9f98 pc=0x402f29c
runtime.goexit()
/usr/local/Cellar/go/1.12.4/libexec/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0000e9fe8 sp=0xc0000e9fe0 pc=0x40596c1
goroutine 20 [chan receive]:
github.com/getlantern/systray.Run.func2(0xc0000862a0, 0x4330db8)
/Users/artheus/go/pkg/mod/github.com/getlantern/[email protected]/systray.go:66 +0x34
created by github.com/getlantern/systray.Run
/Users/artheus/go/pkg/mod/github.com/getlantern/[email protected]/systray.go:65 +0xf1
rax 0x0
rbx 0x70000dc82000
rcx 0x70000dc80488
rdx 0x0
rdi 0xb03
rsi 0x6
rbp 0x70000dc804c0
rsp 0x70000dc80488
r8 0x70000dc80350
r9 0x70000dc80520
r10 0x0
r11 0x206
r12 0xb03
r13 0x3000000008
r14 0x6
r15 0x2d
rip 0x7fff5a6a12c6
rflags 0x206
cs 0x7
fs 0x0
gs 0x0
EDIT: I will add that I am using the latest master 26d5b92
from systray.
@artheus Could you show your code, I had similar issue but that was due to me using nil values when onReady was not done. For reference I'm using systray here https://github.com/promignis/cwitch.
from systray.
We are getting the same issues as @raunaqrox where 'NSOnState' is deprecated:
I was able to get it to work on Mojave by forking, and commenting out lines 5
and 9
in systray_darwin.m
but I doubt that will run on macOS prior to Mojave so we probably need a better solution and me not being a ObjectiveC developer, I am not sure I can solve it.
from systray.
Related Issues (20)
- Remove dependency on github.com/getlantern/golog
- Add support for advanced menu items
- Fix notifyIconData struct HOT 1
- libayatana-appindicator , libappindicator is not available in RedHat HOT 1
- Dark mode support for windows 11 HOT 2
- Deprecation of 'go get' for installing executables
- 蓝灯邀请码,输入各得3个月:YX7T8M6
- Duplicate symbol error building on macOS HOT 3
- Can't compile on MacOS (duplicate symbol)
- [Bug] Debain 12
- won't compile with Go version 1.22 HOT 1
- Icons in menu items have a black background
- Tray Icon is Blur HOT 1
- The menu disappears when you click HOT 3
- Dont support go1.22 HOT 1
- error, crash:Symbol not found: kIOMainPortDefault
- Example doesn't work
- When hovering over the icon, display text
- sir ,please tell us ,How to determine through code whether this library can be used in the current operating system
- raspberrypi can't build HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from systray.