jwm_tools-0.9 (was jwm_menu_create)

Window managers, icon programs, widgets, etc.
Message
Author
User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#31 Post by sc0ttman »

technosaurus wrote:Optimization aside, it appears that Google translate skips capitalized words (as it should, grammatically it indicates a proper name) fortunately sed has a tolower function, but then there is a twist, usually the first word _is_ a proper name. Also the localized names follow name= alphabetically by locale, so doing the read while trick could help out.

Httpd may be able to fix some of those.... http -d .... there was a thread with a better method that zigbert started for pmusic lyrics.
I was looking for a 'tolower' option :)

And you are correct, a lot of capitalized names should not be translated... To be honest, the first word of each entry should not be translated, most of the time...

And I know I should have posted it elsewhere, but my HD was/is dying on me, and I had to get it uploaded quick - I only had it in terminal, not saved (hence the needless bits/mistakes in there).. Sorry!
[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
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#32 Post by sc0ttman »

also, I read users of netbooks (and smaller screens in general) complaining that sub-menus are a real pain the neck... I personally feel no need for them, but dont mind having them.. So I'm not voting either way..
[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
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#33 Post by sc0ttman »

EDIT: translations for french, german, russian and spanish here: http://www.murga-linux.com/puppy/viewto ... 135#555135
[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
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

jwm_tools

#34 Post by L18L »

technosaurus wrote:something like this:
(for the imaginary reverse alphabet english language)

Code: Select all

#!/bin/sh
for FILE in $@; do
[ -e ${FILE} ] && sed -i "
s/a/z/
s/b/y/
s/c/x/
" ${FILE} || echo $FILE not a file >/dev/stderr
done
brilliantly simple - I like it ... and it would work for any script/text file ... but beware of translating key words in scripts (file, echo etc...)
Success in translating the original .jwmrc by simply adding double quotes and omitting keywords (there was just "false in acomment")
wary513

jwm_menu_create_translate_template:

Code: Select all

#!/bin/sh
# translation at end of jwm_menu_create
OUT="jwm_menu_create_tr"
echo -n > $OUT

cat /root/.jwmrc | grep label= | cut -d '"' -f2 > /dev/shm/jwm_menu_translate
keywords="false "
while read LINE ; do
 [[ "$keywords" =~ "$LINE" ]] || echo "s#"${LINE}#"${LINE}#g" >> $OUT
done <  /dev/shm/jwm_menu_translate

# copy $OUT to $OUT_myLANG
# translate $OUT_myLANG
# sed -f jwm_menu_create_tr_de /root/.jwmrc > /dev/shm/.jwmrc_de
# cp /dev/shm/.jwmrc_de  /root/.jwmrc
# jwm -restart
Attached a little gui for switching language of menu
technosaurus wrote:Ideally I would like to eventually be able to have a Puppy start out with only static uclibc busybox, Xvesa, jwm and terminal (+ a few helpers).
FIne, Xvesa is important for my VIA mini-ITX box :D
Attachments
jwm_languageswitcher.tar.gz
(995 Bytes) Downloaded 692 times

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

#35 Post by technosaurus »

v 0.4 is released with more translations and a bugfix that fixes broken keybindings. See initial post for .pet.

Would it be easier on everyone (read developers) if I return jwm_menu_create going to stdout instead of creating the jwmrc file directly? I could always include a wrapper script(s) for the general user.

This is a little template for my next jwm tool (jwm_image_view), I still need to write the script to go with it, but it will be similar to jwm_notify

Code: Select all

<Tray  autohide="false" insert="right" halign="center" y="1" border="0">
<TrayButton popup="Previous" label="<" ></TrayButton>
<TrayButton popup="Next" label=">" ></TrayButton>
<TrayButton popup="Smaller" label="-" ></TrayButton>
<TrayButton popup="Larger" label="+" ></TrayButton>
<TrayButton popup="Maximize" label="[]" ></TrayButton>
<TrayButton popup="Close" label="X"></TrayButton>
</Tray>

<Tray  autohide="false" insert="right" halign="center" y="28"  border="0" height="192" >
<TrayButton popup="$MESSAGE_HERE" icon="/usr/share/backgrounds/default.jpg"></TrayButton>
</Tray>
Attachments
jwm_image_view.png
(40.23 KiB) Downloaded 1247 times
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:

#36 Post by technosaurus »

Ok here is the next jwm tool as promised, you will need to add

Code: Select all

<Include>/root/.jwm/jwmrc-image</Include>
somewhere in your jwmrc ... it will be in v 0.5

Code: Select all

#!/bin/ash

while ([ $1 ]) do
case ${1} in
	*.png|*.jpg|*.xpm)[ $IMAGE1 ] && IMAGES=${IMAGES}' '${1} && IMAGELAST=${1} || IMAGE1=${1};;
	height=*)eval ${1};;
	Close)rm -rf ${HOME}/.jwm/jwmrc-image;jwm -restart;exit;;
	*);;
