Created
June 9, 2017 15:26
-
-
Save vfaronov/6843c6bc817521bfab7e58fff139c525 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
socket_prefix=/tmp/geany-$USER | |
socket=$socket_prefix-$RANDOM | |
desktop=$( xdotool get_desktop ) | |
pid=$( xdotool search --desktop "$desktop" --class Geany getwindowpid ) | |
if [[ $pid ]]; then | |
candidate=$( ps -p $pid -o args= | grep -Eo "$socket_prefix-[0-9]+" ) | |
if [[ -e $candidate ]]; then | |
socket=$candidate | |
fi | |
fi | |
xx geany --socket-file="$socket" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment