aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-04-06 18:03:37 +0300
committerTulir Asokan <tulir@maunium.net>2019-04-06 18:03:37 +0300
commite9cf38a86607d9b41914fa7442661a4dd56ce0a0 (patch)
tree3fe7ad7a7d027b6d52021a7366095e4e53b04aab
parentd0f55f4a6f26cb2bad09d58204c98d0090a78e70 (diff)
Focus username field in login view automatically
-rw-r--r--ui/ui.go2
-rw-r--r--ui/view-login.go2
2 files changed, 3 insertions, 1 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 66a3524..858e407 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -66,7 +66,7 @@ func (ui *GomuksUI) Init() {
ViewLogin: ui.NewLoginView(),
ViewMain: ui.NewMainView(),
}
- ui.app.Root = ui.views[ViewLogin]
+ ui.SetView(ViewLogin)
}
func (ui *GomuksUI) Start() error {
diff --git a/ui/view-login.go b/ui/view-login.go
index 1cef96f..e0268d0 100644
--- a/ui/view-login.go
+++ b/ui/view-login.go
@@ -87,9 +87,11 @@ func (ui *GomuksUI) NewLoginView() mauview.Component {
AddComponent(view.usernameLabel, 1, 1, 1, 1).
AddComponent(view.passwordLabel, 1, 3, 1, 1).
AddComponent(view.homeserverLabel, 1, 5, 1, 1)
+ view.FocusNextItem()
ui.loginView = view
view.container = mauview.Center(mauview.NewBox(view).SetTitle("Log in to Matrix"), 45, 13)
+ view.container.SetAlwaysFocusChild(true)
return view.container
}