Tiny Core Linux
Tiny Core Base => TCB Talk => Topic started by: simond on September 08, 2019, 04:39:26 AM
-
using openbox, some apps, if installed like pcmanfm or netsurf,
will not work using desktop menu.
I find the menu file is /usr/local/tce.openbox.xml
and the command in this file is wrong.
I modified this file and the menu system can work now
but after reboot it revert to that bad state.
even if saved to mydata.tgz by add it to /opt/.filetool.lst
turns out that the menu is dynamicly generated after every reboot
after some further digging,
from command "openbox_makemenu" I see that
it use function "writeMenuItem" from "openbox_menu_common"
to strip out the exec command from *.desktop file
in folder /usr/local/share/applications
the problem is , some freedesktop parameters begin with "%"
seems should NOT be included in the menu
test:
tc@box:~$ . /etc/init.d/tc-functions
tc@box:~$ . /usr/local/bin/openbox_menu_common
tc@box:~$ writeMenuItem /usr/local/share/applications/netsurf.desktop
<item label="netsurf"> <action name="Execute"> <command>netsurf-gtk %u</command> </action> </item>
tc@box:~$
as this, the command stripped is "netsurf-gtk %u", which is bad,
this won't work.
need only "netsurf-gtk" this part,
other menu like wbar or jwm don't have such problem
is this a bug or trival thing to be ignored?
seems openbox is old and never get updated.
maybe some kind guy update it a bit?
Title: openbox.tcz
Description: Highly configurable, next generation window manager
Version: 3.5.2
Author: Dana Jensens, Mikael Magnusson, Derek Foreman, Tore Anderson and others
Original-site: http://openbox.org
Copying-policy: GPL v2
Size: 254k
Extension_by: bmarkus
Tags: WINDOW MANAGER
Comments: Binaries only
----
Compiled for 5.x
Change-log: 2013/08/06 First version, 3.4.11.2
2013/08/13 Fixed TC integration
Current: 2013/08/21 Updated to 3.5.2
-
Hi simond
Welcome to the forum. Since you already dug into this, maybe you could compare how jwm handles this with openbox and
suggest a fix. You can fetch jwm.tcz to examine the menu scripts without installing it as follows:
tce-load -wi squashfs-tools
wget http://tinycorelinux.net/10.x/x86/tcz/jwm.tcz
unsquashfs jwm.tcz
cd squashfs-root/usr/local/bin
editor jwm_menu_common
The openbox menu scripts in /usr/local/bin are links to a read only squash file system. To edit them so you can try out changes,
you first need to replace the links with actual files like this:
sudo busybox cp -f /tmp/tcloop/openbox/usr/local/bin/openbox_menu_common /usr/local/bin/openbox_menu_common
sudo chown tc:staff /usr/local/bin/openbox_menu_common
-
Since you already dug into this, maybe you could compare how jwm handles this with openbox and
suggest a fix.
test jwm:
tc@box:~$ . /etc/init.d/tc-functions
tc@box:~$ . /usr/local/bin/jwm_menu_common
tc@box:~$ writeMenuItem /usr/local/share/applications/netsurf.desktop
<Program label="netsurf">exec netsurf-gtk </Program>
tc@box:~$
the stripped part is 'netsurf-gtk' , no '%u' :
<Program label="netsurf">exec netsurf-gtk </Program>
after comparing /usr/local/bin/openbox_menu_common
and /usr/local/bin/jwm_menu_common,
I found that they are almost same,
except that jwm_menu_common add 2 lines to remove that ‘%’ part:
else if ( $1 == "Exec" ) {
exec = $2
test = match(exec,"%")
if ( test ) exec = substr(exec,0,test-1)
} else if ( $1 == "Terminal" ) {
terminal = $2
}
so to fix this:
add these 2 lines to /usr/local/bin/openbox_menu_common after line 15
seems that Robert noticed this and fixed it in jwm, now just need to copy this same procedure to openbox
(http://forum.tinycorelinux.net/index.php?action=dlattach;topic=23183.0;attach=5154)
-
Hi simond
I just checked my window manager (flwm_topside) and it matches what jwm has:
#!/bin/sh
# (c) Robert Shingledecker 2010
# Called from tc-config to setup initial flwm system menu & tce menu
writeFLWMitem() {
busybox awk -v output="$TARGET" '
BEGIN {
FS = "="
name = ""
exec = ""
}
{
if ( $1 == "Name" && name == "") {
name = $2
gsub(/ /, "", name)
} else if ( $1 == "Exec" && exec == "") {
exec = $2
test = match(exec,"%")
if ( test ) exec = substr(exec,0,test-1)
} else if ( $1 == "Terminal" ) {
terminal = $2
}
}
END {
print "#!/bin/sh" > output"/"name
if ( terminal == "true" ) {
print "exec aterm +tr +sb -T \""name"\" -e " exec > output"/"name
} else {
print "exec " exec > output"/"name
}
system("chmod +x "output"/"name)
} ' "$1"
}
Please perform the following commands:
sudo busybox cp -f /tmp/tcloop/openbox/usr/local/bin/openbox_menu_common /usr/local/bin/openbox_menu_common
sudo chown tc:staff /usr/local/bin/openbox_menu_common
sudo cp -a /usr/local/bin/openbox_menu_common /usr/local/bin/openbox_menu_common.original
Then edit /usr/local/bin/openbox_menu_common to add the required lines and verify it works as intended. Once you are satisfied
with the results, create a unified diff like this:
diff -u /usr/local/bin/openbox_menu_common.original /usr/local/bin/openbox_menu_common > /usr/local/bin/openbox_menu_common.diff
Then attach the /usr/local/bin/openbox_menu_common.diff file to your next post so your changes can be applied to the repository.
-
ok, diff attached.
I don't know what's the exact command to generate menu for all loaded apps,
but here's a little test:
tc@box:~$ sudo patch /usr/local/bin/openbox_menu_common openbox_menu_common.diff
tc@box:~$ sudo rm /usr/local/tce.openbox.xml
tc@box:~$ sudo openbox_initmenu
tc@box:~$ sudo openbox_makemenu leafpad
tc@box:~$ sudo openbox_restart
tc@box:~$ cat /usr/local/tce.openbox.xml
tce.openbox.xml:
<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="apps-menu" label="Applications">
<item label="Leafpad"> <action name="Execute"> <command>leafpad </command> </action> </item>
<!-- END_TCE -->
</menu>
</openbox_menu>
<item label="Leafpad"> <action name="Execute"> <command>leafpad </command> </action> </item>
no more "%" variables part
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html#exec-variables
now test in the desktop menu, it's ok now.
-----
but, as I know, the openbox config is located at /home/tc/.config/openbox
but why these local config files are overriden after every reboot,
though they're actually backed up in mydata.tcz ?
aren't the files under /home/tc/.config supposed to be persistent?
from http://wiki.tinycorelinux.net/wiki:persistence_for_dummies
Getting tinycore to save your documents and settings
Many settings, and all documents, are stored in your home directory called
/home/tc (also called $HOME or ”~” ), and /opt
I trid to create a file in /home/tc/.config/openbox like this:
echo test > /home/tc/.config/openbox/demo.txt
and after reboot, this demo.txt still exists,
but other menu files in the same folder are overridden with origin files
strange
-
Hi simond
... aren't the files under /home/tc/.config supposed to be persistent? ...
Yes, everything under /home and /opt is persistent.
... I trid to create a file in /home/tc/.config/openbox like this:
echo test > /home/tc/.config/openbox/demo.txt
and after reboot, this demo.txt still exists,
but other menu files in the same folder are overridden with origin files ...
Which shows your /home is persistent and something else is overwriting those .xml files.
Menus for installed extensions are built from scratch when you boot. It's possible there may be some mechanism for saving
customizations. Looking at the change log of the jwm info file:
http://tinycorelinux.net/10.x/x86/tcz/jwm.tcz.info
I see the following entry:
2009/10/09 Adjusted jwm_initmenu to not overwrite existing
If you still have the unsquashed jwm.tcz as described in Reply #1 it might be worth trying to see what they fixed in:
squashfs-root/usr/local/bin/jwm_initmenu
Both jwm and openbox have startup scripts that you also might want to look at:
squashfs-root/usr/local/tce.installed/jwm
and:
/usr/local/tce.installed/openbox
-
Hi simond
I see you've taken the time to look through the Wiki, to which I say kudos to you. If you haven't already found it, here is some highly
recommended reading material:
http://tinycorelinux.net/corebook.pdf
-
ok, checked again the command openbox_initmenu,
and I think there's no problem now.
it actually keeps openbox config file unchanged, include menu.xml and rc.xml,
and regenaretes /home/.config/openbox/system-tools.xml and /usr/local/tce.openbox.xml
yesterday I only changed system-tools.xml, so I found it reverted.
now I tried to changed menu.xml and rc.xml, and the change remains after reboot
this is acceptable.
just that, I think maybe the auto generated system-tools.xml should be placed in folder /usr/local,
not in /home/.config/openbox/, since that's supposed to be persistent. a bit confusing
and yes, I've read that book and FAQ. thank you for your detailed documentation. it's very useful for us new users
-
Hi simond
... just that, I think maybe the auto generated system-tools.xml should be placed in folder /usr/local,
not in /home/.config/openbox/, since that's supposed to be persistent. a bit confusing ...
I don't know about openbox so I can't comment on that. There may or may not be a good reason for placing it under /home/.config/openbox/.
... and yes, I've read that book and FAQ. thank you for your detailed documentation. it's very useful for us new users
If you were referring to the book, it was written by curaga, not me. If you were referring to the instructions I posted, you are welcome.
-
Hi Juanito
simond attached a diff to Reply #4 to fix a menu issue. If the x86_64 version requires the same fix, those scripts are in a separate
extension which openbox.tcz.info recommends installing:
http://tinycorelinux.net/10.x/x86_64/tcz/openbox-config.tcz.list
Do you want to apply the patch or do you want me to download the extensions and resubmit them?
-
Up to you :)
I’ll be back the day after tomorrow.
-
Hi Juanito
OK, I'll take care of it tonight.
-
Hi Juanito
Packages sent to tcesubmit with updated .tcz, tcz.info, and .tcz.md5.txt files.
-
Posted - thanks :)