ticker tape PNN - Puppy News Network

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#21 Post by SFR »

vovchik wrote:That source seems to be C#, which is not c++ or C. You need Mono, and that ain't a part of any normal devx.
Well, that explains everything...
Thank you vovchik for saving our time. :)

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#22 Post by Lobster »

pretty good - so how to display a MESSAGE Using the content of that URL which is your daily message . . .

Code: Select all

#!/bin/sh

# =========================================
# Scroller - The Final Frontier by SFR'2012
# =========================================

# Tweakable parameters

MESSAGE=http://tmxxine.com/test2/t.txt
WIDTH=320   # Window width
HEIGHT=0   # Window height
SPEED=0.2   # This parameter accepts even "0.01", but CPU dies then...
POSX=1     # 0 = left, 1 = center, 2 = right
POSY=0      # 0 = top,  1 = center, 2 = bottom
# =============================================================================

# Setting up everything

export SPEED

CHARWIDTH=$(($WIDTH/8))
export CHARWIDTH

# Adding spaces in front of the message

#for i in `seq 0 $CHARWIDTH`; do
#MESSAGE=" "$MESSAGE
#done

# Using temp files to keep the message and current text position

echo "$MESSAGE" > /tmp/scroll_text
echo > /tmp/scroll_var

# Determine current screen resolution and set up X and Y

RES=$(xrandr | grep "current" | cut -d 'c' -f1,3 | tr -cd 'x [:digit:]' | cut -d 'x' -f1,2)
MAXX=$(echo $RES | cut -d 'x' -f1,1)
MAXY=$(echo $RES | cut -d 'x' -f2,3)

case "$POSX" in
  0) X=0 ;;
  1) X=$((($MAXX/2)-($WIDTH/2))) ;;
  2) X=$(($MAXX-$WIDTH)) ;;
  *) X=$((($MAXX/2)-($WIDTH/2))) ;;
esac

case "$POSY" in
  0) Y=0 ;;
  1) Y=$((($MAXY/2)-($HEIGHT/2))) ;;
  2) Y=$(($MAXY-$HEIGHT)) ;;
  *) Y=$((($MAXY/2)-($HEIGHT/2))) ;;
esac


# Zigbert's routine to achieve monospace font.
# Source: OP in http://www.murga-linux.com/puppy/viewtopic.php?t=38608

echo 'style "specialmono"
{
  font_name="Mono 22"
}
widget "*mono" style "specialmono"
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono
export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0
# =============================================================================

# Main scroll function

