At 21:19 +0000 20/3/2002, Mikhael Goikhman wrote:
>On 20 Mar 2002 15:49:43 -0500, Victor Eijkhout wrote:
>>
>> I'm trying to add/delete desktops dynamically.
>>
>> This is a form for adding a desktop:
>> DestroyModuleConfig AddDesk: *
>> *AddDesk: WarpPointer
>> *AddDesk: Line left
>> *AddDesk: Text "Add new desktop:"
>> *AddDesk: Line expand
>> *AddDesk: Input deskname 20 ""
>> *AddDesk: Button quit "OK" ^M
>> *AddDesk: Command Exec cd $HOME/.fvwm ; \
>> echo *FvwmPager: Label $d \"$(deskname)\" >> page_labels ; \
>> sort_labels ; count_desks
>> *AddDesk: Command restart_pager
>> *AddDesk: Button quit "Cancel"
>>
>> It calls two shell scripts to keep the labels sorted, and to update
>> the number of desks in the Module FvwmPager command, which is also in
>> a separate file.
>>
>> Restarting the pager goes like this:
Changed to
DestroyFunc restart_pager
AddToFunc restart_pager
+ "I" KillModule FvwmPager
+ "I" DestroyModuleConfig FvwmPager
+ "I" Read $[HOME]/.fvwm/pager_style
+ "I" Read $[HOME]/.fvwm/page_labels
+ "I" Read $[HOME]/.fvwm/pager_start
where
% cat pager_style
# options for the pager window
Style "FvwmPager" Sticky,StaysOnTop,NoTitle
# : yellow frame
Style "FvwmPager" Color white/yellow
*FvwmPager: Geometry -0+35
# options for the contents of the pager
*FvmwPagerWindowColors yellow gray blue black
# desktop organisation
DeskTopSize 2x1
% cat page_labels
*FvwmPager: Label 0 "stuff"
*FvwmPager: Label 1 "docs"
*FvwmPager: Label 2 "a"
*FvwmPager: Label 3 "NSDL"
*FvwmPager: Label 4 "Atlas"
% cat pager_start
Module FvwmPager 0 4
*FvwmPager: Rows 5
*FvwmPager: Columns 1
So
-- the current desk was #1 "docs", out of "stuff, docs, NSDL, Atlas"
-- I added desk "a"
-- kill the pager and its config
-- read the style, labels, and start files
and what is displayed is a pager with 4 desks: "stuff, a, NSDL,
Atlas", which does not correspond to the input files.
> > The problem is that the pager gets killed and restarted, but it
>> doesn't have its proper size. It shows up without the extra desk,
>> even though the configuration files that are supposed to get read do
>> show the right number.
>>
> > The weird thing is that if I again issue the restart_pager command
> > the new size does become effective. I've tried all sorts of things
>> and I don't understand what's happening here.
>
>You did not provide your pager_start and pager_style files plus
Above.
>sort_labels and count_desks scripts, so I may only guess what they do.
Those are shell scripts that keep the labels sorted and keep the
numbers on the "Module FvwmPager" line in sync with the number of
labels:
e% cat sort_labels
#!/bin/sh
mv page_labels page_labels.tmp
sort -k 3,3 -s page_labels.tmp \
| awk 'BEGIN {v=-1} $3==v {v=v+1; $3=v; print} $3>v {print ; v=$3}' \
> page_labels
% cat count_desks
#!/bin/sh
mv pager_start pager_start.tmp
cat pager_start.tmp \
| awk -v n=`wc -l page_labels | awk '{print $1}'` \
'/Module/ {$4=n-1} /Rows/ {$3=n} {print}' \
> pager_start
>
>Try a more correct Read order (yes, path to files is not needed here):
>
> DestroyFunc restart_pager
> AddToFunc restart_pager
> + I KillModule FvwmPager
> + I DestroyModuleConfig FvwmPager
> + I Read pager_style
> + I Read page_labels
> + I Read pager_start
Did that and it makes no difference.
--
Victor Eijkhout <eijkhout_at_cs.utk.edu>
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Wed Mar 20 2002 - 21:14:45 GMT