mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
hacked out the dcop stuff for now, that only works if inxi is started as a built in konversation script
This commit is contained in:
parent
41b9d5f2aa
commit
d218d50d02
95
inxi
95
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.1.24
|
#### version: 0.1.25
|
||||||
#### Date: October 28 2008
|
#### Date: October 28 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||||
|
@ -49,6 +49,7 @@ DEBUG_FLOOD=0 # Debug flood override: toggle on to allow long debug output
|
||||||
DEFAULT_SCHEME=2 # Defaults to 2, make this 1 for normal, 0 for no colorcodes at all. Set to any other valid scheme you like. Same as runtime parameter.
|
DEFAULT_SCHEME=2 # Defaults to 2, make this 1 for normal, 0 for no colorcodes at all. Set to any other valid scheme you like. Same as runtime parameter.
|
||||||
IBSHELL=0 # Running in a shell? Defaults to false, and is determined later.
|
IBSHELL=0 # Running in a shell? Defaults to false, and is determined later.
|
||||||
INDENT=14 # Default indentation level
|
INDENT=14 # Default indentation level
|
||||||
|
KONVI=0 # default to false, no konversation found
|
||||||
NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
|
NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
|
||||||
SHOW_HOST=1 # Set this to 0 to avoid printing the hostname
|
SHOW_HOST=1 # Set this to 0 to avoid printing the hostname
|
||||||
SHOW_IRC=2 # SHOW_IRC=1 to avoid showing the irc client version number, or SHOW_IRC=0 to disable client information completely.
|
SHOW_IRC=2 # SHOW_IRC=1 to avoid showing the irc client version number, or SHOW_IRC=0 to disable client information completely.
|
||||||
|
@ -131,9 +132,6 @@ then
|
||||||
source $HOME/.$SCRIPT_NAME
|
source $HOME/.$SCRIPT_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# WARNING: In the main part below (search for 'KONVI')
|
# WARNING: In the main part below (search for 'KONVI')
|
||||||
# there's a check for Konversation-specific config files.
|
# there's a check for Konversation-specific config files.
|
||||||
# Any one of these can override the above if infobash is run
|
# Any one of these can override the above if infobash is run
|
||||||
|
@ -207,25 +205,33 @@ script_debugger()
|
||||||
#### print / output cleaners
|
#### print / output cleaners
|
||||||
#### -------------------------------------------------------------------
|
#### -------------------------------------------------------------------
|
||||||
|
|
||||||
# inxi speaks through here. When run by Konversation, use DCOP
|
# inxi speaks through here. When run by Konversation, uses DCOP
|
||||||
|
# note, this is a huge bug trap, for now we're not using this at all except to
|
||||||
|
# output basic stuff. At some point in the future we'll debug the dcop stuff,
|
||||||
|
# but that only works if infobash is being run as a konversation script to begin with
|
||||||
print_screen_output()
|
print_screen_output()
|
||||||
{
|
{
|
||||||
if (( DEBUG > 5 ))
|
if (( DEBUG > 5 ))
|
||||||
then
|
then
|
||||||
if (( KONVI ))
|
# if (( KONVI ))
|
||||||
then
|
# then
|
||||||
dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "konvi='$konvi' saying : '$@'"
|
# dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "konvi='$KONVI' saying : '$@'"
|
||||||
else
|
# else
|
||||||
echo "konvi='$konvi' saying : '$@'"
|
# echo "konvi='$KONVI' saying : '$@'"
|
||||||
fi
|
# fi
|
||||||
|
echo "konvi='$KONVI' saying : '$@'"
|
||||||
|
#((KONVI)) && dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "konvi='$KONVI' saying : '$@'" || echo "konvi='$KONVI' saying : '$@'"
|
||||||
fi
|
fi
|
||||||
#((KONVI)) && dcop $DCPORT Konversation print_screen_output $DCSERVER "$DCTARGET" "$1" || echo -ne "$1\n"
|
#((KONVI)) && dcop $DCPORT Konversation print_screen_output $DCSERVER "$DCTARGET" "$1" || echo -ne "$1\n"
|
||||||
if (( KONVI ))
|
|
||||||
then
|
# if ((KONVI))
|
||||||
dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "$1"
|
# then
|
||||||
else
|
# dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "$1"
|
||||||
echo -ne "$1\n"
|
# else
|
||||||
fi
|
# echo -ne "$1\n"
|
||||||
|
# fi
|
||||||
|
#((KONVI)) && dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "$1" || echo -ne "$1\n"
|
||||||
|
echo -ne "$1\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_erroneous_chars()
|
remove_erroneous_chars()
|
||||||
|
@ -255,7 +261,7 @@ sanitize_characters()
|
||||||
echo "$2" | gawk "BEGIN { IGNORECASE=1 } {gsub(/${!1}/,\"\");
|
echo "$2" | gawk "BEGIN { IGNORECASE=1 } {gsub(/${!1}/,\"\");
|
||||||
gsub(/ [ ]+/,\" \"); ## ([ ]+) with (space)
|
gsub(/ [ ]+/,\" \"); ## ([ ]+) with (space)
|
||||||
gsub(/^ +| +$/,\"\"); ## (pipe char) with (nothing)
|
gsub(/^ +| +$/,\"\"); ## (pipe char) with (nothing)
|
||||||
print }" ## prints (returns) cleaned input
|
print }" ## prints (returns) cleaned input
|
||||||
}
|
}
|
||||||
|
|
||||||
#### -------------------------------------------------------------------
|
#### -------------------------------------------------------------------
|
||||||
|
@ -436,7 +442,7 @@ get_parameters()
|
||||||
#### -------------------------------------------------------------------
|
#### -------------------------------------------------------------------
|
||||||
|
|
||||||
# Determine where infobash was run from
|
# Determine where infobash was run from
|
||||||
get_start_app()
|
get_start_source()
|
||||||
{
|
{
|
||||||
local ircClientPath='' ircClientPathLower='' pidOfKonvi=''
|
local ircClientPath='' ircClientPathLower='' pidOfKonvi=''
|
||||||
|
|
||||||
|
@ -455,6 +461,7 @@ get_start_app()
|
||||||
ircClientPath=$( which konversation )
|
ircClientPath=$( which konversation )
|
||||||
fi
|
fi
|
||||||
ircClientPathLower=$( tr '[:upper:]' '[:lower:]' <<< $ircClientPath )
|
ircClientPathLower=$( tr '[:upper:]' '[:lower:]' <<< $ircClientPath )
|
||||||
|
|
||||||
case $ircClientPathLower in
|
case $ircClientPathLower in
|
||||||
*irssi-text*|*irssi*)
|
*irssi-text*|*irssi*)
|
||||||
IRC_CLIENT_VERSION=" $( $ircClientPath -v | gawk 'NR == 1 { print $2 }' )"
|
IRC_CLIENT_VERSION=" $( $ircClientPath -v | gawk 'NR == 1 { print $2 }' )"
|
||||||
|
@ -607,29 +614,34 @@ set_calculated_variables()
|
||||||
LSPCI=$( lspci -v | awk '{ gsub(/\(prog-if[^)]*\)/,""); print }' )
|
LSPCI=$( lspci -v | awk '{ gsub(/\(prog-if[^)]*\)/,""); print }' )
|
||||||
}
|
}
|
||||||
|
|
||||||
set_konvi()
|
# note, this isn't working as intended, dcop isputting out errors, but who cares
|
||||||
|
# for now skipping all dcop stuff
|
||||||
|
set_konversation()
|
||||||
{
|
{
|
||||||
local i=''
|
local kde_config=''
|
||||||
|
|
||||||
if ((KONVI))
|
if ((KONVI))
|
||||||
then
|
then
|
||||||
DCPORT="$1"
|
# DCPORT="$1"
|
||||||
DCSERVER="$2"
|
# DCSERVER="$2"
|
||||||
DCTARGET="$3"
|
# DCTARGET="$3"
|
||||||
shift 3
|
# shift 3
|
||||||
# The section below is on request of Argonel from the Konversation developer team:
|
# The section below is on request of Argonel from the Konversation developer team:
|
||||||
# it sources config files like $HOME/.kde/share/apps/konversation/scripts/inxi.conf
|
# it sources config files like $HOME/.kde/share/apps/konversation/scripts/inxi.conf
|
||||||
IFS=":"
|
IFS=":"
|
||||||
for i in $( kde-config --path data )
|
for kde_config in $( kde-config --path data )
|
||||||
do
|
do
|
||||||
if [[ -r ${i}${KONVI_CFG} ]]
|
if [[ -r ${kde_config}${KONVI_CFG} ]]
|
||||||
then
|
then
|
||||||
source "${i}${KONVI_CFG}"
|
source "${kde_config}${KONVI_CFG}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$OIFS"
|
IFS="$OIFS"
|
||||||
fi
|
fi
|
||||||
|
# print_screen_output "DCPORT: $DCPORT"
|
||||||
|
# print_screen_output "DCSERVER: $DCSERVER"
|
||||||
|
# print_screen_output "DCTARGET: $DCTARGET"
|
||||||
}
|
}
|
||||||
|
|
||||||
#### -------------------------------------------------------------------
|
#### -------------------------------------------------------------------
|
||||||
|
@ -1260,27 +1272,12 @@ set_calculated_variables
|
||||||
# Check for dependencies before running any commands in this script! So yes, here!!
|
# Check for dependencies before running any commands in this script! So yes, here!!
|
||||||
check_script_depends
|
check_script_depends
|
||||||
|
|
||||||
get_start_app
|
get_start_source
|
||||||
# if ((KONVI))
|
|
||||||
# then
|
# note: this didn't work, dcop kept throwing out errors, I think this only works
|
||||||
# DCPORT="$1"
|
# if it's run from inside konversation as a script builtin or something
|
||||||
# DCSERVER="$2"
|
set_konversation
|
||||||
# DCTARGET="$3"
|
|
||||||
# shift 3
|
|
||||||
# # The section below is on request of Argonel from the Konversation developer team:
|
|
||||||
# # it sources config files like $HOME/.kde/share/apps/konversation/scripts/inxi.conf
|
|
||||||
# IFS=":"
|
|
||||||
# for i in $( kde-config --path data )
|
|
||||||
# do
|
|
||||||
# if [[ -r ${i}${KONVI_CFG} ]]
|
|
||||||
# then
|
|
||||||
# source "${i}${KONVI_CFG}"
|
|
||||||
# break
|
|
||||||
# fi
|
|
||||||
# done
|
|
||||||
# IFS="$OIFS"
|
|
||||||
# fi
|
|
||||||
set_konvi "$@"
|
|
||||||
# "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
# "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
||||||
get_parameters "$@"
|
get_parameters "$@"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue