added tiny tweak, showing protocol out of x if possible.

This commit is contained in:
Harald Hope 2018-04-12 14:26:18 -07:00
parent 27b9b1bfc7
commit 8d060c8cb4
3 changed files with 22 additions and 10 deletions

29
inxi
View file

@ -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;

2
inxi.1
View file

@ -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.

View file

@ -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: