Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 24 Nov 2014, 16:26
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
JWMCONFIG
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Fri 07 Sep 2012, 13:44    Post subject:  JWMCONFIG
Subject description: Roll for fixes and improvements
 

Today

/usr/local/jwmconfig2/taskbarPlace :
Code:
##-----taskbarPlace----->>
GEO=`xwininfo -root | grep 'geometry'|awk '{print $2}' |cut -f 1 -d '+'`
GEO_X=`echo "$GEO" |cut -f 1 -d 'x'`
GEO_Y=`echo "$GEO" |cut -f 2 -d 'x'`

TMP="/tmp/JWMconfig/checklist.tmp.$$"
mkdir -p "${TMP%/*}"

TOP="0";TOPL=horizontal;TOPA=right;TOPH=28;TOPV=top;TOPW=$GEO_X
BTM="-1";BTML=horizontal;BTMA=left;BTMH=28;BTMV=bottom;BTMW=$GEO_X
RIG='1';RIGL=vertical;RIGA=right;RIGH=$((GEO_Y));RIGV=top;RIGW=48
LEF='2';LEFL=vertical;LEFA=left;LEFH=$((GEO_Y));LEFV=top;LEFW=48

CONFIG="/root/.jwmrc-tray"
CONFIG2="/root/.jwmrc-tray-bak"
CONF="/root/.jwmrc-tray-temp"

check_config(){
#------check new configuration----->>
jwm -p 2> $TMP
CHECKCONF=`cat $TMP | grep -vi 'DEBUG:'`
if [ "$CHECKCONF" ]; then
RESMSG="Current configuration not OK:\n$CHECKCONF\nLaunching Editor ..."
RESTOP="Refusing to continue."
defaulttexteditor "$CONFIG" &
sleep 3
Xdialog --title "$RESTOP" --msgbox "$RESMSG" 0 0 &
exit 1
fi
}
check_config

#---get value--->

   SET_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* y="([-[:digit:]]*)"|^<Tray .* y="([-[:digit:]]*)"' $CONFIG | sed 's|\(.* y="\)\([-[:digit:]]*\)\(" .*\)|\2|'`
LAYOUT_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* layout="([[:alpha:]]*)"|^<Tray .* layout="([[:alpha:]]*)"' $CONFIG | sed 's|\(.* layout="\)\([[:alpha:]]*\)\(" .*\)|\2|'`
HALIGN_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* halign="([[:alpha:]]*)"|^<Tray .* halign="([[:alpha:]]*)"' $CONFIG | sed 's|\(.* halign="\)\([[:alpha:]]*\)\(" .*\)|\2|'`
 HEIGHT_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* height="([[:digit:]]*)"|^<Tray .* height="([[:digit:]]*)"' $CONFIG | sed 's|\(.* height="\)\([[:digit:]]*\)\(" .*\)|\2|'`
VALIGN_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* valign="([[:alpha:]]*)"|^<Tray .* valign="([[:alpha:]]*)"' $CONFIG | sed 's|\(.* valign="\)\([[:alpha:]]*\)\(" .*\)|\2|'`
 WIDTH_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* width="([[:digit:]]*)"|^<Tray .* width="([[:digit:]]*)"' $CONFIG | sed 's|\(.* width="\)\([[:digit:]]*\)\(" .*\)|\2|'`
echo SET_NOW=$SET_NOW
echo LAYOUT_NOW=$LAYOUT_NOW
echo HALIGN_NOW=$HALIGN_NOW
echo HEIGHT_NOW=$HEIGHT_NOW
echo VALIGN_NOW=$VALIGN_NOW
echo WIDTH_NOW=$WIDTH_NOW

if [ "$LAYOUT_NOW" = '' ] ; then
sed -i 's|^\([[:blank:]]*<Tray .*\)\(layout[^ ]*\)\(.*\)|\1\3|' $CONFIG
sed -i 's|^\([[:blank:]]*<Tray \)\(.*\)\( .*\)|\1\2 layout="vertical"\3|' $CONFIG
sleep 1
check_config
fi

if [ "$HALIGN_NOW" = '' ] ; then
sed -i 's|^\([[:blank:]]*<Tray .*\)\(halign[^ ]*\)\(.*\)|\1\3|' $CONFIG
sed -i 's|^\([[:blank:]]*<Tray .*\)\(.*\)\( .*\)|\1\2 halign="left"\3|' $CONFIG
sleep 1
check_config
fi

