From 8d060c8cb4ae5cded5f3a5c07eac54b49883fb4a Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Thu, 12 Apr 2018 14:26:18 -0700 Subject: [PATCH] added tiny tweak, showing protocol out of x if possible. --- inxi | 29 ++++++++++++++++++++--------- inxi.1 | 2 +- inxi.changelog | 1 + 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/inxi b/inxi index 0d234a5..71abe7f 100755 --- a/inxi +++ b/inxi @@ -4022,8 +4022,7 @@ sub show_options { ['2', '-C', '', "Minimum CPU speed, if available." ], ['2', '-D', '', "Disk serial number." ], ['2', '-G', '', "Chip vendor:product ID for each video card; OpenGL - compatibility version, if free drivers and available. (Mir/Wayland only) - compositor (experimental)." ], + compatibility version, if free drivers and available; compositor (experimental)." ], ['2', '-I', '', "Other detected installed gcc versions (if present). System default runlevel. Adds parent program (or tty) for shell info if not in IRC. Adds Init version number, RC (if found)." ], @@ -7743,13 +7742,25 @@ sub display_data(){ $protocol = $ENV{'XDG_SESSION_TYPE'} if $ENV{'XDG_SESSION_TYPE'}; $protocol = $ENV{'WAYLAND_DISPLAY'} if (!$protocol && $ENV{'WAYLAND_DISPLAY'}); # need to confirm that there's a point to this test, I believe no, fails out of x -# if (!$protocol && $b_display && !$b_force_display && $ENV{'XDG_SESSION_ID'}){ -# if (my $program = main::check_program('loginctl')){ -# my $temp = (main::grabber("$program show-session $ENV{'XDG_SESSION_ID'} -p Type --no-pager 2>/dev/null"))[0]; -# $temp =~ s/Type=// if $temp; -# $protocol = $temp; -# } -# } + # loginctl also results in the session id + if (!$protocol && $b_display && $b_force_display){ + if (my $program = main::check_program('loginctl')){ + my $id = ''; + # $id = $ENV{'XDG_SESSION_ID'}; # returns tty session in console + my @data = main::grabber("$program --no-pager --no-legend 2>/dev/null",'','strip'); + foreach (@data){ + next if /tty[0-6]$/; + $id = (split /\s+/, $_)[0]; + last; # multiuser? too bad, we'll go for the first one + } + if ($id ){ + my $temp = (main::grabber("$program show-session $id -p Type --no-pager --no-legend 2>/dev/null"))[0]; + $temp =~ s/Type=// if $temp; + # ssh will not show /dev/ttyx so would have passed the first test + $protocol = $temp if $temp && $temp ne 'tty'; + } + } + } if ($extra > 1){ # initial tests, if wayland, it is certainly a compositor $protocol = lc($protocol) if $protocol; diff --git a/inxi.1 b/inxi.1 index aa01ac8..0611fa6 100644 --- a/inxi.1 +++ b/inxi.1 @@ -593,7 +593,7 @@ data (if available) as the voltage now / minimum design voltage (\fBnow/min\fR). \- Adds vendor:product ID of each Graphics card. .TP .B \-xx \-G\fR -\- (Wayland/Mir only; experimental) if found, attempts to show compositor. +\- Adds compositor, if found (experimental). .TP .B \-xx \-G\fR \- For free drivers, adds OpenGL compatibility version number if available. diff --git a/inxi.changelog b/inxi.changelog index 2e34303..52efa95 100644 --- a/inxi.changelog +++ b/inxi.changelog @@ -9,6 +9,7 @@ New version, new man. Fine tunings. New features: 1. for a very few systems that have wmctrl installed, shows with -xxxS, wm if present +2. an attempt to get display protocol from out of X, using --display and loginctl Enhancements: 1. made xorg display server and protocols show more consistently with other layout: