jwm_tools-0.9 (was jwm_menu_create)

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

jwm_param_set

#46 Post by L18L »

Thanks for the explanation :)
technosaurus wrote: but if you would rather use jwm_param_set, I probably wasn't clear enough on the format
The format was clear for me.
Changing 1 value was OK but I did not get more than 1 changed correctly, parameter-value-pairs were set in the wrong order.

Could you show the code which has to be used for changing just
SUBMENU="true" DESKTOPS="3" please?

In my solution there is no limit to 9 values.
Anyhow the delimiter will have to be changed from # to |
echo "s|${param}"${old_value}"|${param}"$new"|" >>$new_values

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#47 Post by technosaurus »

to turn off submenus:
jwm_param_set 'SUBMENU=""'
to turn on submenus:
jwm_param_set 'SUBMENU="any_value"'

sed is pretty efficient at doing these kinds of things - feel free to use any tool of preference, I am just providing a shell only one that does the job ... I will be downloading yad from svn to test it out

as for setting desktops I am using the syntax in jwm-svn500 (which is in Wary) that has width and height vs. just count, but trying to make it compatible with older versions too.
(I started to implement it in v0.6, but wanted to test in an older jwm)
here is the current desktop background code that will be in v0.7

Code: Select all

{ #desktop settings
MENU=${MENU}'
<Desktops count="'${DESKTOPS:-$((${DESKTOPWIDTH}*${DESKTOPHEIGHT}))}'" width="'${DESKTOPWIDTH}'" height="'${DESKTOPHEIGHT}'">
'
i=1 DESKNUM=1
while ([ $i -le ${DESKTOPHEIGHT} ]) do
	j=1
	while ([ $j -le ${DESKTOPWIDTH} ]) do
		DESKTOPNAME=$i","$j
		DESKTOPBGTYPE=`eval echo '$DESKTOPBG'${DESKNUM}'TYPE'`
		DESKTOPBG=`eval echo '$DESKTOPBG'${DESKNUM}`
		[ $DESKTOPBGTYPE ] && MENU=${MENU}'
	<Desktop name="'${DESKTOPNAME}'">
		<Background type="'${DESKTOPBGTYPE}'">'${DESKTOPBG}'</Background>
	</Desktop>
'
	DESKNUM=$(($DESKNUM+1))
	j=$(($j+1))
	done
	i=$(($i+1))
done

MENU=${MENU}'
</Desktops>
'
}
Note: "jwm -restart" takes much longer with multiple/different stretched jpg backgrounds
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#48 Post by technosaurus »

v0.7 released, see initial post for pet

bugfixes (some typos and omissions - thanks maxerro)
reworked jwm_param_set to be able to unlimited values
included L18L's gui for wider testing
logical partitions and swap drives no longer show up in drive tray
media cards are now displayed in the drive tray
added the desktop related stuff including backgrounds and new jwm500 formatting
TODO - update jwm_image_view to change background now

NOTE - the default settings in the JWMRC are set to show multiple per-desktop background images ... these settings are temporary and only for demonstration purposes, because it hogs a lot of RAM and drastically increases the time to do a "jwm -restart"
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

jwm_param_gui

#49 Post by L18L »

Code: Select all

#!/bin/sh
# jwm_param_gui
# version added, same as jwm_tools
# no more sed
# fixed:blank in values
# filtered empty lines and commented lines
# form field types: number, font, combo and color
# TODO: images...
#
version=0.7
conf=${HOME}/.jwm/JWMRC
. $conf

