Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 18 Nov 2017, 06:41
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
text2conky
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
stemsee

Joined: 27 Jun 2013
Posts: 1994
Location: In The Way

PostPosted: Wed 12 Oct 2016, 18:54    Post subject:  text2conky
Subject description: type to a conky display
 

This script opens a yad entry box into which you can type what you want. After hitting enter the text will be displayed on the right of your screen. If there are spaces between words they will be replaced by line breaks (carraige return) for vertical top down display. Otherwise use underscore to force single line.

Change font size to suit.

Need help to achieve transparency.

Good for messaging someone sat behind you!!

Code:
#!/bin/sh
killall conky
while true
do
STUFF=`yad --geometry=200x40 --entry`
ret=$?
[[ $ret > 0 ]] && exit 0
kill $conkpid
conky -x 10 -y 20 -t "`printf %s\\\n $STUFF | tr ' ' '\n'`" -f sans:size=80 &
conkpid=$!
done
text2conky.png
 Description   
 Filesize   51.8 KB
 Viewed   345 Time(s)

text2conky.png

Back to top
View user's profile Send private message MSN Messenger 
drunkjedi


Joined: 24 May 2015
Posts: 684

PostPosted: Wed 12 Oct 2016, 22:30    Post subject:  

Do you have feh installed?
It's needed for transparency to work.
Also need ""own_window_type override" in conkyrc.

Please go through following Conky with Lua Thread

You can find my desktop screenshot on it's last page.

Feh is wallpaper setter, conky uses it to show wallpaper to give illusion of transparency.[/url]
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 1994
Location: In The Way

PostPosted: Thu 13 Oct 2016, 14:43    Post subject:  

thanks drunkjedi!

Yes feh is installed. I got it working by changing in conky.conf
Code:
own_window yes

to
Code:
own_window no


I have updated the code so that there are three functions.

