maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   how to make .desktop file/script (https://talk.maemo.org/showthread.php?t=88446)

Mikkosssss 2012-12-29 22:30

how to make .desktop file/script
 
I made this .desktop file so I can kill CuteTube, OVP and Firefox because they run background after I close em.

Code:

[Desktop Entry]
Type=Application
Name=killall
Icon=/usr/share/icons/hicolor/80x80/apps/killall.png
Exec=killall cutetube
Exec=killall openmediaplayer
Exec=killall fennec

But it works only for one comand (last one,fennec) How to have many comands working.
Code:

Exec=killall cutetube killall openmediaplayer killall fennec
Didint work


Then another thing how to open conversation with desktop shortcut without going to messaging and then pressing conversation from right down corner.

Thanks.

xt4zy 2012-12-30 00:40

Re: how to make .desktop file
 
try write script and exec it

for exsample:

Code:

#!blah-blah-blah

killall cutetube
..and etc.


Mentalist Traceur 2012-12-30 01:15

Re: how to make .desktop file
 
Or maybe do something like:
Code:

Exec=killall cutetube && killall openmediaplayer && killall fennec
Though putting it in a separate script and then executing it might be more convenient. And && will only execute the next command if the first command executes correctly, so if 'killall cutetube' errors out, the other ones won't run. So a separate script is better, but this is something you can do if you don't feel like making the separate script.

Don't forget to make the script file executable though (chmod +x [scriptfile]) on the command-line, or some file managers might let you change it without having to go to the command-line, I wouldn't know.

syake 2012-12-30 01:22

Re: how to make .desktop file
 
freedesktop.org is helpful.
freedesktop.org .desktop file Manual

coderus 2012-12-30 03:36

Re: how to make .desktop file
 
Code:

Exec=killall cutetube; killall openmediaplayer; killall fennec
then

Schturman 2012-12-30 05:48

Re: how to make .desktop file
 
someone know a one command to close all opened windows like a button on the multitasking screen when you do long press -> close all ?

tortoisedoc 2012-12-30 09:36

Re: how to make .desktop file
 
Quote:

Originally Posted by Schturman (Post 1309000)
someone know a one command to close all opened windows like a button on the multitasking screen when you do long press -> close all ?

Hmm..isnt there one in the ovi store?
If not, there you have a good idea for an app ;)

Mikkosssss 2012-12-30 09:54

Re: how to make .desktop file
 
Quote:

Originally Posted by coderus (Post 1308990)
Code:

Exec=killall cutetube; killall openmediaplayer; killall fennec
then

Didint work only kills Firefox.

I think its time to learn to do script files.

See you after Google :D ;)

thedead1440 2012-12-30 10:02

Re: how to make .desktop file
 
Mikkosssss,

In your exec field you can have it as Exec=/home/user/kill.sh

with kill.sh contents being:

Code:

#!/bin/sh

1=cutetube
2=openvideoplayer
3=fennec

if ps -ae | grep -v grep | grep "$1" > /dev/null
then
kill `pgrep -f "$1"`
fi
if ps -ae | grep -v grep | grep "$2" > /dev/null
then
kill `pgrep -f "$2"`
fi
if ps -ae | grep -v grep | grep "$3" > /dev/null
then
kill `pgrep -f "$3"`
fi

Of course use top to check if those are the process names exactly first ;)

Sourav.dubey 2012-12-30 10:11

Re: how to make .desktop file
 
Not an expert still my two cents
try
Exec=killall openmediaplayer cutetube fennec pulseaudio

please add pulseaudio only when media player is playing or you want to close it

Mikkosssss 2012-12-30 10:57

Re: how to make .desktop file
 
Cant find any help and http://harmattan-dev.nokia.com/ doesnt work??

Any other pages where you learn simple harmattan developer stuff. =S
Because I want learn these things for future :D

tortoisedoc 2012-12-30 11:14

Re: how to make .desktop file
 
Quote:

Originally Posted by Mikkosssss (Post 1309043)
Cant find any help and http://harmattan-dev.nokia.com/ doesnt work??

Any other pages where you learn simple harmattan developer stuff. =S
Because I want learn these things for future :D


Harmattan-dev is down again. Welcome to the world of Nokia.
You can have a look at the Freedesktop XDG reference documentation to get an idea of things (and check against your n9).
Worked for me and for BWizz :)

Mikkosssss 2012-12-30 11:17

Re: how to make .desktop file
 
Quote:

Originally Posted by Sourav.dubey (Post 1309033)
Not an expert still my two cents
try
Exec=killall openmediaplayer cutetube fennec pulseaudio

please add pulseaudio only when media player is playing or you want to close it

Works now :D and it was openvideoplayer miss spelled it there.
Thanks

Mikkosssss 2012-12-30 11:21

Re: how to make .desktop file
 
Quote:

Originally Posted by thedead1440 (Post 1309031)
Mikkosssss,

In your exec field you can have it as Exec=/home/user/kill.sh

with kill.sh contents being:

Code:

#!/bin/sh

1=cutetube
2=openvideoplayer
3=fennec

if ps -ae | grep -v grep | grep "$1" > /dev/null
then
kill `pgrep -f "$1"`
fi
if ps -ae | grep -v grep | grep "$2" > /dev/null
then
kill `pgrep -f "$2"`
fi
if ps -ae | grep -v grep | grep "$3" > /dev/null
then
kill `pgrep -f "$3"`
fi

Of course use top to check if those are the process names exactly first ;)

I got it working with desktop file.

But if theres way to add message displayed on script I will use script.

tortoisedoc 2012-12-30 11:26

Re: how to make .desktop file
 
Quote:

Originally Posted by Mikkosssss (Post 1309047)
I got it working with desktop file.

