From 1949c2beb294509ab2e916b1f0d7659ea02e4f0f Mon Sep 17 00:00:00 2001 From: Daniel Byron Date: Wed, 4 May 2016 09:50:53 +1000 Subject: Gnome terminal (dconf) support added --- README.md | 1 + TODO.md | 22 ---------------------- format.go | 5 +++++ output.go | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 22 deletions(-) delete mode 100644 TODO.md diff --git a/README.md b/README.md index 1b96aee..bab6f8c 100644 --- a/README.md +++ b/README.md @@ -93,3 +93,4 @@ And it will be built in your GOPATH directory, in a subdirectory named 'bin'. To - Terminator - Chrome Shell - OS X Terminal +- Gnome Terminal (dconf only for now) diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 55f8ce6..0000000 --- a/TODO.md +++ /dev/null @@ -1,22 +0,0 @@ -# To Do - -- Support for following terminal inputs - + Xterm (Partially done, needs more testing) - + Urxvt (See: xterm) - + Mac Terminal - + iTerm2 - + RoxTerm - + Konsole - + Plain text - -- Write more tests and find existing or write configurations for terminals to test against - - -# "Would be nice" - -- Vim colorscheme input/output - -# Maybe - -- Include pre-compiled binaries for Linux, Mac and Windows -- Separate install instructions into INSTALL.md diff --git a/format.go b/format.go index 82fa53f..fda8bd1 100644 --- a/format.go +++ b/format.go @@ -86,4 +86,9 @@ var formats = []Format{ flagName: "osxterminal", output: printOSXTerminal, }, + { + friendlyName: "Gnome Terminal (dconf)", + flagName: "gnome-terminal", + output: printGnomeDConf, + }, } diff --git a/output.go b/output.go index 71eff48..9441c33 100644 --- a/output.go +++ b/output.go @@ -246,3 +246,25 @@ func printOSXTerminal(colors []color.Color) string { output += "\n" return output } + +func printGnomeDConf(colors []color.Color) string { + output := "#!/usr/bin/env bash\npalette=\"[" + for i, c := range colors { + cc := c.(color.NRGBA) + bytes := []byte{byte(cc.R), byte(cc.G), byte(cc.B)} + output += "'" + output += "#" + output += hex.EncodeToString(bytes) + output += "'" + if i < len(colors)-1 { + output += "," + } + } + output += "]\"" + output += "\n" + output += "default=$(dconf read /org/gnome/terminal/legacy/profiles:/default | sed -e \"s/'//g\")" + output += "\n" + output += "dconf write /org/gnome/terminal/legacy/profiles:/:$default/palette \"$palette\"" + output += "\n" + return output +} -- cgit v1.2.3