While you're here, please consider supporting GamingOnLinux on:
Reward Tiers: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Reward Tiers: Patreon. Plain Donations: PayPal.
This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!
You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register
- GOG launch their Preservation Program to make games live forever with a hundred classics being 're-released'
- Valve dev details more on the work behind making Steam for Linux more stable
- NVIDIA detail upcoming Linux driver features for Wayland and explain current support
- Half-Life 2 free to keep until November 18th, Episodes One & Two now included with a huge update
- Direct3D to Vulkan translation layer DXVK v2.5 released with rewritten memory management
- > See more over 30 days here
-
Half-Life 2 free to keep until November 18th, Episodes …
- Ehvis -
Hybrid gaming controller MoveMaster has a new website, …
- furaxhornyx -
Half-Life 2 free to keep until November 18th, Episodes …
- tuxmuppet -
Half-Life 2 free to keep until November 18th, Episodes …
- Tuxee -
Inspired by SSX, arcade snowboarding game Tricky Madnes…
- based - > See more comments
- New Desktop Screenshot Thread
- Vortex_Acherontic - Types of programs that are irritating
- dvd - What do you want to see on GamingOnLinux?
- Linas - Weekend Players' Club 11/15/2024
- StoneColdSpider - Our own anti-cheat list
- Xpander - See more posts
Now, I'm on Manjaro, but I think this will work pretty seamlessly on just about any distro, because it's all installed using pip/python, and in just two simple commands, which we'll later turn into a launcher.
The script we'll be using is this one:
https://gist.github.com/prefiks
But we'll modify it slightly according to one of the comments, so that we can create that launcher for it. One click = lighthouses turn on, click again = lighthouses turn off. Honestly, I've hardly had to use my legs this whole weekend!
Here's the steps for Manjaro, and also Mint, wherever Mint is different.
Step One
If you haven't already, install Python's PIP manager.
Manjaro - pacman -S python-pip
Mint - sudo apt-get install python3-pip libglib2.0-dev
Step Two
Open a terminal and install the dependency for this script
Manjaro - pip install bluepy
Mint - pip3 install bluepy
Step Three
Give yourself rights to run bluepy without sudo:
sudo setcap 'cap_net_raw,cap_net_admin+eip' ~/.local/lib/python3.8/site-packages/bluepy/bluepy-helper
(note that you might have a different path here, for example if you're only on Python 3.7. Just backspace and tab it out to the correct bluepy-helper executable)
Step Four
Download this script, save it somewhere safe, then execute with python:
#!/usr/bin/python3
from bluepy import btle
import sys
class DiscoLH(btle.DefaultDelegate):
def __init__(self):
self.devices = []
btle.DefaultDelegate.__init__(self)
def handleDiscovery(self, dev, isNewDev, isNewData):
if not isNewDev:
return
isLH = False
name = ""
v = dev.getValue(btle.ScanEntry.MANUFACTURER)
if v is not None and v[0:4] == b'\x5d\x05\x00\x02':
print('Found LightHouse %s: address = %s' %
(dev.getValue(btle.ScanEntry.COMPLETE_LOCAL_NAME), dev.addr))
self.devices.append(dev.addr)
if __name__ == '__main__':
scanner = btle.Scanner()
delegate = DiscoLH()
scanner.withDelegate(delegate)
scanner.scan(2)
for device in delegate.devices:
lh = btle.Peripheral()
print("Connecting to %s" % (device))
lh.connect(device, addrType = btle.ADDR_TYPE_RANDOM)
if len(sys.argv) > 1 and sys.argv[1] == 'on':
lh.writeCharacteristic(0x12, b'\x01')
elif len(sys.argv) > 1 and sys.argv[1] == 'off':
lh.writeCharacteristic(0x12, b'\x00')
else:
# toggle
current = lh.readCharacteristic(0x12)
if(current) == b'\x00':
# turn on
lh.writeCharacteristic(0x12, b'\x01')
else:
# turn off
lh.writeCharacteristic(0x12, b'\x00')
lh.disconnect()
I called mine vr.py and I ran it with
Manjaro
python vr.py
Mint
python3 vr.py
You can also force an option with
python3 vr.py on
or
python3 vr.py off
but if you run it without arguments, it's just a toggle.
That's pretty much it. I created a simple launcher, pinned it to my toolbar, and now whenever I click on it, my lighthouses toggle between powered up and powered down.
Hope this helps someone!
Last edited by scaine on 20 October 2020 at 11:03 pm UTC
View PC info
Haven't tried it myself yet, as when I have to prepare the greenscreen, I can also turn the lighthouses on. And turn them off, when I stow it away again ;)
View PC info
Does it work both with Lighthouse 1.0 and 2.0?
I only have the latest lighthouses, so I can't say for certain. But the project is over a year old so... maybe? Hopefully someone can test and report back.
View PC info
Edit: sorry didn't get around doing it, and are now on a longer work related travel. Maybe next month.
Last edited by Julius on 9 October 2020 at 7:17 pm UTC
Pfff. You're not being anywhere near lazy enough.
I have no idea how you'd auto-detect SteamVR starting... but I love the idea of use a pavucontrol command or similar to set/unset the sound sink. I'll have a look into that, definitely.
I wouldn't bother much if Pulseaudio was intelligent enough to choose my previous sound card when I exit SteamVR... but oh no... it choose my Yeti Microsoft "speaker" every goddam time. Pulseaudio really sucks pretty hard, given how old it is now. Nothing is simple and I STILL have to edit a configuration file just to get it to choose my primary sound card on start up!
Switching sound outputs shouldn't be this hard.
SteamVR starts a few processes (vrcompositor and such) that can be detected. Don't have a suggestion right now, but I'm sure there are a few options for detecting when certain processes appear and disappear so you can trigger a script.
python /path/to/vr.py ; %command%
That works a treat, but of course you still need to execute your vr.py again after closing SteamVR, in order to shutdown the lighthouses again. So a script that detects this stuff would still be pretty cool.
I did try
python /path/to/vr.py ; %command% ; python /path/to/vr.py
but it doesn't work, even with a wait in there, the whole line is executed immediately, because it appears that Steam is forking its games off as a separate process, without waiting for their exit codes.
I just came here from Twitter and tried that script.
I get no error messages but it doesn't do anything either. Whether I am running SteamVR or not.
HTC Vive on Manjaro Linux.