我正在尝试在 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 命令的两个菜单选项,所以他们只是说退出。