mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-15 14:16:02 -06:00
[GH-ISSUE #938] Wishlist: Run a command when switching screens #749
Labels
No labels
HiDPI
bounty
bsd/freebsd
bsd/openbsd
bug
bug
build-infra
cantfix
critical
doc
duplicate
enhancement
fix-available
from git
from release
good first issue
help wanted
installer/package
invalid
linux
macOS
meta
needs testing
pull-request
query
question
regression
regression
v2.4.0
windows
wontfix
work-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/barrier#749
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mathrick on GitHub (Nov 6, 2020).
Original GitHub issue: https://github.com/debauchee/barrier/issues/938
Context
I have a setup where my personal laptop and work laptop are connected to two different docks, which are then connected to the same monitors. Since I don't want to have multiple keyboards on my desk, I'm trying to use Barrier to share it. But since the two machines are displaying on the same physical monitors, I need to cause them to switch inputs when going to the other machine. The monitor controls are for that are really clunky and take about 10 button presses per monitor, but I can run a command (
xset dpmi force off) to turn off video output, which causes the monitor to search for another active input automatically.Request
It'd be very useful if Barrier had an action type that runs a command, and a way to run that command when control switches away from a screen. This way, whenever I switch to the other machine, the one that's being deactivated could automatically run
xset dpmi force off. This might need to be split into multiple issues, since as far as I can tell, it'd need multiple enhancements to implement (namely: new "command" action type, and the ability run actions when switching away from a screen).@mickdarling commented on GitHub (May 17, 2021):
General solution
There is a more elegant way of switching the monitor input (if the monitor supports it), but it still requires triggers a terminal command. You need to send DDC codes to the monitor.
It would be great to be able to trigger a terminal command on_screen_change, and it could make it almost seamless to swipe from one computer to another on the same Monitor.
MacOS
For MacOS ddcctl (https://github.com/kfix/ddcct ) allows you to send a signal via the video signal to change the monitor input on the monitor.
e.g. This is my script for changing from HDMI-1 to DVI-1
ddcctl -d 1 -i 3I run these on the Barrier server computer, even when my the screen is on another input, with a command shortcut using Better Touch Tools (https://folivora.ai/ ) but I am sure other shortcut/macro tools can be used.
Linux
On linux ddcutil (https://www.ddcutil.com/ ) fulfills the same purpose.
Windows
Not sure, and several older windows apps seem to be abandoned that might have done the trick. This Autohotkey script may be able to switch monitors. Autohotkey Change Monitor Input Source (https://autohotkey.com/board/topic/96884-change-monitor-input-source/)
@Scoopie commented on GitHub (Jan 25, 2022):
Windows
ControlMyMonitor by Nirsoft https://www.nirsoft.net/utils/control_my_monitor.html allows sending DDC codes to the monitor. You can modify the monitor settings from the GUI and from command-line.
@mem- commented on GitHub (Feb 9, 2023):
I also like the idea of running scripts at edge. Then one of the computers can send correct ddccontrol commands to the monitor(s).
Today I use some bash aliases to ssh to the correct computer to execute the ddccontrol commands. To automate this would be really nice.