3 ms·
Err... Maybe next time I'll remember to test before posting! (I fixed an obvious but easy to ignore bug that was in since the beginning to make it "presentable"
by t-3 4y ago
Err... Maybe next time I'll remember to test before posting! (I fixed an obvious but easy to ignore bug that was in since the beginning to make it "presentable", but didn't test/trace to make sure the new version actually worked correctly!)
--- newterm Mon Aug 15 18:09:51 2022
+++ .local/bin/newterm Mon Aug 15 18:07:51 2022
@@ -1,8 +1,8 @@
#!/bin/sh
if [ $(tmux has-session 2>/dev/null; echo $?) -eq 0 ]; then
- if [ $(tmux list-windows -f '#{window_active_clients}') ]; then
- if [ $(tmux ls | head -n 1 | awk '{print $2}') -le 2 ]; then
+ if [ $(tmux list-windows -F '#I' -f '#{window_active_clients}' | wc -l) -gt 0 ]; then
+ if [ $(tmux ls -F '#{session_windows}' | head -n 1) -le 2 ]; then
xterm -e "tmux new-session -f active-pane,ignore-size -t "0" \; new-window"
else
xterm -e "tmux new-session -f active-pane,ignore-size -t "0" \; select-window -t +2"