Hmm, my laptop (which is MSI GP75-9SE) got optical output via 3.5mm jack (so you need an adapter or dedicated cable), however I do really recommend you to use SPDIF Passthrough and let your AVR decode that signal - basically your PC will stream untouched audio data directly.
This is far better than using apps or plugins (mostly bundled with Realtek/Sound Card drivers), the reason for using such programs/plugins is when you're using analog speakers connected to an amplifier or directly to your PC and they can't handle such processing by themself, so if you don't want to lose multichannel audio or just better bitrate/audio source (because it might be downgraded to poorer format).
Nowadays even recent TV's are able to decode advanced Dolby Audio and DTS codecs so no reason to this on your PC.
Also HDMI is more robust and easier solution for AVR - especially if you got good/recent one, you can rely on AVR features audio and video wise
Every modern video player like VLC, MPC-HC, PotPlayer etc. will let you do passthrough to AVR, no matter how advanced sound codec is baked in.
You also need to be aware about some limitations with toslink :
Digital audio signals, such as 5.1/7.1 multi-channel PCM, Dolby Digital Plus, Dolby TrueHD (Atmos), DTS-HD MA, DTS:X, and Auro 3D Audio cannot be transferred via Toslink connections.
So if you're going to watch some good quality movies (even from netflix, they sometimes use DTS or DDP (even with Atmos) then switch over to HDMI.
Every bluray remux, good quality BD rip, sometimes even Webrips are using at least DTS or DDP/Dolby TrueHD.
Dolby Digital Plus (also known as E-AC3) are mostly used for VOD rips from Netflix, Disney+ etc. because this is the "worst" format that could be used with Dolby Atmos layer and due to it's size it better suit VOD politics.
Classic DTS or AC-3 could be considered as a DVD era, but those codecs are still popular - mostly with smaller size BD rips or if you're watching movies with different than english sound (it's pretty common that language specific audio tracks are coded in the inferior to english quality, for example DTS-HD vs. AC-3).
Also if you're using old or bacis quality AVR (or soundbar) without support for Atmos, DTS-HD MA / X then don't worry, your AVR should recognize it as a lower quality stream and play it, for example: if you're missing DTS-HD support, but your AVR works with classic DTS then it will be played as a DTS.
Most audio formats used in movies are compatibile with their older versions - which is good, because you don't need to worry or reencode (and then remux) entire movie.