You are not logged in.

#1 2024-11-03 17:15:47

archlynovice
Member
Registered: 2023-10-22
Posts: 28

[SOLVED] Reading tty messages from within a graphical session

Hi, this is a short one:

How can I read tty messages from within my Sway session? Is there a way that uses basic command line tools and doesn't revolve around some AUR package?

I struggle to get my Wayland/Sway setup running on my new device (Hiding the Waybar is bugging around: Flickering shadow of hidden Waybar). I start Sway manually from tty. Every time I want to read the tty debug info, I have to exit Sway. My iteration process would be a lot less painful if I just could read those messages from within the session (I don't even want to input anything). Any help is appreciated.

Much love

- An archly novice

Last edited by archlynovice (2024-11-04 19:22:49)

Offline

#2 2024-11-03 18:07:58

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,290

Re: [SOLVED] Reading tty messages from within a graphical session

Log stdout and stderr to a file yourself by starting sway with

sway |& tee /tmp/sway.log

or so.

Offline

#3 2024-11-03 18:49:16

archlynovice
Member
Registered: 2023-10-22
Posts: 28

Re: [SOLVED] Reading tty messages from within a graphical session

Well, this leaves a lot out. It only prints messages, errors, warnings, or logs generated by Sway.

Everything _during_ Sway, but not _by_ Sway will not be printed. This includes:

Environment variable $... not set, ignoring.
Gdk-Message: Error reading events ...
[common/ipc-client.c:XX] Unable to receive ...

All of this is missing.

Any idea to just follow along the tty directly?

Offline

#4 2024-11-03 20:54:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,290

Re: [SOLVED] Reading tty messages from within a graphical session

You want every programs output that's ever happening ever? You're not going to have that in the tty either, in a general sense. your probably seeing systemd journal integration or so, so check the journal with journalctl. Can you link to a screenshot of which messages you mean that would be excluded?

Offline

#5 2024-11-03 21:26:50

archlynovice
Member
Registered: 2023-10-22
Posts: 28

Re: [SOLVED] Reading tty messages from within a graphical session

I'm tired. Will respond tomorrow.

Last edited by archlynovice (2024-11-03 22:00:33)

Offline

#6 2024-11-04 07:34:22

seth
Member
Registered: 2012-09-03
Posts: 59,012

Re: [SOLVED] Reading tty messages from within a graphical session

exec >> /tmp/sway.log 2>&1
sway

However

Everything _during_ Sway, but not _by_ Sway

You cannot perfectly control where random stuff prints its messages and also the behavior might differ depending on whether the tty is occupied by something else.

Run tmux, start sway from there and attach to the session from some GUI terminal inside sway.
Remember that sway is pot. the foreground process in that shell, so ctrl+c inside the tmux session will kick you out of the sway session!

Offline

#7 2024-11-04 19:00:45

archlynovice
Member
Registered: 2023-10-22
Posts: 28

Re: [SOLVED] Reading tty messages from within a graphical session

@V1del I'm pretty new to shell scripting, so I tried to understand your command first. I learned about the |& expression and replaced it by 2>&1 (thought I'm smart). My shell interpreter didn't read that well and split the output in two files: /tmp/sway.log and ~/%1. When using your command, it works just fine. Thank you for the help :)

@seth I wanted to learn about tmux anyway, so this may be a reason to do it now. Thanks! :)

Offline

Board footer

Powered by FluxBB