Skip to content

Instantly share code, notes, and snippets.

@glitsj16
Created September 9, 2019 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glitsj16/5e890c34519c7ab48aa060c63ececc30 to your computer and use it in GitHub Desktop.
Save glitsj16/5e890c34519c7ab48aa060c63ececc30 to your computer and use it in GitHub Desktop.
#!/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