But if theres way to add message displayed on script I will use script.

You mean notify the user?
http://talk.maemo.org/showthread.php?t=84624

Win7Mac 2012-12-30 14:38

Re: how to make .desktop file
 
Hi,

I'm trying to put a script together for a desktopfile that turns standby screen on/off.
The idea is to have an icon in home screen that switches between the regular standby screen with clock, notifications and billboard and a blank black one.
In settings>phone>display> there is an option to turn standby screen off, but I wonder if it is really disabling it or just sets it to blank.
A notification via dbus (like tortoisedoc suggested) to display if its active or passive would be nice.
As you can guess from my name, I'm not into Linux at all. :o
So far I only have some breadcrumbs of code, so please help putting this right.
Here's what I have in mind:

LPSswitch.desktop:
Code:

[Desktop Entry]
Type=Application
Name=LPSswitch
Icon=/usr/share/icons/hicolor/80x80/apps/LPSswitch.png
Exec=/home/user/LPSswitch.sh

LPSswitch.sh:
Code:

#!/bin/sh

if {standby screen on}
then {kill com.nokia.systemui.ScreenLock}
and {dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:'standby screen off' string:'' string:'icon-m-toolbar-done' uint32:0}

if {standby screen off}
then {exec com.nokia.systemui.ScreenLock}
and {dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:'standby screen on' string:'' string:'icon-m-toolbar-done' uint32:0}

I can't wait to get this to work. I will then put up a new thread and present it like an app. :)
Thank you.

thedead1440 2012-12-30 15:02

Re: how to make .desktop file
 
Win7Mac,

Are you sure that's the process name?

Get your process name and the below is something you can use; in the below example PROCESS_NAME should be replaced with your process name:

Code:

SERVICE=PROCESS_NAME

if ps -ae | grep -v grep | grep "$SERVICE" > /dev/null
then
        kill `pgrep -f "$SERVICE"`
        dbus-send --print-reply --dest=com.meego.core.MNotificationManager/notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:"Standby Screen Off" string:'' string:'' uint32:0
else
        "$SERVICE" &
        dbus-send --print-reply --dest=com.meego.core.MNotificationManager/notificationmanager com.meego.core.MNotificationManager.addNotification uint32:0 uint32:0 string:'device' string:'' string:"Standby Screen On" string:'' string:'' uint32:0

fi


Win7Mac 2012-12-30 15:09

Re: how to make .desktop file
 
Quote:

Originally Posted by thedead1440 (Post 1309109)
Are you sure that's the process name?

No, it's only what sounded the most likely... :D
From here.

thedead1440 2012-12-30 15:11

Re: how to make .desktop file
 
Quote:

Originally Posted by Win7Mac (Post 1309113)
No, it's only what sounded the most likely... :D
From here.

Ah that's a dbus service not a process name; i know very little of dbus; someone else needs to share their knowledge here...

Mikkosssss 2012-12-30 15:17

Re: how to make .desktop file
 
Quote:

Originally Posted by Win7Mac (Post 1309102)
Hi,

I'm trying to put a script together for a desktopfile that turns standby screen on/off.
The idea is to have an icon in home screen that switches between the regular standby screen with clock, notifications and billboard and a blank black one.
In settings>phone>display> there is an option to turn standby screen off, but I wonder if it is really disabling it or just sets it to blank.
A notification via dbus (like tortoisedoc suggested) to display if its active or passive would be nice.

I was going to try do same thing but I forgot whole thing :D waiting for your app.

:o

Sourav.dubey 2012-12-30 15:28

Re: how to make .desktop file/script
 
Don't forget to chmod your script file

Win7Mac 2012-12-30 21:40

Re: how to make .desktop file/script
 
^ Yeah... but first I need the correct process to kill. If standby screen really has to be terminated.
I mean, its still there, its just blank, no?

Can somebody verify what exactly happens when you turn standby screen on/off in settings>phone>display? - Knowing what this command exactly does would be very helpfull.

E: nevermind, thedead already put everything together, awesome:
http://talk.maemo.org/showthread.php?t=88466 :)

Mikkosssss 2013-07-06 20:33

Re: how to make .desktop file/script
 
Hello again.

Iuse this thread again for another desktop file.

I made desktop file:

Code:

Exec=/opt/operamobile-labs/bin/operamobile-labs www.maemo.org
So that opens Maemo.org with Opera Mobile.

How I can change that www.maemo.org to content of clipboard?

and if its not possible, is it possible with script?

I change browser often and it would help a lot if you dont need to open another browser and paste adress but only copy and press desktop icon.

Thanks. :D

Mikkosssss 2013-07-07 10:07

Re: how to make .desktop file/script
 
Anyone? :confused:

coderus 2013-07-07 11:38

Re: how to make .desktop file/script
 
xclip can help you

Mikkosssss 2013-07-07 12:46

Re: how to make .desktop file/script
 
I dont know what I am doing. :p

Code:

~$ /opt/operamobile-labs/bin/operamobile-labs
xclip -selection o

Unknown/incorrect option "-selection".
Use -h for list of options.
~ $

If I type -h there is no commands about clipboard.

Mikkosssss 2013-07-08 09:36

Re: how to make .desktop file/script
 
Should I make new thread. :rolleyes:

Mikkosssss 2013-07-08 17:04

Re: how to make .desktop file/script
 
Someone say its not possible so I can stop bumbing. :D

coderus 2013-07-08 18:43

Re: how to make .desktop file/script
 
CLIPBOARD=$(xclip -sel clip -o)
/my/browser/executable -url $CLIPBOARD


All times are GMT. The time now is 23:53.

vBulletin® Version 3.8.8