mirror of https://github.com/uriel1998/tdab
commit
324ce8e1ce
@ -0,0 +1,21 @@ |
||||
MIT License |
||||
|
||||
Copyright (c) 2020 Steven Saus |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
@ -0,0 +1,80 @@ |
||||
# tmux-devours-a-bar |
||||
|
||||
Create side and top bars in tmux easily, along with a "devour" style command. |
||||
|
||||
![TDAB logo](https://github.com/uriel1998/tdab/raw/main/tdab-open-graph.png "logo") |
||||
|
||||
![TDAB demo](https://raw.githubusercontent.com/uriel1998/tdab/main/tdab_example.gif "demo") |
||||
https://raw.githubusercontent.com/uriel1998/vindauga/master/output.gif |
||||
You can see a larger version of the demo with the [included MKV file](https://github.com/uriel1998/tdab/blob/main/tdab_example.mkv?raw=true). |
||||
|
||||
## Contents |
||||
1. [About](#1-about) |
||||
2. [License](#2-license) |
||||
3. [Prerequisites](#3-prerequisites) |
||||
4. [Installation](#4-installation) |
||||
5. [Usage](#5-usage) |
||||
6. [TODO](#6-todo) |
||||
|
||||
*** |
||||
|
||||
## 1. About |
||||
|
||||
These three scripts (called `TDAB` for short) will create side or top bars |
||||
(or a "devour" style new pane) that run a command inside tmux. See the image |
||||
above to get an idea of what this means. |
||||
|
||||
The name is a play on "A *blank* walks into a bar", because puns. |
||||
|
||||
## 2. License |
||||
|
||||
This project is licensed under the MIT License. For the full license, see `LICENSE`. |
||||
|
||||
## 3. Prerequisites |
||||
|
||||
* tmux |
||||
* bash |
||||
|
||||
These scripts will *probably* work in other shells, but I don't know for sure. |
||||
|
||||
## 4. Installation |
||||
|
||||
Clone or download the repository. Put the scripts (or symlinks to the scripts) |
||||
in your `$PATH`. (In the example above, I've symlinked them to `sidebar`, |
||||
`topbar`, and `devour`.) |
||||
|
||||
If you wish to change the width or height of the sidebar/topbar, you will |
||||
need to edit this line: |
||||
|
||||
`tmux resize-pane -t "$c_pane" -R 30` |
||||
|
||||
which actually resizes the *larger* pane from the center line. My screen that |
||||
I used for the demo is 194 columns wide, so when it's first split, it's 97/96 |
||||
columns wide, then resizes it *to the right* an additional 30 columns so that |
||||
I end up with a 127/67 split. The same thing goes for the topbar, except it |
||||
resizes upward (-U). Adjust so that they work for your terminal size. |
||||
|
||||
## 5. Usage |
||||
|
||||
`SCRIPTNAME [program to run]` |
||||
|
||||
For example, `tmux-sidebar.sh man man` will show you the man page for man in |
||||
the sidebar. |
||||
|
||||
If you run the scripts outside of tmux, it will just run the command. |
||||
|
||||
### tmux_devour.sh |
||||
|
||||
Launch a process in a new pane, zoom the pane, kill the pane when done. |
||||
|
||||
### tmux_sidebar.sh |
||||
|
||||
Create a sidebar (e.g. for reading manpages) and kill when done. |
||||
|
||||
### tmux_topbar.sh |
||||
|
||||
Create a vertical split and kill when done. |
||||
|
||||
## 6. TODO |
||||
|
||||
* Have a configurable size modifier so nobody needs to edit the script. |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 310 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,28 @@ |
||||
#!/bin/bash |
||||
|
||||
############################################################################## |
||||
# |
||||
# tmux-devour |
||||
# (c) Steven Saus 2020 |
||||
# Licensed under the MIT license |
||||
# |
||||
############################################################################## |
||||
|
||||
|
||||
|
||||
c_tmux=$(env | grep -c TMUX) |
||||
if [ $c_tmux -gt 0 ];then |
||||
command=$(echo "$@") |
||||
o_pane=$(tmux list-panes -F "#D") |
||||
tmux split-window -h |
||||
c_pane=$(tmux list-panes -F "#D" | grep -v "$o_pane") |
||||
printf '\033]2;%s\033\\' 'devour' |
||||
tmux resize-pane -t "$c_pane" -R 20 |
||||
tmux select-pane -m -t "$c_pane" |
||||
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}") |
||||
tmux resize-pane -Z -t "$c_pane" |
||||
tmux send-keys -t "$c_pane" "$command2" C-m |
||||
else |
||||
eval "$@" |
||||
fi |
||||
|
@ -0,0 +1,29 @@ |
||||
#!/bin/bash |
||||
|
||||
############################################################################## |
||||
# |
||||
# tmux-sidebar |
||||
# (c) Steven Saus 2020 |
||||
# Licensed under the MIT license |
||||
# |
||||
############################################################################## |
||||
|
||||
|
||||
|
||||
c_tmux=$(env | grep -c TMUX) |
||||
if [ $c_tmux -gt 0 ];then |
||||
command=$(echo "$@") |
||||
o_pane=$(tmux list-panes -F "#D") |
||||
tmux split-window -h |
||||
c_pane=$(tmux list-panes -F "#D" | grep -v "$o_pane") |
||||
# Uncomment for left hand sidebar |
||||
#tmux swap-pane -s "$o_pane" -t "$c_pane" |
||||
printf '\033]2;%s\033\\' 'topbar' |
||||
tmux resize-pane -t "$c_pane" -R 30 |
||||
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}") |
||||
tmux send-keys -t "$c_pane" "$command2" C-m |
||||
tmux last-pane |
||||
else |
||||
eval "$@" |
||||
fi |
||||
|
@ -0,0 +1,26 @@ |
||||
#!/bin/bash |
||||
|
||||
############################################################################## |
||||
# |
||||
# tmux-topbar |
||||
# (c) Steven Saus 2020 |
||||
# Licensed under the MIT license |
||||
# |
||||
############################################################################## |
||||
|
||||
|
||||
c_tmux=$(env | grep -c TMUX) |
||||
if [ $c_tmux -gt 0 ];then |
||||
command=$(echo "$@") |
||||
o_pane=$(tmux list-panes -F "#D") |
||||
tmux split-window -v |
||||
c_pane=$(tmux list-panes -F "#D"| grep -v "$o_pane") |
||||
tmux swap-pane -s "$o_pane" -t "$c_pane" |
||||
printf '\033]2;%s\033\\' 'topbar' |
||||
tmux resize-pane -t "$c_pane" -U 14 |
||||
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}") |
||||
tmux send-keys -t "$c_pane" "$command2" C-m |
||||
tmux last-pane |
||||
else |
||||
eval "$@" |
||||
fi |
Loading…
Reference in new issue