if [ "$HEIGHT_NOW" = '' ] ; then
sed -i 's|^\([[:blank:]]*<Tray .*\)\(height[^ ]*\)\(.*\)|\1\3|' $CONFIG
sed -i 's|^\([[:blank:]]*<Tray .*\)\(.*\)\( .*\)|\1\2 height="28"\2|' $CONFIG
sleep 1
check_config
fi

if [ "$VALIGN_NOW" = '' ] ; then
sed -i 's|^\([[:blank:]]*<Tray .*\)\(valign[^ ]*\)\(.*\)|\1\3|' $CONFIG
sed -i 's|^\([[:blank:]]*<Tray .*\)\(.*\)\( .*\)|\1\2 valign="bottom"\3|' $CONFIG
sleep 1
check_config
fi

if [ "$WIDTH_NOW" = '' ] ; then
sed -i 's|^\([[:blank:]]*<Tray .*\)\(width[^ ]*\)\(.*\)|\1\3|' $CONFIG
sed -i "s|^\([[:blank:]]*<Tray .*\)\(.*\)\( .*\)|\1\2 width=\"$GEO_X\"\3|" $CONFIG
sleep 1
check_config
fi


AT_TOP=off;AT_BTM=off;AT_RIG=off;AT_LEF=off
case $SET_NOW in
-1) AT_BTM=on;;
0) AT_TOP=on;;
1) AT_RIG=on;;
2) AT_LEF=on;;
esac

#-----Backup current settings----->>
cp $CONFIG $CONFIG2

#-------------gui----------->>

Xdialog --backtitle "JWM Taskbar Configuration" \
   --title "Taskbar" \
        --radiolist "Choose a tray placement option" 13 46 2 \
"BOTTOM"  "Tray at Bottom of Screen." $AT_BTM \
"TOP"  "Tray at Top of Screen" $AT_TOP \
"RIGHT"  "Tray at Right Side of Screen" $AT_RIG \
"LEFT"  "Tray at Left Side of Screen2" $AT_LEF 2>$TMP

retval=$?

#--------cancel pressed----->>
case $retval in
  1 | 255) exit 0;;
esac

#---------save changes----->>

#---

SEDTOP=s!y=\"$SET_NOW\"!y=\"$TOP\"!
SEDTOQ=s!layout=\"$LAYOUT_NOW\"!layout=\"$TOPL\"!
SEDTOR=s!halign=\"$HALIGN_NOW\"!halign=\"$TOPA\"!
SEDTOS=s!height=\"$HEIGHT_NOW\"!height=\"$TOPH\"!
SEDTOT=s!valign=\"$VALIGN_NOW\"!valign=\"$TOPV\"!
SEDTOU=s!width=\"$WIDTH_NOW\"!width=\"$TOPW\"!

SEDBTM=s!y=\"$SET_NOW\"!y=\"$BTM\"!
SEDBTQ=s!layout=\"$LAYOUT_NOW\"!layout=\"$BTML\"!
SEDBTR=s!halign=\"$HALIGN_NOW\"!halign=\"$BTMA\"!
SEDBTS=s!height=\"$HEIGHT_NOW\"!height=\"$BTMH\"!
SEDBTT=s!valign=\"$VALIGN_NOW\"!valign=\"$BTMV\"!
SEDBTU=s!width=\"$WIDTH_NOW\"!width=\"$BTMW\"!

SEDRIG=s!y=\"$SET_NOW*\"!y=\"$RIG\"!
SEDRIH=s!layout=\"$LAYOUT_NOW\"!layout=\"$RIGL\"!
SEDRII=s!halign=\"$HALIGN_NOW\"!halign=\"$RIGA\"!
SEDRIJ=s!height=\"$HEIGHT_NOW\"!height=\"$RIGH\"!
SEDRIK=s!valign=\"$VALIGN_NOW\"!valign=\"$RIGV\"!
SEDRIL=s!width=\"$WIDTH_NOW\"!width=\"$RIGW\"!

SEDLEF=s!y=\"$SET_NOW*\"!y=\"$LEF\"!
SEDLEH=s!layout=\"$LAYOUT_NOW\"!layout=\"$LEFL\"!
SEDLEI=s!halign=\"$HALIGN_NOW\"!halign=\"$LEFA\"!
SEDLEJ=s!height=\"$HEIGHT_NOW\"!height=\"$LEFH\"!
SEDLEK=s!valign=\"$VALIGN_NOW\"!valign=\"$LEFV\"!
SEDLEL=s!width=\"$WIDTH_NOW\"!width=\"$LEFW\"!

