summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Pykhalov <go.wigust@gmail.com>2018-02-22 04:01:01 +0300
committerOleg Pykhalov <go.wigust@gmail.com>2018-02-22 04:04:14 +0300
commit507dcb2eb015b36a4db7cdbb2ac15a05ae9436dd (patch)
treea31548ba85665e86879a35cf3b5155bd73a03bb7
parentterminal-here-terminal-window-name: Remove odd multiplexer argument. (diff)
downloademacs-terminal-here-507dcb2eb015b36a4db7cdbb2ac15a05ae9436dd.tar.gz
Add color options.
* terminal-here.el (terminal-here-terminal-options): New function. (terminal-here--term-command): Add this. (terminal-here-color): New variable.
-rw-r--r--terminal-here.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/terminal-here.el b/terminal-here.el
index 20dab79..4aa9c86 100644
--- a/terminal-here.el
+++ b/terminal-here.el
@@ -86,6 +86,11 @@ Typically this is -e, gnome-terminal uses -x."
:group 'terminal-here
:type 'string)
+(defcustom terminal-here-color 'dark
+ "Color theme for a terminal."
+ :group 'terminal-here
+ :type 'symbol)
+
(defcustom terminal-here-multiplexers
'("screen" "tmux")
"List of terminal emulators."
@@ -118,6 +123,14 @@ If f attach to a `screen' session inside multiplexer."
"Return current directory."
(file-name-nondirectory (directory-file-name dir)))
+(defun terminal-here-terminal-options ()
+ "Return options for a terminal."
+ (cond ((string-equal (car terminal-here-terminal-emulators) "xterm")
+ (cond ((eq terminal-here-color 'light)
+ '("-bg" "white" "-fg" "black"))
+ ((eq terminal-here-color 'dark)
+ '("-bg" "black" "-fg" "white"))))))
+
(defun terminal-here-multiplexer-session (dir)
"If new is t create a new multiplexer session called `dir'.
@@ -154,14 +167,16 @@ If new is f attach to a multiplexer session called `dir'."
multiplexer))
(t (let ((command (if (functionp terminal-here-terminal-command)
(funcall terminal-here-terminal-command dir)
- terminal-here-terminal-command)))
+ terminal-here-terminal-command))
+ (options (terminal-here-terminal-options)))
(if multiplexer
`(,@command
,@(terminal-here-terminal-window-name command dir)
+ ,@options
,terminal-here-command-flag
,@(terminal-here-multiplexer-command dir))
- `(,@command ,@(terminal-here-terminal-window-name
- command dir))))))))
+ `(,@command ,@options ,@(terminal-here-terminal-window-name
+ command dir))))))))
(defun terminal-here-launch-in-directory (dir &optional multiplexer)
"Launch a terminal in directory DIR.