scroll () {
GET=$(cat /tmp/scroll_text)
POS=$(cat /tmp/scroll_var)
LEN=${#GET}

TEXT=${GET:$POS:$CHARWIDTH}
POS=$(($POS+1))
if [ "$POS" == "$LEN" ]; then POS=0; fi
echo $POS > /tmp/scroll_var
echo "$TEXT"
}
export -f scroll

# Gtkdialog structure

export MAIN='
<window title="Puppy News Network" allow-grow="false">
    <vbox>
    <progressbar visible="false">
      <input>while [ A = A ]; do sleep $SPEED; echo 99; echo 100; done</input>
      <action>refresh:SCROLL</action>
    </progressbar>
   
    <entry name=\"mono"\ sensitive="true">
      <variable>SCROLL</variable>
      <input>scroll</input>
    </entry>
    </vbox>
</window>
'

# Ok, let's begin!

gtkdialog -G "$WIDTH"x"$HEIGHT"+$X+$Y -p MAIN

# Cleaning, cleaning...

rm -f /tmp/scroll_text
rm -f /tmp/scroll_var
unset CHARWIDTH
unset SPEED
unset MAIN
unset scroll

# This part is to kill 'broken pipe' or whatever it is...
# To see what I mean, comment the following lines, launch the code in Terminal,
# and close the application's window (but not Terminal).
# If you know better way to do it, change the code please :)

TEST=`ps | grep while | grep sleep | grep done | cut -d"r" -f 1`
kill $TEST
exit

# THE END

I moved the position of the scroller as it was behind the taskbar . . .
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#23 Post by SFR »

You almost did it:

Code: Select all

MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"`
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#24 Post by SFR »

Lobster wrote:I moved the position of the scroller as it was behind the taskbar . . .
Oh, with JWM it behaves a bit different than with Openbox/Fbpanel...
Insert this line right above Zigbert's part, should be ok:

Code: Select all

if [ "$POSY" -eq 2 ]; then Y=$(($Y-50)); fi
(50 is my panel's height, your may vary.)

EDIT: Whole code here:

Code: Select all

#!/bin/sh 

# ========================================= 
# Scroller - The Final Frontier by SFR'2012 
# ========================================= 

# Tweakable parameters 

MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"`

WIDTH=320   # Window width 
HEIGHT=35   # Window height 
SPEED=0.2   # This parameter accepts even "0.01", but CPU dies then... 
POSX=2      # 0 = left, 1 = center, 2 = right 
POSY=2      # 0 = top,  1 = center, 2 = bottom 
# ============================================================================= 

# Setting up everything 

export SPEED 

CHARWIDTH=$(($WIDTH/8)) 
export CHARWIDTH 

# Adding spaces in front of the message 

for i in `seq 0 $CHARWIDTH`; do 
 MESSAGE=" "$MESSAGE 
done 

# Using temp files to keep the message and current text position 

echo "$MESSAGE" > /tmp/scroll_text 
echo > /tmp/scroll_var 

# Determine current screen resolution and set up X and Y 

RES=$(xrandr | grep "current" | cut -d 'c' -f1,3 | tr -cd 'x [:digit:]' | cut -d 'x' -f1,2) 
MAXX=$(echo $RES | cut -d 'x' -f1,1) 
MAXY=$(echo $RES | cut -d 'x' -f2,3) 

case "$POSX" in 
  0) X=0 ;; 
  1) X=$((($MAXX/2)-($WIDTH/2))) ;; 
  2) X=$(($MAXX-$WIDTH)) ;; 
  *) X=$((($MAXX/2)-($WIDTH/2))) ;; 
esac 

case "$POSY" in 
  0) Y=0 ;; 
  1) Y=$((($MAXY/2)-($HEIGHT/2))) ;; 
  2) Y=$(($MAXY-$HEIGHT)) ;; 
  *) Y=$((($MAXY/2)-($HEIGHT/2))) ;; 
esac 

if [ "$POSY" -eq 2 ]; then Y=$(($Y-50)); fi

# Zigbert's routine to achieve monospace font. 
# Source: OP in http://www.murga-linux.com/puppy/viewtopic.php?t=38608 

echo 'style "specialmono" 
{ 
  font_name="Mono 12" 
} 
widget "*mono" style "specialmono" 
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono 
export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0 
# ============================================================================= 

# Main scroll function 

