首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自定义Rofi菜单不会返回选定的值

自定义Rofi菜单不会返回选定的值
EN

Stack Overflow用户
提问于 2019-05-05 02:01:19
回答 1查看 991关注 0票数 0

我正在尝试在i3wm中创建一个Rofi菜单,我可以调用它来调整外部监视器等等。我可以很好地调用和运行脚本,但是,当我从菜单中选择一个选项时,不会返回任何内容,也不会调用调整屏幕的命令。关于rofi的信息可以在这里找到(https://github.com/davatorium/rofi)。

有没有一种特殊的方式来调用命令?我没有正确地设置自定义菜单的格式吗?

这是我调用的脚本:(https://pastebin.com/Uev1tiR5)

代码语言:javascript
复制
#!/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。

EN

回答 1

Stack Overflow用户

发布于 2019-05-05 02:10:20

事实证明,过去一两个小时的谷歌搜索,最后,这篇文章都是因为我定义选择时的一个拼写错误。谢谢你的帮助,很抱歉在这么愚蠢的错误上浪费时间。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55985407

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档