File: FvwmScript-Clock

package info (click to toggle)
fvwm-crystal 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,748 kB
  • ctags: 793
  • sloc: sh: 2,815; cs: 880; python: 875; makefile: 212
file content (115 lines) | stat: -rw-r--r-- 2,512 bytes parent folder | download | duplicates (3)
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
#
# o Support for temporary switch for display date/time after click on widget
#   LiNiO <linio@wonder.pl> - 2005.01.16
#
# o With message 1 (configured for right click in recipe) switch between
#   12h clock and 24h clock. Initially, the clock will be set according
#   to the current locale
#   Michael Stilkerich <ms@mike2k.de> - 2006.05.16

WindowTitle {FvwmScript-Clock}
WindowSize  60 22
Font "xft:Verdana:pixelsize=15:Bold"
Colorset 1

Init
Begin
  Set $display= time

  If (GetOutput {date "+%p"} 1 -1)=={} Then
  Begin
    Set $mode={24}
    Set $timecmd={date "+%R"}
    Set $timefont={xft:Verdana:pixelsize=15:Bold}
    Set $datecmd={date "+%d/%m"}
    Set $datefont={xft:Verdana:pixelsize=15:Bold}
  End
  Else
  Begin
    Set $mode={12}
    Set $timecmd={LC_TIME=C date "+%I:%M %p"}
    Set $timefont={xft:Verdana:pixelsize=11:Bold}
    Set $datecmd={date "+%d/%m"}
    Set $datefont={xft:Verdana:pixelsize=15:Bold}
  End
  Set $tmp = (GetOutput $timecmd 1 -1)
  ChangeTitle 1 $tmp
  ChangeFont 1 $timefont
End

PeriodicTasks
Begin 
  If (RemainderOfDiv (GetTime) 60)==0 Then
  Begin
    If $display=={time} Then
    Begin
      Set $tmp = (GetOutput $timecmd 1 -1)
      ChangeFont 1 $timefont
    End
    Else
    Begin
      Set $tmp = (GetOutput $datecmd 1 -1)
      ChangeFont 1 $datefont
    End
    ChangeTitle 1 $tmp
  End
End

Widget 1
Property
 Position 0 -3
 Size 60 22
 Type ItemDraw
 Flags NoReliefString
 Title {}
 Colorset 1
Main
 Case message of
  SingleClic :
  Begin
    If $display=={time} Then
    Begin
      Set $display= date
      ChangeFont 1 $datefont
      Set $tmp = (GetOutput $datecmd 1 -1)
    End
    Else
    Begin
      Set $display= time
      ChangeFont 1 $timefont
      Set $tmp = (GetOutput $timecmd 1 -1)
    End
    ChangeTitle  1 $tmp
  End
  1 :
  Begin
    If $mode=={24} Then
    Begin
    Set $mode={12}
    Set $timecmd={LC_TIME=C date "+%I:%M %p"}
    Set $timefont={xft:Verdana:pixelsize=11:Bold}
    Set $datecmd={date "+%m/%d"}
    Set $datefont={xft:Verdana:pixelsize=15:Bold}
    End
    Else
    Begin
    Set $mode={24}
    Set $timecmd={date "+%R"}
    Set $timefont={xft:Verdana:pixelsize=15:Bold}
    Set $datecmd={date "+%d/%m"}
    Set $datefont={xft:Verdana:pixelsize=15:Bold}
    End

    If $display=={date} Then
    Begin
      Set $tmp = (GetOutput $datecmd 1 -1)
      ChangeFont 1 $datefont
    End
    Else
    Begin
      Set $tmp = (GetOutput $timecmd 1 -1)
      ChangeFont 1 $timefont
    End
    ChangeTitle  1 $tmp
  End
End