Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
#
## wrapper for calling gnome-pie with a hotkey, Wayland-safe
#+ use this in the 'command' box when setting up GNOME custom
#+ keybindings adding the preferred pies number, e.g. 'gnome-pie-focused 123'
## IMPORTANT #######################################
#+ uses gnome-pie-focus-helper in Xwayland mode to supply the needed
#+ previously focused Xwayland app for Gnome-Pie to function properly
#+ see https://github.com/Schneegans/Gnome-Pie/issues/172
##################################################
_selfie="$(basename "$0")"
# bail if we didn't recieve an argument
if [ -z "$1" ]; then
[ -x "/usr/bin/notify-send" ] && notify-send "Gnome-Pie" "ERROR: no argument supplied to ${_selfie}" &
exit 1
fi
### vars
# focus overlay executable
_bin_focus="gnome-pie-focus-helper"
# gnome-pie executable
_bin_gp="gnome-pie"
# X11/Xwayland support
[ "$WAYLAND_DISPLAY" ] && export GDK_BACKEND=x11
### logic
# focus Xwayland overlay to create Gnome-Pie Xwayland context
${_bin_focus} &
sleep 0.5
# call gnome-pie's pies here
${_bin_gp} -o "$1"
# kill focus overlay
sleep 8
pkill -f ${_bin_focus}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.