From 1b1e1c43c7bb44e8c7115b34cd1adbf750ebb981 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Thu, 20 Aug 2020 13:18:23 +0200 Subject: modules/profpatsch/weechat: add a workaround to attach ssh directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far we directly start a mosh-daemon when the user connects. This breaks down in situations where UDP is blocked (e.g. some hotspots). In that case, ssh can be used directly: Example: ssh -t weechat@legosi ssh The ssh argument tells it to connect directly. Note the `-t`, which forces a pseudo-tty, otherwise tmux will complain that it can’t find a terminal. --- modules/user/profpatsch/programs/weechat.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/user') diff --git a/modules/user/profpatsch/programs/weechat.nix b/modules/user/profpatsch/programs/weechat.nix index 51574a9b..317f63ec 100644 --- a/modules/user/profpatsch/programs/weechat.nix +++ b/modules/user/profpatsch/programs/weechat.nix @@ -21,7 +21,7 @@ let bins = getBins pkgs.tmux [ "tmux" ] // getBins pkgs.weechat [ "weechat" ] // getBins pkgs.dash [ "dash" ] - // getBins pkgs.s6-portable-utils [ "s6-sleep" ] + // getBins pkgs.s6-portable-utils [ "s6-sleep" "s6-test" ] // getBins pkgs.mosh [ "mosh-server" ] ; @@ -51,7 +51,11 @@ let ]; attachWeechatTmuxSession = writeExecline "attach-weechat-tmux-session" {} [ - # make sure that we can use mosh here + "importas" "-u" "-D" "" "what" "SSH_ORIGINAL_COMMAND" + # if the user passes "ssh" as argv, it will call tmux directly + "ifelse" [ bins.s6-test "$what" "=" "ssh" ] + [ bins.tmux "attach-session" "-t" sessionName ] + # if not, it uses the mosh-server (default) bins.mosh-server "--" bins.tmux "attach-session" -- cgit 1.4.1