Archived
1
0
Fork 0

waybar: Add module for quickly switching inputs on primary monitor

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2023-02-11 01:03:18 +01:00
parent e647668924
commit 5d594bc8c3
Signed by: c8h4
GPG key ID: 9C82009BEEDEA0FF
2 changed files with 25 additions and 1 deletions

View file

@ -2,7 +2,10 @@
"position": "top",
"modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": [],
"modules-right": ["tray", "custom/spotify", "backlight", "pulseaudio", "network", "battery", "idle_inhibitor", "sway/language", "clock"],
"modules-right": [
"tray", "custom/spotify", "backlight", "pulseaudio", "network", "battery",
"custom/disp1-ddcswitch", "idle_inhibitor", "sway/language", "clock"
],
"sway/mode": {
"format": " {}"
},
@ -67,6 +70,10 @@
"sway/language": {
"tooltip-format": "{long}"
},
"custom/disp1-ddcswitch": {
"format": "",
"on-click": "~/.config/waybar/modules/disp1-ddcswitch.sh"
},
"tray": {
"icon-size": 18
}

View file

@ -0,0 +1,17 @@
#!/usr/bin/env sh
DISP_BUS=4
INPUT_SWITCH_CODE=60
INPUT_DP=x0f
INPUT_HDMI=x11
current="`ddcutil getvcp --bus $DISP_BUS --terse $INPUT_SWITCH_CODE | cut -d' ' -f4`"
case $current in
$INPUT_DP)
ddcutil setvcp --bus $DISP_BUS $INPUT_SWITCH_CODE $INPUT_HDMI
;;
$INPUT_HDMI)
ddcutil setvcp --bus $DISP_BUS $INPUT_SWITCH_CODE $INPUT_DP
;;
esac