View Single Post
Posts: 110 | Thanked: 363 times | Joined on May 2014
#124
use at your own risk and reponsibility.

A first try at customizing menus in maemo-leste

install:


download
leste-menu_noicon.tar.gz

extract to leste root

cd /
tar xvvf leste-menu_noicon.tar.gz

# copy icons (for example from maemo) to leste
scp -r /opt/usr/share/icons/hicolor/64x64/hildon/app_install* root@$maemo-leste-ip:/usr/share/icons/hicolor/64x64/hildon/
scp -r /opt/usr/share/icons/hicolor/64x64/apps/app_install* root@$maemo-leste-ip:/usr/share/icons/hicolor/64x64/apps/

# on leste
update-icon-caches /usr/share/icons/*

done.

Result should look very similar to http://maemo.hinoarashi.de/catorise/...526-190524.png from https://talk.maemo.org/showthread.php?t=73443

how it is done and some insights:


I just copied my maemo configuration generated by catorise over to leste.

Involving
/opt/catorise and /etc/xdg/menus/hildon.menu
/etc/xdg/menus/hildon.menu is a xml file, which uses /opt/catorise/share/*.directory as menus

At this time i have the usual catorise submenus, but right icons doesnt show up and the names are
ai_category_?

root@devuan:~# cat /opt/catorise/share/system.directory
[Desktop Entry]
Type=Directory
Name=ai_category_system
Icon=app_install_system
X-Text-Domain=hildon-application-manager

ai_category seems to be a naming convention from catorise.
So icons arent found and Name is taken.

Lets look at the user_guide

cat /usr/share/applications/hildon/user-guide.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=tana_ap_user_guide
Comment=Show the user guide in a new window
Exec=dbus-send --print-reply --dest=com.nokia.osso_browser /com/nokia/osso_browser/request com.nokia.osso_browser.open_new_window string:http://maemo.nokia.com/n900/userguides/
Icon=tasklaunch_user_guide
Terminal=false
Type=Application
Categories=System
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

lets modify /opt/catorise/share/system.directory
root@devuan:~# cat /opt/catorise/share/system.directory
[Desktop Entry]
Type=Directory
Name=ai_category_system
#Icon=app_install_system
Icon=tasklaunch_user_guide
X-Text-Domain=hildon-application-manager

and we get a nice white on blue question mark.

find / | grep tasklaunch_user_guide
/usr/share/icons/hicolor/64x64/hildon/tasklaunch_user_guide.png

on maemo
find / | grep app_install_system
/opt/usr/share/icons/hicolor/64x64/apps/app_install_system.png
/opt/usr/share/icons/hicolor/64x64/hildon/app_install_system.png


so to be save i copy both, (they seem to be the same)
scp -r /opt/usr/share/icons/hicolor/64x64/hildon/app_install* root@$maemo-leste-ip:/usr/share/icons/hicolor/64x64/hildon/
scp -r /opt/usr/share/icons/hicolor/64x64/apps/app_install* root@$maemo-leste-ip:/usr/share/icons/hicolor/64x64/apps/

no, still just tasklaunch_user_guide icon is working.

ok, i guess we need to update some icon cache

after
update-icon-caches /usr/share/icons/*
(and a reboot ?)
we have working icons (great) and .. names, ahm (thats different on maemo), great (if the names werent all ai_category_? like on maemo).

[fix using emacs on path /opt/catorise/share
dired-do-query-replace-regexp Name=ai_category_ Name=
doesnt work ???]

but sed did
cd /opt/catorise/share
find ./ -type f -exec sed -i -e 's/Name=ai_category_/Name=/g' {} \;

resulting in more meaningful names

lets try to install a debian packet and see if it shows up, lets try something small and useful: mc

apt-get install mc

and it didnt show up (there is a known fix https://github.com/maemo-leste/bugtracker/issues/82)

cp /usr/share/applications/mc.desktop /usr/share/applications/hildon/mc.desktop

update-icon-caches /usr/share/icons/*

Icon and name should show up, but it doesnot launch. (https://github.com/maemo-leste/bugtracker/issues/165)
Lets look why.

# devuan
cat /usr/share/applications/mc.desktop
[Desktop Entry]
Name=Midnight Commander
Name[af]=Middernag Kommandeur
Name[eo]=Meznokta komandanto
Name[fa]=فرمان*دار نیمه شب
Name[ko]=미드나잇 커멘더
Name[lv]=Pusnakts Komandieris
Name[nso]=Molaedi wa Bosegogare
Name[th]=มิดไนท์คอมมานเดอร์
Name[ve]=Muhulwane wa vhukati ha vhusiku
Name[xh]=Umyaleli Waphakathi kobusuku
Name[zu]=Umyaleli waphakathi nobusuku
Comment=File manager
Comment[pl]=Menedżer plików
Exec=mc
Icon=MidnightCommander
Terminal=true
Type=Application
Categories=ConsoleOnly;Utility;FileManager;System; FileTools;
Keywords=file manager;console;

# on Maemo
cat /usr/share/applications/hildon/mc.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Midnight Commander
Comment=Console-based file manager and visual shell
Exec=osso-xterm -e mc
Icon=mc
# Terminal=true does not work in Maemo
X-Window-Icon=mc
X-Window-Icon-Dimmed=mc
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable

Found "Terminal=true does not work in Maemo"
fixing to

root@devuan:~# cat /usr/share/applications/hildon/mc.desktop
[Desktop Entry]
Name=Midnight Commander
Name[af]=Middernag Kommandeur
Name[eo]=Meznokta komandanto
Name[fa]=فرمان*دار نیمه شب
Name[ko]=미드나잇 커멘더
Name[lv]=Pusnakts Komandieris
Name[nso]=Molaedi wa Bosegogare
Name[th]=มิดไนท์คอมมานเดอร์
Name[ve]=Muhulwane wa vhukati ha vhusiku
Name[xh]=Umyaleli Waphakathi kobusuku
Name[zu]=Umyaleli waphakathi nobusuku
Comment=File manager
Comment[pl]=Menedżer plików
Exec=osso-xterm -e mc
Icon=MidnightCommander
#Terminal=true
Type=Application
Categories=ConsoleOnly;Utility;FileManager;System; FileTools;
Keywords=file manager;console;

starts mc in osso-xterm


to put it in a category edit /etc/xdg/menus/hildon.menu

for example in utilities:
...
<Menu>
<Name>utilities</Name>
<Directory>utilities.directory</Directory>
<Include>
<Filename>emacs24.desktop</Filename>
<Filename>mc.desktop</Filename>
<Filename>osso-xterm.desktop</Filename>
</Include>
<Layout>
<Filename>mc.desktop</Filename>
<Filename>osso-xterm.desktop</Filename>
<Filename>emacs24.desktop</Filename>
</Layout>
</Menu>
<Menu>
<Name>all</Name>
<Directory>all.directory</Directory>
<Include>
<All/>
</Include>
<Layout>
<Filename>osso-xterm.desktop</Filename>
<Filename>emacs24.desktop</Filename>
<Filename>mc.desktop</Filename>
<Merge type="all"/>
</Layout>
<Exclude>
<Filename>catorise-browser.desktop</Filename>
<Filename>catorise-calendar.desktop</Filename>
<Filename>catorise-image-viewer.desktop</Filename>
<Filename>catorise-modest.desktop</Filename>
<Filename>catorise-osso-addressbook.desktop</Filename>
<Filename>catorise-rtcom-call-ui.desktop</Filename>
<Filename>catorise-rtcom-messaging-ui.desktop</Filename>

</Exclude>
</Menu>
...

I dont know if there is a way to not repeat the entry in Include and Layout. Layout defines the actual gui position.
So in "utilities" mc goes first, in "all" osso-xterm.


Remarks
You cant currently use /debian/.desktop files in hildon directly cause terminal=true is not supported.
So currently seperation of /debian/.desktop and /hildon/.desktop files make sense,
you have to "import" them and cant just add the /usr/share/applications directory.
This alignes with the different ui interfaces of hildon apps and debian apps.
(and their problems right click, drag and drop, hover, keyboard shortcuts collisions)

osso-xterm -e should be something like debian-terminal-app i just used osso-xterm -e cause i didnt know better.
(Is something like debian-gui-app needed too?)

You currently have to modify (maemo-hildon) catorise for rebased hildon to fix "Name"s.

Rant
To make a nice menu creation application for hildon (hildon-rebased and many other modern UX) you need to follow
the (free)Desktop(.org) Menu Specification (which uses xml in Menus and the "Desktop Entry Specification"
which includes a simpler own file format)
and finally find out about the current icon caching mechanism.

different formats, different tools, different bugs, more to learn, easier to automate.
 

The Following 12 Users Say Thank You to pythoneye2 For This Useful Post: