ROFI
可观看bilibili视频 BV1ag411Q7Po
rofi–一个窗口切换器、应用启动器、dmenu的替代品
git仓库
用自定义脚本实现 rofi自定义菜单和选项
自己自定义菜单项 和 选中后的操作
自定义脚本
1 2 3 4 5
| rofi -show 自定义 -modi "自定义:~/rofi.sh" 1: 上述命令可调用rofi.sh作为自定义脚本 2: 将打印的内容作为rofi的选项 3: 每次选中后 会用选中项作为入参再次调用脚本 4: 当没有输出时 整个过程结束
|
demo脚本:
编辑~/rofi.sh 以下内容并chmod +x rofi.sh
终端执行 rofi -show powermenu -modi "powermenu:~/rofi.sh"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| case "$*" in "poweroff") notify-send "Shutting down" echo yes echo no ;; "reboot") notify-send "reboot" ;; "lock") notify-send "lock" ;;
"yes") notify-send "已触发关机" ;; "") echo poweroff echo reboot echo lock ;; esac
|
dmenu
demo
1 2
| file=$(ls | rofi -dmenu -window-title find) echo $file
|
自用的rofi主题
config.rasi
1 2 3
| configuration { theme: "mine.rasi"; }
|
mine.rasi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| configuration { display-drun: ""; display-window: ""; display-windowcd: ""; display-ssh: ""; display-run: "﮸"; show-icons: false; drun-display-format: "{icon} {name} {comment}"; }
* { font: "JetBrainsMono Nerd Font Mono 12.5"; background-color: transparent; text-color: #f1f1f1; width: 680px; height: 300px; location: 0; spacing: 0; transparent: rgba(34,62,79,0.80); }
window { location: center; anchor: center;
background-color:@transparent; spacing: 0; children: [mainbox]; orientation: horizontal; }
inputbar { border: 0 0 1px 0; children: [prompt,entry]; }
prompt { padding: 0px 13px 0px 13px; border: 0 1px 0 0; vertical-align: 0.5; }
textbox { background-color:@transparent; border: 0 0 1px 0; border-color: #161B1A; padding: 8px 13px;
}
entry { padding: 13px; }
listview { cycle: false; margin: 0 0 -1px 0; scrollbar: false; }
element { border: 0 0 1px 0; padding: 4px; }
element-text { expand: true; vertical-align: 0.5; padding: 0px 13px; }
element selected { background-color: rgba(34,82,99); }
element-icon { size: 30px; border: 0px; }
|