LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create Launcher Icon to Run As Administrator
#1
I want to create a launcher for projectM that automatically runs it as SU.
Currently, I can right click on the icon and select "Run as Administrator" and it works.
I would like to be able to bypass that and just be able to doubleclick to open it.
Can't seem to find how this works anywhere... Thanks!
Reply
#2
Hello idResponse,

there is a tutorial of how to do this here - https://askubuntu.com/questions/118822/h...y-launcher
Reply
#3
As a new user of LL, I've been tackling with a similar problem for a long time now.

First, you won't be able to run as administrator without entering the administrator password.  It would violate the security protocol.  You're either an administrator or you're not.

And the reason I wanted to respond to this thread is because gksudo, as suggested in the tutorial, was not working for me and is also deprecated (ref.: https://bugs.debian.org/cgi-bin/bugrepor...bug=892768).

The actual method used in LL is:

Code:
pkexec thunar [filename]

You can verify this by opening the file manager (i.e., open any directory).  These windows are managed by the program Thunar.

On this window menu, select Edit -> Configure custom actions...; The window Custom Actions will appear.

These are all the definitions for the items appearing in the right-click menu in Thunar (ref.: https://linuxliteos.com/manual/install.html#secureerase).  You can select Open as Administrator and click Edit (the slanted pencil on the left).  The window Edit action will appear.

On the line Command, you can find the code I previously presented.

I used this code for the command box when I wanted to add items in 'Menu' (found in the panel) with the Menu Editor (MenuLibre) to run programs as an Administrator.

Creating a Launcher that opens as administrator
  1. Click 'Menu' on the desktop panel;
  2. Type 'menu' in the search bar.  The program Menu Editor should appear in the available choices above, click on it;
  3. In the window that appeared, in the left panel, select the directory you wish to install your Launcher;
  4. Click the '+' sign in the top menu and select Add Launcher;
  5. On the right panel, you can click on the icon, the title ('New Launcher') and the description ('A small descriptive blurb about this application.') to modify them;
  6. On the command box, type the code pkexec thunar [filename], where [filename] is the filename (with the full path) of the desired file;
  7. Click Save Launcher (the down arrow) in the top menu.
Your new launcher is now in the 'Menu' of the desktop panel (in the directory you chose).

As an example, I created a Launcher for XAMPP.  The instructions ask me to execute the following code on the command line (ref.: How do I start XAMPP?):
Code:
cd /opt/lampp

sudo ./manager-linux.run (or manager-linux-x64.run)

With my installation, I actually had the file /opt/lampp/manager-linux-x64.run. So I used this command for my Launcher:
Code:
pkexec thunar /opt/lampp/manager-linux-x64.run

pkexec opens a graphical interface to get the administrator's password and then runs the program thunar as the administrator and asks thunar to execute the given file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)