我正在尝试在i3wm中创建一个Rofi菜单,我可以调用它来调整外部监视器等等。我可以很好地调用和运行脚本,但是,当我从菜单中选择一个选项时,不会返回任何内容,也不会调用调整屏幕的命令。关于rofi的信息可以在这里找到(https://github.com/davatorium/rofi)。
有没有一种特殊的方式来调用命令?我没有正确地设置自定义菜单的格式吗?
这是我调用的脚本:(https://pastebin.com/Uev1tiR5)
#!/bin/bash
seleted=$(echo "Laptop Only
HDMI Only
Display Port Only
Dual Monitor" | rofi -dmenu -p "Select Monitor Setup: ")
echo You Picked: " $selected"
if [ "$selected" == "Laptop Only" ]; then
xrandr --output eDP-1-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-0 --off --output DP-1-2 --off --output DP-1-1 --off --output DP-0 --off
exit
fi
if [ "$selected" == "HDMI Only" ]; then
exit
fi
if [ "$selected" == "Display Port Only" ]; then
exit
fi
if [ "$selected" == "Dual Monitor" ]; then
xrandr --output eDP-1-1 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output DP-1 --mode 1920x1080 --pos 3840x0 --rotate normal --output HDMI-0 --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1-2 --off --output DP-1-1 --off --output DP-0 --off
exit
fi应该发生的情况是,在if语句中使用选定的值,并调用正确的命令。有两个菜单选项我还没有为其生成xrandr命令,所以它们只显示exit。
发布于 2019-05-05 02:10:20
事实证明,过去一两个小时的谷歌搜索,最后,这篇文章都是因为我定义选择时的一个拼写错误。谢谢你的帮助,很抱歉在这么愚蠢的错误上浪费时间。
https://stackoverflow.com/questions/55985407
复制相似问题