Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panedの2番目のタブで取得できない #290

Open
akira-87 opened this issue Feb 14, 2025 · 5 comments
Open

panedの2番目のタブで取得できない #290

akira-87 opened this issue Feb 14, 2025 · 5 comments

Comments

@akira-87
Copy link

panedの1番目のタブではコマンドラインから取得できるのですが、2番目のタブでは取得できません。
どうすれば出来ますか?
例えば以下のように

while true; do
echo aaa
sleep 1
echo bbb
sleep 1
if [[ -z ps -A | grep yad ]]; then break; fi
done | yad --plug=$$ --tabnum=1 --form --field=: --cycle-read|
yad --plug=$$ --tabnum=2 --form --field=: --cycle-read &
yad --paned --key=$$ --width=300 --height=150

@ryonakano
Copy link

I think the reason why it doesn't work as your expectation would be because the yad for the first tab passes nothing to the next yad through the pipe.

What about using tee and the process substitution?

#!/bin/bash

while true; do
        echo aaa
        sleep 1

        echo bbb
        sleep 1

        if [[ -z `ps -A | grep yad` ]]; then
                break;
        fi
done |
        tee >(yad --plug=$$ --tabnum=1 --form --field=: --cycle-read) |
        yad --plug=$$ --tabnum=2 --form --field=: --cycle-read &
        yad --paned --key=$$ --width=300 --height=150

The above code works like this, I'm not sure if it's your expected behavior though. Possibly you might want to show aaa for the first tab and bbb for the next tab.

Screencast.From.2025-02-16.17-30-10.mp4

See also: https://qiita.com/ronin_gw/items/bacef57a53411bbc7406

@akira-87
Copy link
Author

ありがとうございます。
コメントの最後に言っているように、最初のタブでaaa、2番目のタブでbbbを表示したいと思っています。
しかし、非常にいいヒントになって、タブ毎のループにしてみました。最初のタブでもbbbが表示されてしまうのが今一ですが,,,

while true; do
    echo aaa
    sleep 1
    echo bbb
    sleep 1
    if [[ -z ps -A | grep yad ]]; then
        break;
    fi
done | tee >(yad --plug=$$ --tabnum=1 --form --field=: --cycle-read) |
while read line; do
    if [[ $line = bbb ]]; then
       echo $line
    fi
done | yad --plug=$$ --tabnum=2 --form --field=: --cycle-read |
yad --paned --key=$$ --width=300 --height=150

@ryonakano

This comment has been minimized.

@akira-87
Copy link
Author

aaaとbbbは最初のループで変化する値を取得して、それぞれのタブで表示したいと思っています。説明不足ですいません。

@cou645
Copy link

cou645 commented Feb 21, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants