maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Solution] Create shortcut Harmattan (https://talk.maemo.org/showthread.php?t=91753)

Kroll 2013-11-09 10:16

[Solution] Create shortcut Harmattan
 
Hello maemers!
Looks like there is no easy noob-way to make a shortcut on the desktop on the Harmattan device as it is on n900.
Like:
1. insert a command to run application or command like "ping"
2. insert a way to icon
3. put some line to write a geek words or commands
4. ????
5. PROFIT

Anybody here to handle this? Any one? Please?

Mikkosssss 2013-11-09 11:10

Re: [Request] Shortcut creator Harmattan
 
You can do it manually by making following text file:
Code:

[Desktop Entry]
Type=Application
Name=Name of your shortcut
Exec=Command that you want to do
Icon=/patch/to/your/icon.png

And name it something.desktop

Then place it to /home/user/.local/share/applications

Kroll 2013-11-09 12:31

Re: [Request] Shortcut creator Harmattan
 
Yes, this is what I was talking about! There is no noob way :)
Anyway, thanks, Mikkosssss.

Kroll 2013-11-10 10:11

Re: [Request] Shortcut creator Harmattan
 
Quote:

Originally Posted by Mikkosssss (Post 1385269)
You can do it manually by making following text file:
Code:

[Desktop Entry]
Type=Application
Name=Name of your shortcut
Exec=Command that you want to do
Icon=/patch/to/your/icon.png

And name it something.desktop

Then place it to /home/user/.local/share/applications

How can I make a shortcut to run a command or application as a root?

Mikkosssss 2013-11-10 10:57

Re: [Request] Shortcut creator Harmattan
 
Using scripts.

Code:

Exec=/home/user/execroot.sh /home/user/yourscript.sh
Execroot.sh is script that lets you use root command once (or thats how I get it :p)
Heres code for it:

Code:

#!/bin/sh

