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 Tue 23 Sep 2014, 22:41
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
ticker tape PNN - Puppy News Network
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 3 [43 Posts]   Goto page: Previous 1, 2, 3
Author Message
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 06 Feb 2012, 10:41    Post subject:  

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/viewtopic.php?p=602401#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!
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Mon 06 Feb 2012, 17:04    Post subject:  

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:
#!/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!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Mon 06 Feb 2012, 18:11    Post subject:  

vovchik wrote:
http://www.murga-linux.com/puppy/viewtopic.php?p=602401#602401

Sorry, I didn't notice that before... I was in trance, perhaps I'm a "code-junkie"..? Shocked
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!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Mon 06 Feb 2012, 18:15    Post subject:  

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) Smile

Regards,
s
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Mon 06 Feb 2012, 18:44    Post subject:  

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> Sad

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 Smile
AFAIK urxvt = Unicode rxvt
Thanks to it shoud be possible to get diacritic characters...maybe multilanguage news..?

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Mon 06 Feb 2012, 18:54    Post subject:  

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 Smile
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

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Mon 06 Feb 2012, 19:16    Post subject:  

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:
#!/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!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Mon 06 Feb 2012, 20:55    Post subject:  

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> Sad

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 Smile
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 Smile )
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 07 Feb 2012, 05:20    Post subject:  

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


Did not work for me, bits of it did . . .
I could not incorporate this:
Code:
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:
#!/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 WIKI
Back to top
View user's profile Send private message Visit poster's website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 07 Feb 2012, 05:33    Post subject:  

SFR the transparency is great - your code is working Smile
BUT the off/on switch is not. Crying or Very sad

I will look at the code later but I thought I might add today's news first Smile

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Tue 07 Feb 2012, 06:30    Post subject:  

Thanks seaside!
Achieving compability between different Puppies is more complex than I thought...
It's some kind of Sisyphean labor. Rolling Eyes
So if javascript has nothing to do with <marquee> there's still a chance to find working one.
More scroller versions = More fun Smile

@Lobster:
It's odd...
I downloaded the latest Saluki (whoa, great progress since 006, by the way), and ON/OFF works, but has no transparency.
(might be because I launched it in VBox..?)
I tried Slacko either, everything's ok...

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1068

PostPosted: Tue 07 Feb 2012, 17:14    Post subject:  

Lobster, I encountered the failure of On/Off feature, at last.
It was because I tried to turn off the scroller too soon, before the message was loaded.
The line which exports PID was placed AFTER that. Now it's fixed.
Hope it was the same in your case, not something worse...

BTW, sometimes it takes two times to run the scroller, especially when it's turned off via ctrl+c instead of mouse-click.

Assuming everyone has it's own settings of panel(s) (top/bottom/vertical/horizontal) and different background colors,
I've added few easy-editable parameters in front of the script, to make it more friendly/customizable.

Code:
#!/bin/bash

# Scroller for "News Network"
# Requirements: Bash + urxvt + wget

TRANS="-"           # Transparency On (-) or Off (+)
FORECOL=Blue        # Foreground color (also: 0-15)
BACKCOL=White       # Background color (also: 0-15)
LENGHT=20           # Scroller lenght (in characters)
POSITIONX=0         # Scroller X position (in pixels)
POSITIONY=0         # Scroller Y position (in pixels)
#==============================================================================
PRECODELENGHT=37    # 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 -fg "$FORECOL" -bg "$BACKCOL" "$TRANS"tr -bl +sb -g "$LENGHT"x1+"$POSITIONX"+"$POSITIONY" -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e bash /tmp/scroller_temp.txt

# START

# Here the main scroller's code starts

echo -n $$ > /tmp/scroller_pid   # Export PID into temp file
WINLEN=$(tput cols)            # Get current number of columns
echo -ne "\033[?25l"          # 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 $WINLEN`; do
  MESSAGE=" "$MESSAGE
done

LEN=${#MESSAGE}
POS=0
}

getmessage
 
# Main loop

while true; do

  TEXT=${MESSAGE:$POS:$WINLEN}
  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

EDIT: I overlooked one more reference to sh in this line:
Code:
exec urxvt -fg "$FORECOL" -bg "$BACKCOL" "$TRANS"tr -bl +sb -g "$LENGHT"x1+"$POSITIONX"+"$POSITIONY" -fn 'xft:DejaVu Sans Mono-18:dpi=76' -e sh /tmp/scroller_temp.txt

Code corrected now.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Mon 05 Mar 2012, 19:34    Post subject:  

Would anyone be interested in having this in their tray, or is there too much text to fit?
If so, I did a generic tray icon program that will work:
http://murga-linux.com/puppy/viewtopic.php?t=76431

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 3 [43 Posts]   Goto page: Previous 1, 2, 3
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.1250s ][ Queries: 12 (0.0119s) ][ GZIP on ]