« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.js16
1 files changed, 3 insertions, 13 deletions
diff --git a/ui.js b/ui.js
index c7ddfac..5302c7c 100644
--- a/ui.js
+++ b/ui.js
@@ -62,7 +62,6 @@ class AppElement extends FocusElement {
     this.form.addInput(this.queueListingElement, false)
 
     this.queueListingElement.on('queue', item => this.playGrouplikeItem(item))
-    this.queueListingElement.on('space', item => this.handleSpacePressed())
     this.queueListingElement.on('remove (backspace)', item => this.unqueueGrouplikeItem(item))
     this.queueListingElement.on('remove (x)', item => this.unqueueGrouplikeItem(item))
     this.queueListingElement.on('shuffle', () => this.shuffleQueue())
@@ -109,7 +108,6 @@ class AppElement extends FocusElement {
 
     grouplikeListing.on('download', item => this.downloadGrouplikeItem(item))
     grouplikeListing.on('browse', item => grouplikeListing.loadGrouplike(item))
-    grouplikeListing.on('space', item => this.handleSpacePressed())
     grouplikeListing.on('menu', (item, opts) => this.menu.show(opts))
 
     grouplikeListing.on('queue', (item, {where = 'end', shuffle = false, play = false}) => {
@@ -335,6 +333,8 @@ class AppElement extends FocusElement {
       this.seekAhead(10)
     } else if (telc.isLeft(keyBuf)) {
       this.seekBack(10)
+    } else if (telc.isSpace(keyBuf)) {
+      this.togglePause()
     } else if (telc.isEscape(keyBuf)) {
       this.clearPlayingTrack()
     } else if (telc.isShiftUp(keyBuf) || telc.isCaselessLetter(keyBuf, 'p')) {
@@ -415,14 +415,6 @@ class AppElement extends FocusElement {
     this.queueListingElement.pathElement.showItem(null)
   }
 
-  handleSpacePressed() {
-    // Pauses/resumes if a track is currently playing.
-
-    if (this.playingTrack) {
-      this.togglePause()
-    }
-  }
-
   seekAhead(seconds) {
     this.player.seekAhead(seconds)
   }
@@ -764,7 +756,7 @@ class GrouplikeListingElement extends FocusElement {
     if (this.grouplike.items.length) {
       for (const item of this.grouplike.items) {
         const itemElement = new GrouplikeItemElement(item, this.recordStore)
-        for (const evtName of ['download', 'remove (backspace)', 'remove (x)', 'mark', 'browse', 'space', 'queue', 'menu']) {
+        for (const evtName of ['download', 'remove (backspace)', 'remove (x)', 'mark', 'browse', 'queue', 'menu']) {
           itemElement.on(evtName, (...data) => this.emit(evtName, item, ...data))
         }
         form.addInput(itemElement)
@@ -934,8 +926,6 @@ class GrouplikeItemElement extends Button {
       this.emit('queue', {where: 'end'})
     } else if (telc.isCharacter(keyBuf, 'Q')) {
       this.emit('queue', {where: 'next'})
-    } else if (telc.isSpace(keyBuf)) {
-      this.emit('space')
     } else if (telc.isEnter(keyBuf)) {
       if (isGroup(this.item)) {
         this.emit('browse')