waybar: Add module for quickly switching inputs on primary monitor
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
e647668924
commit
5d594bc8c3
|
@ -2,7 +2,10 @@
|
||||||
"position": "top",
|
"position": "top",
|
||||||
"modules-left": ["sway/workspaces", "sway/mode"],
|
"modules-left": ["sway/workspaces", "sway/mode"],
|
||||||
"modules-center": [],
|
"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": {
|
"sway/mode": {
|
||||||
"format": " {}"
|
"format": " {}"
|
||||||
},
|
},
|
||||||
|
@ -67,6 +70,10 @@
|
||||||
"sway/language": {
|
"sway/language": {
|
||||||
"tooltip-format": "{long}"
|
"tooltip-format": "{long}"
|
||||||
},
|
},
|
||||||
|
"custom/disp1-ddcswitch": {
|
||||||
|
"format": "",
|
||||||
|
"on-click": "~/.config/waybar/modules/disp1-ddcswitch.sh"
|
||||||
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
"icon-size": 18
|
"icon-size": 18
|
||||||
}
|
}
|
||||||
|
|
17
waybar/modules/disp1-ddcswitch.sh
Executable file
17
waybar/modules/disp1-ddcswitch.sh
Executable 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
|
Reference in a new issue