外部モニターなどを調整するために呼び出すことができる 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 ステートメントで使用され、正しいコマンドが呼び出されます。2 つのメニュー オプションについては、まだ xrandr コマンドを生成していないため、exit とだけ表示されます。