| |

VerySource

 Forgot password?
 Register
Search
View: 1190|Reply: 4

How to get to which tty the user is currently switched to

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-1 20:40:02
| Show all posts |Read mode
My brother is currently working on a program to run a program in the background to determine which tty the current user has switched to, and then pop up the newt window or the gtk window according to the current tty is a character terminal or xwindows, but how to judge, please hero Suggestion
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-3-25 11:00:01
| Show all posts
Just run the tty command
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-3 11:00:01
| Show all posts
So how do you do it programmatically?


I still have to look at the source code of tty-_ ~~~~
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-6 17:30:01
| Show all posts
I read / proc / self / fd / 0 and see where the link goes
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-8 19:45:01
| Show all posts
Check the environment variables to get it
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list