esac
shift
done

PREVIOUS=${IMAGELAST}' '${IMAGE1}' '${IMAGES%*${IMAGELAST}}
NEXT=${IMAGES}' '${IMAGE1}
SMALLER='height='$((${height:-192}/2))' '${IMAGE1}' '${IMAGES}
LARGER='height='$((${height:-192}*2))' '${IMAGE1}' '${IMAGES}

MAXHEIGHT=`xwininfo -root`
MAXHEIGHT=${MAXHEIGHT##*-geometry *x};
MAXHEIGHT=$((${MAXHEIGHT%%+*}-50));
MAXIMIZE='height='${MAXHEIGHT}' '${IMAGE1}' '${IMAGES}


[ $height ] && height='height="'$height'"'
echo '<JWM><Tray  autohide="false" halign="center" y="1" border="0">
	<TrayButton popup="Previous - not yet implemented" label="<" >exec:jwm_image_view '${height}' '${PREVIOUS}'</TrayButton>
	<TrayButton popup="Next - not yet implemented" label=">" >exec:jwm_image_view '${height}' '${NEXT}'</TrayButton>
	<TrayButton popup="Smaller" label="-" >exec:jwm_image_view '${SMALLER}'</TrayButton>
	<TrayButton popup="Larger" label="+" >exec:jwm_image_view '${LARGER}'</TrayButton>
	<TrayButton popup="Maximize" label="[]" >exec:jwm_image_view '${MAXIMIZE}'</TrayButton>
	<TrayButton popup="Close" label="X">exec:jwm_image_view Close</TrayButton>
</Tray>
<Tray  autohide="false" halign="center" y="25"  border="2" '$height' >
<TrayButton popup="'${IMAGE1}'" icon="'${IMAGE1:-mini-dog.xpm}'">exec:jwm_image_view Close</TrayButton>
</Tray></JWM>' > ${HOME}/.jwm/jwmrc-image
jwm -restart
Note: I intentionally used xwininfo because it has been ported to xcb and will compile into a low resource binary with uclibc or musl. Let me know if anyone has a shell only way that will work in Xorg _and_ Xvesa to get the screen resolution.

I think for Xorg I can look in xorg.conf for "PreferredMode"
  • Option "PreferredMode" "####x###"
usually Xvesa has its own file in /etc/videomode too
  • 0x011B 1280x800x24
does anyone know if these are consistent across hardware and puppy versions?
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
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#37 Post by Bert »

JWM Menu categories Dutch translation.

Code: Select all

nl*)   #Dutch
      jwm_Desktop="Bureaublad"
      jwm_DesktopSettings="Bureaublad Instellingen"
      jwm_DesktopCountry="Land Instellingen"
      jwm_DesktopApplets="Applets"
      jwm_System="Systeem"
      jwm_SystemConfig="Systeem Configuratie"
      jwm_SystemMemory="Apparaten"
      jwm_SystemSchedule="Planning"
      jwm_Setup="Instellingen"
      jwm_SetupEntry=""
      jwm_SetupWizard="Wizard Instellingen"
      jwm_SetupUtility="Hulpmiddelen"
      jwm_Utility="Hulpmiddelen"
      jwm_UtilityUtilities=""
      jwm_UtilityArchiving="Archief"
      jwm_UtilityConsole="Terminal"
      jwm_Filesystem="Bestandssysteem"
      jwm_FilesystemManager="Bestandsbeheer"
      jwm_FilesystemMount="Schijven aan-/afkoppelen"
      jwm_FilesystemUtilities="Hulpprogramma's"
      jwm_FilesystemFind="Vinden"
      jwm_Graphic="Grafisch"
      jwm_GraphicGraphics=""
      jwm_GraphicEdit="Grafische editor"
      jwm_GraphicUtility="Hulpprogramma's"
      jwm_Document="Document"
      jwm_DocumentCompose="Opstellen"
      jwm_DocumentText="Tekst"
      jwm_DocumentUtilities="Hulpoprogramma's"
      jwm_Business="Zakelijk"
      jwm_BusinessSheets="Rekenblad"
      jwm_BusinessCalculator="Rekenmachine"
      jwm_BusinessUtilities="Hulpprogramma's"
      jwm_Personal="Persoonlijk"
      jwm_PersonalPlan="Agenda"
      jwm_PersonalUtilities="Hulpprogramma's"
      jwm_Network="Netwerk"
      jwm_NetworkDialup="Inbel-netwerk"
      jwm_NetworkRemote="Netwerk"
      jwm_Internet="Internet"
      jwm_InternetWWW=""
      jwm_Multimedia=""
      jwm_MultimediaMedia=""
      jwm_MultimediaBurn="Media branden"
      jwm_Fun="Spelletjes"
      jwm_Help="Hulp"
      jwm_Shutdown="Afsluiten"
      jwm_Exit="Exit naar prompt"
      jwm_Reboot="Herstarten"
      jwm_Poweroff="Computer afsluiten"
      jwm_RestartX="X herstarten"
      jwm_RestartJWM="JWM herstarten"
      ;; 
