-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: recipe for using rofi as menu for way-displays #140
Comments
I'm using rofi (https://github.com/davatorium/rofi, https://wiki.archlinux.org/title/rofi), together with a customized rust program driving the interactive menu, displayed by rofi. In order to make the recipes more self-contained and thus useful (minimal dependencies), I need to post some examples on how to use rofi and way-displays with the least amount of customization. But once you get the gist on how rofi works, should be fairly straight-forward to include shortcuts to way-displays like the ones in the screenshot. |
The following example allows user to switch between internal only, external only, or both displays. #/bin/sh
# Configure names of external and internal displays
EXTERNAL="HDMI-A-1"
INTERNAL="eDP-1"
function show() {
way-displays --delete DISABLED "$1" > /dev/null
}
function hide() {
way-displays -s DISABLED "$1" > /dev/null
}
OPT_INTERNAL="Internal display"
OPT_EXTERNAL="External display"
OPT_BOTH="Both displays"
function menu() {
echo "${OPT_INTERNAL}"
echo "${OPT_EXTERNAL}"
echo "${OPT_BOTH}"
}
OPTION=$( (menu) | rofi -dmenu -p "Configure displays")
# Invoke way-displays. Only hide a display if showing the other display
# succeeded. This reduces the chances to end up with both displays turned off,
# which is typically rather inconvenient.
if [ "${OPTION}" == "${OPT_INTERNAL}" ]
then
show "${INTERNAL}" && hide "${EXTERNAL}"
elif [ "${OPTION}" == "${OPT_EXTERNAL}" ]
then
show "${EXTERNAL}" && hide "${INTERNAL}"
elif [ "${OPTION}" == "${OPT_BOTH}" ]
then
show "${EXTERNAL}"
show "${INTERNAL}"
fi
|
That is just fantastic! Thank you so much. I've moved things to a wiki, with a recipes page. I'd be most grateful if you could add you recipe in there - you should get the credit ;) |
Happy to make the edit myself.
|
Added to the recipes. |
Sorry for sitting on this so long ... https://github.com/alex-courtis/way-displays/wiki/Recipes looks good. Thank you! |
No worries; please do update it as needed. |
Originally posted by @alex-courtis in #121 (comment)
The text was updated successfully, but these errors were encountered: