Skip to content

loops/ClaimMonitor

Repository files navigation

#!/bin/bash

# A simple dbus service to query the monitor to see which input it is using
# and if it is different than the one we want, send command to switch inputs

# I use this with my software KVM,  whenever the mouse changes computers
#  it invokes a script to change the selected input on my monitor.  This
#   way both computers share a single keyboard/mouse and monitor.

# You must install ddcutil and pydbus, for example:
sudo dnf install ddcutil python3-pydbus

# Copy dbus policy to  /etc/dbus-1/system.d/com.eztux.ClaimMonitor.conf.
sudo cp -i com.eztux.ClaimMonitor.conf /etc/dbus-1/system.d/

# Although, they might be detected automatically without this,
# Reload the system bus config via:
    busctl call org.freedesktop.DBus \
                /org/freedesktop/DBus \
                org.freedesktop.DBus \
                ReloadConfig

# Copy the service script into /usr/local:
sudo mkdir -p /usr/local/libexec/
sudo cp -i monclaim.py /usr/local/libexec/

# Copy and edit as needed the ini file for the service
#  The ini file params were required on one of my systems, ymmv
sudo cp -i ClaimMonitor.ini /etc/

# Install the service file
sudo cp -i ClaimMonitor.service /etc/systemd/system/
sudo systemctl enable --now ClaimMonitor

# copy the trigger script
sudo cp -i claim_monitor /usr/local/bin/

# Now you can call claim_monitor as an unprivileged user to restore
# the monitor input selection to the current machine

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published