Sunamu icon indicating copy to clipboard operation
Sunamu copied to clipboard

macOS developers wanted

Open NyaomiDEV opened this issue 3 years ago • 7 comments

TL;DR I need this to work on macOS but I do a shitty job at being a developer. Developers needed. H E L P

Long version: Here at Sunamu I am committed to the support of every desktop platform on planet Earth. After porting the project to Windows, it only makes sense to port it to macOS; however, the road is bumpier than I imagined.

  • For starters, there's no obvious way to get what's playing on a Mac, because there's no equivalent of a global Now Playing API and a third party application can only officially control the Apple Music app.
  • Going the AppleScript route means that there'd be no events and everything is polled explicitly by Sunamu, which will reduce responsiveness and overall performance; also, synchronized lyrics are a time sensitive matter, so having reasonably short poll times and async events is a must. Plus, if using AppleScript scripts Sunamu must know in advance which app is open and playing music, or brute force through a list of known media players; all of which is not ideal.
  • We could do it like other (native) lyrics applications do it: by making a custom Objective-C framework that exposes us the MediaRemote private framework; but Objective-C doesn't really do well with NodeJS and Electron, plus I lack the knowledge of building a native ObjC addon that can talk to the Node context.

NyaomiDEV avatar Apr 14 '22 23:04 NyaomiDEV

You can use macos for free with docker. It works ten times better on Linux. Try it: https://github.com/sickcodes/Docker-OSX It's not hard to setup, and it works flawlessly :) (on Linux)

Tips: mac is weird, you need to learn about many special stuff it does. (DIfferent menus, shortcuts...). APIs should be the same, unless sometimes you need the user to "allow" permissions. If you go very deep (need something electron apis don't provide), yes , you need to go the objective c route. Sorry! It is what it is :)

Wouldn't mind to drop a PR, but I don't have Linux and I don't know anything about mac.

Good luck

ghost avatar Oct 02 '22 20:10 ghost

You can use macos for free with docker. It works ten times better on Linux.

You are assuming I do not own any Mac hardware, but I do own a MacBook. The problem is the lack of knowledge around this platform: I use macOS daily, but as an average user.

You could say it's my comfort operating system where everything just works; but again, I am a fine arts student and I make digital art so that's why macOS "just works" for me.

I also don't want to dig deep into the development rabbit hole, as my MacBook needs to be functional at all times for what I actually do in life. I actually broke D-Bus on Linux several times while figuring out Sunamu and I don't want to make a fuckup with no prior advanced experience on my literal daily driver.

NyaomiDEV avatar Oct 02 '22 21:10 NyaomiDEV

You are assuming I do not own any Mac hardware, but I do own a MacBook. The problem is the lack of knowledge around this platform: I use macOS daily, but as an average user.

Oh. I like Mac but can't afford it lol.

I also don't want to dig deep into the development rabbit hole, as my MacBook needs to be functional at all times for what I actually do in life. I actually broke D-Bus on Linux several times while figuring out Sunamu and I don't want to make a fuckup with no prior advanced experience on my literal daily driver.

Electron isn't as deep as that, but if you aren't comfortable using your mac, use a VM.

ghost avatar Oct 05 '22 12:10 ghost

Electron isn't as deep as that, but if you aren't comfortable using your mac, use a VM.

Sure, but the problem here is that Sunamu needs a native binding to work on Mac. Electron alone won't cut it, as it didn't on Windows and Linux. Electron is just used for the GUI part.

Also, yes I could have a macOS VM on my Mac, but still that doesn't solve the time constraints I have that I didn't have before.

NyaomiDEV avatar Oct 07 '22 06:10 NyaomiDEV

I've written a swift interface over the private MediaRemote API, if swift-Node interop is good enough for that to be usable?

lillycham avatar Jan 26 '23 14:01 lillycham

@lillycat332

I don't know if there's any way to get interoperability between Swift and Node; I only know that N-API can theoretically be used for building Objective-C++ projects.

If Swift is C-compatible, then probably something like Swift <-> C/C++ <-> Node is achievable.

Some stuff I found:

  • https://forums.swift.org/t/shared-library-constructors-in-swift/19948
  • https://github.com/tmkx/swift-napi

Probably you can pull it off!

(As for me, I am currently in a bad situation and I can't open any code editor...)

NyaomiDEV avatar Jan 27 '23 13:01 NyaomiDEV

@lillycat332

Hello there; sorry for the ping (again) but I would gladly invite you to discuss this further, if you want, on the Discord server.

NyaomiDEV avatar Feb 05 '23 09:02 NyaomiDEV