Image
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

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

#38 Post by sc0ttman »

0.4 is looking awesome!!
technosaurus wrote:Would it be easier on everyone (read developers) if I return jwm_menu_create going to stdout instead of creating the jwmrc file directly? I could always include a wrapper script(s) for the general user.
That would be nice, although to be honest, I dont see myself redirecting it anywhere else - as long as I have a backup .jwmrc I don't really mind replacing it directly...

And obviously I am no expert, but I have used the Xvesa videomode file to get resolutions in Puppy Arcade.. As far as I remember it works fine..
[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:

jwm_tools-0.5

#39 Post by technosaurus »

jwm_tools-0.5 released see initial post for .pet
Changelog:
v 0.5
added jwm_image_view ... usage: jwm_image_view [images]
add drive tray ... usage jwm_create_drives
fixed a bug in jwm_notify -- used by the drive tray
removed static ${HOME}/.jwm/jwmrc-install - autogenerate with jwm_install_menu_create
blacklisted only BuildingBlock,DOC,DEV in jwm_install_menu_create (NLS should appear now)
added TODOs
- split out localizations in separate files to be sources
- background setting - already have image_viewer & gtk2jwm for the colors
Attachments
jwm_tools-0.5.png
jwm_image_view (viewing /usr/sjare/backgrounds/*)
drive tray (using 24x24 pngs at bottom center)
install menu open in the top left
(45.94 KiB) Downloaded 1144 times
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:

#40 Post by technosaurus »

Ok, I now have a goal for the 1.0 version

I am tired of simple little changes to the "static" xml files (which are still valid xml) borking some aspect of something. There a several different tools out there with various methods of poking/prodding the xml with the shell to beat it into submission and as many different styles of breaking it all out. So I tried to come up with the simplest way to fix/support all of these issues/concerns.

as I posted in the pupngo thread

I think I have come up with a way to let users (or pupleteers) choose and support everywhere from a single jwmrc to a separate include for every parameter. Almost too simple, so I am sure it will need tweaks....

just use a separate config file with

Var1=
Var2=
... where the vars are all the parameters covered in http://joewing.net/programs/jwm/config.shtml

Easily sourced by...for instance?
. $HOME/.JWMRC
A program could choose to use only 1 or all vars to generate 1 or many xml files

And it would be fast and easy to modify with the while read line case format.

Thoughts?
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
maxerro
Posts: 53
Joined: Sun 10 Oct 2010, 16:11

#41 Post by maxerro »

From users' point of view the advantage would be that they could quickly define several jwm profiles that they could switch easily. Or the emphasis is on detail of customization?

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

#42 Post by technosaurus »

not sure the question, but maybe this will answer it

v0.6 is released


1. monolithic configuration file that can easily be used by any program to know what the jwm settings are, use them, change them etc... without having to hack at xml files with the shell
2. script to modify the configuration file (up to 9 parameters at a time)
3. jwm_menu_create now uses the config file (at ${HOME}/.jwm/JWMRC) to set almost all parameters (tray, keys and groups not yet implemented - see ${HOME}/.jwm/jwmrc-extra)
4. Submenus and drive icon tray are now enabled/disabled via JWMRC
5. drive tray is now part of the main .jwmrc if enabled
6 removable drives now display a usb icon (devicehandler doesn't however have an unmount option... or other frills )
7. jwm_notify and jwm_image_view now share a temporary jwmrc file (${HOME}/.jwm/jwmrc-tmp)
8. add jwm_param_set to modify jwm settings
usage:
jwm_param_set 'DRIVES="true"'
jwm_menu_create && jwm -restart
#will rebuild the jwmrc and include a drive tray at bottom center
jwm_param_set 'DRIVES=""'
jwm_menu_create && jwm -restart
#will rebuild the jwmrc and exclude the drive tray at bottom center
even with the extra

a gui wrapper can just do this

Code: Select all

. ${HOME}/.jwm/JWMRC 
#bunch of gui crud here
jwm_param_set 'PARAM1="'${VALUE}'"' ... 
jwm_menu_create && jwm -restart
note the double and single quotes in jwm_param_set --- I find it easier to use than backslashing quotes (which are needed becaus some params have spaces or begin with a #)
Attachments
jwm_tools-0.6.pet
(11.14 KiB) Downloaded 686 times
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
maxerro
Posts: 53
Joined: Sun 10 Oct 2010, 16:11

#43 Post by maxerro »

Yes, I can modify the JWMRC (among other things) to answer my question. Thanks.
You have a couple of suggestions in PM. Hope at least some of them will be useful.

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

jwm_tools-0.6

#44 Post by L18L »

As I had some difficulties applying jwm_param_set I was using sed again :)

Code: Select all

#!/bin/sh
# jwm-tools-gui
# TODO: what about comments in config file?
#       color selectors, checkboxes,...

# 2 file locations
new_values="/dev/shm/jwm_tools_gui"
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"  --image="gtk-preferences" --text="$text1" --height=300 \
      --list --multiple \
      --column="" \
| tr '|' ' ' )
choice=$?
[[ $choice -eq 1 || $choice -eq 252 ]] && exit 0      
 
# let user change selected values 
echo -n "" > $new_values
for ONEchange in $change_it
do
     param=`echo $ONEchange | cut -d '"' -f 1`
 old_value=`echo $ONEchange | cut -d '"' -f 2`
 
 new=$(echo $ONEchange \
      | yad --image="gtk-edit" --text="$text2" \
            --form \
            --field="$param" "$old_value" \
      | cut -d '|' -f1 
      )

 echo "s#${param}\"${old_value}\"#${param}\"$new\"#"  >>$new_values   
done

#apply changes
mv $conf ${conf}tmp
sed -f $new_values ${conf}tmp > $conf
sync
jwm_menu_create && jwm -restart

#end
How can
param=`echo $ONEchange | cut -d '"' -f 1`
be coded without cut :?:
Attachments
jwm_tools_gui.png
1st attempt
(16.21 KiB) Downloaded 1031 times

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

#45 Post by technosaurus »

cut/sed can normally replaced by string manipulations

lets say:

VARNAME='BG="/usr/share/backgrounds/default.jpg"'

and you want this value
NEWVAL=/usr/share/backgrounds/newbg.jpg

echo ${VARNAME//${VARNAME#*=}/\"$NEWVAL\"}


(for more info google bash substring manipulation)

but if you would rather use jwm_param_set, I probably wasn't clear enough on the format

jwm_param_set 'VAR1="value1"' 'VAR2="value2"'
#note double quotes (blue) around value and single quotes (red) around each parameter
I am sure there is a better way to set them, this was the first one I came up with to change multiple parameters while respecting # (in colors) and spaces (font names)
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_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].

Post Reply