[GH-ISSUE #1079] Feature request : configurable shortcuts for triggering scripts on host #859

Open
opened 2026-05-05 07:13:36 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @Potomac on GitHub (Feb 26, 2021).
Original GitHub issue: https://github.com/debauchee/barrier/issues/1079

Hello,

a PC monitor can have several inputs : vga, hdmi, dvi, display port,

I decided to connect 2 PCs on my iiyama monitor (VGA and DVI ports),
I want to select the input (VGA, DVI) by sending DDC commands to the monitor, instead of using the OSD of my monitor, it is possible by using DDC protocol :
https://en.wikipedia.org/wiki/Display_Data_Channel

I can write a bash script with inside commands made by "ddcutil", that can automatically switch the monitor to the desired video input (VGA, DVI) :
https://passthroughpo.st/switching-monitor-inputs-software-ddc/
https://www.ddcutil.com/

The feature I want for barrier : have the ability to trigger a custom bash script with the keyboard, by configuring shortcuts, the bash script would run the appropriate ddcutil command for switching the monitor to the correct input (VGA, DVI etc...), according to the PC I want to control.

Thanks.

Originally created by @Potomac on GitHub (Feb 26, 2021). Original GitHub issue: https://github.com/debauchee/barrier/issues/1079 Hello, a PC monitor can have several inputs : vga, hdmi, dvi, display port, I decided to connect 2 PCs on my iiyama monitor (VGA and DVI ports), I want to select the input (VGA, DVI) by sending DDC commands to the monitor, instead of using the OSD of my monitor, it is possible by using DDC protocol : https://en.wikipedia.org/wiki/Display_Data_Channel I can write a bash script with inside commands made by "ddcutil", that can automatically switch the monitor to the desired video input (VGA, DVI) : https://passthroughpo.st/switching-monitor-inputs-software-ddc/ https://www.ddcutil.com/ The feature I want for barrier : have the ability to trigger a custom bash script with the keyboard, by configuring shortcuts, the bash script would run the appropriate ddcutil command for switching the monitor to the correct input (VGA, DVI etc...), according to the PC I want to control. Thanks.
Author
Owner

@eldorel commented on GitHub (Dec 14, 2021):

@Potomac I have no idea where I found this, but barrier has a command line flag for the server that can be used to trigger a script on screen change.

--screen-change-script /path/to/script

This runs the named script on switch with the name of the screen as the first argument.
I have a bash script with a case statement that changes the color of my RGB keyboard to reflect which system i'm currently controlling.


That said, I do actually have a different use case for an 'action' that can be triggered by keypresses to execute a script on the host (and hopefully allow this as a secondary action for that keypress).

I want to configure a single shortcut on all of my systems to toggle screen brightness (also using DDCutil actually) and have barrier send that keypress to everything.

Sending the key works, but the shortcut system in X11 runs at a lower level than barrier and hides the keypress, so I actually can't have barrier trigger a keypress on an action that's linked to an X11 shortcut.

Being able to setup something similar to this:
keystroke(F21) = keystroke(F21,*)+run(/path/to/script)
or
keystroke(F21) = run(/$home/relative/path/to/script,*)
would allow me to execute the brightness control script on the server or trigger a script on all clients in the same location.

<!-- gh-comment-id:994119643 --> @eldorel commented on GitHub (Dec 14, 2021): @Potomac I have no idea where I found this, but barrier has a command line flag for the server that can be used to trigger a script on screen change. `--screen-change-script /path/to/script` This runs the named script on switch with the name of the screen as the first argument. I have a bash script with a case statement that changes the color of my RGB keyboard to reflect which system i'm currently controlling. -------- That said, I do actually have a different use case for an 'action' that can be triggered by keypresses to execute a script on the host (and hopefully allow this as a secondary action for that keypress). I want to configure a single shortcut on all of my systems to toggle screen brightness (also using DDCutil actually) and have barrier send that keypress to everything. Sending the key works, but the shortcut system in X11 runs at a lower level than barrier and hides the keypress, so I actually _can't_ have barrier trigger a keypress on an action that's linked to an X11 shortcut. Being able to setup something similar to this: `keystroke(F21) = keystroke(F21,*)+run(/path/to/script)` or `keystroke(F21) = run(/$home/relative/path/to/script,*)` would allow me to execute the brightness control script on the server or trigger a script on all clients in the same location.
Author
Owner

@superuser7777 commented on GitHub (Jul 30, 2022):

Is this command line not used anymore?
--screen-change-script /path/to/script
I checked. It's not there.
https://github.com/debauchee/barrier-wiki/blob/master/Command-Line.md#server_cli

I have an AHK script that I want to run only when I am operating on a barrier.
I was looking for a way to be a trigger.

Windows to Windows
Win10Pro & Barrier latest

<!-- gh-comment-id:1200095853 --> @superuser7777 commented on GitHub (Jul 30, 2022): Is this command line not used anymore? ` --screen-change-script /path/to/script ` I checked. It's not there. https://github.com/debauchee/barrier-wiki/blob/master/Command-Line.md#server_cli I have an AHK script that I want to run only when I am operating on a barrier. I was looking for a way to be a trigger. Windows to Windows Win10Pro & Barrier latest
Author
Owner

@mitchcapper commented on GitHub (Oct 24, 2022):

Seems like it exists only on the xwindows clients: fc045fc793/src/lib/barrier/ServerApp.cpp (L123)

and in the man page:
fc045fc793/doc/barriers.1 (L50)

is captured no matter the client: fc045fc793/src/lib/barrier/ArgParser.cpp (L64)

But only run if it is XWindows:
fc045fc793/src/lib/barrier/ServerApp.cpp (L690)

Extending it to support other platforms would not be overly difficult ( and likely just require modifying that last function around handleScreenSwitched

<!-- gh-comment-id:1289485987 --> @mitchcapper commented on GitHub (Oct 24, 2022): Seems like it exists only on the xwindows clients: https://github.com/debauchee/barrier/blob/fc045fc79326cef966405b1cc578e8f062ae5294/src/lib/barrier/ServerApp.cpp#L123 and in the man page: https://github.com/debauchee/barrier/blob/fc045fc79326cef966405b1cc578e8f062ae5294/doc/barriers.1#L50 is captured no matter the client: https://github.com/debauchee/barrier/blob/fc045fc79326cef966405b1cc578e8f062ae5294/src/lib/barrier/ArgParser.cpp#L64 But only run if it is XWindows: https://github.com/debauchee/barrier/blob/fc045fc79326cef966405b1cc578e8f062ae5294/src/lib/barrier/ServerApp.cpp#L690 Extending it to support other platforms would not be overly difficult ( and likely just require modifying that last function around handleScreenSwitched
Author
Owner

@superuser7777 commented on GitHub (Oct 26, 2022):

@mitchcapper
Thanks for the details.
I look forward to future development.

<!-- gh-comment-id:1291874216 --> @superuser7777 commented on GitHub (Oct 26, 2022): @mitchcapper Thanks for the details. I look forward to future development.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#859
No description provided.