POSN=`cat $TMP`
echo "POSN='$POSN'"
#-----If there new settings chosen then make the changes----->>
case $POSN in
TOP)   sed -e "$SEDTOP" $CONFIG > $CONF
sed -e "$SEDTOQ" $CONF > $CONFIG
sed -e "$SEDTOR" $CONFIG > $CONF
sed -e "$SEDTOS" $CONF > $CONFIG
sed -e "$SEDTOT" $CONFIG > $CONF
sed -e "$SEDTOU" $CONF > $CONFIG
;;
RIGHT) sed -e "$SEDRIG" $CONFIG > $CONF
sed -e "$SEDRIH" $CONF > $CONFIG
sed -e "$SEDRII" $CONFIG > $CONF
sed -e "$SEDRIJ" $CONF > $CONFIG
sed -e "$SEDRIK" $CONFIG > $CONF
sed -e "$SEDRIL" $CONF > $CONFIG
;;
LEFT)  sed -e "$SEDLEF" $CONFIG > $CONF
sed -e "$SEDLEH" $CONF > $CONFIG
sed -e "$SEDLEI" $CONFIG > $CONF
sed -e "$SEDLEJ" $CONF > $CONFIG
sed -e "$SEDLEK" $CONFIG > $CONF
sed -e "$SEDLEL" $CONF > $CONFIG
;;
BOTTOM) sed -e "$SEDBTM" $CONFIG > $CONF
sed -e "$SEDBTQ" $CONF > $CONFIG
sed -e "$SEDBTR" $CONFIG > $CONF
sed -e "$SEDBTS" $CONF > $CONFIG
sed -e "$SEDBTT" $CONFIG > $CONF
sed -e "$SEDBTU" $CONF > $CONFIG
;;
esac
#    mv $CONF $CONFIG


#------check new configuration----->>
jwm -p 2> $TMP

CHECKCONF=`cat $TMP | grep -vi 'DEBUG:'`

#----notify of result----->>
if [ "$CHECKCONF" ]; then
    RESTOP="Change Reversed"
    RESMSG="$CHECKCONF\nNew config corrupt. Keeping original"
    mv $CONFIG2 $CONFIG
else
   RESTOP="Change applied"
   RESMSG="Restart jwm to apply change"
fi


Xdialog --title "$RESTOP" --msgbox "$RESMSG" 0 0

#--------clean exit------->>
rm -f $TMP
exit 0


Support for rotating the taskbar also to the left and right side of the desktop .

Pic of jwm-492 on Puppy-Lupu-5.1.1 with ~/.jwmrc-tray main line :
Code:
   <Tray autohide="false" insert="left" x="0" y="1" border="1" height="1024" valign="top" halign="right" layout="vertical" width="48" >
taskbar-right.jpg
 Description   
 Filesize   184.61 KB
 Viewed   1063 Time(s)

taskbar-right.jpg


Last edited by Karl Godt on Sat 08 Sep 2012, 12:26; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sat 08 Sep 2012, 07:06    Post subject:  

Update 1 :

3 fixes in the above code :

1)
Since I use a tmp subdirectory i have to add
Code:
mkdir -p "${TMP%/*}"

Otherwise Xdialog would not find it's needed values.

2)
Added support for jwm -p if jwm is configured with --enable-debug :
Code:
CHECKCONF=`cat $TMP |grep -vi 'DEBUG:'`


3)
Changed the order of notifying if editor was not already started somewhere or configured without socket
Code:
defaulttexteditor "$CONFIG" &
sleep 3
Xdialog --title "$RESTOP" --msgbox "$RESMSG" 0 0 &
Back to top
View user's profile Send private message Visit poster's website 
sc0ttman


Joined: 16 Sep 2009
Posts: 2386
Location: UK

PostPosted: Sat 08 Sep 2012, 08:12    Post subject:  

Karl Godt wrote:
3 fixes in the above code

Had a quick look, might be using this sometime... Also see 'hight' in the code, not 'height'... I didn't double check but I assume that is a typo. EDIT: I see it may not be...

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sat 08 Sep 2012, 12:19    Post subject:  

Thanks , scottman for pointing me to a typo, must have forgotten about the height and high spelling since "High" became a common word in germany (Hifi etc ) .

Seems that jwm -p does not complain about a tag called "hight" and jwm starts anyway .

Next fixes :

