Skip to content

Commit

Permalink
feat: update keybinding to quit Viddy
Browse files Browse the repository at this point in the history
    * 'q' will quit viddy, only if it's not in help view, else it'll
      go back
    * 'Q` to exit viddy from any view
  • Loading branch information
coolabhays committed Dec 24, 2022
1 parent 6431f52 commit 9fa4c28
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion viddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,27 @@ func (v *Viddy) Run() error {
any = true
}

if event.Key() == tcell.KeyEsc || event.Rune() == 'q' {
if event.Key() == tcell.KeyEsc {
v.showHelpView = false
v.arrange()
}

if event.Rune() == 'q' {
if (v.showHelpView) { // if it's help mode, just go back
v.showHelpView = false
v.arrange()
} else { // it's not help view, so just quit
v.app.Stop()
os.Exit(0)
}
}

// quit viddy from any view
if event.Rune() == 'Q' {
v.app.Stop()
os.Exit(0)
}

switch event.Rune() {
case 's':
v.isSuspend = !v.isSuspend
Expand Down

0 comments on commit 9fa4c28

Please sign in to comment.