The Following 13 Users Say Thank You to AapoRantalainen For This Useful Post: | ||
![]() |
2012-03-12
, 16:55
|
Posts: 1,397 |
Thanked: 2,126 times |
Joined on Nov 2009
@ Dublin, Ireland
|
#2
|
![]() |
2012-03-21
, 20:08
|
Posts: 839 |
Thanked: 3,386 times |
Joined on Mar 2009
|
#4
|
mkdir -p $(CURDIR)/debian/qbw-harmattan-date/var/lib/gconf/apps/osso/hildon-desktop/applets/queen-beecon.desktop-HarmattanDate cp conf.xml $(CURDIR)/debian/qbw-harmattan-date/var/lib/gconf/apps/osso/hildon-desktop/applets/queen-beecon.desktop-HarmattanDate/%gconf.xml mkdir -p $(CURDIR)/debian/qbw-harmattan-date/opt/qbw-harmattan-date/ cp exported_widget.txt $(CURDIR)/debian/qbw-harmattan-date/opt/qbw-harmattan-date/exported_widget
#!/bin/sh PACKAGE_NAME=qbw-harmattan-date ################################### NAME=`grep instanceTitle /opt/$PACKAGE_NAME/exported_widget | tail -c +15` #Add new widget data (from exported_widget) to the .queen_beecon #be sure file exists touch /home/user/.queen_beecon #work with copy cp /home/user/.queen_beecon /home/user/.queen_beecon_new_rows echo >> /home/user/.queen_beecon_new_rows echo "[queen-beecon.desktop-$NAME]" >> /home/user/.queen_beecon_new_rows tail -n +5 /opt/$PACKAGE_NAME/exported_widget >> /home/user/.queen_beecon_new_rows mv /home/user/.queen_beecon_new_rows /home/user/.queen_beecon #Add new entries to the 'header' of the .queen_beecon #split: grep c_titles /home/user/.queen_beecon > /home/user/.queen_beecon_temporary_titles grep c_commands /home/user/.queen_beecon > /home/user/.queen_beecon_temporary_commands grep -v c_titles /home/user/.queen_beecon | grep -v c_commands > /home/user/.queen_beecon_temporary_file #fetch title/cmd grep instanceTitle /opt/$PACKAGE_NAME/exported_widget | tail -c +15 > /home/user/.queen_beecon_new_title grep instanceCmd /opt/$PACKAGE_NAME/exported_widget | tail -c +13 > /home/user/.queen_beecon_new_command #merge (add needed ;) and remove linebreak cat /home/user/.queen_beecon_temporary_titles > /home/user/.queen_beecon_temporary_titles2 cat /home/user/.queen_beecon_new_title >> /home/user/.queen_beecon_temporary_titles2 echo ";" >> /home/user/.queen_beecon_temporary_titles2 sed -i ':a;N;$!ba;s/\n//g' /home/user/.queen_beecon_temporary_titles2 cat /home/user/.queen_beecon_temporary_commands > /home/user/.queen_beecon_temporary_commands2 cat /home/user/.queen_beecon_new_command >> /home/user/.queen_beecon_temporary_commands2 echo ";" >> /home/user/.queen_beecon_temporary_commands2 sed -i ':a;N;$!ba;s/\n//g' /home/user/.queen_beecon_temporary_commands2 #merge rows back echo " [config] version=1" > /home/user/.queen_beecon_temporary_file2 cat /home/user/.queen_beecon_temporary_titles2 >> /home/user/.queen_beecon_temporary_file2 cat /home/user/.queen_beecon_temporary_commands2 >> /home/user/.queen_beecon_temporary_file2 echo "" >> /home/user/.queen_beecon_temporary_file2 tail -n +5 /home/user/.queen_beecon_temporary_file >> /home/user/.queen_beecon_temporary_file2 mv /home/user/.queen_beecon_temporary_file2 /home/user/.queen_beecon rm /home/user/.queen_beecon_temporary_titles /home/user/.queen_beecon_temporary_commands /home/user/.queen_beecon_temporary_titles2 /home/user/.queen_beecon_temporary_commands2 /home/user/.queen_beecon_new_title /home/user/.queen_beecon_new_command /home/user/.queen_beecon_temporary_file #Add icon to the desktop echo " [queen-beecon.desktop-$NAME] X-Desktop-File=/usr/share/applications/hildon-home/queen-beecon.desktop ">> /home/user/.config/hildon-desktop/home.plugins #these should be owned by user chown user /home/user/.config/hildon-desktop/home.plugins chown user /home/user/.queen_beecon exit 0
#!/bin/sh PACKAGE_NAME=qbw-harmattan-date ################################### NAME=`grep instanceTitle /opt/$PACKAGE_NAME/exported_widget | tail -c +15` #COMMAND_ENTRY='echo "`date +'"'"'<span font=\\"Nokia Pure Text 70\\" color=\\"#ffffff\\" >%I:%M%p</span>'"'"'`"' #split .queen_beecon to three part # c_titles # c_commands # every other (without c_titles and c_commands) grep c_titles /home/user/.queen_beecon > /home/user/.queen_beecon_temporary_titles grep c_commands /home/user/.queen_beecon > /home/user/.queen_beecon_temporary_commands grep -v c_titles /home/user/.queen_beecon | grep -v c_commands > /home/user/.queen_beecon_temporary_file #remove title and command from 'header' sed -i 's|'"$NAME"';||' /home/user/.queen_beecon_temporary_titles grep instanceCmd /opt/$PACKAGE_NAME/exported_widget | tail -c +13 > /home/user/.queen_beecon_new_command sed -i 's|\\|\\\\|g' /home/user/.queen_beecon_new_command COMMAND=`cat /home/user/.queen_beecon_new_command` sed -i 's|'"$COMMAND"';||' /home/user/.queen_beecon_temporary_commands #merge rows back echo " [config] version=1" > /home/user/.queen_beecon_temporary_file2 cat /home/user/.queen_beecon_temporary_titles >> /home/user/.queen_beecon_temporary_file2 cat /home/user/.queen_beecon_temporary_commands >> /home/user/.queen_beecon_temporary_file2 echo "" >> /home/user/.queen_beecon_temporary_file2 tail -n +5 /home/user/.queen_beecon_temporary_file >> /home/user/.queen_beecon_temporary_file2 #Remove widget from the .config/hildon-desktop/home.plugins #remove two subsequent rows # [queen-beecon.desktop-HarmattanClock] # X-Desktop-File=/usr/share/applications/hildon-home/queen-beecon.desktop sed -i ':a;N;$!ba;s|\[queen-beecon.desktop-'"$NAME"'\]\nX-Desktop-File=/usr/share/applications/hildon-home/queen-beecon.desktop||' /home/user/.config/hildon-desktop/home.plugins #Remove widget from the .queen_beecon #We know the name of widget #We guess the last option for widget is empty updOnDBUSMatchRule= # #*Because every widget contains that 'updOnDBUSMatchRule=' and sed is greedy, it will eat every widget after what we are looking for # -> solution: use perl -pe with .*? so it stops on first 'updOnDBUSMatchRule=' # #*It is multiline file and we want it works on 'single-line mode', but for some reason it won't work # -> solution, change every linebreak to the FOORAB (foobar might be in use). do the thing. change every FOORAB back to linebreak cat /home/user/.queen_beecon_temporary_file2 | sed ':a;N;$!ba;s/\n/FOORAB/g' | perl -pe 's/\[queen-beecon.desktop-'"$NAME"'\].*?updOnDBUSMatchRule=//' | sed 's/FOORAB/\n/g' > /home/user/.queen_beecon_temporary_file #and now place it on real name mv /home/user/.queen_beecon_temporary_file /home/user/.queen_beecon #remove temp-files rm /home/user/.queen_beecon_temporary_titles rm /home/user/.queen_beecon_temporary_commands rm /home/user/.queen_beecon_temporary_file2 #these should be owned by user chown user /home/user/.config/hildon-desktop/home.plugins chown user /home/user/.queen_beecon exit 0
The Following 3 Users Say Thank You to AapoRantalainen For This Useful Post: | ||
![]() |
2012-03-21
, 20:47
|
|
Posts: 5,028 |
Thanked: 8,613 times |
Joined on Mar 2011
|
#5
|
The Following User Says Thank You to Estel For This Useful Post: | ||
![]() |
2012-03-30
, 18:53
|
Posts: 138 |
Thanked: 90 times |
Joined on Mar 2012
|
#6
|
Issues are described here:
http://wiki.maemo.org/Queen_BeeCon_W...ipts_please.3F
So far I have made first debian-package and pushed it to the extas-devel.
WARNING: It can ruin your working widgets (during installation, upgrading or removing). I have not installed it on my primary phone myself!
Package name is qbw-harmattan-date
With apt-get source qbw-harmattan-date you can get all files.
(http://maemo.org/packages/view/qbw-harmattan-date/)
I will describe how it is made so it can be analysed and potential failing parts could be spotted.
I'm using unmodified queen-beecon, but it can be tuned, if something can be then done more robust way.
I will use name HarmattanDate for this instructions. Name can't contain spaces or dashes.
-------
So...
You have good widget on your phone. Export it to the file (exported_widget.txt).
copy file "/var/lib/gconf/apps/osso/hildon-desktop/applets/XXX/%gconf.xml" (conf.xml) where XXX is something like queen-beecon.desktop-0. This file contains coordinates for widget.
on debian/rules:install
Package will contain some files, and postinstallation/postrm are used for adding/deleting widget (or widgets, if many desktops are used). Removing package (i.e. running postrm) should be possible (and safe) even widget (or some of them) is reconfigured by user, or even manually removed.