maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Desktop Command Execution Widget scripts (https://talk.maemo.org/showthread.php?t=39177)

geno123 2010-02-27 19:19

Re: Desktop Command Execution Widget scripts
 
show your current fm transmitter strength:
cat /sys/class/i2c-adapter/i2c-2/2-0063/power_level

rooted 2010-02-27 19:39

Re: Desktop Command Execution Widget scripts
 
Why does the battery mAh script use "current"/"design" values? Wouldn't it be more accurate to use "last full charge" value instead of battery design one (because of the battery wear)? This way the battery wear level can also be monitored?

Also, I'm reminding, because I really think of it as important feature: center alignment. It is needed to be used with "no command title" option, it makes widget much more aesthetic.

cpscotti 2010-02-27 22:46

Re: Desktop Command Execution Widget scripts
 
@calvin_42:
yeah yeah... that's a very ugly "feature" that will be removed on the next version. So far, just edit one thing at a time and everybody will be fine.

@rooted:
ok, i got it some time ago but I think that sometimes center alignement is bad. Some people, for example, are asking for monospace fonts for multiline results.. I believe I'll just have to add an option on the next version somehow.

andy_con 2010-02-28 00:06

Re: Desktop Command Execution Widget scripts
 
Quote:

Originally Posted by geno123 (Post 549134)
show your current fm transmitter strength:
cat /sys/class/i2c-adapter/i2c-2/2-0063/power_level

this command doesnt seem to work for me

b666m 2010-02-28 00:23

Re: Desktop Command Execution Widget scripts
 
Quote:

Originally Posted by andy_con (Post 549403)
this command doesnt seem to work for me

works without problems :)

if you got any errors you might typed anything wrong. ^^

andy_con 2010-02-28 00:27

Re: Desktop Command Execution Widget scripts
 
did a straight copy and paste and all im getting is 0

RobbH 2010-02-28 02:15

Re: Desktop Command Execution Widget scripts
 
Quote:

Originally Posted by RobbH (Post 547512)
Shouldn't it be possible to process the output of uptime through awk and create a conditional script that runs when the widget is clicked, but not at startup?

I hoped someone else would provide an answer before I found one, but no such luck. The following script, entitled Edit Notes, seems to work as intended: the script runs when the widget is clicked (assuming uptime reports a value greater than 1 min), but not at startup:

Code:

if [ `uptime | awk '{ print $3 $4 }'` = "1min," ] ; then echo " " ; else leafpad ~/MyDocs/desktop_notes.txt ; echo " " ; fi
It's not pretty, and anyone who might be inclined to improve it is welcome to do so.

The above script opens a file for editing in Leafpad. I use it in conjunction with this script, "Notes", which displays the same file in a multi-line widget, serving as a very basic desktop notes applet:

Code:

cat ~/MyDocs/desktop_notes.txt

b666m 2010-02-28 11:30

Re: Desktop Command Execution Widget scripts
 
Quote:

Originally Posted by andy_con (Post 549427)
did a straight copy and paste and all im getting is 0

yep, because your fm-transmitter is off. ^^

just turn on your fm-transmitter and do the same thing again. (:

rooted 2010-02-28 14:00

Re: Desktop Command Execution Widget scripts
 
Quote:

Originally Posted by cpscotti (Post 549343)
@calvin_42:
yeah yeah... that's a very ugly "feature" that will be removed on the next version. So far, just edit one thing at a time and everybody will be fine.

@rooted:
ok, i got it some time ago but I think that sometimes center alignement is bad. Some people, for example, are asking for monospace fonts for multiline results.. I believe I'll just have to add an option on the next version somehow.


Please do so, because every option you add increases potential of your widget exponentially. It really is the most useful widget even if it does one of the most basic tasks. And I meant adding an option for alignment in the beginning, not changing it into the center one. The power of this widget is in its customization, which means having options :)

Also, can you implement an option that in desktop edit mode icons for removing and configuring the widget can't be too close. I have a widget to output just battery percentage without anything else and because the two icons are so close together I can't "grab" and move the widget (even with stylus). I press one of the two buttons anytime I try (workaround is to increase width, move the widget and decrease it back, but it is not very practical).

And I really like the speed of development, please don't slow down! :D

rooted 2010-02-28 16:13

Re: Desktop Command Execution Widget scripts
 
Sorry for double post, but it's totally different issue, so I figured it would be ok to put it in own post. So, I tried to write a command for Desktop Command Execution widget to disable Wi-Fi (like "Wifi switcher"). It unloads the modules and disables Wi-Fi. The script, which I extracted from Wifi switcher looks:

Code:

#!/bin/sh
out=`ifconfig wlan0`
if [ $? -eq "0" ] ; then
if [ `echo "$out" | grep -c RUNNING` -gt "0" ] ; then
run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
fi
ifconfig wlan0 down
rmmod wl12xx
run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Wi-Fi disabled'
exit 2
else
modprobe wl12xx
wl1251-cal
stop wlancond
start wlancond
ifconfig wlan0 up
run-standalone.sh dbus-send --print-reply --system --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false
exit 0
fi

And it works if run from terminal with "sh script.sh". But when I configure DCE command:

sh /path/to/script.sh | echo ""

And click the widget only line which shows connect menu gets executed (at least that's only visible change).

So, what is the issue?



Also, to contribute a little, here are scripts to be put in DCE to (one line each):

- Disconnect internet:
Code:

dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true; dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Internet disconnected'; echo ""
- Connect internet (show connections):
Code:

dbus-send --print-reply --system --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false | echo ""


All times are GMT. The time now is 06:37.

vBulletin® Version 3.8.8