From 45f3d15a30c08f56fe8eb155143b380179eacb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20St=C3=BCgelmayer?= Date: Sun, 10 Dec 2017 17:49:30 -0300 Subject: [PATCH 1/5] Remove quiet command, it is no longer valid --- tmuxomatic | 1 - 1 file changed, 1 deletion(-) diff --git a/tmuxomatic b/tmuxomatic index 6bcac4c..311adeb 100755 --- a/tmuxomatic +++ b/tmuxomatic @@ -2090,7 +2090,6 @@ def tmuxomatic( program_cli, full_cli, user_wh, session_name, session, active_se # There are two ways to fix this. 1) Add "set-option -g allow-rename off" to your ".tmux.conf". # 2) Add "export DISABLE_AUTO_TITLE=true" to your shell's run commands file (e.g., ".bashrc"). # Here we automatically do method 1 for the user, unless the user requests otherwise. - list_build.append( "set-option -t " + session_name + " quiet on" ) renaming = [ "off", "on" ][ARGS.renaming] list_build.append( "set-option -t " + session_name + " allow-rename " + renaming ) list_build.append( "set-option -t " + session_name + " automatic-rename " + renaming ) From bcb57174f8e2365e73d64ce32c74b363cb1035e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20St=C3=BCgelmayer?= Date: Sun, 24 Dec 2017 16:10:44 -0300 Subject: [PATCH 2/5] Refactor, check version before use quiet option --- tmuxomatic | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tmuxomatic b/tmuxomatic index 311adeb..d246a45 100755 --- a/tmuxomatic +++ b/tmuxomatic @@ -512,6 +512,9 @@ def signal_handler_hup( signal_number, frame ): _ = repr(signal_number) + repr(frame) # Satisfies pylint raise KeyboardInterrupt +def support_quiet_option(version): + return float(version) < 2.5 + def satisfies_minimum_version(minimum, version): """ Asserts compliance by tmux version. I've since seen a similar version check somewhere that may come with Python @@ -2090,6 +2093,9 @@ def tmuxomatic( program_cli, full_cli, user_wh, session_name, session, active_se # There are two ways to fix this. 1) Add "set-option -g allow-rename off" to your ".tmux.conf". # 2) Add "export DISABLE_AUTO_TITLE=true" to your shell's run commands file (e.g., ".bashrc"). # Here we automatically do method 1 for the user, unless the user requests otherwise. + + if support_quiet_option(tmux_version()[1]): + list_build.append( "set-option -t " + session_name + " quiet on" ) renaming = [ "off", "on" ][ARGS.renaming] list_build.append( "set-option -t " + session_name + " allow-rename " + renaming ) list_build.append( "set-option -t " + session_name + " automatic-rename " + renaming ) From 09a4020ef96966ce02d72f39e5a3aa3efb5e4083 Mon Sep 17 00:00:00 2001 From: Matias Grunberg Date: Tue, 4 Jun 2019 11:54:45 -0300 Subject: [PATCH 3/5] Remove deprecation warning on phyton 3 --- tmuxomatic | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tmuxomatic b/tmuxomatic index d246a45..00bfcf8 100755 --- a/tmuxomatic +++ b/tmuxomatic @@ -777,8 +777,12 @@ class SessionFile(object): self.Load_Shorthand_SharedCore( bol ) def Load(self): # Load raw data + if sys.version_info < (3, ): + mode = "rU" + else: # python 3 deprecates mode "U" in favor of "newline" option + mode = "r" rawfile = "" - f = open(self.filename, "rU") + f = open(self.filename, mode) while True: line = f.readline() if not line: break # EOF From 4671afeacc1c48189f49ca6bdb7fbc7044f89800 Mon Sep 17 00:00:00 2001 From: Matias Grunberg Date: Wed, 19 Jun 2019 21:47:37 -0300 Subject: [PATCH 4/5] Add new-session window size if required --- tmuxomatic | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tmuxomatic b/tmuxomatic index 00bfcf8..e130874 100755 --- a/tmuxomatic +++ b/tmuxomatic @@ -515,6 +515,15 @@ def signal_handler_hup( signal_number, frame ): def support_quiet_option(version): return float(version) < 2.5 +def new_session_dimensions_args(tmux_version, user_w, user_h): + if float(tmux_version) <= 2.5: + return '' # Tmux 2.5 use user screen as default windowsize + if float(tmux_version) < 2.8: + return "-x " + str(user_w) + " -y " + str(user_h) # Tmux 2.6 use 80x24 window for detached sessions + + return "-x - -y -" # tmux 2.8 add '-' argument to use users screen as default window size + + def satisfies_minimum_version(minimum, version): """ Asserts compliance by tmux version. I've since seen a similar version check somewhere that may come with Python @@ -2092,7 +2101,7 @@ def tmuxomatic( program_cli, full_cli, user_wh, session_name, session, active_se # The shell's cwd must be set, the only other way to do this is to discard the # window that is automatically created when calling "new-session". cwd_execution = ("cd " + list_panes_dir) if list_panes_dir else "" - list_build.append( "new-session -d -s " + session_name + " -n \"" + window_name + "\"" ) + list_build.append( "new-session -d -s " + session_name + " -n \"" + window_name + "\" " + new_session_dimensions_args(USERS_TMUX, user_wh[0], user_wh[1]) ) # Normally, tmux automatically renames windows based on whatever is running in the focused pane. # There are two ways to fix this. 1) Add "set-option -g allow-rename off" to your ".tmux.conf". # 2) Add "export DISABLE_AUTO_TITLE=true" to your shell's run commands file (e.g., ".bashrc"). From ace52a14302beb8ca03021e5cfb5136478a4c7bb Mon Sep 17 00:00:00 2001 From: Matias Grunberg Date: Wed, 19 Jun 2019 21:47:45 -0300 Subject: [PATCH 5/5] Use global tmux variable --- tmuxomatic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmuxomatic b/tmuxomatic index e130874..08c4b3e 100755 --- a/tmuxomatic +++ b/tmuxomatic @@ -2107,7 +2107,7 @@ def tmuxomatic( program_cli, full_cli, user_wh, session_name, session, active_se # 2) Add "export DISABLE_AUTO_TITLE=true" to your shell's run commands file (e.g., ".bashrc"). # Here we automatically do method 1 for the user, unless the user requests otherwise. - if support_quiet_option(tmux_version()[1]): + if support_quiet_option(USERS_TMUX): list_build.append( "set-option -t " + session_name + " quiet on" ) renaming = [ "off", "on" ][ARGS.renaming] list_build.append( "set-option -t " + session_name + " allow-rename " + renaming )