1UseGettext
2WindowLocaleTitle {Screen Setup}
3WindowSize 695 400		# Taille
4Font "xft:monospace:pixelsize=11;"
5
6Init
7 Begin
8  WarpPointer 1
9
10  Set $FILE=(GetScriptArgument 1)
11  If $FILE=={} Then
12   Set $FILE={.xinitrc-fvwm}
13  Set $CAT={cat ~/} $FILE
14
15  #Screen Saver
16  Set $pos=0
17  Set $finish=1
18  While $finish=={1} Do
19  Begin
20    Set $pos=(Add $pos 1)
21    Set $tmp=(GetOutput {xset -q} $pos 1)
22    If $tmp=={Screen} Then
23      Set $finish=0
24    If $pos=={50} Then
25      Set $finish=0
26  End
27  If $pos=={50} Then
28  Begin
29   Do {Echo ScreenSetup: uncompatible xset}
30   #Quit
31  End
32  Set $pos=(Add $pos 1)
33  If (GetOutput  {xset -q} $pos 3) == {yes} Then
34   ChangeValue 10 1
35  Else
36   ChangeValue 11 1
37  Set $pos=(Add $pos 1)
38  ChangeTitle 14 (GetOutput {xset -q} $pos 2)
39  ChangeTitle 15 (GetOutput {xset -q} $pos 4)
40
41  # Dpms
42  Set $pos=0
43  Set $finish=1
44  While $finish=={1} Do
45  Begin
46    Set $pos=(Add $pos 1)
47    Set $tmp=(GetOutput {xset -q} $pos 1)
48    If $tmp=={Font} Then
49      Set $finish=0
50    If $pos=={30} Then
51      Set $finish=0
52  End
53  If $pos=={50} Then
54  Begin
55   Do {Echo ScreenSetup: uncompatible xset}
56   Quit
57  End
58  Set $pos=(Add $pos 4)
59  ChangeTitle 63 (GetOutput {xset -q} $pos 2)
60  ChangeTitle 65 (GetOutput {xset -q} $pos 4)
61  ChangeTitle 67 (GetOutput {xset -q} $pos 6)
62  Set $pos=(Add $pos 1)
63  If (GetOutput  {xset -q} $pos 3) == {Enabled} Then
64   ChangeValue 60 1
65  Else
66   ChangeValue 61 1
67
68  # Background
69  Set $pos=0
70  Set $finish=1
71  While $finish=={1} Do
72  Begin
73    Set $pos=(Add $pos 1)
74    Set $tmp=(GetOutput $CAT $pos 1)
75    If $tmp=={#ScreenMark} Then
76      Set $finish=0
77    If $pos=={50} Then
78      Set $finish=0
79  End
80  ChangeValue 4 0
81  ChangeValue 5 0
82  ChangeValue 50 1
83  Set $BColor={#0EC4B8}
84  ChangeTitle 7 {~/}
85  #ChangeIcon 8 /usr/include/X11/pixmaps/fvwm2.xpm
86  Set $pos=(Add $pos 1)
87  Set $test=(GetOutput  $CAT $pos 1)
88  If $test=={fvwm-root} Then
89  Begin
90   ChangeTitle 7 (GetOutput  $CAT $pos 2)
91   ChangeIcon 8 (GetTitle 7)
92   ChangeValue 50 0
93   ChangeValue 5 1
94  End
95  If $test=={xsetroot} Then
96  Begin
97   Set $BColor=(StrCopy (GetOutput  $CAT $pos 3) 2 8)
98   ChangeValue 4 1
99   ChangeValue 50 0
100   ChangeTitle 24 $BColor
101   ChangeBackColor 6 $BColor
102   ChangeValue 20 (HexToNum (StrCopy $BColor 2 3))
103   ChangeValue 21 (HexToNum (StrCopy $BColor 4 5))
104   ChangeValue 22 (HexToNum (StrCopy $BColor 6 7))
105  End
106  # xscreensaver
107  Set $pos=(Add $pos 3)
108  Set $xsstest=(GetOutput $CAT $pos 1)
109  If $xsstest=={xscreensaver} Then
110   ChangeValue 72 1
111End
112
113PeriodicTasks
114 Begin
115  Set $MSG=(ReceivFromScript $BROWSER)
116  If $MSG <> {No message} Then
117  Begin
118   ChangeTitle 7 $MSG
119   ChangeIcon 8 $MSG
120  End
121 End
122
123#-----------------------------------------------------------------------------
124# Ok, apply and cancel buttons
125
126Widget 1
127Property
128 Size 85 20
129 Position 110 355
130 Type PushButton
131 Flags NoReliefString
132 LocaleTitle {Apply}
133Main
134 Case message of
135  SingleClic :
136  Begin
137   # Background
138   If (GetValue 5) == 1 Then
139    Do {Exec fvwm-root } (GetTitle 7)
140   If (GetValue 4) == 1 Then
141    Do {Exec xsetroot -solid "} $BColor {"}
142   # screen-saver
143   Do {Exec xset s } (GetTitle 14) { } (GetTitle 15)
144   If (GetValue 10)==1 Then
145    Do {Exec xset s blank}
146   Else
147    Do {Exec xset s noblank}
148   # dpms
149   If (GetValue 60)==1 Then
150    Do {Exec xset dpms } (GetTitle 63) { } (GetTitle 65) { } (GetTitle 67)
151   Else
152    Do {Exec xset -dpms}
153   # xscreensaver
154   If (GetValue 72) == 1 Then
155   Begin
156    Do {Exec xscreensaver-command -exit}
157    Do {Exec xscreensaver -no-splash&}
158   End
159   Else
160    Do {Exec exec xscreensaver-command -exit}
161  End
162End
163
164Widget 2
165Property
166 Size 85 20
167 Position 305 355
168 Type PushButton
169 Flags NoReliefString
170 LocaleTitle {Save}
171Main
172 Case message of
173  SingleClic :
174  Begin
175   WriteToFile $FILE {#ScreenMark}
176
177   # Background
178   If (GetValue 5)==1 Then
179   Begin
180    Do {Exec fvwm-root } (GetTitle 7)
181    WriteToFile $FILE {fvwm-root } (GetTitle 7)
182   End
183   If (GetValue 4)==1 Then
184   Begin
185    Do {Exec xsetroot -solid "} $BColor {"}
186    WriteToFile $FILE {xsetroot -solid "} $BColor {"}
187   End
188   If (GetValue 50)==1 Then
189     WriteToFile $FILE {#xsetroot -solid "} $BColor {"}
190
191   # saver
192   If (GetValue 10)==1 Then
193    Set $tmp2 = { s blank}
194   Else
195    Set $tmp2 = { s noblank}
196   Do {Exec xset s } (GetTitle 14) { } (GetTitle 15) $tmp2
197   WriteToFile $FILE {xset s } (GetTitle 14) { } (GetTitle 15) $tmp2
198
199   # dpms
200   If (GetValue 60)==1 Then
201   Begin
202    Do {Exec xset dpms } (GetTitle 63) { } (GetTitle 65) { } (GetTitle 67)
203    WriteToFile $FILE {xset dpms } (GetTitle 63) { } (GetTitle 65) { } (GetTitle 67)
204   End
205   Else
206   Begin
207    Do {Exec xset -dpms}
208    WriteToFile $FILE {xset -dpms}
209   End
210
211   # xscreensaver
212   If (GetValue 72) == 1 Then
213   Begin
214    Do {Exec xscreensaver-command -exit}
215    Do {Exec xscreensaver -no-splash&}
216    WriteToFile $FILE {xscreensaver -no-splash&}
217   End
218   Else
219   Begin
220    Do {Exec exec xscreensaver-command -exit}
221    WriteToFile $FILE {#xscreensaver}
222   End
223
224   Do {Exec chmod +x } $FILE
225   #Quit
226  End
227End
228
229Widget 3
230Property
231 Size 85 20
232 Position 500 355
233 Type PushButton
234 Flags NoReliefString
235 LocaleTitle {Quit}
236Main
237 Case message of
238  SingleClic :
239  Begin
240   Quit
241  End
242End
243
244#----------------------------------------------------------------------------
245# Left rectangle
246
247Widget 16
248Property
249 Size 410 330
250 Position 10 13
251 Type Rectangle
252Main
253 Case message of
254  SingleClic :
255  Begin
256  End
257End
258
259Widget 18
260Property
261 Position 15 5
262 Type ItemDraw
263 Flags NoReliefString NoFocus
264 LocaleTitle {Background}
265Main
266 Case message of
267  SingleClic :
268  Begin
269  End
270End
271
272#---------- Uniform color
273
274Widget 4
275Property
276 Position 30 30
277 Type RadioButton
278 Flags NoReliefString
279 LocaleTitle {Uniform color:}
280Main
281 Case message of
282  SingleClic :
283  Begin
284   ChangeValue 4 1
285   ChangeValue 5 0
286   ChangeValue 50 0
287  End
288End
289
290Widget 6
291Property
292 Size 50 50
293 Position 60 80
294 Flags NoFocus
295 Type ItemDraw
296 BackColor {#0EC4B8}
297Main
298 Case message of
299  SingleClic :
300  Begin
301  End
302End
303
304Widget 23
305Property
306 Size 60 60
307 Position 55 75
308 Type Rectangle
309Main
310 Case message of
311  SingleClic :
312  Begin
313  End
314End
315
316Widget 24
317Property
318 Size 50 50
319 Position 58 140
320 Type ItemDraw
321 Flags NoReliefString NoFocus
322 Title {#0EC4B8}
323Main
324 Case message of
325  SingleClic :
326  Begin
327  End
328End
329
330Widget 20
331Property
332 Size 200 20
333 Position 195 20
334 Type HScrollBar
335 Flags NoReliefString
336 Value 14
337 MinValue 0
338 MaxValue 255
339Main
340 Case message of
341  SingleClic :
342  Begin
343   Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
344   ChangeTitle 24 $BColor
345   ChangeBackColor 6 $BColor
346  End
347End
348
349Widget 21
350Property
351 Size 200 20
352 Position 195 75
353 Type HScrollBar
354 Flags NoReliefString
355 Value 196
356 MinValue 0
357 MaxValue 255
358Main
359 Case message of
360  SingleClic :
361  Begin
362   Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
363   ChangeTitle 24 $BColor
364   ChangeBackColor 6 $BColor
365  End
366End
367
368Widget 22
369Property
370 Size 200 20
371 Position 195 130
372 Type HScrollBar
373 Flags NoReliefString
374 Value 184
375 MinValue 0
376 MaxValue 255
377Main
378 Case message of
379  SingleClic :
380  Begin
381   Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
382   ChangeTitle 24 $BColor
383   ChangeBackColor 6 $BColor
384  End
385End
386
387#--------- Pixmaps
388
389Widget 5
390Property
391 Position 30 220
392 Type RadioButton
393 Flags NoReliefString
394 LocaleTitle {Pixmap:}
395Main
396 Case message of
397  SingleClic :
398  Begin
399   ChangeValue 4 0
400   ChangeValue 5 1
401   ChangeValue 50 0
402  End
403End
404
405Widget 7
406Property
407 Size 230 30
408 Position 30 280
409 Type TextField
410 Flags NoReliefString
411 Title {~/}
412Main
413 Case message of
414  SingleClic :
415  Begin
416   ChangeIcon 8 (GetTitle 7)
417  End
418End
419
420Widget 25
421Property
422 Position 300 279
423 Type PushButton
424 Flags NoReliefString
425 LocaleTitle {Browser...}
426Main
427 Case message of
428  SingleClic :
429  Begin
430   Set $ARG={FvwmScript-FileBrowser } (GetTitle 7) { Hello word}
431   Set $BROWSER=(LaunchScript $ARG )
432  End
433End
434
435Widget 8
436Property
437 Size 175 75
438 Position 120 195
439 Flags NoReliefString NoFocus
440 Type ItemDraw
441 Icon /usr/X11/include/X11/pixmaps/fvwm2.xpm
442Main
443 Case message of
444  SingleClic :
445  Begin
446  End
447End
448
449Widget 9
450Property
451 Size 179 79
452 Position 118 193
453 Type Rectangle
454Main
455 Case message of
456  SingleClic :
457  Begin
458  End
459End
460
461#--------- Disabled
462
463Widget 50
464Property
465 Position 30 320
466 Type RadioButton
467 Flags NoReliefString
468 LocaleTitle {Disable xinit background}
469Main
470 Case message of
471  SingleClic :
472  Begin
473   ChangeValue 4 0
474   ChangeValue 5 0
475   ChangeValue 50 1
476  End
477End
478
479#----------------------------------------------------------------------------
480# Right up rectangle
481
482
483Widget 17
484Property
485 Size 260 105
486 Position 425 13
487 Type Rectangle
488Main
489 Case message of
490  SingleClic :
491  Begin
492  End
493End
494
495Widget 19
496Property
497 Position 430 5
498 Type ItemDraw
499 Flags NoReliefString NoFocus
500 LocaleTitle {Screen-saver}
501Main
502 Case message of
503  SingleClic :
504  Begin
505  End
506End
507
508
509Widget 10
510Property
511 Position 430 40
512 Type RadioButton
513 Flags NoReliefString
514 LocaleTitle {Blank}
515Main
516 Case message of
517  SingleClic :
518  Begin
519   ChangeValue 11 0
520  End
521End
522
523Widget 12
524Property
525 Position 520 40
526 Type ItemDraw
527 Flags NoReliefString NoFocus
528 LocaleTitle {Timeout(s):}
529Main
530 Case message of
531  SingleClic :
532  Begin
533  End
534End
535
536Widget 14
537Property
538 Size 60 79
539 Position 615 37
540 Flags NoReliefString
541 Type TextField
542Main
543 Case message of
544  SingleClic :
545  Begin
546  End
547End
548
549Widget 11
550Property
551 Position 430 85
552 Type RadioButton
553 Flags NoReliefString
554 LocaleTitle {Pattern}
555Main
556 Case message of
557  SingleClic :
558  Begin
559   ChangeValue 10 0
560  End
561End
562
563
564Widget 13
565Property
566 Position 520 85
567 Type ItemDraw
568 Flags NoReliefString NoFocus
569 LocaleTitle {Cycle(s):}
570Main
571 Case message of
572  SingleClic :
573  Begin
574   ChangeValue 10 0
575  End
576End
577
578Widget 15
579Property
580 Size 60 79
581 Position 615 82
582 Flags NoReliefString
583 Type TextField
584Main
585 Case message of
586  SingleClic :
587  Begin
588   ChangeValue 10 0
589  End
590End
591
592
593#----------------------------------------------------------------------------
594# Right middle rectangle
595
596
597Widget 57
598Property
599 Size 260 135
600 Position 425 128
601 Type Rectangle
602Main
603 Case message of
604  SingleClic :
605  Begin
606  End
607End
608
609Widget 59
610Property
611 Position 430 120
612 Type ItemDraw
613 Flags NoReliefString NoFocus
614 LocaleTitle {DPMS}
615Main
616 Case message of
617  SingleClic :
618  Begin
619  End
620End
621
622
623Widget 60
624Property
625 Position 440 150
626 Type RadioButton
627 Flags NoReliefString
628 LocaleTitle {Enable}
629Main
630 Case message of
631  SingleClic :
632  Begin
633   ChangeValue 61 0
634  End
635End
636
637
638Widget 61
639Property
640 Position 580 150
641 Type RadioButton
642 Flags NoReliefString
643 LocaleTitle {Disable}
644Main
645 Case message of
646  SingleClic :
647  Begin
648   ChangeValue 60 0
649  End
650End
651
652Widget 62
653Property
654 Position 440 180
655 Type ItemDraw
656 Flags NoReliefString NoFocus
657 LocaleTitle {Standby(s):}
658Main
659 Case message of
660  SingleClic :
661  Begin
662  End
663End
664
665Widget 63
666Property
667 Size 60 20
668 Position 560 177
669 Type TextField
670 Flags NoReliefString
671 LocaleTitle{1000}
672Main
673 Case message of
674  SingleClic :
675  Begin
676  End
677End
678
679Widget 64
680Property
681 Position 440 205
682 Type ItemDraw
683 Flags NoReliefString NoFocus
684 LocaleTitle {Suspend(s):}
685Main
686 Case message of
687  SingleClic :
688  Begin
689  End
690End
691
692Widget 65
693Property
694 Size 60 20
695 Position 560 202
696 Type TextField
697 Flags NoReliefString
698 Title{1000}
699Main
700 Case message of
701  SingleClic :
702  Begin
703  End
704End
705
706Widget 66
707Property
708 Position 440 230
709 Type ItemDraw
710 Flags NoReliefString NoFocus
711 LocaleTitle {Off(s):}
712Main
713 Case message of
714  SingleClic :
715  Begin
716  End
717End
718
719Widget 67
720Property
721 Size 60 20
722 Position 560 227
723 Type TextField
724 Flags NoReliefString
725 Title{1000}
726Main
727 Case message of
728  SingleClic :
729  Begin
730  End
731End
732
733#----------------------------------------------------------------------------
734# Right down rectangle
735
736
737Widget 70
738Property
739 Size 260 65
740 Position 425 278
741 Type Rectangle
742Main
743 Case message of
744  SingleClic :
745  Begin
746  End
747End
748
749Widget 71
750Property
751 Position 430 270
752 Type ItemDraw
753 Flags NoReliefString NoFocus
754 LocaleTitle {xscreensaver}
755Main
756 Case message of
757  SingleClic :
758  Begin
759  End
760End
761
762
763Widget 72
764Property
765 Position 440 298
766 Type CheckBox
767 Flags NoReliefString
768 LocaleTitle {Enable}
769Main
770 Case message of
771  SingleClic :
772  Begin
773   If (GetValue 72) == 1 Then
774   Begin
775    Set $SSTIMOUT= (GetTitle 14)
776    Set $SSCYCLE= (GetTitle 15)
777    ChangeTitle 14 {0}
778    ChangeTitle 15 {0}
779   End
780   Else
781   Begin
782    ChangeTitle 14 $SSTIMOUT
783    ChangeTitle 15 $SSCYCLE
784   End
785  End
786End
787
788
789Widget 73
790Property
791 Position 550 295
792 Type PushButton
793 Flags NoReliefString
794 LocaleTitle {Config and Demo}
795Main
796 Case message of
797  SingleClic :
798  Begin
799   Do {Exec xscreensaver-command -prefs&}
800  End
801End
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820