From b248c6e5c754a553d9468e14ed48247c0fd6aa73 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Thu, 10 Nov 2016 16:36:45 -0500 Subject: [PATCH] Add tako config --- personal.conf.yaml | 2 ++ tako/config.tako | 66 +++++++++++++++++++++++++++++++++++++++++++ tako/suppress_message | 0 3 files changed, 68 insertions(+) create mode 100644 tako/config.tako create mode 100644 tako/suppress_message diff --git a/personal.conf.yaml b/personal.conf.yaml index 1d25ac8..bca62a0 100644 --- a/personal.conf.yaml +++ b/personal.conf.yaml @@ -3,8 +3,10 @@ ~/.config/sxhkd: sxhkd/ ~/.config/panel: panel/ ~/.config/qutebrowser: qutebrowser/ + ~/.config/tako: tako/ ~/.mbsyncrc: isync/.mbsyncrc ~/.mutt: mutt/ + ~/.pentadactylrc: pentadactyl/.pentadactylrc ~/.Xresources: X/.Xresources ~/.Xdefaults: X/.Xdefaults ~/.urlview: urlview/.urlview diff --git a/tako/config.tako b/tako/config.tako new file mode 100644 index 0000000..04e3133 --- /dev/null +++ b/tako/config.tako @@ -0,0 +1,66 @@ +import re + +$TAKO_SETTINGS.auto_pushd = True + +$TAKO_SETTINGS.aliases.update({ + 'startx': 'ssh-agent startx ; vlock', + 'la': 'ls -a', + 'll': 'ls -l', + 'units': 'units --verbose', + 'trr': 'transmission-remote', + 'vol': 'pulseaudio-ctl set', +}) + +if '256color' in $TERM: + colors = { + 'blue': 81, + 'orange': 166, + 'purple': 135, + 'red': 196, + 'green': 118, + 'gray': 241, + } + + def colorize(color, text): + prefix = '\x1b[38;5;{}m'.format(colors[color]) + suffix = '\x1b[0m' + return prefix + text + suffix +else: + colors = { + 'blue': 'BLUE', + 'orange': 'YELLOW', + 'purple': 'PURPLE', + 'red': 'RED', + 'green': 'GREEN', + 'gray': 'WHITE', + } + def colorize(color, text): + prefix = '{%s}' % colors[color] + suffix = '{NO_COLOR}' + return prefix + text + suffix + +def git_branch(): + ref=$(git symbolic-ref HEAD err> /dev/null) + if not ref: return None + prefix = colorize('gray', ':') + branch = colorize('orange', re.sub('^refs/heads/', '', ref.strip())) + return prefix + branch + +$TAKO_SETTINGS.prompt_fields['git_branch'] = git_branch + +username = colorize('purple', '{user}') +host = colorize('blue', '{hostname}') +directory = colorize('green', '{cwd}') +lbrkt = colorize('gray', '[') +rbrkt = colorize('gray', ']') +colon = colorize('gray', ':') + +$TAKO_SETTINGS.prompt = lbrkt + colon.join([ + username, + host, + directory, +]) + '{git_branch}' + rbrkt + '\n{prompt_end} ' + +'{color_155}' + +$TAKO_SETTINGS.show_traceback = True diff --git a/tako/suppress_message b/tako/suppress_message new file mode 100644 index 0000000..e69de29