Commit Graph

48 Commits

Author SHA1 Message Date
b2a67705b6 wip(commands): re-implement core commands as bash functions
Re-implement all libexec executables as bash functions, with the goal of
being able build a single standalone execuable bash script for
tmuxifier.
2025-12-01 23:17:41 +00:00
adb008b301 style(shell): improve shell script formatting and quoting
Apply shfmt formatting and fix some schellcheck complaints.
2025-12-01 23:04:40 +00:00
Paul Laffitte
68b02f07b0 Prepend commands in run_cmd with a space to prevent them to be stored in the history 2024-09-30 17:57:15 +02:00
895dace853 fix(layout-helpers): split_h/split_v work correctly on latest tmux (#99)
The `-p` flag on `split-window` was deprecated in Tmux 3.1 in favor of
just adding a `%` suffix to the numeric value given to the `-l` flag.

This uses the new `-l <n>%` format on Tmux 3.1 and later, and uses the
old `-p <n>` format on 3.0 and older.
2024-02-18 00:42:44 +00:00
9049818b25 Add optional target window argument to newly added layout helpers 2017-04-27 19:48:15 +01:00
a9ca566c28 Merge pull request #73 from Yuki-Inoue/synchronize-helper-methods
Add synchronize helper methods
2017-04-27 19:23:22 +01:00
Stefan Reichoer
e41b15c515 Work around a problem with tmux has-session:
tmux has-session does a prefix match and not an exact match.

When a session "ABC" does exist, the session "A" is also interpreted as "ABC"
Using tmux list-sessions fixes this problem
2016-10-28 13:07:17 +02:00
Yuki Inoue
9bcfbd3428 Add synchronize helper methods 2016-05-09 12:34:48 +09:00
Yuki Inoue
499c5abd83 Add balance_window helper methods 2016-04-28 15:17:05 +09:00
Daniel Hahler
3a8a43ccdc style: load_session: move return case up, removing indent 2016-04-02 22:38:40 +02:00
Daniel Hahler
a9a87992df load_session: prefer existing session instead of file in cwd
This also adds './' to a file used from the current working dir (in case
there is no session with that name), which is required for Bash's
`source` to use it (and not look for it in `$PATH`).

Fixes https://github.com/jimeh/tmuxifier/issues/69.
2016-04-02 22:38:25 +02:00
Benjamin Chrétien
6f8773133d new_window: disable allow-rename if a window name was given 2015-12-15 17:53:45 +01:00
595269dd6a Make load-window within a session adhere to session_root setting
This should fix #61. Previously when you manually ran `tmuxifier
load-window` from within a session created by Tmuxifier, the
`session_root` path set in the session was ignored, and the new window
would be cd'd to `$HOME` unless the window configuration had
`window_root` set.
2015-07-25 13:24:02 +01:00
41da75ad39 Add support for iTerm2's Tmux integration
This should resolve #52.
2014-12-01 21:01:58 +00:00
ef0f25591c Set $window var based on currently active window
Previously $window was only set by the new_window() helper when it was
passed a name argument. This caused weird behavior cause if it was
called without a name it would simply attempt to recreate the same
window and fail. That was until @blueyed's fix in 2249cf8.

However, the $window var still wasn't being set correctly, leaving
split_v(), split_h() and other helpers to operate on the wrong
window. This is no longer an issue as $window is always set to the index
of the currently active window at the end of new_window() and
select_window().
2014-08-29 22:29:03 +01:00
0ae0bc84e3 Add __get_current_window_index internal helper function 2014-08-29 22:28:25 +01:00
Daniel Hahler
2249cf8d1b new_window: only set $window and pass -n if a name is provided
Otherwise `new_window` after `new_window foo` would re-use the same
name, resulting in an error.
2014-08-29 20:20:07 +01:00
4bf105eebc Improve wording of comment 2014-08-29 20:15:32 +01:00
71236afccf Clean up structure of initialize_session helper function 2014-08-29 20:14:59 +01:00
33f26bca56 Wrap long line 2014-02-27 23:41:11 +00:00
90caa0d362 Fix typo in code comment 2014-02-27 23:40:48 +00:00
0653074570 Fix issue #28, default-path error with Tmux 1.9
When using Tmux 1.9 and later the "-c" argument is given to the
"new-session" command to set the session's root/default path. When using
Tmux 1.8.x and earlier, the old "default-path" session option method is
used instead.
2014-02-25 00:30:34 +00:00
e231f2d642 Enable passing custom arguments to tmux
Custom arguments can now be passed to tmux by setting the
TMUXIFIER_TMUX_OPTS environment variable.
2014-01-29 08:11:20 +00:00
4c1cb0762a Fix issue #23 - Some consoles don't seem to support C-l 2013-07-17 14:42:46 +01:00
1dddbb502c Enable load commands to accept file paths in addition to layout names
Resolves issue #20. Additionally, load_session now has an optional
second argument to set the default session name. And error output from
both load commands is now printed to STDERR and give a return code of 1
on error.
2013-07-02 23:05:18 +02:00
limeyd
212693b1e9 added optional window name 2013-06-26 20:55:29 -06:00
a0365273d0 Minor formatting fixes 2013-06-20 09:38:00 +01:00
Lawrence Siebert
5e33aefa7d modified: lib/layout-helpers.sh
added split_hl and split_hl and split_vl which split with a count of
columns/lines instead of by percentage,  and clock which starts
clock-mode.  Comments for each added.
2013-06-19 23:35:13 -07:00
Stanislav Fomichev
0fc1f20af7 Fix typo 2013-06-18 11:11:22 +04:00
Stanislav Fomichev
8c2582a948 Add set_default_path option
This option lets user disable 'tmux set-option default-path' for
$session_root, like this:
	session_root "~/x/y/z"
	set_default_path=false
2013-06-18 11:10:48 +04:00
f9c91e5fcd Improve --help and --complete argument handling 2013-06-03 09:32:13 +03:00
5363ac555b Re-organize internal files a bit 2013-06-02 18:45:12 +03:00
0e2cfa2327 Enable load-session command from outside of Tmux
This means that "init" session layouts can now be used to start and/or
re-attach to your main session.

Personally I have a "main" session layout with a couple of default
windows. I can now either start that session, or re-attach to it from
outside of Tmux by just running `tmuxifier s main`, instead of manually
creating a session named "main" and then loading my windows into it.
2013-06-02 18:30:28 +03:00
d5d87d3ab2 Fix issue #7
Instead of assuming that the default created window in a new session has
a index of `0`, we now check window index for the session with Tmux's
list-windows command.

Additionally, the default window is now moved to index `999` instead of
`99`, cause I'm paranoid and probably stupid :)
2012-09-06 22:11:51 +01:00
b79125f55d Rename function to match existing naming convention 2012-07-04 19:56:00 +01:00
Trae Robrock
5c2659c8e7 Use cd to set the working dir of a split or window so that rvm works 2012-06-27 17:46:12 -07:00
5989b1f516 Add send_keys layout helper 2012-06-27 21:39:54 +01:00
012526656e Remove send-keys -l support check as it is not needed
After some experimentation it turns out that if input to send-keys is
not a known key sequence like `C-m` or `C-l` for example, it it
automatically treated as literal input.

 Negating the need to use it and hence check if it's supported.
2012-06-27 21:29:29 +01:00
Trae Robrock
75ae3ba142 Support tmux versions that do not have the -l flag 2012-06-26 16:35:23 -07:00
89325d0982 Add new layout helper functions for pane creation and command execution 2012-05-24 00:42:35 +01:00
8155740ceb Fix window specific root path
If a session root was set, any window layouts loaded with a window root
set caused the window root to be ignored. This resolves the issue.
2012-05-24 00:42:34 +01:00
ae70bae022 Reorganize functions a bit 2012-05-24 00:42:31 +01:00
a8ff37808a Clean up the code a bit 2012-05-24 00:41:37 +01:00
178bbdecff Make better use of conditional operators and quote vars properly 2012-04-30 02:14:52 +01:00
1fc854dbdd Move internal runtime functions to layout-helpers.sh file 2012-04-30 02:12:01 +01:00
855c522cf0 Avoid exiting with a cleaner syntax for commands that might fail 2012-04-26 02:22:40 +01:00
0d3cfb2494 Improve new_window helper function's internals 2012-04-26 02:10:30 +01:00
ebc1d9c31e Move layout-helpers.sh to lib/layout-helpers.sh 2012-04-25 23:27:31 +01:00