text1=$(gettext "Select <span color='darkgreen'>one</span> ore <span color='darkred'>several</span> items
 then click or press OK button
 to change the <span color='darkred'>values</span> of the <span color='darkgreen'>selected</span> items")

text2=$(gettext "Now change value")

# ask what has to be changed
change_it=$(cat $conf \
| yad --title="jwm-tools $version"  --image="gtk-preferences" --text="$text1" --height=300 \
      --list --multiple \
      --column="" \
| tr ' ' '_' ) # ex: DejaVu Sans12 -> DejaVu_Sans12
choice=$?
[[ $choice -eq 1 || $choice -eq 252 ]] && exit 0     
echo $change_it
 
# let user change selected values

for ONEchange in $change_it ; do
    case "${ONEchange:0:1}" in
		"|") continue;; # was blank line
		"#") continue;; # was comment
	esac		
    param=${ONEchange//${ONEchange#*=}}
    old_value=`echo "$ONEchange" | cut -d '"' -f 2`
    
    field_type=""
    case $param in
#         SUBMENU=) field_type=':CHK';;
#          DRIVES=) field_type=':CHK';;
           *FONT*) field_type=':FN';;
        DESKTOPS=) field_type=':NUM';;
          *WIDTH=) field_type=':NUM';;
         *HEIGHT=) field_type=':NUM';;
          *SPEED=) field_type=':NUM';;
          *DELTA=) field_type=':NUM';;
       *DISTANCE=) field_type=':NUM';;
              BG=) :               ;;
             *BG=) field_type=':CLR';;
             *FG=) field_type=':CLR';;
        *OUTLINE=) field_type=':CLR';;
           *TEXT=) field_type=':CLR';;
    esac
    field_values=""
    case $param in
        SUBMENU=) field_type=':CB' && field_values='!TRUE!FALSE';;
         DRIVES=) field_type=':CB' && field_values='!TRUE!FALSE';;
         *MODEL=) field_type=':CB' && field_values='!sloppy!click';;
       SNAPMODE=) field_type=':CB' && field_values='!none!sreen!border';;
       MOVEMODE=) field_type=':CB' && field_values='!outline!opaque';;
     RESIZEMODE=) field_type=':CB' && field_values='!outline!opaque';;
    esac
    
    
    new=$(yad --image="gtk-edit" --text="$text2" \
              --form \
              --field="${param}${field_type}" "$old_value${field_values}" \
          | cut -d '|' -f1 \
          | tr '_' ' ' # ex: DejaVu_Sans12 -> DejaVu Sans12
         )

    # apply change
    jwm_param_set $param'"'"$new"'"'
done

#jwm_menu_create && jwm -restart

#end
:)
Edited:
forget this one please
Use next 2 posts down
Last edited by L18L on Sun 04 Sep 2011, 15:57, edited 1 time in total.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#50 Post by technosaurus »

thinking of adding support for sfs handling as part of the trays implementation (the rox part at the end will be replace with a read of the desktop file for Exec=)

I currently have it mounting and linking an sfs then running all apps in that sfs with a *.desktop file (or unlinking and unmounting if already mounted)

here is the code I have so far:

Code: Select all

#!/bin/ash

linkmount(){ # link/copy as appropriate everything in dir $1 and suffix list them in $2
[ ! -d ${1} ] && echo usage $0 /mnt/directory not $1 && exit
for F in ${1}/* ; do #all files in directory passed in 1st arg
NF=/${F#/*/*/} #packages are mounted at /mnt/package ... remove those for its "/" equivalent
if [ -L ${F} ];then #we need to do symlinks 1st in case a dir is a symlink to .
	busybox cp ${F} ${NF} && echo ${NF} >>${2} #we copy symlinks in case they are a relative path
# the echo after && only executes if cp has no errors, but cp without -f errors and doesn't
#overwrite an existing file ... that way we only get a list of new files that can be removed
elif [ -d ${F} ];then #better to make directories than symlink them... no real size anyways
#and a symlink would prevent anything within from being writeable
	[ ! -e ${NF} ] && mkdir ${NF} && echo ${NF} >>${2}
	linkmount ${F} $2 & #this is recursion + threading in action 
elif [ -f ${F} ];then # -f tells us its _not_ a block or char device ... they need write capability
	busybox ln -s ${F} ${NF} && echo ${NF} >>${2} # todo cp files in $HOME may need 2b rw
else # we assume it does need to be copied (block or char device)
	busybox cp ${F} ${NF} && echo ${NF} >>${2}
