cross-platform / apple-music-for-linux

Access your Apple Music library from Linux
https://snapcraft.io/apple-music-for-linux
GNU General Public License v3.0
82 stars 15 forks source link

Dark Mode! #23

Closed p0ryae closed 3 years ago

p0ryae commented 3 years ago

Hello!

I think everyone would love to have an option to turn their apple music into the dark mode.

Regards, Porya

5ysk3y commented 3 years ago

Not sure the author would necessarily appreciate this, but I found a workaround to enable darkmode.

The problem with this request, in general, is that the snap is basically a Chromium instance running the Apple Music web player (duh, I know). The point being that there's no button in Chromium to allow the quick-switching between light/dark modes, not without the use of a plugin etc. Remember: not everyone may wish to run in dark mode, that's just one option so AFIAK if the maintainer enabled it, it would be enabled for everyone in some capacity.

For those who can handle some basic commands (at your own risk of course-- backup files before you modify them etc) and if you would indeed like to make dark mode available, there is a hacky work around you could use to set this option for yourself:

Make a temporary working directory, go into it and then run:

$ sudo umount /snap/apple-music-for-linux/*
$ sudo cp /var/lib/snapd/snaps/apple-music-for-linux_* .

I have 2 snaps for this application as of the time of writing this: apple-music-for-linux_29.snap and apple-music-for-linux_30.snap

The next bit is probably overkill but for each of these snaps, I did the following (this is an example of apple-music-for-linux_29.snap):

$ sudo unsquashfs /var/lib/snapd/snaps/apple-music-for-linux_29.snap
$ cd squashfs-root
$ sudo vim apple-music-for-linux.launcher

Modify the final exec line so that it matches as follows:

exec "$SNAP/usr/lib/chromium-browser/chromium-browser" "--no-sandbox" "--app=https://music.apple.com/$cc/browse" "--disable-sync" "--window-size=1000,600" "--user-data-dir=$SNAP_USER_DATA/.config/chromium" "--class=apple-music-for-linux" "--force-dark-mode"

Notice the dark mode flag on the end. Save it, then:

cd ..
sudo mksquashfs squashfs-root apple-music-for-linux_29.snap
sudo cp squashfs-root apple-music-for-linux_29.snap /var/lib/snapd/snaps/

I then did the same for the second snap (apple-music-for-linux_30.snap). You could then attempt to then remount things, e.g:

sudo mount -t squashfs -o ro,nodev,relatime,x-gdu.hide /var/lib/snapd/snaps/apple-music-for-linux_29.snap /snap/apple-music-for-linux/29

This didnt have any effect for me. Once I'd rebooted, however, the application did indeed launch in dark-mode:

image

If the snap ever gets updated then its very likely these steps will need to be re-applied. Again, it's a bit hacky but for those of us who use this snap and want a dark mode option-- this is one solution I found. Hope that helps.

p0ryae commented 3 years ago

This is awesomee!!!! Yeah, I know chromium uses white mode as default, and I tried finding multiple ways to make it detect dark mode but I couldn't.

Now with this, I'm finally able to do it!

Thank you very much for taking the time to show and sharing this for us :D

5ysk3y commented 3 years ago

No problem at all. It was a decent question to be fair-- made me realise that I also wanted a dark variant here.

Interestingly, I did also find a suppliment to my initial suggestion. If you see the screen I posted, the scrollbar is still white, which bothers me beyond absolute belief. I managed to fix it (and this may potentially work as a total replacement method to my original steps; I haven't tested in that capacity) by doing this:

My scrollbars now also use the dark variant making it all look a bit more cohesive. Again, this may actually work in place of my original suggested steps, I just haven't tested that hence why I say its a suppliment. Just goes to show how little I know about snap really as I'm just sorta trying things that may or may not work! I didnt think any changes made directly inside the snap app (e.g. Chromium) would persist; turns out that's likely incorrect!

MarcusTomlinson commented 3 years ago

Hey guys, dark mode can now be toggled via Ctrl+D in version 0.7.0+ of the snap.

Please run snap refresh apple-music-for-linux