Open with Emacs in same window

/usr/local/bin/myemacs:

#!/bin/bash

# how many emacs?
NUM_EMACS=$(emacsclient -e "(length (frame-list))" -a "")

if [ $NUM_EMACS -le 1 ]; then
	emacsclient -c -e "(progn (select-frame-set-input-focus (selected-frame)) (find-file \"$@\"))"
else
	emacsclient -e "(progn (select-frame-set-input-focus (selected-frame)) (find-file \"$@\"))"
fi

(Note: Simply using emacsclient -n /path/to/file causes operations like flyspell on loading to be very slow, hence the indirect call through elisp.)

/usr/share/applications/myemacs.desktop:

[Desktop Entry]
Name=Emacs (Single)
GenericName=Text Editor (Single)
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=myemacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs
Keywords=Text;Editor;

Open with Emacs as root

/usr/local/bin/myemacssu:

#!/bin/bash

# how many emacs?
NUM_EMACS=$(emacsclient -e "(length (frame-list))" -a "")

if [ $NUM_EMACS -le 1 ]; then
	emacsclient -c -e "(progn (select-frame-set-input-focus (selected-frame)) (find-file \"/sudo::$@\"))"
else
	emacsclient -e "(progn (select-frame-set-input-focus (selected-frame)) (find-file \"/sudo::$@\"))"
fi

/usr/share/applications/myemacssu.desktop:

[Desktop Entry]
Name=Emacs (Single) as Root
GenericName=Text Editor (Single)
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=myemacssu %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs
Keywords=Text;Editor;