Page 6 of 8

Posted: Mon 12 Mar 2012, 18:03
by sc0ttman
Support added for the XDG standard 'NoDisplay' option..
See lines marked #20120312 for changes.

Code: Select all

for DESKTOP_FILE in /usr/share/applications/* ; do
	#[ "$( cat $DESKTOP_FILE | grep -m1 ^NoDisplay=true)" != "" ] && continue
	ICON="" CATS="" NAME="" EXEC="" SKIP=false #prevent carryover #20120312, added SKIP
	while read LINE || [ "$LINE" ] ; do
		case $LINE in
			NoDisplay=true*) SKIP=true ;; #20120312
			Name=*|Name?${myLANG%_*}?=*) NAME="${LINE#*=}"'' ;; # sc0ttman... should use "Name[$myLANG]=" if found
#			Comment=*|Comment?${myLANG%_*}?=*) COMMENT="${LINE#*=}"''  ;; #jwm doesn't support tooltips on menu items yet ... 
			Icon=*) ICON="${LINE#*=}"''  ;;
			Categories=*) CATS="${LINE#*=}"'' ;;
			Exec=*) EXEC="${LINE#*=}"'' ;;
		esac
		
	done < $DESKTOP_FILE	
	[ "${SKIP}" = true ] && continue #20120312

jwm_tools-0.9.1

Posted: Wed 14 Mar 2012, 19:12
by L18L
sc0ttman wrote:Support added for the XDG standard 'NoDisplay' option..
See lines marked #20120312 for changes.
...done

Running in Racy 5229 was not possible because no language files included. In normal cases a program would run English.....

Thus I have fixed some bugs and, for easier testing added the entry jwm_tools: Parameters in jwmconfig.
Thus launches jwm_param_gui where you can choose from the installed languages (Dutch added)

Have fun

---
edit: deleted 0.9.2.pet

Posted: Wed 14 Mar 2012, 19:35
by L18L
Sorry
yet a bug in 1 of the scripts
value not "" but " " (always 1 space too much)
does not change SUBMENU and DRIVES

-----
edit: here is a fix.

----
edit: bug located
choices were always overwritten by config file
quick fix:
search in file
$HOME/.jwm/JWMRC
for
SUBMENU="1" #SUBMENUS=""
DRIVES="1" #DRIVES=""
and change every found into
#SUBMENU="1" #SUBMENUS=""
#DRIVES="1" #DRIVES=""

----
thanks for testing
pet deleted : take version 0.9.3 next post please

jwm_tools-0.9 (was jwm_menu_create)

Posted: Thu 15 Mar 2012, 20:21
by L18L
Please delete config file /root/.jwm/JWMRC
then install 0.9.3.pet

What´s new?

jwm_param_gui can be launched from JWM configuration

known bugs are fixed

menu has an alternative for translations now
no more inside /usr/share/applications/*.desktop
but simply in 1 file, ex: /usr/share/locales/de/names
/usr/share/locales/de/names wrote:s%"Abiword wordprocessor"%"Abiword Textverarbeitung"%
s%"FFConvert multimedia converter"%"FFConvert Multimedia-Konverter"%
s%"Mixer generic sound mixer"%"Mixer Sound-Mischpult"%
s%"Pmount mount/unmount drives"%"Pmount Laufwerke ein-/aushängen"%
Copy this file (170 program names from racy, extendable) into your locales and you can translate everything very quick (momanager needed more than 1 minute for each word and I think this is much better)

Image

----
edited 2012-10-18
downloaded 164 times
deleted jwm_tools-0.9.3.pet
use jwm_tools-0.9.4.pet please :)

Posted: Sat 02 Jun 2012, 07:28
by technosaurus
J have been working on some C projects lately and haven't gotten the stuff done here that I wanted to, so I am posting a quick, updated todo list. - let me know if I am missing something
  • sync up with patches - thanks guys
    finish support for multiple custom trays, including app trays, swallow and all other niceties.
    have option for drives as a menu instead of a tray (then jwm -reload will update them on the fly)
    remove the %* from the execs in the menu - jwm does not support drag and drop, so %U, %s, %f and whatever are meaningless
    (NOTE: what if there is an rxvt -e with a printf "%s...", ...)
    add tools for viewing pdf and other doc types that can be converted to images to reduce resource usage similar to the image viewer (mubusy in mupdf will do pdf and several other formats, abiword's cli can do others, etc...)
    Explain the purpose of unix-ifying the tools and general documentation.

Posted: Sat 02 Jun 2012, 12:34
by maxerro
You might consider using data from /sys/block (instead of /sys/dev/block) in that lite drive-detector, and get it all organized even easier (and slightly faster). Partitions could be displayed as sub-menus. (And every partition could have its own sub-menu, if you want to add more options like mount/unmount/open-in-fm/info/[dare to blank/format/backup/play]/...)
Also consider displaying partition size next to the name (since it's handed on a plate):
size = /sys/block/drive/queue/hw_sector_size x /sys/block/drive[/partname]/size

Wanted to suggest something else too, but can't remember... It'll strike me later...

Posted: Sat 02 Jun 2012, 14:17
by maxerro
OK, forget that little size formula.
It appears that on newer hard-drives (after 2010) you may need to check /sys/block/drive/queue/logical_block_size or physical_block_size.

Posted: Sat 02 Jun 2012, 14:29
by technosaurus
There is a nifty little trick for that.
[ -f "file" ] && Var=$(<file)
Then use
${Var:-default_value}

Posted: Sat 02 Jun 2012, 15:59
by maxerro
These are the values that should be used:

/sys/block/drive[/partname]/size * 512 (in bytes)
or
/sys/block/drive[/partname]/size / 2048 (in MBytes)

... for all drives (for now).

Anyone who buys one of the new Advanced-Format HDDs and gets the wrong size reading, please report here (kindly).

Posted: Mon 04 Jun 2012, 04:14
by technosaurus
I have built a static version of jwm 579 against musl libc and tinyx11 - confirm, icons, png, xpm and jpeg enabled. No Xinerama or Xft, but should work on just about any distro and only uses 1.6Mb RAM with a solid background.

Looks like garbage with the builtin font (DejaVu Sans is not supported) so I set all the fonts to:
-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1
... and it looks pretty good.

Posted: Sun 17 Jun 2012, 01:43
by 01micko
I made a patch for jwm_menu_create to show icons that have entries in the .desktop file that don't have an extension, presuming they are .png format. I have kept it pure bash, there may be a better way though.

See here.

Posted: Tue 26 Jun 2012, 04:45
by technosaurus
I am glad you brought that up, I had forgotten that non-compliance.

I'll add a todo to patch jwm - looks like its in image.c @
ImageNode *LoadImage(const char *fileName) {
it could just try to add the suffixes after the first pass to fileName and retry

still need to remove the %U %f etc from the execs though
I think it can be fixed in command.c by doing a s*printf and using NULL values prior to exec (maybe using strstr 1st to see if it has a %*) ... the problem with % is that it gets special treatment compared to normal characters.

I think I'd do this though:

Code: Select all

Icon=*.xpm|Icon=*.png|Icon=*.jpg||Icon=*.jpeg) ICON="${LINE#*=}"''  ;;
Icon=*)ICON="${LINE#*=}.png"''  ;; 
here is some tentative code for doing desktop icons using *.desktop files in $HOME/Desktop (useful for systems, including virtual machines with as little as 4Mb of RAM)

Code: Select all

#!/bin/sh

[ -f ${HOME}/.jwm/JWMRC ] || cp /etc/JWMRC ${HOME}/.jwm/JWMRC
. ${HOME}/.jwm/JWMRC
[ -f ${HOME}/.jwm/jwm-icons ] && mv -f ${HOME}/.jwm/jwm-icons ${HOME}/.jwm/jwm-icons~ && echo "<JWM>" >${HOME}/.jwm/jwm-icons &
{	#localization block
[ $myLANG ] || myLANG=${LANGUAGE%% *}
[ $myLANG ] || myLANG=${LANG%_*}

[ -f /usr/share/locale/$myLANG/LC_MESSAGES/jwm ] && . /usr/share/locale/$myLANG/LC_MESSAGES/jwm
LANG=C
}

#should make check for display, but we can also set MAX_X in the JWMRC
[ ! "$MAX_X" ] && SCREEN_WIDTH=`xwininfo -root |awk '/geometry/{print $2}' |awk 'BEGIN{FS="x"}/x/{print $1}'` && MAX_X=$(($SCREEN_WIDTH-75))

XPOS=25
YPOS=25

for A_FILE in ${HOME}/Desktop/* ; do
ICON="" CATS="" NAME="" EXEC="" LINE="" COMMENT="" #prevent carryover from previous file
case "$A_FILE" in
*.desktop)
	while read LINE || [ "$LINE" ]; do
		case $LINE in
			Name=*|Name?${myLANG%_*}?=*) NAME="${LINE#*=}"'' ;;
			Comment=*|Comment?${LANG%_*}?=*) COMMENT="${LINE#*=}"''  ;;
			Icon=*.xpm|Icon=*.png|Icon=*.jpg|Icon=*.jpeg) ICON="${LINE#*=}"'' ;;
			Icon=*)ICON="${LINE#*=}.png"'';; 
			Exec=*) EXEC="${LINE#*=}"'' ;;
		esac
		
	done < $A_FILE	

	[ "${EXEC}" ] && wait && echo '<Tray layout="vertical" x="'$XPOS'" y="'$YPOS'" layer="0" border="0" width="50" >
	<TrayButton popup="'${COMMENT:-$NAME}'" icon="'${ICON:-mini-dog.xpm}'">exec:'$EXEC'</TrayButton>
	<TrayButton popup="'${COMMENT:-$NAME}'" label="'${NAME:0:6}'">exec:'$EXEC'</TrayButton>
</Tray>' >>${HOME}/.jwm/jwm-icons &
XPOS=$(($XPOS+75))
[ $XPOS -gt $MAX_X ] && YPOS=$(($YPOS+75)) XPOS=25
;;
*)echo "$A_FILE" not supported >/dev/stderr;;	#todo xdg-open it?
												#find $ICONPATH -iname $A_FILE*
esac

done
wait && echo "</JWM>" >>${HOME}/.jwm/jwm-icons

Posted: Tue 26 Jun 2012, 08:43
by disciple
Does JWM/fixmenus/jwm_menu_create/whatever handle applications with "Terminal=true" in the .desktop file correctly?

Posted: Tue 26 Jun 2012, 19:43
by technosaurus
I could, but unfortunately it probably would not work on all puppy's hacked desktop files... normally they would end up running
$TERM -e $EXEC
in older Puppy this would typically end up being
rxvt -e rxvt -e sh -c command args
(newer Pups have terminal=false set when the exec= already has been modified with the terminal)

I'd rather it be compliant and fix issues that it identifies rather than try to work around them though, but I'd need to look at the spec.

Posted: Wed 04 Jul 2012, 22:40
by technosaurus
I wish I had never started looking at this, Puppy has a _lot_ of non-compliant behavior that could actually be simplified if it were (well it could be simplified without making it compliant too, but why bother with that?)

For instance I doubt we need 4 instances of delayedrun... or about 100 variations of autostarting sfs files on mount:
instead implement autostart

The menu generator in ALL standard directories

Create icons for each of standard icon names (look into patching jwm for imlib2 like icewm ... then it would also be pretty cool to implement my simple icon tray directly in jwm - just need to inotify watch each image and redraw on change)

Include these standard categories and add an OnlyShowIn support for jwm (and Rox?)

implement a better default handler (that does not depend on ROX-Filer) using mime info from desktop file entries including Trash and thumbnail support if possible (basically xdg-open lite)

shift jwm tools to using recently released xsettings spec

In order to do this programatically I will be going to 1 include file per operation: menu, install, tray, desktop, theme, temp (for notify, imageviewer, etc...) This will allow things like seamless jwm -refresh upon program installation (one for main menu and one for slower install menu) or operations on drive trays being inserted/removed to trigger jwm -refresh ... as well as some experimental features such as controlling desktop icons, drive menus, viewing images, notifications etc...

Posted: Thu 05 Jul 2012, 06:37
by disciple
instead implement autostart
Yes.
For when your window manager doesn't provide the functionality, I thought there was a shell script somewhere like github or gitorious produced by some Arch person... but if there was, I can't find it now. Maybe I was thinking of http://gitorious.org/xdg-autostart/ (not a shell script).

Posted: Thu 05 Jul 2012, 06:51
by disciple
implement a better default handler (that does not depend on ROX-Filer) using mime info from desktop file entries including Trash and thumbnail support if possible (basically xdg-open lite)
I think the "new generation" pcmanfm actually handles this (file associations, not opening files from the command line like xdg-open), quite well, and I've been wondering what the chances would be of linking something like Rox or the old GTK searchmonkey against libfm to get this functionality... but I'm sure it's a lot too difficult for me.

This thing looks fun:
https://bbs.archlinux.org/viewtopic.php?pid=1124843https://github.com/Cloudef/PKGBUILDS/tr ... er/linopen

Posted: Sun 15 Jul 2012, 12:55
by disciple
disciple wrote:
instead implement autostart
Yes.
For when your window manager doesn't provide the functionality, I thought there was a shell script somewhere like github or gitorious produced by some Arch person... but if there was, I can't find it now. Maybe I was thinking of http://gitorious.org/xdg-autostart/ (not a shell script).
Another one (also not a shell script): https://bitbucket.org/jjacky/dapper

Re: jwm_tools-0.9 (was jwm_menu_create)

Posted: Thu 18 Oct 2012, 11:45
by L18L
Once upon a time...
L18L wrote:Please delete config file /root/.jwm/JWMRC
then install 0.9.3.pet

What´s new?

jwm_param_gui can be launched from JWM configuration

known bugs are fixed

menu has an alternative for translations now
no more inside /usr/share/applications/*.desktop
but simply in 1 file, ex: /usr/share/locales/de/names
/usr/share/locales/de/names wrote:s%"Abiword word processor"%"Abiword Textverarbeitung"%
s%"FFConvert multimedia converter"%"FFConvert Multimedia-Konverter"%
s%"Mixer generic sound mixer"%"Mixer Sound-Mischpult"%
s%"Pmount mount/unmount drives"%"Pmount Laufwerke ein-/aushängen"%
Copy this file (170 program names from racy, extendable) into your locales and you can translate everything very quick (momanager needed more than 1 minute for each word and I think this is much better)

Image
Please delete config file /root/.jwm/JWMRC
then install 0.9.4.pet

What´s new?

- You can switch (back) to English now

Does it not look nice in in of the "sinister languages" :lol:

menu fixes

Posted: Fri 05 Dec 2014, 23:39
by torios
I have been modifying the script for use on Ubuntu, and I handle a few things slightly different.

First... Icons and Exec=
if [[ "${ICON##*.}" == "xpm" ]] || [[ "${ICON##*.}" == "svg" ]] || [[ "${ICON##*.}" == "png" ]] || [[ "${ICON}" == "/*" ]]
then
MenuEntry='
<Program label="'${NAME}'" icon="'${ICON}'">'${EXEC%\ \%?}'</Program>'
else
MenuEntry='
<Program label="'${NAME}'" icon="'${ICON}'.svg">'${EXEC%\ \%?}'</Program>'
fi


And secondly for the case statement to get the info I added two items
case $LINE in
Name?${myLANG%_*}?=*|Name=*) NAME="${LINE#*=}"'' ;; # sc0ttman... should use "Name[$myLANG]=" if found
TryExec=*|Exec=*) EXEC="${LINE#*=}"'' ;;
Categories=*) CATS="${LINE#*=}"'' ;;
Icon=*) ICON="${LINE#*=}"'' ;;
Terminal=*) TERM="${LINE#*=}"'' ;;
'[Desktop Action'*) break ;;
"["*" Shortcut Group]") break ;;
the last two things check for Ubuntu specific (?) Desktop Actions and Shortcut Group for apps like Chrome...

I also include an xdg desktop directories folder, and parse that for localization for the category names... Which are structured like the Lubuntu menu
case "$CAT" in
AudioVideo)AV=${AV}${MenuEntry};;
Development)DEV=${DEV}${MenuEntry};;
Education)ED=${ED}${MenuEntry};;
Game)GAME=${GAME}${MenuEntry};;
Graphics)ART=${ART}${MenuEntry};;
Network)NET=${NET}${MenuEntry};;
Office)OFF=${OFF}${MenuEntry};;
Science)SCI=${SCI}${MenuEntry};;
Settings)SET=${SET}${MenuEntry};;
System)SYS=${SYS}${MenuEntry};;
Utility)ACC=${ACC}${MenuEntry};;
*)Misc=${MISC}${MenuEntry};; #add Miscellaneous category?
esac
If anyone is interested in this menu script let me know... it generates a Root menu, so it looks and behaves much like the old Gnome2 menu or the LXDE/XFCE etc... menus
I put my menu generation script in
/etc/menu-methods
and install menu && menu-xdg so this script is run everytime a program is installed...
The end of the script also does
sed -i 's/&/&/g' ${MENUFILE}
RESULT=$(jwm -reload)
to replace & with the xml &amp
and reloads the menu

I use svg icons but feel free to change svg to whatever you like best
Basically it checks to see if it starts with '/' which would mean it is full path
and it looks to see if it has a . extention to keep that the same as well...