aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2020-05-22 14:14:27 -0400
committerDeterminant <tederminant@gmail.com>2020-05-22 14:14:27 -0400
commit6ac1467a93fffa629ee56874eaa21ed2cae25805 (patch)
tree7270026fd23ae5d004dd2fc604cedb721da4d24d
parent16ebad6bff9eb0ddac853e57b642e41ce5310a75 (diff)
distinguish the saved states for sessionsv1.1
-rw-r--r--README.rst4
-rwxr-xr-xname2color.py5
-rwxr-xr-xtmux-colortag-prompt.sh12
-rwxr-xr-xtmux-colortag.tmux2
4 files changed, 13 insertions, 10 deletions
diff --git a/README.rst b/README.rst
index 9d202d1..8cb0226 100644
--- a/README.rst
+++ b/README.rst
@@ -25,9 +25,9 @@ programs!
Features
========
-- Support Powerline symbols
- Automically color the window tabs by their name hash
-- Allow manual coloring
+- Manual control of coloring in tmux (also saved)
+- Support Powerline symbols
TLDR; I just want it
====================
diff --git a/name2color.py b/name2color.py
index 2137687..a473301 100755
--- a/name2color.py
+++ b/name2color.py
@@ -14,7 +14,6 @@ def error(msg):
print("ColorTag: {}\n".format(msg))
-saved_state = os.path.expanduser("~/.tmux-colortag.state")
# add your favorite color code (256) here as candidates
colors = [
63, 64, 65, 68, 103, 107,
@@ -23,6 +22,7 @@ colors = [
]
parser = argparse.ArgumentParser(description='Maps tmux window tags to colors.')
+parser.add_argument('session', type=str, help='session name')
parser.add_argument('idx', type=int, help='index of the window')
parser.add_argument('name', type=str, help='name of the window')
parser.add_argument('--color-idx', type=int, help='manually change the color mapping for an index')
@@ -34,6 +34,9 @@ args = parser.parse_args()
state = {}
changed = True
+saved_state = os.path.expanduser(
+ "~/.tmux-colortag-{}.state".format(args.session))
+
try:
with open(saved_state, "rb") as f:
_state = pickle.load(f)
diff --git a/tmux-colortag-prompt.sh b/tmux-colortag-prompt.sh
index 8e2aeaf..c3a46c4 100755
--- a/tmux-colortag-prompt.sh
+++ b/tmux-colortag-prompt.sh
@@ -3,22 +3,22 @@
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
case "$1" in
prompt)
- tmux command-prompt -p '[ColorTag]:' "run-shell 'idx=#I name=#W $CURRENT_DIR/tmux-colortag-prompt.sh %1'"
+ tmux command-prompt -p '[ColorTag]:' "run-shell 'idx=#I name=#W session=#S $CURRENT_DIR/tmux-colortag-prompt.sh %1'"
;;
color-idx)
- "$CURRENT_DIR/name2color.py" "$idx" "$name" --color-idx "$2" || echo "ColorTag: invalid argument"
+ "$CURRENT_DIR/name2color.py" "$session" "$idx" "$name" --color-idx "$2" || echo "ColorTag: invalid argument"
;;
color-name)
- "$CURRENT_DIR/name2color.py" "$idx" "$name" --color-name "$2" || echo "ColorTag: invalid argument"
+ "$CURRENT_DIR/name2color.py" "$session" "$idx" "$name" --color-name "$2" || echo "ColorTag: invalid argument"
;;
clear-idx)
- "$CURRENT_DIR/name2color.py" "$idx" "$name" --clear-idx
+ "$CURRENT_DIR/name2color.py" "$session" "$idx" "$name" --clear-idx
;;
clear-name)
- "$CURRENT_DIR/name2color.py" "$idx" "$name" --clear-name
+ "$CURRENT_DIR/name2color.py" "$session" "$idx" "$name" --clear-name
;;
clear-all)
- "$CURRENT_DIR/name2color.py" "$idx" "$name" --clear
+ "$CURRENT_DIR/name2color.py" "$session" "$idx" "$name" --clear
;;
*) echo "ColorTag: invalid command"; exit 0;;
esac
diff --git a/tmux-colortag.tmux b/tmux-colortag.tmux
index 4fd47b4..70a46a4 100755
--- a/tmux-colortag.tmux
+++ b/tmux-colortag.tmux
@@ -44,7 +44,7 @@ RIGHTBAR_DEFAULT0="#[fg=$color1,bg=$color0]"
RIGHTBAR_HOST="#[fg=$color0,bg=$color4]"
RIGHTBAR_HOST0="#[fg=$color4,bg=$color1]"
LOAD_DISP="#(awk '{print \$1, \$2, \$3}' /proc/loadavg)"
-TAB_COLOR="#(\"$CURRENT_DIR/name2color.py\" #I #W)"
+TAB_COLOR="#(\"$CURRENT_DIR/name2color.py\" #S #I #W)"
TAB_NORMAL_BEGIN="#[fg=$color0,bg=$TAB_COLOR]"
TAB_END="#[fg=$TAB_COLOR,bg=$color0]"
TAB_FOCUS_BEGIN_BG="#[bg=$TAB_COLOR]"