Skip to content

Instantly share code, notes, and snippets.

View mwvent's full-sized avatar

Matthew Watts mwvent

View GitHub Profile
@mwvent
mwvent / bluetoothbulb_connector.service
Created January 30, 2019 14:49
Bluetooth Speaker Auto connect service - for running in BG when autologging in on Kodi, replace USERGID and USERNAME with autologin user
#/etc/systemd/system/bluetoothbulb_connector.service
[Unit]
Description=BluetoothBulbConnector
After=network.target
[Path]
PathExists=/run/user/1000
[Install]
WantedBy=multi-user.target
@mwvent
mwvent / listdisplays
Created May 10, 2018 13:42
List display number, glx capable and gpu name - I use for scripts that need to automatically locate a GPU display number when number is unkown
#!/bin/bash
# Get a list of sessions from loginctl - filtered to ones with a DISPLAY set then filter DISPLAY number
DISPLAYS=$(loginctl list-sessions | grep -v "SESSION" | grep -v "listed" | tr -s " " | sed '/^$/d' | cut -d " " -f2 | xargs loginctl show-session | grep "Display=" | cut -d "=" -f 2)
# Iterate found list of DISPLAYS - attempt to determine which are GLX capable, add them to the GLX_DISPLAYS list when found
for CUR_DISPLAY in $DISPLAYS; do
if [ "$( DISPLAY=$CUR_DISPLAY glxinfo 2>&1 | grep "Error:" )" = "" ]; then
HAS_GLX="HASGLX"
else
HAS_GLX="NOGLX"
@mwvent
mwvent / vglrun_auto
Created May 10, 2018 13:13
Automatically find GLX capable display and run vglrun with it. Useful for multiseat with one powerful GPU. Assumes displays are accessible by all users
#!/bin/bash
# This script is intended to be used as a replacement for vglrun -d ? program - the display is auto selected
# it can also be included in a game launcher script to automatically get virtualgl if needed and fix LD_PRELOAD order issues with Steam games
# if you have a preffered GPU put name here as it appears on glxinfo renderer string - a partial string is fine if it matches more than one
# GPU the result will be randomly selected
PREFFERED_CARD="GTX 650 Ti"
# ------------------------------------------------------------------------------------------------------------------------------------
# This portion of the script checks libdlfaker.so and libvglfaker.so are at the END of the LD_PRELOAD string