We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
效果图:
链接:https://wiki.archlinux.org/index.php/xrandr#Example_3
下面是原文中的代码,将此脚本设置成快捷键,便可实现一键切换显示器。 xrandr好像只支持X11,不支持Wayland
xrandr
X11
Wayland
#!/bin/bash # get info from xrandr connectedOutputs=$(xrandr | awk '$2 == "connected"{print $1}') activeOutput=$(xrandr | grep -E " connected (primary )?[1-9]+" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/") # initialize variables execute="xrandr " default="xrandr " i=1 switch=0 for display in $connectedOutputs do # build default configuration if [ $i -eq 1 ] then default=$default"--output $display --auto " else default=$default"--output $display --off " fi # build "switching" configuration if [ $switch -eq 1 ] then execute=$execute"--output $display --auto " switch=0 else execute=$execute"--output $display --off " fi # check whether the next output should be switched on if [ $display = $activeOutput ] then switch=1 fi i=$(( $i + 1 )) done # check if the default setup needs to be executed then run it if ! (echo "$execute" | grep -q "auto") then `$default` else `$execute` fi
The text was updated successfully, but these errors were encountered:
No branches or pull requests
效果图:
链接:https://wiki.archlinux.org/index.php/xrandr#Example_3
下面是原文中的代码,将此脚本设置成快捷键,便可实现一键切换显示器。
xrandr
好像只支持X11
,不支持Wayland
The text was updated successfully, but these errors were encountered: