apply settings
parent
fd79bceb79
commit
0adaf9e90c
|
@ -1,6 +1,10 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.sr.ht/~rockorager/vaxis"
|
||||
"git.sr.ht/~rockorager/vaxis/widgets/textinput"
|
||||
"git.tilde.town/nbsp/welcome/ui"
|
||||
|
@ -26,7 +30,23 @@ func (view *Settings) Event(state *ui.State, event vaxis.Event) (processed bool)
|
|||
}
|
||||
case "Enter":
|
||||
if view.index == 3 {
|
||||
// TODO: save settings
|
||||
pronouns := strings.TrimSpace(view.inputs[0].String())
|
||||
birthday := strings.TrimSpace(view.inputs[1].String())
|
||||
timezone := strings.TrimSpace(view.inputs[2].String())
|
||||
|
||||
// XXX: this assumes nothing will break
|
||||
if pronouns != "" {
|
||||
os.WriteFile(".pronouns", []byte(pronouns), 0644)
|
||||
}
|
||||
if birthday != "" {
|
||||
os.WriteFile(".birthday", []byte(pronouns), 0644)
|
||||
}
|
||||
if timezone != "" {
|
||||
f, _ := os.OpenFile(".bashrc", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
f.Write([]byte(fmt.Sprintf("export TZ='%s'\n", timezone)))
|
||||
f.Close()
|
||||
}
|
||||
|
||||
ui.ViewChange <- &Shell{}
|
||||
}
|
||||
if view.index < 3 {
|
||||
|
|
Loading…
Reference in New Issue