File: FvwmScript-ScreenSetup

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

Init
 Begin
  WarpPointer 1

  Set $FILE=(GetScriptArgument 1)
  If $FILE=={} Then
   Set $FILE={.xinitrc-fvwm}
  Set $CAT={cat ~/} $FILE

  #Screen Saver
  Set $pos=0
  Set $finish=1
  While $finish=={1} Do
  Begin
    Set $pos=(Add $pos 1)
    Set $tmp=(GetOutput {xset -q} $pos 1)
    If $tmp=={Screen} Then
      Set $finish=0
    If $pos=={50} Then
      Set $finish=0
  End
  If $pos=={50} Then
  Begin
   Do {Echo ScreenSetup: uncompatible xset}
   #Quit
  End
  Set $pos=(Add $pos 1)
  If (GetOutput  {xset -q} $pos 3) == {yes} Then
   ChangeValue 10 1
  Else
   ChangeValue 11 1
  Set $pos=(Add $pos 1)
  ChangeTitle 14 (GetOutput {xset -q} $pos 2)
  ChangeTitle 15 (GetOutput {xset -q} $pos 4)

  # Dpms
  Set $pos=0
  Set $finish=1
  While $finish=={1} Do
  Begin
    Set $pos=(Add $pos 1)
    Set $tmp=(GetOutput {xset -q} $pos 1)
    If $tmp=={Font} Then
      Set $finish=0
    If $pos=={30} Then
      Set $finish=0
  End
  If $pos=={50} Then
  Begin
   Do {Echo ScreenSetup: uncompatible xset}
   Quit
  End
  Set $pos=(Add $pos 4)
  ChangeTitle 63 (GetOutput {xset -q} $pos 2)
  ChangeTitle 65 (GetOutput {xset -q} $pos 4)
  ChangeTitle 67 (GetOutput {xset -q} $pos 6)
  Set $pos=(Add $pos 1)
  If (GetOutput  {xset -q} $pos 3) == {Enabled} Then
   ChangeValue 60 1
  Else
   ChangeValue 61 1

  # Background
  Set $pos=0
  Set $finish=1
  While $finish=={1} Do
  Begin
    Set $pos=(Add $pos 1)
    Set $tmp=(GetOutput $CAT $pos 1)
    If $tmp=={#ScreenMark} Then
      Set $finish=0
    If $pos=={50} Then
      Set $finish=0
  End
  ChangeValue 4 0
  ChangeValue 5 0
  ChangeValue 50 1
  Set $BColor={#0EC4B8}
  ChangeTitle 7 {~/}
  #ChangeIcon 8 /usr/include/X11/pixmaps/fvwm2.xpm
  Set $pos=(Add $pos 1)
  Set $test=(GetOutput  $CAT $pos 1)
  If $test=={fvwm-root} Then
  Begin
   ChangeTitle 7 (GetOutput  $CAT $pos 2)
   ChangeIcon 8 (GetTitle 7)
   ChangeValue 50 0
   ChangeValue 5 1
  End
  If $test=={xsetroot} Then
  Begin
   Set $BColor=(StrCopy (GetOutput  $CAT $pos 3) 2 8)
   ChangeValue 4 1
   ChangeValue 50 0
   ChangeTitle 24 $BColor
   ChangeBackColor 6 $BColor
   ChangeValue 20 (HexToNum (StrCopy $BColor 2 3))
   ChangeValue 21 (HexToNum (StrCopy $BColor 4 5))
   ChangeValue 22 (HexToNum (StrCopy $BColor 6 7))
  End
  # xscreensaver
  Set $pos=(Add $pos 3)
  Set $xsstest=(GetOutput $CAT $pos 1)
  If $xsstest=={xscreensaver} Then
   ChangeValue 72 1
End

PeriodicTasks
 Begin
  Set $MSG=(ReceivFromScript $BROWSER)
  If $MSG <> {No message} Then
  Begin
   ChangeTitle 7 $MSG
   ChangeIcon 8 $MSG
  End
 End

#-----------------------------------------------------------------------------
# Ok, apply and cancel buttons

Widget 1
Property
 Size 85 20
 Position 110 355
 Type PushButton
 Flags NoReliefString
 LocaleTitle {Apply}
Main
 Case message of
  SingleClic :
  Begin
   # Background
   If (GetValue 5) == 1 Then
    Do {Exec fvwm-root } (GetTitle 7)
   If (GetValue 4) == 1 Then
    Do {Exec xsetroot -solid "} $BColor {"}
   # screen-saver
   Do {Exec xset s } (GetTitle 14) { } (GetTitle 15)
   If (GetValue 10)==1 Then
    Do {Exec xset s blank}
   Else
    Do {Exec xset s noblank}
   # dpms
   If (GetValue 60)==1 Then
    Do {Exec xset dpms } (GetTitle 63) { } (GetTitle 65) { } (GetTitle 67)
   Else
    Do {Exec xset -dpms}
   # xscreensaver
   If (GetValue 72) == 1 Then
   Begin
    Do {Exec xscreensaver-command -exit}
    Do {Exec xscreensaver -no-splash&}
   End
   Else
    Do {Exec exec xscreensaver-command -exit}
  End
End

Widget 2
Property
 Size 85 20
 Position 305 355
 Type PushButton
 Flags NoReliefString
 LocaleTitle {Save}
Main
 Case message of
  SingleClic :
  Begin
   WriteToFile $FILE {#ScreenMark}

   # Background
   If (GetValue 5)==1 Then
   Begin
    Do {Exec fvwm-root } (GetTitle 7)
    WriteToFile $FILE {fvwm-root } (GetTitle 7)
   End
   If (GetValue 4)==1 Then
   Begin
    Do {Exec xsetroot -solid "} $BColor {"}
    WriteToFile $FILE {xsetroot -solid "} $BColor {"}
   End
   If (GetValue 50)==1 Then
     WriteToFile $FILE {#xsetroot -solid "} $BColor {"}

   # saver
   If (GetValue 10)==1 Then
    Set $tmp2 = { s blank}
   Else
    Set $tmp2 = { s noblank}
   Do {Exec xset s } (GetTitle 14) { } (GetTitle 15) $tmp2
   WriteToFile $FILE {xset s } (GetTitle 14) { } (GetTitle 15) $tmp2

   # dpms
   If (GetValue 60)==1 Then
   Begin
    Do {Exec xset dpms } (GetTitle 63) { } (GetTitle 65) { } (GetTitle 67)
    WriteToFile $FILE {xset dpms } (GetTitle 63) { } (GetTitle 65) { } (GetTitle 67)
   End
   Else
   Begin
    Do {Exec xset -dpms}
    WriteToFile $FILE {xset -dpms}
   End

   # xscreensaver
   If (GetValue 72) == 1 Then
   Begin
    Do {Exec xscreensaver-command -exit}
    Do {Exec xscreensaver -no-splash&}
    WriteToFile $FILE {xscreensaver -no-splash&}
   End
   Else
   Begin
    Do {Exec exec xscreensaver-command -exit}
    WriteToFile $FILE {#xscreensaver}
   End
   
   Do {Exec chmod +x } $FILE
   #Quit
  End
End

Widget 3
Property
 Size 85 20
 Position 500 355
 Type PushButton
 Flags NoReliefString
 LocaleTitle {Quit}
Main
 Case message of
  SingleClic :
  Begin
   Quit
  End
End

#----------------------------------------------------------------------------
# Left rectangle

Widget 16
Property
 Size 410 330
 Position 10 13
 Type Rectangle
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 18
Property
 Position 15 5
 Type ItemDraw
 Flags NoReliefString NoFocus	
 LocaleTitle {Background}
Main
 Case message of
  SingleClic :
  Begin
  End
End

#---------- Uniform color

Widget 4
Property
 Position 30 30
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Uniform color:}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 4 1
   ChangeValue 5 0 
   ChangeValue 50 0
  End
End

Widget 6
Property
 Size 50 50
 Position 60 80
 Flags NoFocus
 Type ItemDraw
 BackColor {#0EC4B8}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 23
Property
 Size 60 60
 Position 55 75
 Type Rectangle
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 24
Property
 Size 50 50
 Position 58 140
 Type ItemDraw
 Flags NoReliefString NoFocus
 Title {#0EC4B8}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 20
Property
 Size 200 20
 Position 195 20
 Type HScrollBar
 Flags NoReliefString
 Value 14
 MinValue 0
 MaxValue 255
Main
 Case message of
  SingleClic :
  Begin
   Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
   ChangeTitle 24 $BColor
   ChangeBackColor 6 $BColor
  End
End

Widget 21
Property
 Size 200 20
 Position 195 75
 Type HScrollBar
 Flags NoReliefString
 Value 196
 MinValue 0
 MaxValue 255
Main
 Case message of
  SingleClic :
  Begin
   Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
   ChangeTitle 24 $BColor
   ChangeBackColor 6 $BColor
  End
End

Widget 22
Property
 Size 200 20
 Position 195 130
 Type HScrollBar
 Flags NoReliefString
 Value 184
 MinValue 0
 MaxValue 255
Main
 Case message of
  SingleClic :
  Begin
   Set $BColor = {#} (NumToHex (GetValue 20) 2) (NumToHex (GetValue 21) 2) (NumToHex (GetValue 22) 2)
   ChangeTitle 24 $BColor
   ChangeBackColor 6 $BColor
  End
End

#--------- Pixmaps

Widget 5
Property
 Position 30 220
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Pixmap:}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 4 0
   ChangeValue 5 1
   ChangeValue 50 0
  End
End

Widget 7
Property
 Size 230 30
 Position 30 280
 Type TextField
 Flags NoReliefString
 Title {~/}
Main
 Case message of
  SingleClic :
  Begin
   ChangeIcon 8 (GetTitle 7) 
  End
End

Widget 25
Property
 Position 300 279
 Type PushButton
 Flags NoReliefString
 LocaleTitle {Browser...}
Main
 Case message of
  SingleClic :
  Begin
   Set $ARG={FvwmScript-FileBrowser } (GetTitle 7) { Hello word}
   Set $BROWSER=(LaunchScript $ARG )
  End
End

Widget 8
Property
 Size 175 75
 Position 120 195
 Flags NoReliefString NoFocus
 Type ItemDraw
 Icon /usr/X11/include/X11/pixmaps/fvwm2.xpm
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 9
Property
 Size 179 79
 Position 118 193
 Type Rectangle
Main
 Case message of
  SingleClic :
  Begin
  End
End

#--------- Disabled

Widget 50
Property
 Position 30 320
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Disable xinit background}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 4 0
   ChangeValue 5 0
   ChangeValue 50 1
  End
End

#----------------------------------------------------------------------------
# Right up rectangle


Widget 17
Property
 Size 260 105
 Position 425 13
 Type Rectangle
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 19
Property
 Position 430 5
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {Screen-saver}
Main
 Case message of
  SingleClic :
  Begin
  End
End


Widget 10
Property
 Position 430 40
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Blank}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 11 0
  End
End

Widget 12
Property
 Position 520 40
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {Timeout(s):}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 14
Property
 Size 60 79
 Position 615 37
 Flags NoReliefString
 Type TextField
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 11
Property
 Position 430 85
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Pattern}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 10 0
  End
End


Widget 13
Property
 Position 520 85
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {Cycle(s):}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 10 0
  End
End

Widget 15
Property
 Size 60 79
 Position 615 82
 Flags NoReliefString
 Type TextField
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 10 0
  End
End


#----------------------------------------------------------------------------
# Right middle rectangle


Widget 57
Property
 Size 260 135
 Position 425 128
 Type Rectangle
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 59
Property
 Position 430 120
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {DPMS}
Main
 Case message of
  SingleClic :
  Begin
  End
End


Widget 60
Property
 Position 440 150
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Enable}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 61 0
  End
End


Widget 61
Property
 Position 580 150
 Type RadioButton
 Flags NoReliefString
 LocaleTitle {Disable}
Main
 Case message of
  SingleClic :
  Begin
   ChangeValue 60 0
  End
End

Widget 62
Property
 Position 440 180
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {Standby(s):}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 63
Property
 Size 60 20
 Position 560 177
 Type TextField
 Flags NoReliefString
 LocaleTitle{1000}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 64
Property
 Position 440 205
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {Suspend(s):}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 65
Property
 Size 60 20
 Position 560 202
 Type TextField
 Flags NoReliefString
 Title{1000}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 66
Property
 Position 440 230
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {Off(s):}
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 67
Property
 Size 60 20
 Position 560 227
 Type TextField
 Flags NoReliefString
 Title{1000}
Main
 Case message of
  SingleClic :
  Begin
  End
End

#----------------------------------------------------------------------------
# Right down rectangle


Widget 70
Property
 Size 260 65
 Position 425 278
 Type Rectangle
Main
 Case message of
  SingleClic :
  Begin
  End
End

Widget 71
Property
 Position 430 270
 Type ItemDraw
 Flags NoReliefString NoFocus
 LocaleTitle {xscreensaver}
Main
 Case message of
  SingleClic :
  Begin
  End
End


Widget 72
Property
 Position 440 298
 Type CheckBox
 Flags NoReliefString
 LocaleTitle {Enable}
Main
 Case message of
  SingleClic :
  Begin
   If (GetValue 72) == 1 Then
   Begin
    Set $SSTIMOUT= (GetTitle 14)
    Set $SSCYCLE= (GetTitle 15)
    ChangeTitle 14 {0}
    ChangeTitle 15 {0}
   End
   Else
   Begin
    ChangeTitle 14 $SSTIMOUT
    ChangeTitle 15 $SSCYCLE
   End 
  End
End


Widget 73
Property
 Position 550 295
 Type PushButton
 Flags NoReliefString
 LocaleTitle {Config and Demo}
Main
 Case message of
  SingleClic :
  Begin
   Do {Exec xscreensaver-command -prefs&}
  End
End