JWMCONFIG

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

JWMCONFIG

#1 Post by Karl Godt »

Today

/usr/local/jwmconfig2/taskbarPlace :

Code: Select all

##-----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: Select all

	<Tray autohide="false" insert="left" x="0" y="1" border="1" height="1024" valign="top" halign="right" layout="vertical" width="48" >
Attachments
taskbar-right.jpg
(184.61 KiB) Downloaded 1358 times
Last edited by Karl Godt on Sat 08 Sep 2012, 16:26, edited 2 times in total.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

Update 1 :

3 fixes in the above code :

1)
Since I use a tmp subdirectory i have to add

Code: Select all

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: Select all

CHECKCONF=`cat $TMP |grep -vi 'DEBUG:'`
3)
Changed the order of notifying if editor was not already started somewhere or configured without socket

Code: Select all

defaulttexteditor "$CONFIG" &
sleep 3
Xdialog --title "$RESTOP" --msgbox "$RESMSG" 0 0 &

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

#3 Post by sc0ttman »

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...
[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
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#4 Post by Karl Godt »

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: Select all

sed -i 's|^\([[:blank:]]*<Tray .*\)\(hight[^ ]*\)\(.*\)|\1\3|' $CONFIG
2)
adjusting grep -e syntax :

Code: Select all

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

Code: Select all

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.

darussell
Posts: 7
Joined: Thu 04 Oct 2012, 16:53

Missing Taskbar

#5 Post by darussell »

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

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

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.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#7 Post by Karl Godt »

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 :
#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: Select all

#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 :P

Post Reply