stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [STUMP] Using run-or-raise to manage pre-configured windows inatmux


From: Mostafa Razavi
Subject: Re: [STUMP] Using run-or-raise to manage pre-configured windows inatmux session
Date: Wed, 9 Apr 2014 22:40:20 +0430

Alexander,

This is from my .stumpwmrc. Perhaps something like this works for you too.

(defcommand emacs-in-tmux () ()
  "attempts to switch to an emacs instance run in a tmux window
   called 'emacs', itself inside a urxvt instance."

  (let ((ret
(run-shell-command "tmux select-window -t emacs ; echo $?" t)))

    (if (eql (elt ret 0) #\0)
        (run-or-raise "urxvt" '(:class "URxvt"))
        (message "no tmux session found."))))
(define-key *root-map* (kbd "C-e") "emacs-in-tmux")



On Wed, Apr 9, 2014 at 8:09 PM, Stefan Reichör <address@hidden> wrote:
"J. David Smith" <address@hidden> writes:

> Not sure about tmux being able to do that, I don't use it myself. If it can, great. If not, then
> (window-send-string) is the way to go.

I have one tmux session running and the following works for me:
(run-shell-command "tmux select-window -t CONTROL")

Not sure, how multiple tmux sessions will be handled.

(window-send-string "tmux select-window -t CONTROL") will only work when
you are in a shell window.

Otherwise you need to send Control-B : somehow to enter the tmux command mode.

> On Wed, Apr 9, 2014 at 11:28 AM, Michael Raskin <address@hidden> wrote:
>
>     >@Michael Raskin: that'll send the command to a *new* shell, not the
>     >existing mlterm session.
>
>     Can't tmux send commands to a preexisting session? I use this screen
>     functionality a lot and always assumed tmux also has something like
>     that. It is somewhat more reliable than emulating key events…
>
>     >Bjergaard's solution works -- at least with urxvt.
>     >
>     >Here is a sample that runs ls in a non-emacs urxvt client window:
>     >
>     >(defcommand ls () ()
>     >
>     >            (run-or-raise "urxvtc" '(:class "URxvt" :title "^(?!emacs)"))
>     >
>     >            (window-send-string (format nil "ls~%")))
>     >
>     >Using (format nil "ls~%") is necessary, the C-style "ls\n" will not work.
>
>     Literal line break should work, though.
>
>     "ls
>     "


Stefan.

_______________________________________________
Stumpwm-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]