Skip to content

Commit 5283394

Browse files
committedJan 25, 2025
Correct lock semantics and allow it to be specified on commandline
1 parent 501d101 commit 5283394

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
 

‎cmd/fyshsaver/main.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package main
22

33
import (
4+
"flag"
5+
46
"fyne.io/fyne/v2/app"
57

68
"github.com/FyshOS/saver"
@@ -9,10 +11,14 @@ import (
911
func main() {
1012
a := app.NewWithID("com.fyshos.fyshsaver")
1113

14+
lock := flag.Bool("lock", false, "Lock the screen")
15+
label := flag.String("label", "(clock)", "Label to display")
16+
flag.Parse()
17+
1218
s := saver.NewScreenSaver(a.Quit)
1319
s.ClockFormat = a.Preferences().StringWithFallback("clockformatting", "12h")
14-
s.Label = a.Preferences().StringWithFallback("fysh.label", "FyshOS")
15-
s.Lock = true
20+
s.Label = *label
21+
s.Lock = *lock
1622

1723
s.ShowWindow()
1824
a.Run()

‎ui.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func (s *ScreenSaver) startedInput(w fyne.Window) {
187187
if s.started.After(time.Now().Add(time.Millisecond * -200)) {
188188
return // something flickering as we start
189189
}
190-
if !s.Lock && s.started.After(time.Now().Add(time.Second*-3)) {
190+
if !s.Lock || s.started.After(time.Now().Add(time.Second*-3)) {
191191
showCursor(w)
192192
s.unlock()
193193
return

0 commit comments

Comments
 (0)