fi
done
}
mntdir=/mnt/${1##*/} # we will use /mnt + the filename as the mount location
if [ -d ${mntdir} ];then #if it exists we unmount and remove otherwise mount & run.
while read LINE; do #we are getting the list of files to remove
[ -d ${LINE} ] && rmdir ${LINE} || rm ${LINE} # rmdir directories & rm files
done <${HOME}/.packages/${1##*/}.files
rm ${HOME}/.packages/${1##*/}.files #now that the file are gone this is garbage
umount ${mntdir} #might as well unmount it and free a loop
rmdir ${mntdir} #harmless to leave, but we use it as our toggle switch
else
mkdir -p ${mntdir} # we need to create the place we will mount it.
busybox mount ${1} ${mntdir} # mount the filesystem using busybox for automatic loops
linkmount ${mntdir} ${HOME}/.packages/${1##*/}.files 2>/dev/null #silence output because
#we need the cp,ln errors for preventing "clobbering" and for creating the list of new files.
sleep 1 # wait a little bit in case recursion threads are still going.
[ -e ${mntdir}/usr/share/applications ] && rox ${mntdir}/usr/share/applications/*
#start the GUI app(s) ... todo remove dep on rox using the Exec= line ... just lazy now
fi
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

jwm_tools-0.7 (was jwm_menu_create)

#51 Post by L18L »

Code: Select all

#!/bin/sh
# jwm_param_gui
# version added, same as jwm_tools
# filtered empty lines and commented lines
# form field types: number, font, combo and color
#                   file for images (jpg and png)
# fonts: selection in yad from installed fonts, format example: DejaVu Sans 12
# TODO: further testing, ranges for numeric values
#
version=0.7.1
Attachments
jwm_param_gui-0.7.1.png
(22.31 KiB) Downloaded 1220 times
jwm_param_gui.gz
/usr/bin/jwm_param_gui
(1.27 KiB) Downloaded 509 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#52 Post by technosaurus »

here is the updated sfs linker and executor that _should_ work with multiuser and is toolkit independent (only requires jwm)

Code: Select all

#!/bin/ash

linkmount(){
[ ! -d ${1} ] && echo usage $0 /mnt/directory not $1 && exit
for F in ${1}/* ; do
	NF=/${F#/*/*/} #the root of the mount
	case ${NF} in #multiuser support
		/root*)NF=${HOME}/${NF#/*/}
	esac
	if [ -L ${F} ];then #handle symlinks first in case of looping links (ex ., ../)
		cp ${F} ${NF} && echo ${NF} >>${2}
	elif [ -d ${F} ];then #if its a directory, we want to thread and recurse it
		[ ! -e ${NF} ] && mkdir ${NF} && NEWDIR=true
		linkmount ${F} $2 &
		[ $NEWDIR ] && echo ${NF} >>${2}
	elif [ -f ${F} ];then #we can just use symlinks for all but dir & nodes
	case ${NF} in
		${HOME}*)cp ${F} ${NF} && echo ${NF} >>${2};;
		*)ln -s ${F} ${NF} && echo ${NF} >>${2};;
	esac
else #for /dev/* mostly ... we need write access to block/char devices
	cp ${F} ${NF} && echo ${NF} >>${2}
fi
done
}

