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
97
inxi
97
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.1.24
|
||||
#### version: 0.1.25
|
||||
#### Date: October 28 2008
|
||||
########################################################################
|
||||
#### 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.
|
||||
IBSHELL=0 # Running in a shell? Defaults to false, and is determined later.
|
||||
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.
|
||||
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.
|
||||
|
@ -131,9 +132,6 @@ then
|
|||
source $HOME/.$SCRIPT_NAME
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# WARNING: In the main part below (search for 'KONVI')
|
||||
# there's a check for Konversation-specific config files.
|
||||
# Any one of these can override the above if infobash is run
|
||||
|
@ -207,25 +205,33 @@ script_debugger()
|
|||
#### 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()
|
||||
{
|
||||
if (( DEBUG > 5 ))
|
||||
then
|
||||
if (( KONVI ))
|
||||
then
|
||||
dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "konvi='$konvi' saying : '$@'"
|
||||
else
|
||||
echo "konvi='$konvi' saying : '$@'"
|
||||
fi
|
||||
# if (( KONVI ))
|
||||
# then
|
||||
# dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "konvi='$KONVI' saying : '$@'"
|
||||
# else
|
||||
# echo "konvi='$KONVI' saying : '$@'"
|
||||
# fi
|
||||
echo "konvi='$KONVI' saying : '$@'"
|
||||
#((KONVI)) && dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "konvi='$KONVI' saying : '$@'" || echo "konvi='$KONVI' saying : '$@'"
|
||||
fi
|
||||
#((KONVI)) && dcop $DCPORT Konversation print_screen_output $DCSERVER "$DCTARGET" "$1" || echo -ne "$1\n"
|
||||
if (( KONVI ))
|
||||
then
|
||||
dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "$1"
|
||||
else
|
||||
echo -ne "$1\n"
|
||||
fi
|
||||
|
||||
# if ((KONVI))
|
||||
# then
|
||||
# dcop "$DCPORT" "$DCOPOBJ" print_screen_output "$DCSERVER" "$DCTARGET" "$1"
|
||||
# else
|
||||
# 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()
|
||||
|
@ -255,7 +261,7 @@ sanitize_characters()
|
|||
echo "$2" | gawk "BEGIN { IGNORECASE=1 } {gsub(/${!1}/,\"\");
|
||||
gsub(/ [ ]+/,\" \"); ## ([ ]+) with (space)
|
||||
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
|
||||
get_start_app()
|
||||
get_start_source()
|
||||
{
|
||||
local ircClientPath='' ircClientPathLower='' pidOfKonvi=''
|
||||
|
||||
|
@ -455,6 +461,7 @@ get_start_app()
|
|||
ircClientPath=$( which konversation )
|
||||
fi
|
||||
ircClientPathLower=$( tr '[:upper:]' '[:lower:]' <<< $ircClientPath )
|
||||
|
||||
case $ircClientPathLower in
|
||||
*irssi-text*|*irssi*)
|
||||
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 }' )
|
||||
}
|
||||
|
||||
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))
|
||||
then
|
||||
DCPORT="$1"
|
||||
DCSERVER="$2"
|
||||
DCTARGET="$3"
|
||||
shift 3
|
||||
# DCPORT="$1"
|
||||
# DCSERVER="$2"
|
||||
# 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 )
|
||||
for kde_config in $( kde-config --path data )
|
||||
do
|
||||
if [[ -r ${i}${KONVI_CFG} ]]
|
||||
if [[ -r ${kde_config}${KONVI_CFG} ]]
|
||||
then
|
||||
source "${i}${KONVI_CFG}"
|
||||
source "${kde_config}${KONVI_CFG}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$OIFS"
|
||||
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_script_depends
|
||||
|
||||
get_start_app
|
||||
# if ((KONVI))
|
||||
# then
|
||||
# DCPORT="$1"
|
||||
# DCSERVER="$2"
|
||||
# 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 "$@"
|
||||
get_start_source
|
||||
|
||||
# note: this didn't work, dcop kept throwing out errors, I think this only works
|
||||
# if it's run from inside konversation as a script builtin or something
|
||||
set_konversation
|
||||
|
||||
# "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
||||
get_parameters "$@"
|
||||
|
||||
|
|
Loading…
Reference in a new issue