We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

Root privilegs for Sailfish app? [answered]

asked 2017-01-15 21:00:43 +0300

yajo gravatar image

updated 2017-01-16 22:01:19 +0300

I started to learn how to program a app. I want to manipulate some /usr/share/applications/*.desktop files in my app, but therefore I need root privilegs. How can I get them?

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by yajo
close date 2017-03-23 16:36:00.903635

Comments

2

If you could explain what you are trying to achieve by manipulating *.desktop files, then perhaps somebody can tell whether it is the right way to do what you are doing.

ln ( 2017-01-15 21:54:36 +0300 )edit

I started to write a app to lock other apps with a pin. But therefore I need to manipulate the .desktop files to change the Exec line to execute my app. Because if you then tip on the app icon in app launcher and try to start the app my app is starting. So the user can input the pin and then the other app can start. This was my idea and on my phone it works well, but i manipulatet the .desktop files manuell

yajo ( 2017-01-16 08:56:17 +0300 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2017-01-15 23:01:18 +0300

tortoisedoc gravatar image

updated 2017-01-15 23:01:29 +0300

If you plan to touch .desktop files, add the modified ones to the local (nemo) .local/share/applications folder I'd strongly suggest agains editing any of the .desktop files present in the /usr/share/applications; you might break many things.

edit flag offensive delete publish link more

Comments

I tried your idea, but the problem is now I have two entries in the app launcher. And as explained above I don't want this. It would be great if you now how to get the entry in /usr/share/applications ignored... Then I could modify the Local onces only

yajo ( 2017-01-16 09:30:34 +0300 )edit

this is probably a hack, and not going to work, but have you tried adding NotShownIn to the ones in .local ?

tortoisedoc ( 2017-01-16 23:29:23 +0300 )edit

Yeah, then the entries in .local are hidden. But If the manipulated files in .local are hidden, I don't have to copy the originals to .local and manipulate them.

yajo ( 2017-01-23 19:56:43 +0300 )edit

its about "hacking" lipstick to launch the .local ones instead of the original ones. lipstick relies on libcontentaction to trigger .desktop files; according to this, libcontentaction will search first the .desktop files under the .local location (which also is the place for user-specific overrides), THEN the system location under /usr/share/applications. Hiding the items under .local should STILL make them trigger (when you launch the system-ones from the lipstick ui). If this is not the case, there might be a bug in lipstick / xdg-utils somewhere. Any other solution is a hack, and should not be pursued.

tortoisedoc ( 2017-01-29 21:40:00 +0300 )edit

I have putted some *.desktop files in the .local folder. And now I'm getting one new entry in my app launcher after each start up :/ .

yajo ( 2017-01-31 16:50:10 +0300 )edit
2

answered 2017-01-15 23:04:10 +0300

coderus gravatar image

Use suid bit and setuid/setgid call.

edit flag offensive delete publish link more

Question tools

Follow
2 followers

Stats

Asked: 2017-01-15 21:00:43 +0300

Seen: 771 times

Last updated: Jan 16 '17