I like to have multiple Geany instances opened on different virtual desktops. So when opening a file I like to choose in which instance to open it.

I wrote this little bash script. It also keeps the shell clean for further usage.

#!/bin/bash

instance="${1}"
shift

sock_basepath="${HOME}/.config/geany/geany_socket_$(hostname)__"

if [ "${instance}" == 'GUI' ]; then
	instance_names=()
	old_ifs="${IFS}"
	IFS=$'\n'
	for sock_path in $(ls -1 "${sock_basepath}"* 2>/dev/null); do
		inst_name="${sock_path:${#sock_basepath}}"
		instance_names+=("${inst_name}")
	done
	echo "${instance_names[@]}"
	IFS="${old_ifs}"
	instance_names=("${instance_names[@]}" 0)
	if [ ${#instance_names[@]} -eq 2 ]; then
		instance_names=("${instance_names[@]}" 0)
	fi
	instance="$(zenity --width=300 --entry --title 'Geany Instance Manager' '--entry-text' "${instance_names[@]}" --text 'Select a Geany instance')"
	if [ $? -ne 0 ]; then
		exit 1
	fi
elif [ "${instance}" == '' ]; then
	instance='0'
fi

geany --socket-file="${sock_basepath}${instance}" "${@}" 1>/dev/null 2>/dev/null & disown

 

Maybe someone likes to come up with something more mature.

Ideally there would be a way to open multiple Geany windows from one instance. So they share things like a common recent files history.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/issues/3351@github.com>