Browse Source

Merge branch 'master' of github.com:Eugeny/terminus

Eugene Pankov 8 years ago
parent
commit
571884f39c

+ 54 - 44
terminus-community-color-schemes/schemes/Base16 Default Dark

@@ -1,44 +1,54 @@
-!
-! Generated with :
-! XRDB2Xreources.py
-!
-*.foreground:  #d8d8d8
-*.background:  #181818
-*.cursorColor: #d8d8d8
-!
-! Black
-*.color0:      #181818
-*.color8:      #585858
-!
-! Red
-*.color1:      #ab4642
-*.color9:      #ab4642
-!
-! Green
-*.color2:      #a1b56c
-*.color10:     #a1b56c
-!
-! Yellow
-*.color3:      #f7ca88
-*.color11:     #f7ca88
-!
-! Blue
-*.color4:      #7cafc2
-*.color12:     #7cafc2
-!
-! Magenta
-*.color5:      #ba8baf
-*.color13:     #ba8baf
-!
-! Cyan
-*.color6:      #86c1b9
-*.color14:     #86c1b9
-!
-! White
-*.color7:      #d8d8d8
-*.color15:     #f8f8f8
-!
-! Bold, Italic, Underline
-*.colorBD:     #d8d8d8
-!*.colorIT:
-!*.colorUL:
+! Base16 Default Dark
+! Scheme: Chris Kempson (http://chriskempson.com)
+
+#define base00 #181818
+#define base01 #282828
+#define base02 #383838
+#define base03 #585858
+#define base04 #b8b8b8
+#define base05 #d8d8d8
+#define base06 #e8e8e8
+#define base07 #f8f8f8
+#define base08 #ab4642
+#define base09 #dc9656
+#define base0A #f7ca88
+#define base0B #a1b56c
+#define base0C #86c1b9
+#define base0D #7cafc2
+#define base0E #ba8baf
+#define base0F #a16946
+
+*.foreground:   base05
+#ifdef background_opacity
+*.background:   [background_opacity]base00
+#else
+*.background:   base00
+#endif
+*.cursorColor:  base05
+
+*.color0:       base00
+*.color1:       base08
+*.color2:       base0B
+*.color3:       base0A
+*.color4:       base0D
+*.color5:       base0E
+*.color6:       base0C
+*.color7:       base05
+
+*.color8:       base03
+*.color9:       base08
+*.color10:      base0B
+*.color11:      base0A
+*.color12:      base0D
+*.color13:      base0E
+*.color14:      base0C
+*.color15:      base07
+
+! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt),
+! use 'shell' template to set these if necessary
+*.color16:      base09
+*.color17:      base0F
+*.color18:      base01
+*.color19:      base02
+*.color20:      base04
+*.color21:      base06

+ 11 - 1
terminus-community-color-schemes/src/colorSchemes.ts

@@ -10,13 +10,23 @@ export class ColorSchemes extends TerminalColorSchemeProvider {
 
         schemeContents.keys().forEach(schemeFile => {
             let lines = (schemeContents(schemeFile) as string).split('\n')
+
+            // process #define variables
+            let variables: any = {}
+            lines
+                .filter(x => x.startsWith('#define'))
+                .map(x => x.split(' ').map(v => v.trim()))
+                .forEach(([ignore, variableName, variableValue]) => {
+                    variables[variableName] = variableValue
+                })
+
             let values: any = {}
             lines
                 .filter(x => x.startsWith('*.'))
                 .map(x => x.substring(2))
                 .map(x => x.split(':').map(v => v.trim()))
                 .forEach(([key, value]) => {
-                    values[key] = value
+                    values[key] = variables[value] ? variables[value] : value
                 })
 
             let colors: string[] = []

+ 1 - 0
terminus-core/src/configDefaults.yaml

@@ -3,6 +3,7 @@ appearance:
   dockScreen: current
   dockFill: 50
   tabsLocation: top
+  cycleTabs: true
   theme: Standard
   frame: thin
   css: '/* * { color: blue !important; } */'

+ 16 - 6
terminus-core/src/services/app.service.ts

@@ -3,6 +3,7 @@ import { Injectable, ComponentFactoryResolver, Injector, Optional } from '@angul
 import { DefaultTabProvider } from '../api/defaultTabProvider'
 import { BaseTabComponent } from '../components/baseTab.component'
 import { Logger, LogService } from '../services/log.service'
+import { ConfigService } from '../services/config.service'
 
 export declare type TabComponentType = new (...args: any[]) => BaseTabComponent
 
@@ -18,6 +19,7 @@ export class AppService {
     constructor (
         private componentFactoryResolver: ComponentFactoryResolver,
         @Optional() private defaultTabProvider: DefaultTabProvider,
+        private config: ConfigService,
         private injector: Injector,
         log: LogService,
     ) {
@@ -70,16 +72,24 @@ export class AppService {
     }
 
     nextTab () {
-        let tabIndex = this.tabs.indexOf(this.activeTab)
-        if (tabIndex < this.tabs.length - 1) {
-            this.selectTab(this.tabs[tabIndex + 1])
+        if (this.tabs.length > 1) {
+            let tabIndex = this.tabs.indexOf(this.activeTab)
+            if (tabIndex < this.tabs.length - 1) {
+                this.selectTab(this.tabs[tabIndex + 1])
+            } else if (this.config.store.appearance.cycleTabs) {
+                this.selectTab(this.tabs[0])
+            }
         }
     }
 
     previousTab () {
-        let tabIndex = this.tabs.indexOf(this.activeTab)
-        if (tabIndex > 0) {
-            this.selectTab(this.tabs[tabIndex - 1])
+        if (this.tabs.length > 1) {
+            let tabIndex = this.tabs.indexOf(this.activeTab)
+            if (tabIndex > 0) {
+                this.selectTab(this.tabs[tabIndex - 1])
+            } else if (this.config.store.appearance.cycleTabs) {
+                this.selectTab(this.tabs[this.tabs.length - 1])
+            }
         }
     }