Running Pycharm as root from launcher

后端 未结 6 2105
小鲜肉
小鲜肉 2021-02-19 07:04

How is it possible to run Pycharm from the launcher with root privileges?

I can do that from the terminal window, with sudo ./pycharm.sh, but I\'d like to d

6条回答
  •  北海茫月
    2021-02-19 07:44

    I have Pycharm-community 2020. I edited the

    /var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop
    

    file with nano just modified the Desktop Entry as follow:

    [Desktop Entry]
    X-SnapInstanceName=pycharm-community
    Version=1.0
    Type=Application
    Name=root PyCharm Community Edition
    Icon=/snap/pycharm-community/222/bin/pycharm.png
    Exec=sudo env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop /snap/bin/pycharm-community %f
    Comment=root Python IDE for Professional Developers
    Categories=Development;IDE;
    Terminal=false
    StartupWMClass=jetbrains-pycharm-ce
    StartupNotify=true
    

    that is: added the sudo command in front of the EXEC item, put "root" in front of couple of fields (see above) and saved with a different name:

    /var/lib/snapd/desktop/applications/root_pycharm-community_pycharm-community.desktop
    

    now I have two icons in the launcher, one that is the standard and the other one with "root" as leading word in the description and runs as root.

    Note: the original desktop launcher (which is still there):

    [Desktop Entry]
    X-SnapInstanceName=pycharm-community
    Version=1.0
    Type=Application
    Name=PyCharm Community Edition
    Icon=/snap/pycharm-community/222/bin/pycharm.png
    Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop /snap/bin/pycharm-community %f
    Comment=Python IDE for Professional Developers
    Categories=Development;IDE;
    Terminal=false
    StartupWMClass=jetbrains-pycharm-ce
    StartupNotify=true
    

提交回复
热议问题