if [ $# -ne 1 ]
then
        echo "Usage: $0 command"
        exit 1
fi

echo rootme | devel-su -c "$1"

Then yourscript.sh can be like this:

Code:

#!/bin/sh

My command

After you make script you need to chmod it or it wont work:
Code:

chmod +x /home/user/yourscript.sh
Also do it to execroot.sh

Edit: Also scripts wont work In MyDocs-> So place them in /home/user/

coderus 2013-11-10 11:05

Re: [Request] Shortcut creator Harmattan
 
you can launch script everywhere.
Code:

sh /home/user/MyDocs/shell-script.sh
perl /home/user/MyDocs/perl-script.pl
python /home/user/MyDocs/python-script.py


Mikkosssss 2013-11-10 11:25

Re: [Request] Shortcut creator Harmattan
 
Even if its FAT32?

coderus 2013-11-10 15:19

Re: [Request] Shortcut creator Harmattan
 
you dont understand. you not need to set executable to script. you can execute shell, or perl, or python, whatever with option reading and executing script command from file. its same what operating system does when executing your script file if it have executable flag and shebang line (#!/bin/sh i.e.).

for example:
you have /home/user/MyDocs/script.sh
Code:

#!/bin/sh
echo "Hello!"

you cant set chmod +x as usual, but you always can launch shell with your script
Code:

sh /home/user/MyDocs/script.sh
in this way your script dont need to be executable.

Kroll 2013-11-21 16:26

Re: [Request] Shortcut creator Harmattan
 
1 Attachment(s)
Are u sure that execroot.sh script is correct?

Mikkosssss 2013-11-21 16:45

Re: [Request] Shortcut creator Harmattan
 
Quote:

Originally Posted by Kroll (Post 1387950)
Are u sure that execroot.sh script is correct?

Are you sure that you copied it correct?
But heres my that works everyday...

Code:

#!/bin/sh

if [ $# -ne 1 ]
then
        echo "Usage: $0 command"
        exit 1
fi

echo rootme | devel-su -c "$1"


Kroll 2013-11-21 17:05

Re: [Request] Shortcut creator Harmattan
 
I am.
Look on my screenshot please, it says "syntax error"...

Mikkosssss 2013-11-21 18:39

Re: [Request] Shortcut creator Harmattan
 
Quote:

Originally Posted by Kroll (Post 1387965)
I am.
Look on my screenshot please, it says "syntax error"...

It also says "operation not permitted" when you chmod so you need to be root?
To get root do:
Code:

devel-su
Password:(default is: rootme)

And here is also my output when I run my execroot.sh:

Code:

BusyBox v1.20.0.git (MeeGo 3:1.20-0.2+0m8) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ /home/user/Asd/execroot.sh
Usage: /home/user/Asd/execroot.sh command
~ $

(Asd is my scripts folder :p)

humble 2013-11-21 22:49

Re: [Request] Shortcut creator Harmattan
 
I could wip something up.. check out
TDSC (The.Desktop.Shortcut.Creator)


it's based on python..

But due to my life issues(no computer..that's not all but... )

it might take at least a week to do so or less. But I will only under take the project if requested. let me know.

Kroll 2013-11-23 07:39

Re: [Request] Shortcut creator Harmattan
 
Quote:

Originally Posted by Mikkosssss (Post 1387991)
It also says "operation not permitted" when you chmod so you need to be root?
To get root do:

And it also shows hash (#) in the beginning of the line instead of the $ which shows that I am root already.
By the way this thing made me surprise too.

Maybe this forum breaks something when you post the script on it or I copy it from it?

There is one more thing to try... reboot my n9 :D

Kroll 2013-11-23 08:07

Re: [Request] Shortcut creator Harmattan
 
btw chmod +x made by user don't return with any error.
But If I trying to run the script it shows syntax error. Copied your script from your post twice, didn't help.

Mikkosssss 2013-11-23 08:34

Re: [Request] Shortcut creator Harmattan
 
Yes right return is nothing when you chmod.

And heres right code sorry I remember it this late. :p

Code:

chmod a+rx /home/user/scripts/execroot.sh

Kroll 2013-11-23 18:25

Re: [Request] Shortcut creator Harmattan
 
Thanks bro, but I found what was wrong.
I remembered that Notepad on Windows add excess symbols to the file (or it appears in the file after you put it on Linux machine, don't know) so I checked the script with vi editor on the phone and yeah, it was full of ^M in the end of each line. Deleted it. And now it works.

BTW, I did not made a chmod thing, it works without it too.

maegon9y00 2015-10-05 19:31

Re: [Solution] Create shortcut Harmattan
 
What should be the size of ico.png?

I am using this 300x300 image http://imgim.com/keacs.png
with the associated .sh file, the icon appears on desktop but when I tap on it, nothing else happens.

I am just to execute a sh file without root privileges.

maegon9y00 2015-10-05 22:30

Re: [Request] Shortcut creator Harmattan
 
Quote:

Originally Posted by Mikkosssss (Post 1385269)
You can do it manually by making following text file:
Code:

[Desktop Entry]
Type=Application
Name=Name of your shortcut
Exec=Command that you want to do
Icon=/patch/to/your/icon.png

And name it something.desktop

Then place it to /home/user/.local/share/applications

It didnt work to me.

Then I added the line
Code:

Terminal=true
to the something.desktop file and it worked

Note: I guess if you are going to run a .sh file probably it will run in terminal (busybox) so terminal=true, else terminal=false.


The other thing I had to modify was the Exec line this way
Code:

Exec=/bin/sh /home/user/myscript.sh
without the /bin/sh I got an error message :
Code:

I could not find /home/user/myscript.sh
running /bin/sh instead


n9dyfi 2015-10-06 04:11

Re: [Solution] Create shortcut Harmattan
 
Quote:

Originally Posted by maegon9y00 (Post 1484473)
What should be the size of ico.png?

Here are the icon dimensions:
https://dl.dropboxusercontent.com/u/...guidelines.jpg

And the full specification: https://dl.dropboxusercontent.com/u/...Guidelines.pdf


All times are GMT. The time now is 01:09.

vBulletin® Version 3.8.8