1)
Changed HIGHT to HEIGHT and fixed a
Code:
sed -i 's|^\([[:blank:]]*<Tray .*\)\(hight[^ ]*\)\(.*\)|\1\3|' $CONFIG


2)
adjusting grep -e syntax :
Code:
LAYOUT_NOW=`grep -m 1 -e '^[[:blank:]]*<Tray .* layout="[[:alpha:]]*"' $CONFIG | sed 's|\(.* layout="\)\([[:alpha:]]*\)\(" .*\)|\2|'`

to
Code:
LAYOUT_NOW=`grep -m 1 -E -e '^([[:blank:]]*)<Tray .* layout="([[:alpha:]]*)"|^<Tray .* layout="([[:alpha:]]*)"' $CONFIG | sed 's|\(.* layout="\)\([[:alpha:]]*\)\(" .*\)|\2|'`

to support .jwmrc-tray files with missing indentation .

*
When i submit this please give me 10-15 minutes to fix the code in the first post . Edit : done.
Back to top
View user's profile Send private message Visit poster's website 
darussell

Joined: 04 Oct 2012
Posts: 7

PostPosted: Fri 05 Oct 2012, 23:11    Post subject: Missing Taskbar
Subject description: on Toshiba Libretto 800x480
 

Karl:
Wondered if you might have an idea what happened to my newly-installed Puppy Linux 4.1.2. Originally it came up with the Menu/Taskbar on a 640x480 VGA default, but somewhere along the line (possibly while modifying xorg.conf and .jwmrc-tray it managed to competely disappear. After searching through the forum I did a fixmenus and (at least) restored the right-click menu, but the menu/taskbar (bottom of screen) is still gone.

I'm new to the Linux environment, but years ago (am retired AT&T) worked in the UNIX System V environment. Anyway, years away have eroded my memory, but it's coming back, little by little.

Much appreciated (in advance.)
Don
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5042
Location: Arizona, U.S.A.

PostPosted: Sat 06 Oct 2012, 03:47    Post subject:  

Hey Karl; Little while no talk to. Your code looks impressive!
Like so many things, JWM needs a comprehensive GUI to control it.
Puppy has a good one, but as you show, JWM can do so much more.

Puppy`s desktop drive icons are a little buggy, and they clutter up the desktop.

I`ve been thinking of a slide-out panel for drive icons.
Just hover over a thin color bar along the side of the screen to activate it.
This would allow multiple color bars for panels on each screen side.
I`m contemplating writing it in BaCon as I can`t find a decent panel I like.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3972
Location: Kiel,Germany

PostPosted: Sun 14 Oct 2012, 09:58    Post subject:  

darussell , I have no knowledge about http://en.wikipedia.org/wiki/UNIX_System_V . That times I had an ATARI-800XL which corroded inside on the loft .

The Puppy tray had been always a problem at the time I joined this forum for I think one year .
Disappearances of trays were common .

To restore the /root/.jwmrc-tray file on full installations :
Keep a frugal folder with devx, main.sfs, vmlinuz, initrd.gz on top-rootfs , click the main.sfs which would run sunburnt's /usr/sbin/filemnt and navigate with the file manager around there in /root and drag'n'drop the hidden file in the place you want it .

In frugals :
Go to /initrd directory and find the directory that has the main.sfs mounted . In frugal on normal HDD PUPMODE=12 it should be /initrd/pup_ro2 i think . On flash drive PUPMODE=13 it might be different and also different in live PUPMODE=5 mode . There in /initrd/pup_*/root you should be able to find the original .jwmrc-tray file .

*

sunburnt : The only language i know is the shell language i learned while looking inside the Puppy code . I had 2 days of HTML and C printf(Hello world) . The C was very kindergarden like :

Quote:
#include <some.h>

int main (){
scanf(enter something)
printf(%s, something)
return 0
}


From what i think i have learned by make'ing i would do it like

Code:
#include <headers.h>

#define VERSION=1.0

function print_version(){
printf(%s, VERSION)
exit(0)
}

function print_usage(){
printf("Here the usage message")
exit(0)
}

function get_input(){
scanf(enter something)
return
}

function print_input(){
printf(%s something)
return
}

int main(){
while (1) {
 do_getops(){
 case param in
 help) print_usage;;
 version) print_version;;
 }
 if(get_input != 0) exit(1);
 if(print_input != 0) exit(1);
 return 0
}

_________________
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal Razz
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1031s ][ Queries: 13 (0.0084s) ][ GZIP on ]