0

I was looking for a way to run sublime text right from the desktop (without using the terminal) as an administrator. So far so good, I modified the file sublime_text.desktop with a text editor, called the command sudo -H after the exec command, like this:

Before:

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;

after:

[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec= sudo -H /opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=sublime-text
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;

[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
OnlyShowIn=Unity;

[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file
OnlyShowIn=Unity;

and until it worked, when I click on the sublime it opens normally as root administrator, but it opens only with the files I left open on it, its packages and modifications are reset. Could someone tell me a method to get around this problem? would help me a lot.

3
  • The packages and modifications are reset every time you open the application?
    – user1091774
    Feb 14, 2021 at 22:57
  • Yes, when opening Sublime (after I modified the file sublime_text.desktop) it simply opens as if finished if installed. I just want to make this change so that I can create files directly from within the sublime, and a folder where the files will be required root permission. Feb 15, 2021 at 1:32
  • You will probably want to copy the .config/sublime-text-3 directory from your home directory to /root then, as running things with sudo does not necessarily mean using the same PATH information.
    – user1091774
    Feb 15, 2021 at 3:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.