adi1090x / rofi

A huge collection of Rofi based custom Applets, Launchers & Powermenus.
GNU General Public License v3.0
6.33k stars 293 forks source link

Powermenu: allow typing in addition to selecting buttons #156

Open rixx opened 8 months ago

rixx commented 8 months ago

Idk if this is something you want, but I kinda like not having to click things, so I took your (awesome!) powermenu and modded it to support typing in what you want to do (eg "lock", "hib", etc). Just wanted to document it here, so feel free to close if you're not interested (but if you are, feel free to copy or tell me to open a PR).

What I did: Switched to using icons rather than nerd code font, and put the strings to be matched in the text options (and then hide the text, so that only the icons are visible). In order to make things non-ugly, I hide the typing input, so you can't see what you're typing, but for something this simple, I feel like that's fine.

Full script and theme, but the relevant parts are:

# Options include strings for fast selection, but only icons will be shown
option_1="shutdownpoweroff"
option_2="reboot"
option_3="logoutexit"
option_4="suspendsleephibernate"
option_5="lock"
yes='yes'
no='no'

icon_1="\0icon\x1fsystem-shutdown"
icon_2="\0icon\x1fsystem-reboot"
icon_3="\0icon\x1fgnome-logout"
icon_4="\0icon\x1fgnome-session-hibernate"
icon_5="\0icon\x1flock"
icon_yes="\0icon\x1fdialog-ok"
icon_no="\0icon\x1fdialog-cancel"

and

chosen="$(echo -e "$option_1$icon_1\n$option_2$icon_2\n$option_3$icon_3\n$option_4$icon_4\n$option_5$icon_5" | rofi \
    …etc

Anyway, tysm for this collection of themes, I learned a lot about rofi while mixing and matching them into something to suit me – really cool!