Linux Mint (Nemo) - Add "run as root" in start context menu 
Sunday, 6 October 2019, 13:18 - Informatica, Linux
Postata da Daniels118
Today we'll see how to add a custom menu entry to the context menu of the applications listed in the "start menu" in Linux Mint. Mint uses Nemo as file manager, and the start menu is implemented by an applet written in javascript. In this article we will add a custom entry to run any application as root. By clicking the entry the applet will call a custom reusable script placed under a directory of our choice.
To add a custom entry to the context menu we have to edit the menu applet. Follow these steps:
1) go to "/usr/share/cinnamon/applets/menu@cinnamon.org".
2) edit the file named "applet.js";
3) scroll down to the ApplicationContextMenuItem class definition;
4) find the "activate" method and add the following case to the switch code block:
            case "run_as_root":
Util.spawnCommandLine("gnome-terminal -- /usr/local/sbin/runasroot " + this._appButton.app.get_app_info().get_filename());
break;

5) scroll down to the GenericApplicationButton class definition;
6) find the "populateMenu" method and add the following lines before the method close:
        menuItem = new ApplicationContextMenuItem(this, "Run as root", "run_as_root", "locked");
menu.addMenuItem(menuItem);

Continua...
commenta ( 505 letture )   |  permalink   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 164 )


| 1 | 2 | 3 | Altre notizie> Ultima>>