Function one is text2conky which posts what ever you type and return. Full stop is a line break. in this way multiple multi-word lines (Cool can fill the screen with text. Starts on the left.

Function two is text2conky auto, which posts word by word what you typed and returned top left of screen. Good for countdowns or infos. Loops until new or function one is initiated.

Function three is text2conky file, which always loads /root/text2conky copying it to tmp first. This is read line by line and posted on the right.

Code:
#!/bin/sh
#text2conky by stemsee (c) 2016
killall conky
#text2conky

if [[ "$1" = auto ]]; then
STUFF=`yad --geometry=200x40+600+600 --entry`
ret=$?
[[ $ret > 0 ]] && exit 0

while true
do
for i in $STUFF
do   
   kill $conkpid
   killall conky
   conky -x 10 -y 40 -t "`printf %s\\\n $i | tr ' ' '\n'`" -f sans:size=200 -a top_right &
   conkpid=$!
   sleep 3
done
done
elif [[ "$1" = file ]]; then
geany ~/text2conky
[[ -f ~/text2conky ]] && cp -f ~/text2conky /tmp/
while true
do
while read line
do
killall conky
   conky -x 10 -y 40 -t "$line" -f sans:size=120 &
   conkpid=$!
   sleep 3
kill $conkpid
done < /tmp/text2conky
done
else
while true
do
STUFF=`yad --geometry=200x40 --entry`
ret=$?
[[ $ret > 0 ]] && exit 0
kill $conkpid
killall conky
conky -x 10 -y 10 -t "`printf %s\\\n $STUFF | tr '\n' ' ' | tr '.' '\n'`" -f sans:size=90 &
conkpid=$!
done
fi


control script. /usr/sbin/ktext2conky
Code:
#!/bin/sh
killall text2conky
killall conky
text2conky


I spent thee day trying to get the shade contour and defaut colors to rotate or randomise! Didn't quite get that working with nested loops! Ended up with a seized-up-ram bloated brick!
text2conky.png
 Description   
 Filesize   220.36 KB
 Viewed   295 Time(s)

text2conky.png

Back to top
View user's profile Send private message MSN Messenger 
smokey01


Joined: 30 Dec 2006
Posts: 2657
Location: South Australia

PostPosted: Thu 13 Oct 2016, 16:45    Post subject:  

stemsee, the "killall conky" will kill all current instances of running conky's.

Did you know you can run multiple instances of conky with different config files?

_________________
Software <-> Distros <-> Tips <-> Newsletters
Back to top
View user's profile Send private message Visit poster's website 
stemsee

Joined: 27 Jun 2013
Posts: 1994
Location: In The Way

PostPosted: Thu 13 Oct 2016, 17:55    Post subject:  

Hi Smokey01

I became aware of the option to use other configs today as I was 'improving' the script. And I have wbar running and it isn't affected by killall conky and there is also another widget which doesn't suffer, but yeah, the conky resources panel is compromised. I am new to this arena and as usual like a bull in a china shop. Some finesse will come as I am made aware of consequences!

Although there has been a lot of work completed by others in developing widgets etc with conky, I myself can only glean a few tidbits as they are offered.

cheers

stemsee
Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 1994
Location: In The Way

PostPosted: Sat 15 Oct 2016, 07:42    Post subject:  

I have refined this a bit by adding auto line wrap according to screen res and font size and also the count of thin characters i,l,j. Also changed line break character to ']' instead of '.' Which means '.' can now be used normally.


Code:
#!/bin/sh
#killall text2conky
killall conky
#text2conky

if [[ "$1" = auto ]]; then
STUFF=`yad --geometry=200x40+600+600 --entry`
ret=$?
[[ $ret > 0 ]] && exit 0

while true
do
for i in $STUFF
do   
   kill $conkpid
   killall conky
   conky -x 10 -y 40 -t "`printf %s\\\n $i | tr ' ' '\n'`" -f sans:size=200 -a top_right &
   conkpid=$!
   sleep 2
done
done
elif [[ "$1" = file ]]; then
geany ~/text2conky
[[ -f ~/text2conky ]] && cp -f ~/text2conky /tmp/
while true
do
while read line
do
killall conky
   conky -x 10 -y 40 -t "$line" -f sans:size=120 &
   conkpid=$!
   sleep 2
kill $conkpid
done < /tmp/text2conky
done
else
while true
do
STUFF=`yad --geometry=200x40 --entry`
ret=$?
[[ $ret > 0 ]] && exit 0
kill $conkpid
killall conky
f=88
w=`xrandr | head -1 | cut -f2 -d',' | cut -f3 -d' '`
cn=$((((w / f) * 24) / 18))
num=`echo "$STUFF" |  awk 'BEGIN{FS="i"} {print NF?NF-1:0}'`
num2=`echo "$STUFF" | awk 'BEGIN{FS="l"} {print NF?NF-1:0}'`
num3=`echo "$STUFF" | awk 'BEGIN{FS="j"} {print NF?NF-1:0}'`
num4=`echo "$STUFF" |  awk 'BEGIN{FS="I"} {print NF?NF-1:0}'`
num=$((num2 + num + num4))
if [[ $num > 3 ]]; then
num=$((num / 2))
fi
cn=$((cn + num))
conky -x 00 -y 00 -t "`printf %s\\\n $STUFF | tr '\n' ' ' | fold -w$cn | tr ']' '\n'`" -f sans:size=$f -a top_left &
conkpid=$!
done
fi
Back to top
View user's profile Send private message MSN Messenger 
stemsee

Joined: 27 Jun 2013
Posts: 1994
Location: In The Way

PostPosted: Thu 20 Oct 2016, 16:07    Post subject:  

Added a more useful yad gui. Entry boxes for text wether for 'live' or 'auto': live posts what you type with auto line wrapping. Auto posts what you have typed word by word, a space is the fs. File opense geany to edit a text file with lines of text, displayed er line by line.

Position of text can be top left/middle/right, middle /left/middle/right, bottom left/middle/right.
Size can be selected or specified.

Time to display each item can be selected or specified.

updated code
Code:
#!/bin/sh

#text2conky by stemsee (c) 2016
#
function input () {
STUFF=$(yad --columns=1 --title "text2conky: configurator" --form --item-separator="," --field="Live Input" "" --field="Auto Cycle"  "" --field="Size":CBE "88,11,22,33,44,55,66,77,88,99,111,121,131,141,151,161,171,181,191,222,333,444,555,666,777,888" --field=File:CHK "" --field=top:CHK "TRUE" --field=right:CHK "" --field=middle:CHK "" --field=frequency:CBE "0.8,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.5,2,2.5,3,4" --button="gtk-ok:0" --button="gtk-close:1")
ret=$?
[[ $ret > 0 ]] && exit 0
f=`echo "$STUFF" | cut -f3 -d'|'`
lf=`echo "$f" | cut -c1`
if [ "$lf" = l ]; then
   f=`echo "$f" | cut -c2,3,4,5,6,7,8,9,10`
elif [ "$lf" = r ]; then
   f=`echo "$f" | cut -c2,3,4,5,6,7,8,9,10`
fi
STUFF1=`echo "$STUFF" | cut -f1 -d'|'`
STUFF2=`echo "$STUFF" | cut -f2 -d'|'`
STUFF3=`echo "$STUFF" | cut -f4 -d'|'`
STUFF4=`echo "$STUFF" | cut -f5 -d'|'`
STUFF5=`echo "$STUFF" | cut -f6 -d'|'`
STUFF6=`echo "$STUFF" | cut -f7 -d'|'`
STUFF7=`echo "$STUFF" | cut -f8 -d'|'`

if [[ "$STUFF4" = TRUE && "$STUFF5" = FALSE && "$STUFF6" = FALSE ]]; then
   pre=top
   suf=left
elif [[ "$STUFF4" = TRUE && "$STUFF5" = TRUE && "$STUFF6" = FALSE ]]; then
   pre=top
   suf=right
elif [[ "$STUFF4" = FALSE && "$STUFF5" = FALSE && "$STUFF6" = TRUE ]]; then
   pre=middle
   suf=middle
elif [[ "$STUFF4" = TRUE && "$STUFF5" = FALSE && "$STUFF6" = TRUE ]]; then
   pre=top
   suf=middle
elif [[ "$STUFF4" = FALSE && "$STUFF5" = TRUE && "$STUFF6" = TRUE ]]; then
   pre=bottom
   suf=middle
elif [[ "$STUFF4" = FALSE && "$STUFF5" = FALSE && "$STUFF6" = FALSE ]]; then
   pre=bottom
   suf=left
elif [[ "$STUFF6" = TRUE && "$lf" = r ]]; then
   pre=middle
   suf=right
elif [[ "$STUFF6" = TRUE && "$lf" = l ]]; then
   pre=middle
   suf=left
elif [[ "$STUFF4" = FALSE && "$STUFF5" = TRUE && "$STUFF6" = FALSE ]]; then
   suf=right
   pre=bottom
fi

pos="$pre"_"$suf"

}
export -f input
input

if [[ ! -z "$STUFF2" ]]; then
function auto () {
while true
do
for i in $STUFF2
do   
   killall conky
   conky -x 10 -y 40 -t "`printf %s\\\n $i | tr ' ' '\n'`" -f sans:size=$f -a $pos &
   conkpid=$!
   sleep $STUFF7
   kill $conkpid
done
done

}
export -f auto
auto
fi

if [[ "$STUFF3" = TRUE ]]; then
function file () {
geany ~/text2conky
[[ -f ~/text2conky ]] && cp -f ~/text2conky /tmp/
while true
do
while read line
do
killall conky
   conky -x 10 -y 40 -t "$line" -f sans:size=$f -a $pos &
   conkpid=$!
   sleep $STUFF7
kill $conkpid
done < /tmp/text2conky
done
}
export -f file
file
fi

if [[ ! -z "$STUFF1" ]]; then
function live () {
while true
do
kill $conkpid
killall conky
w=`xrandr | head -1 | cut -f2 -d',' | cut -f3 -d' '`
cn=$((((w / f) * 24) / 18))
num=`echo "$STUFF1" |  awk 'BEGIN{FS="i"} {print NF?NF-1:0}'`
num2=`echo "$STUFF1" | awk 'BEGIN{FS="l"} {print NF?NF-1:0}'`
num3=`echo "$STUFF1" | awk 'BEGIN{FS="j"} {print NF?NF-1:0}'`
num4=`echo "$STUFF1" |  awk 'BEGIN{FS="I"} {print NF?NF-1:0}'`
num=$((num2 + num + num4))
if [[ $num > 3 ]]; then
   num=$((num / 2))
fi
cn=$((cn + num))
conky -x 00 -y 00 -t "`printf %s\\\n $STUFF1 | tr '\n' ' ' | fold -w$cn | tr ']' '\n'`" -f sans:size=$f -a $pos &
conkpid=$!
input
done

}
export -f live
live
fi
t2c.png
 Description   
 Filesize   49.71 KB
 Viewed   229 Time(s)

t2c.png

screeny.png
 Description   
 Filesize   161.65 KB
 Viewed   233 Time(s)

screeny.png

Back to top
View user's profile Send private message MSN Messenger 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0502s ][ Queries: 14 (0.0065s) ][ GZIP on ]