mntdir=/mnt/${1##*/}

if [ -d ${mntdir} ];then 
	while read LINE; do
		[ -d ${LINE} ] && rmdir ${LINE} || rm ${LINE} &
	done <${HOME}/.packages/${1##*/}.files
	rm ${HOME}/.packages/${1##*/}.files &
	umount ${mntdir} &&	rmdir ${mntdir} &
else
	mkdir -p ${mntdir} 2>/dev/null
	busybox mount ${1} ${mntdir} 2>/dev/null
	linkmount ${mntdir} ${HOME}/.packages/${1##*/}.files 2>/dev/null
	sleep .2
	if [ -d ${mntdir}/usr/share/applications ];then
		for PROG in ${mntdir}/usr/share/applications/*.desktop; do
			while read LINE; do
				case $LINE in
					Name=*)NAME=${LINE#*=};;
					Exec=*)EXEC=${LINE#*=};;
					Comment=*)COMM=${LINE#*=};;
					Icon=*)ICON=${LINE#*=};;
				esac
			done <${PROG}
			#one prog
			jwm_notify "${NAME}" "${COMM}" "${ICON}" "${EXEC}" close "click here to continue without running $NAME" mini-stop.xpm exit
		done
	fi
fi
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#53 Post by technosaurus »

I just got a bug report by PM about *.desktop files that dont end with a new line character using the desktop entry from the previous

the fix is to replace;

read LINE;
with
read LINE || [ "$LINE" ];

there are several occurrences of this and I _may_ need to a LINE="" prior to the loop?

(this fix will be in 0.8)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#54 Post by technosaurus »

that wasn't as bad as I thought it would be, I even added support for groups see first post for an update to 0.8

Edit:
OOps I broke keybindings trying to type in Barry's woof compat fix for the pinstall script - fixed and uploaded
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#55 Post by technosaurus »

New Todo, rewrite udevd and possibly other daemons into a single shell daemon.
http://www.bangmoney.org/presentations/hotplug/

Still todo: keybindings, trays, more translations
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#56 Post by sc0ttman »

I had some thoughts, these may not be of any use to you, but I think I'll have a go myself, as I need this in Akita:

Update jwm_menu_create:

- try to remove duplicates if they end up in same sub category

- maybe remove all non JWM .desktop files??

For example, in a .desktop file, we can add 'WM=openbox' or 'WM=windowmaker', and jwm_menu_create can skip any files which contain WM= (when not WM=jwm)...
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#57 Post by technosaurus »

sc0ttman wrote:I had some thoughts, these may not be of any use to you, but I think I'll have a go myself, as I need this in Akita:

Update jwm_menu_create:

- try to remove duplicates if they end up in same sub category

- maybe remove all non JWM .desktop files??

For example, in a .desktop file, we can add 'WM=openbox' or 'WM=windowmaker', and jwm_menu_create can skip any files which contain WM= (when not WM=jwm)...
Part 1 is doable just keep a throwaway variable that contains each subcategory as it is added then use a case ... to check before adding

The 2nd seems like non standard .desktop files, so probably not, however I could have it optionally scan an additional directory like maybe:
$HOME/.jwm/applications/*.desktop
/usr/share/applications.jwm/*.desktop
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

problems after jwm2-505.pet added!

#58 Post by scsijon »

Technosausus, with jwm2-505's pet loaded, jwm tools no longer works properly.

I'm getting :

a 2x3 virtual desktop, even if set as 1x1 in jwm config manager, and I can't change it;

multiple menu items for the same application appearing;

it won't start (but no error message either onscreen or the logs).

If I unload 0.8 it's all back to normal(, 0.7 gives the same result).

Could you have a look please.

thanks
scsijon

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#59 Post by technosaurus »

jwm config manager is not distributed with jwm_tools and probably makes some assumptions about include files, you can try jwm_param_gui (requires yad) - thus far that is the only gui that is supported (but it doesn't currently have a menu entry) or if you find out what include file jwm config manager stores the desktop config in, I can add it to the list of include files that are there to support other/legacy jwm config apps (though it would be much better to to just have jwm config modify the JWMRC file directly if possible)

The multiple menu items are there because the developers wanted it to be in multiple categories (they put multiple categories in the .desktop file) If you use submenus, there shouldn't be duplicates in the same submenu though.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

scsijon
Posts: 1596
Joined: Thu 24 May 2007, 03:59
Location: the australian mallee
Contact:

#60 Post by scsijon »

technosaurus wrote: If you use submenus, there shouldn't be duplicates in the same submenu though.
their are though, in at least the latest wary and lucid528!

and sorry but the first paragraph is goggledegoop to me this morning, rebuilding after losing the dev box's brand new hard drive is still getting to me. The jwm config manager is part of puppy, and to use the gui I also need to have yad installed, is that right?

regards
scsijon

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#61 Post by sc0ttman »

to remove duplicates, using a quick dirty fix (im too dumb to understand technos guide above):

remove all tabs and spaces fro mthe start of the <Program> lines

then, right at the end of the script, echo it all to a VAR, then 'uniq' then echo to .jwmrc

# ugly fix to remove duplicates that end up in the same sub menu
FILE1=`cat ${HOME}/.jwmrc | uniq `
echo "$FILE1" > ${HOME}/.jwmrc#

this totally goes against the shell only thing, but it works
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#62 Post by technosaurus »

Hmm interesting solution, could probably pipe it through unique when echoing it to the .jwmrc[/img]
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#63 Post by technosaurus »

I have made some changes to eliminate duplicate menu entries and added support for keybindings... It borks the pretty formatting in the jwmrc, but it works, so I will upload when I get home.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#64 Post by technosaurus »

v0.9 is uploaded and ready for testing, see initial post
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#65 Post by 01micko »

Ok, trialling this in Slacko on my lappy with jwm-svn572.

This works fine:

Code: Select all

jwm_menu_create && jwm -reload.
*If* I were to use this in the next release this is what I think I would have to do:
  • patch petget to run jwm_menu_create && jwm -reload (or -restart depending on version)
    patch the jwm_install_menu_create to read /etc/DISTRO_SPECS which provides DISTRO_FILE_PREFIX (eg "slacko", "wary5", "dpup") and only show those repos, maybe cross reference with ~/.packages/woof-installed-packages for obvious reasons, also filter out the DISTRO_COMPAT_REPOS with "Packages-puppy-*" instead of "Packages-"
    ---Possible support for closest geographical repo based on locale???
    set 'DRIVES=""' as default since I'm using rox-desktop
    anything anyone else can think of?
I really like the speed, simplicity and ease of use, not to mention built in locale support.
Attachments
jwm1.png
(99.51 KiB) Downloaded 799 times
Puppy Linux Blog - contact me for access

Post Reply