scroll () { 
GET=$(cat /tmp/scroll_text) 
POS=$(cat /tmp/scroll_var) 
LEN=${#GET} 

TEXT=${GET:$POS:$CHARWIDTH} 
POS=$(($POS+1)) 
if [ "$POS" == "$LEN" ]; then POS=0; fi 
echo $POS > /tmp/scroll_var 
echo "$TEXT" 
} 
export -f scroll 

# Gtkdialog structure 

export MAIN=' 
<window title="Puppy News Network" allow-grow="false"> 
    <vbox> 
    <progressbar visible="false"> 
      <input>while [ A = A ]; do sleep $SPEED; echo 99; echo 100; done</input> 
      <action>refresh:SCROLL</action> 
    </progressbar> 
    
    <entry name="mono"\ sensitive="true"> 
      <variable>SCROLL</variable> 
      <input>scroll</input> 
    </entry> 
    </vbox> 
</window> 
' 

# Ok, let's begin! 

gtkdialog -G "$WIDTH"x"$HEIGHT"+$X+$Y -p MAIN 

# Cleaning, cleaning... 

rm -f /tmp/scroll_text 
rm -f /tmp/scroll_var 
unset CHARWIDTH 
unset SPEED 
unset MAIN 
unset scroll 

# This part is to kill 'broken pipe' or whatever it is... 
# To see what I mean, comment the following lines, launch the code in Terminal, 
# and close the application's window (but not Terminal). 
# If you know better way to do it, change the code please :) 

TEST=`ps | grep while | grep sleep | grep done | cut -d"r" -f 1` 
kill $TEST 
exit 

# THE END
EDIT2: Experimental! Put this code at the very beginning of the "scroll" function, right after "scroll () {":

Code: Select all

# update check
TEMP1=`date +%M`		# get current minute
TEMP2=`date +%S`		# get current second
if [ "$TEMP1" -eq 0 ] && [ "$TEMP2" -eq 0 ]; then
  MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"`
    for i in `seq 0 $CHARWIDTH`; do 
      MESSAGE=" "$MESSAGE
    done 
  echo "$MESSAGE" > /tmp/scroll_text
  echo > /tmp/scroll_var 
fi
The message should be updated every full hour.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#25 Post by technosaurus »

noone interested in using rxvt

Code: Select all

#beware, this was coded blind with no terminal to test it in
i=0
LENGTH=20
DELAY=1
while ([ $i -lt ${#1} ]) do
 clear
 echo ${1:$i:$LENGTH}
 sleep $DELAY
 i=$(($i+1))
done
you'd want to play with rxvt -e and geometry, background and forground settings, possibly the name also, to remove the title bar via a jwm group setting
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#26 Post by trapster »

@ technosaurus

Very nice. Works nice on a transparent console with no decorations!

How can we keep the loop going, repeating the text scroll?
I understand we'd have to kill it with Ctrl-c or maybe run it for x minutes.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#27 Post by technosaurus »

put the whole thing in a
while : do
...
done

or you could replace the ":" (equivalent of true) with a check for something like ... ([ -f $HOME/.pnn_on ])

now that I think about it printf would be better than echo
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#28 Post by Lobster »

Code: Select all

MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"`
was playing about with wget, curl and piping (unsuccessfully) - but you got it 8)
The message should be updated every full hour.
OK have changed the message
I should imagine the program best run once a day or in emergencies . . .
Just having it running would be annoying?
http://puppylinux.org/wikka/NewsNetwork

Using rxvt does not give you control of font sizes unless changing terminal software
I changed to this

Code: Select all

font_name="Mono 22"
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#29 Post by technosaurus »

you mean like this?

Code: Select all

rxvt -g 40x1 +sb -name xmessage -fn 'xft:DejaVu Sans Mono-18:dpi=76'
xmessage already has a notitle setting :)

you may want to change the command prompt value by
PS1=""

then you can use the string size in your terminal's geometry setting (otherwise it will wrap around)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#30 Post by SFR »

@Lobster:
Lobster wrote:Just having it running would be annoying?
Hmm, maybe On/Off switch..?

By the way, <window decorated="false"> removes decorations...

@technosaurus:
It's very good idea to explore. Could be more efficient/showy than GtkDialog.
And it's possible to set initial X/Y coordinates too via rxvt -g 40x1+0+0,
so it should be very easy to replace GtkDialog part to rxvt it in my code.
technosaurus wrote:[...] to remove the title bar via a jwm group setting
But what about Openbox..?

EDIT: a small example how it could look:

Code: Select all

#!/bin/sh
tail -n +4 $0  > /tmp/scroller_temp.txt 
exec rxvt -g 40x1+0+0 -name xmessage -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e sh /tmp/scroller_temp.txt

MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"`

for i in `seq 0 40`; do
  MESSAGE=" "$MESSAGE
done

LEN=${#MESSAGE}
POS=0

# Main scroll function 

echo -ne "\033[?25l\033[1;31m\033[1;103m"

while true; do
  TEXT=${MESSAGE:$POS:40}
  POS=$(($POS+1))
  if [ "$POS" == "$LEN" ]; then POS=0; fi
  echo
  echo -n "$TEXT"
  sleep 0.2
done
PS. It's enough to click on the script file to launch it.

EDIT2: second attempt, now it's fully undecorated:

Code: Select all

#!/bin/sh 
tail -n +4 $0  > /tmp/scroller_temp.txt 
exec rxvt -borderLess +sb -g 40x1+0+0 -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e sh /tmp/scroller_temp.txt 

MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"` 

for i in `seq 0 40`; do 
  MESSAGE=" "$MESSAGE
done 

LEN=${#MESSAGE} 
POS=0 

# Main scroll function 

echo -ne "\033[?25l\033[1;31m\033[1;103m" 

while true; do 
  TEXT=${MESSAGE:$POS:40} 
  POS=$(($POS+1)) 
  if [ "$POS" == "$LEN" ]; then POS=0; fi 
  echo 
  echo -n "$TEXT" 
  sleep 0.2 
done
EDIT3: ...and with pseudo-transparency:

Code: Select all

#!/bin/sh 
tail -n +4 $0  > /tmp/scroller_temp.txt 
exec rxvt -foreground 4 -transparent -borderLess +sb -g 40x1+0+0 -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e sh /tmp/scroller_temp.txt 

MESSAGE=`wget -q -O - "http://tmxxine.com/test2/t.txt"` 

for i in `seq 0 40`; do 
  MESSAGE=" "$MESSAGE
done 

LEN=${#MESSAGE} 
POS=0

# Main scroll function 

echo -ne "\033[?25l" # to disable cursor

while true; do
  TEXT=${MESSAGE:$POS:40}
  POS=$(($POS+1)) 
  if [ "$POS" == "$LEN" ]; then POS=0; fi 
  echo 
  echo -n "$TEXT" 
  sleep 0.2
done 
...and now I have to go to work. C'ya.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#31 Post by vovchik »

Dear guys,

I am enjoying the ideas here. If you don't really want to do any work, you could try this: http://www.murga-linux.com/puppy/viewto ... 401#602401.

It's good for standard RSS feeds, but I really like the idea of a tiny ticker along the lines of what we are sseing in this thread.

With kind regards,
vovchik

PS. The transparent rxvt version is fabulous. Thanks, technosaurus!

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#32 Post by SFR »

I'm back...
Another draft, this time with auto update and ON/OFF mechanism.
Now it's enought to click the script to turn it on, and click again to turn off.
Works in Openbox and JWM (Lupu-528).

But what about colors, size, placement, etc.?
I'm not good with decoration stuff...

Code: Select all

#!/bin/sh

PRECODELENGHT=25	 # This parameter is the number of lines from the very beginning to the "START" comment
                    # It MUST be very accurate to make the script working!!!

# checking if there's temporary scroll state file, create one if not           
if [ ! -f /tmp/scroller_state ]; then
  echo -n "OFF" > /tmp/scroller_state
fi

# checking if the script is working now: if yes - kill, if not - launch
ONOFFTEST=$(cat /tmp/scroller_state)
if [ "$ONOFFTEST" == "ON" ]; then
  kill $(cat /tmp/scroller_pid)			# kills scroller process
  echo -n "OFF" > /tmp/scroller_state
  rm -f /tmp/scroller_pid
  exit
else
  echo -n "ON" > /tmp/scroller_state
fi

tail -n +$PRECODELENGHT $0  > /tmp/scroller_temp.txt 
exec rxvt -foreground 7 -transparent -borderLess +sb -g 40x1+0+0 -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e sh /tmp/scroller_temp.txt 

# START

# Here the main scroller's code starts

echo -ne "\033[?25l" # to disable cursor

# Get the message and add spaces in front of it
function getmessage () {
echo -n "UPDATING..."

MESSAGE=$(wget -q -O - "http://tmxxine.com/test2/t.txt")

for i in `seq 0 40`; do 
  MESSAGE=" "$MESSAGE
done

LEN=${#MESSAGE} 
POS=0
}

getmessage

echo -n $$ > /tmp/scroller_pid	# export PID into temp file

# Main loop

while true; do

  TEXT=${MESSAGE:$POS:40}
  POS=$(($POS+1)) 
  if [ "$POS" == "$LEN" ]; then POS=0; fi 
  echo 
  echo -n "$TEXT"
  
  # update check (every full hour)
  TEMP1=`date +%M`		# get current minute
  TEMP2=`date +%S`		# get current second
  if [ "$TEMP1" -eq 0 ] && [ "$TEMP2" -eq 0 ]; then
    getmessage
  fi
  
  sleep 0.2
  
done 

# The End
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#33 Post by SFR »

Sorry, I didn't notice that before... I was in trance, perhaps I'm a "code-junkie"..? :shock:
I donwloaded the tool; very nice find, but can't achieve transparency (Openbox).
Anyway, I like it!

Ok, so the problem seems to be solved now..?
Thanks for the challenge - it was fun!

Take care & Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#34 Post by seaside »

SFR,

That is very impressive. Nice and compact. I still had hoped to get PuppyBrowser to work with newer pups since it works perfectly in pup431, so that the full use of the marquee tag could be exploited with all it's extra functions. Alas, it seems it is loathe to work on the newer ones.

Perhaps the rxvt command should be changed to urxvt, because sometimes it's a link to urxvt and sometimes not. (many extra functions in urxvt not in rxvt) :)

Regards,
s

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#35 Post by SFR »

seaside wrote:I still had hoped to get PuppyBrowser to work with newer pups since it works perfectly in pup431, so that the full use of the marquee tag could be exploited with all it's extra functions. Alas, it seems it is loathe to work on the newer ones.
...because it's a good idea, too!
I even was looking for a tiny browser with javascript (it's needed by <marquee>, am I right?) that could be compatibile with as many Puppies as possible.
I found Links2 - very, very nice one, but doesn't support <marquee> :(
seaside wrote:Perhaps the rxvt command should be changed to urxvt, because sometimes it's a link to urxvt and sometimes not. (many extra functions in urxvt not in rxvt)
Why not, it's just a single-letter modification :)
AFAIK urxvt = Unicode rxvt
Thanks to it shoud be possible to get diacritic characters...maybe multilanguage news..?

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#36 Post by technosaurus »

SFR wrote:
seaside wrote:Perhaps the rxvt command should be changed to urxvt, because sometimes it's a link to urxvt and sometimes not. (many extra functions in urxvt not in rxvt)
Why not, it's just a single-letter modification :)
AFAIK urxvt = Unicode rxvt
Thanks to it shoud be possible to get diacritic characters...maybe multilanguage news..?

Greetings!
because you can't simply make a symlink for urxvt using a rxvt binary

if it is programmed/tested to work on rxvt, then it will more than likely work in urxvt with only a symlink, but not vice versa

its kinda like putting #!/bin/sh in a script that uses bashisms, when you add bashisms you should change it to #!/bin/bash ... likewise, when you add unicode, -hold, etc... that urxvt does not support then you _should _change rxvt to urxvt
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#37 Post by SFR »

Thanks, I didn't know that.
So, I checked and in Lupu-528 rxvt IS a symlink for urxvt, and sh IS a symlink for bash.
...and I was wondering why everything works no matter it's #!/bin/sh or #!/bin/bash...

Code corrected:

Code: Select all

#!/bin/bash

PRECODELENGHT=25	# This parameter is the number of lines from the very beginning to the "START" comment
                    # It MUST be very accurate to make the script working!!!

# checking if there's temporary scroll state file, create one if not           
if [ ! -f /tmp/scroller_state ]; then
  echo -n "OFF" > /tmp/scroller_state
fi

# checking if the script is working now: if yes - kill, if not - launch
ONOFFTEST=$(cat /tmp/scroller_state)
if [ "$ONOFFTEST" == "ON" ]; then
  kill $(cat /tmp/scroller_pid)			# kills scroller process
  echo -n "OFF" > /tmp/scroller_state
  rm -f /tmp/scroller_pid
  exit
else
  echo -n "ON" > /tmp/scroller_state
fi

tail -n +$PRECODELENGHT $0  > /tmp/scroller_temp.txt 
exec urxvt -foreground 7 -transparent -borderLess +sb -g 40x1+0+0 -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e sh /tmp/scroller_temp.txt 

# START

# Here the main scroller's code starts

echo -ne "\033[?25l" # to disable cursor

# Get the message and add spaces in front of it
function getmessage () {
echo -n "UPDATING..."

MESSAGE=$(wget -q -O - "http://tmxxine.com/test2/t.txt")

for i in `seq 0 40`; do 
  MESSAGE=" "$MESSAGE
done

LEN=${#MESSAGE} 
POS=0
}

getmessage

echo -n $$ > /tmp/scroller_pid	# export PID into temp file

# Main loop

while true; do

  TEXT=${MESSAGE:$POS:40}
  POS=$(($POS+1)) 
  if [ "$POS" == "$LEN" ]; then POS=0; fi 
  echo 
  echo -n "$TEXT"
  
  # update check (every full hour)
  TEMP1=`date +%M`		# get current minute
  TEMP2=`date +%S`		# get current second
  if [ "$TEMP1" -eq 0 ] && [ "$TEMP2" -eq 0 ]; then
    getmessage
  fi
  
  sleep 0.2
  
done 

# The End
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#38 Post by seaside »

SFR wrote:
seaside wrote: I even was looking for a tiny browser with javascript (it's needed by <marquee>, am I right?) that could be compatibile with as many Puppies as possible.
I found Links2 - very, very nice one, but doesn't support <marquee> :(
seaside wrote:Perhaps the rxvt command should be changed to urxvt, because sometimes it's a link to urxvt and sometimes not. (many extra functions in urxvt not in rxvt)
Why not, it's just a single-letter modification :)
AFAIK urxvt = Unicode rxvt
Thanks to it shoud be possible to get diacritic characters...maybe multilanguage news..?

Greetings!
SFR,

<marquee> tag is html and doesn't require javascript. There are some implementations using javascript see-
http://www.htmlmarquee.com/

I mentioned the change to rxvt because in pup431 there is a rxvt binary and a separate urxvt binary. Whereas, in the newer puppies it seems that rxvt usually is only a symlink to urxvt as you discovered.

So when rxvt is used in pup431, it results thus...
rxvt -foreground 7 -transparent -borderLess
rxvt: bad option "-transparent"
rxvt: bad option "-borderLess"

And no problem using urxvt - so urxvt should always work.

Regards,
s
(Also, #!/bin/sh refers to the file "/bin/sh" which is a link to "/bin/bash" , while #!/bin/bash refers directly to bash- so everything works :) )

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#39 Post by Lobster »

PS. The transparent rxvt version is fabulous. Thanks, technosaurus!
Did not work for me, bits of it did . . .
I could not incorporate this:

Code: Select all

rxvt -g 40x1+0+0 +sb -name xmessage -fn 'xft:DejaVu Sans Mono-28:dpi=76'
into something like this which requires a populated text file called autocue

Code: Select all

#!/bin/bash
# run from command line with ./Script
# will read the text file "autocue"
# and display one character after another 

INPUT=autocue

clear
while IFS= read -r -n1 char
do
   sleep 0.05
   echo -n "$char"
done < "$INPUT"
I used this a couple of years back in this video
but had to use the Sakura terminal to get large text
http://youtu.be/E4BqXF_ZXiY

I am using Saluki Beta 010 (based on Racy 5.2.2)

So how to get large text directly?
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#40 Post by Lobster »

SFR the transparency is great - your code is working :)
BUT the off/on switch is not. :cry:

I will look at the code later but I thought I might add today's news first :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Post Reply