Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-02-01 16:41:31

Shimo
Member
Registered: 2022-02-01
Posts: 1

Help with Generic monitor. Scrolling text.

Hey everyone! Apologies if this is the wrong place, please move it if I messed up.

I'll get right into it though, I've been making my own monitors with GenMon lately. Trying to get a little bit more of a personal touch. But where I'm stuck right now is wanting one with scrolling text. So my question for the hive mind is. 1. How do I set a static width for what the monitor shows on the task bar, and 2. How do I get text to scroll in that monitor like a news feed or a stock ticker does.

Ultimately, I'm hoping to build my own little ticker to keep track of just the crypto and stock I own; and keep an eye on them. I already have the stock info pulled through awk etc so I'm just stuck on the scrolling part.

?u=https%3A%2F%2Fi.makeagif.com%2Fmedia%2F6-12-2015%2FCXpkGB.gif&f=1&nofb=1

Offline

#2 2022-02-01 17:56:08

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: Help with Generic monitor. Scrolling text.

Hello and welcome.

Shimo wrote:

I'll get right into it though, I've been making my own monitors with GenMon lately.

Cool plugin.

How do I set a static width for what the monitor shows on the task bar

Not currently possible, unless you use a fixed width font like monospace

2. How do I get text to scroll in that monitor like a news feed or a stock ticker does.

Use a script like this:

#!/bin/bash

# str is the string to tick
str="Lorem ipsum dolor sit amet. Qui beatae nulla vel incidunt excepturi et fugiat alias a dolorem dolor ut delectus vero ut molestiae nobis a consequatur eligendi. Non esse ipsam et adipisci molestiae cum dolorem praesentium ut officia iure ut magnam accusantium 33 culpa necessitatibus."

# length is the length of the substring to display
length=30

# processing code
counter=$(cat ~/.cache/counter 2>/dev/null || echo 0)
[[ $counter -gt $((${#str}-$length)) ]] && counter=0

echo "${str:$counter:$length}"
echo "$((counter+1))" > ~/.cache/counter

exit 0

...and change the str and length variables. In the genmon plugin, set the command to point to this script and the period to indicate how fast to scroll. Don't forget to make the script executable.

In your case, $str would hold the output of the awk command to get the stock price.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-02-02 01:25:57

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: Help with Generic monitor. Scrolling text.

in general, scrolling can be done by just re-displaying the text shifted over by some amount.  the picture you included has a shift of a whole character.  a faster shift of a single pixel at a time could also be done but would need more involved programming.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 525.55 KiB (Peak: 531.5 KiB) ]