« 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--telnet-server.js1
-rw-r--r--ui.js9
2 files changed, 7 insertions, 3 deletions
diff --git a/telnet-server.js b/telnet-server.js
index d12e649..4e87499 100644
--- a/telnet-server.js
+++ b/telnet-server.js
@@ -27,6 +27,7 @@ class TelnetServer {
       writable: socket,
       interfacer,
       appConfig: {
+        canSuspend: false,
         showLeftPane: false,
         stopPlayingUponQuit: false,
         menubarColor: 2
diff --git a/ui.js b/ui.js
index 21b5844..2ec13fa 100644
--- a/ui.js
+++ b/ui.js
@@ -143,8 +143,9 @@ class AppElement extends FocusElement {
     this.attachListeners()
 
     this.config = Object.assign({
-      showLeftPane: true,
+      canSuspend: true,
       menubarColor: 4, // blue
+      showLeftPane: true,
       stopPlayingUponQuit: true
     }, config)
 
@@ -241,7 +242,7 @@ class AppElement extends FocusElement {
         {label: 'mtui (perpetual development)'},
         {divider: true},
         {label: 'Quit', action: () => this.shutdown()},
-        {label: 'Suspend', action: () => this.suspend()}
+        this.config.canSuspend && {label: 'Suspend', action: () => this.suspend()}
       ]},
       {text: 'Playback', menuFn: () => {
         const { playingTrack } = this.backend
@@ -631,7 +632,9 @@ class AppElement extends FocusElement {
   }
 
   suspend() {
-    this.emit('suspendRequested')
+    if (this.config.canSuspend) {
+      this.emit('suspendRequested')
+    }
   }
 
   fixLayout() {