You are not logged in.

#1 2019-07-03 04:28:05

MrEd
Member
Registered: 2018-06-26
Posts: 27

[SOLVED] Conky help issue

My first post, I hope I put it in the right place.

I signed up in the forums awhile back after finding the greatest weather conky I've ever seen and have been following @TeoBigusGeekus & @Sector11 & the rest of the gang here ever since so it's my hopes that my issue can get some input.

I've made what some might refer to as a useless creation haha
However in my endeavor to make it better, I've hit a snag and finally gave me a reason to post and hope others my be interested in the final product.

The project I started was conky-Sandwich....the short version.
Basically it went out and curled a picture of a sandwich every day of the month.
It has since evolved into screen-shotting a website, and posting the output into a window.

Well, started evolving more to change the recipe once every 15minutes...that's when I started getting conky libpng error: IDAT: CRC error or libpng error: IDAT: incorrect data check or "insert others like it" I THINK, it's a cache error but unsure.

I'm actually at then end of Antergos, with a basic Arch install if that helps if anyone is familiar with whats going on with antergos atm.....I'll post short version.

Here is the conky, sry you'll need to adjust dir's and stuff, but you may determine just by reading what the issue is and the gap x y is setup for dual monitor.

conky.config = {
-- from where does conky start
--alignment = "middle_middle",
     alignment = 'top_left',

-- distance from screen edge
--gap_x = 0,
--gap_y = 0,
	gap_x = -1898,
	gap_y = 20,

-- size settings for conky window
minimum_height = 800,
--minimum_width = 720,
     minimum_width = 475,
--maximum_width = 720,
     maximum_width = 475,
     max_text_width = 475,
--max_text_width = 720,

-- set conky behavior on screen (adjustable in the color section)
	-- allows setting own WM_Class. conky is the default
own_window_class = "Conky",
	-- don"t share the desktop, makes conky its own animal
own_window = true,
	-- on some systems does give full transparency, but cannot be adjusted as this setup allows
own_window_transparent = false,
	-- necessary to get adjustable transparency
own_window_argb_visual = true,
       -- normal, desktop, dock, panel, override
own_window_type = "normal",
-- own_window_type = 'override',
	--set values for conky behavior
--    own_window_type = 'dock',
    --own_window_hints = "sticky,above,skip_pager,skip_taskbar", --put below dock for window over conky!!! or remove above
    own_window_hints = "sticky,skip_pager,skip_taskbar",
    own_window_title = "Food Yummies",
-- set border/shading behavior
default_outline_color = "000000",
default_shade_color = "000000",
--draw_borders = false,
draw_borders = true,

border_width = 1,
stippled_borders = 0,
draw_graph_borders = false,
draw_outline = false,
draw_shades = false,
border_inner_margin = 5,

-- set special conditions for conky
out_to_x = true,
background = true,
out_to_console = false,
out_to_stderr = false,
text_buffer_size = 512,
total_run_times = 0,
double_buffer = true,
update_interval = 2,
cpu_avg_samples = 2,
net_avg_samples = 2,
no_buffers = true,
short_units = true,

imlib_cache_size = 256, --orig

--imlib2_cache_size = 0,
--libpng_cache_size = 7500,

--imlib_cache_flush_interval 60,
--cache flush interval -f 90,
--cache flush interval -f 86400,

show_graph_scale = false,
show_graph_range = false,

-- Text options

	-- anti-aliased font use and value = .1 to 1.0
use_xft = true,
xftalpha = 0.8,
	-- Xft font to use
font = "DejaVuSans:size=8.0",
	-- UTF8 support required for XFT
override_utf8_locale = true,

-- START COLORS
default_color = '57007C',
color0 = '86A8FF',
color1 = 'A15EC8',
color2 = 'D5D5D5',
color3 = 'FFFFFF',
color4 = '223867',
color5 = 'D6A0A0',
color6 = '86A8FF',
color7 = 'F6C3FF',
color8 = 'BBBBBB',
color9 = '3C3C3C',
-- END COLORS
own_window_colour = "000000",

-- affects transparency value 0-250
own_window_argb_value = 250,

}
-- That \ at the end of each line tells conky to keep what follows on the same line.
-- pdf in conky??

conky.text = [[

#${execi 43200 ~/.conky/My_conky/scripts/food.sh} # 12hrs
#${execi 14400 ~/.conky/My_conky/scripts/food.sh} # 4hrs

${execi 3600 ~/.conky/My_conky/scripts/food.sh} # 1hr start food 1

${execi 30 ~/.conky/My_conky/scripts/food2cp.sh} # 30sec food 2
${execi 60 ~/.conky/My_conky/scripts/food3cp.sh} # 60sec food 3
${execi 90 ~/.conky/My_conky/scripts/food4cp.sh} # 90sec food 4
${execi 120 ~/.conky/My_conky/scripts/food1cp.sh} # 30sec food 1
 



#${execi 10 ~/.conky/My_conky/scripts/food.sh} #10 sec

##Internet
# |--WiFi
${if_existing /proc/net/route wlan0}
#${execi 3600 ~/.conky/My_conky/scripts/food.sh} # 1hr
${alignc}${image ~/.conky/My_conky/food/food.png -p 0,0 -s 700x3000}

${else}
${if_existing /proc/net/route ppp0}
#${execi 3600 ~/.conky/My_conky/scripts/food.sh} # 1hr
${alignc}${image ~/.conky/My_conky/food/food.png -p 0,0 -s 700x3000}

${else}
#${if_up enp3s0}
${if_existing /proc/net/route enp3s0}

#${execi 3600 ~/.conky/My_conky/scripts/food.sh} # 1hr start food 1

${alignc}${image ~/.conky/My_conky/food/food.png -p 0,0 -s 700x3000}

#${execi 900 ~/.conky/My_conky/scripts/food2cp.sh} # 15min food 2
#${execi 1800 ~/.conky/My_conky/scripts/food3cp.sh} # 30min food 3
#${execi 2700 ~/.conky/My_conky/scripts/food4cp.sh} # 45min food 4

#${execi 30 ~/.conky/My_conky/scripts/food2cp.sh} # 30sec food 2
#${execi 60 ~/.conky/My_conky/scripts/food3cp.sh} # 60sec food 3
#${execi 90 ~/.conky/My_conky/scripts/food4cp.sh} # 90sec food 4
#${execi 120 ~/.conky/My_conky/scripts/food1cp.sh} # 30sec food 1

#${alignc}${image ~/.conky/My_conky/food/food.png -p 0,0 -s 700x3000}

${else}
${image ~/.conky/My_conky/food/No-Network-connection700x3000.jpg -p 0,0 -s 700x3000}

${endif}${endif}${endif}

#${alignc}${image $HOME/.conky/My_conky/food/food.png -p 0,0 -s 700x3000}



#${alignc}${image $HOME/.conky/My_conky/food/food.png -p 0,0 -s 475x800}
#${alignc}${image $HOME/.conky/My_conky/food/food3.gif -p 0,0 -s 490x400}
]];

The main bash script SHORT VERSION change day of month for it to work

#!/bin/bash
# install wkhtmltopdf for html to pdf and image   
#         wkhtmltoimage   https://wkhtmltopdf.org/   in Arch repo
#usage   wkhtmltopdf http://google.com google.pdf
#        wkhtmltoimage http://google.com google.png
# add -n or --no-stop-slow-scripts for scripts when java too slow
<<COMMENT
Conky-Sandwich by Mr Ed 2019
A food window display
number 2 is burgers & number 4 is a pizza, can be used as an index of where the script is in conky
COMMENT

#TMP=$( date +%y%b | awk '{print tolower($0)}' )
TMP=$( date +%d | awk '{print tolower($0)}' )

#if [ $TMP = 19jan ]
if [ $TMP = 01 ]
then
#curl -o /home/major/.conky/My_conky/food/food1.gif -O -f https://food.fnr.sndimg.com/content/dam/images/food/fullset/2011/6/6/0/FNM-070111-Take-It-From-Here-005_s4x3.jpg.rend.hgtvcom.966.725.suffix/1371597731091.jpeg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/ultimate-ham-sandwich-recipe-2105834 /home/major/.conky/My_conky/food/food.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/bobby-flay/perfect-burger-recipe-1957542 /home/major/.conky/My_conky/food/food2.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/melissa-darabian/three-cheesesteak-sandwiches-recipe-2119851 /home/major/.conky/My_conky/food/food3.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/ree-drummond/cast-iron-pizza-5428725 /home/major/.conky/My_conky/food/food4.png;

cp /home/major/.conky/My_conky/food/food_dl/food.png /home/major/.conky/My_conky/food/food.png;

elif [ $TMP = 02 ]
then
#curl -o /home/major/.conky/My_conky/food/food3.gif -O -f https://food.fnr.sndimg.com/content/dam/images/food/fullset/2011/6/6/0/FNM-070111-Take-It-From-Here-005_s4x3.jpg.rend.hgtvcom.966.725.suffix/1371597731091.jpeg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/trisha-yearwood/deviled-egg-salad-club-sandwich-3667947 /home/major/.conky/My_conky/food/food_dl/food.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/perfect-beef-burgers-recipe-1973839 /home/major/.conky/My_conky/food/food_dl/food2.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/italian-subs-recipe-1973242 /home/major/.conky/My_conky/food/food_dl/food3.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/grilled-pizza-5289011 /home/major/.conky/My_conky/food/food_dl/food4.png;

cp /home/major/.conky/My_conky/food/food_dl/food.png /home/major/.conky/My_conky/food/food.png;


elif [ $TMP = 03 ]
then
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/camping-muffuletta-3738968 /home/major/.conky/My_conky/food/food.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/perfect-pork-burgers-recipe-1973834 /home/major/.conky/My_conky/food/food_dl/food2.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/beg-sandwiches-bacon-egg-griddle-sandwiches-3363724 /home/major/.conky/My_conky/food/food_dl/food3.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/skillet-deep-dish-pizza-3566083 /home/major/.conky/My_conky/food/food_dl/food4.png;

cp /home/major/.conky/My_conky/food/food_dl/food.png /home/major/.conky/My_conky/food/food.png;

elif [ $TMP = 04 ]
then
wkhtmltoimage -n https://www.foodnetwork.com/recipes/katie-lee/fried-bologna-sandwich-5644724 /home/major/.conky/My_conky/food/food.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/perfect-grilled-burgers-recipe-2108173 /home/major/.conky/My_conky/food/food_dl/food2.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/tyler-florence/the-ultimate-steak-sandwich-recipe-1947893 /home/major/.conky/My_conky/food/food_dl/food3.png;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/ree-drummond/french-bread-pizzas-2247960 /home/major/.conky/My_conky/food/food_dl/food4.png;

cp /home/major/.conky/My_conky/food/food_dl/food.png /home/major/.conky/My_conky/food/food.png;

else
cp /home/major/.conky/My_conky/food/No-day-in-month700x3000.jpg /home/major/.conky/My_conky/food/food.png;

# 700x3000
# /home/major/.conky/My_conky/food/neon2.jpg

#curl -o /home/major/.conky/My_conky/food/food.png -O -f https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fak3.picdn.net%2Fshutterstock%2Fvideos%2F24049543%2Fthumb%2F9.jpg&f=1;
exit
sleep 3
fi

the cp bash script the conky runs food2cp.sh
there are 4, but only number changes

this is food1cp.sh

#!/bin/bash
#testing image cache for short intervals
cp /home/major/.conky/My_conky/food/food_dl/food.png /home/major/.conky/My_conky/food/food.png;

exit
sleep 3
fi

this is food2cp.sh

#!/bin/bash

cp /home/major/.conky/My_conky/food/food_dl/food2.png /home/major/.conky/My_conky/food/food.png;

exit
sleep 3
fi

It seems to work fine in rotating images, until the third image, this is when the libpng issues start and they seem to be affected by the cache setting in the conky script.

Hope someone finds my useless creation interesting enough to solve the issue...If I missed anything, please let me know as it's late, and should have just sought advice sooner but wanted to try and do it myself but have run out of searches to find a solution lol

RmVrIBf.jpg

Last edited by MrEd (2019-07-07 03:58:41)


MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10

Offline

#2 2019-07-03 07:53:39

unklar
Member
Registered: 2015-10-31
Posts: 946

Re: [SOLVED] Conky help issue

Welcome to the Forum  smile
I had a similar mistake...

Offline

#3 2019-07-03 23:37:31

MrEd
Member
Registered: 2018-06-26
Posts: 27

Re: [SOLVED] Conky help issue

Thank you unklar that was a big help actually!
It helped me uncover a couple more issues as well.

Here is why.
I was going to add cmd's to modify the png files but figured why complicate it if I didn't have to....sooooo everything jpg now LOL

It helped for one because the files are smaller which in all my experiences png's were always smaller but these went from 17mb png's to less than 800k jpg's so whatever, it's faster tongue

The problems this now uncovered was my copy cmd seemed a little slow and found it might be asking for a permission so changed it from

 
cp [file name] to [filename]
to
cp -rf [file name] to [filename1]

which ran a little more faster and then made me realize I can't do the timing to copy the file every 15m in conky the way I have it now bc by then the others have tried to run and are walking on each other out of order tongue

So now, I'm on a new quest to figure out another bash script to copy and rename 4 different files every 15m

So that's where I'm stuck atm bc I'm not real good with bash so doing alot of searching to find something that will work so I can get it done, so if you've seen a script someplace that can accomplish this, point the way. tongue


MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10

Offline

#4 2019-07-04 01:32:44

damo
....moderator....
Registered: 2015-08-20
Posts: 5,172

Re: [SOLVED] Conky help issue

So now, I'm on a new quest to figure out another bash script to copy and rename 4 different files every 15m

Is it a random selection? If so:

#!/bin/bash
##
## dupes.sh

IMG_PATH="/path/to/images"
DUPES_PATH="/path/for/duplicates"

declare -a arrImg   # array to hold images
i=0
for f in "$IMG_PATH"/*;do   # load images in dir into array
    arrImg+=("$f")
    ((i++))
done

ARR_LENGTH=${#arrImg[@]}    # total number of images in dir

declare -a arrNums      # array to hold 4 random numbers
for n in {1..4};do
    RAND_PIC=$(( $RANDOM % $ARR_LENGTH ))   # generate pseudo-random number
    RAND_PIC=($RAND_PIC - 1)                # subtract 1 ( array indices start at zero)
    arrNums+=($RAND_PIC)                    # add random numbers to array
done

# copy the 4 "random" images
for j in {0..3};do
    cp "${arrImg[${arrNums[$j]}]}" "$DUPES_PATH/"
done

DISCLAIMER: no checks for image files, or if directories exist. No error checking. Probably need to make sure duplicates dir is empty before copying?

Last edited by damo (2019-07-04 02:44:02)


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#5 2019-07-04 04:17:18

MrEd
Member
Registered: 2018-06-26
Posts: 27

Re: [SOLVED] Conky help issue

Unfortunately not random, but thank
you for that, looks like it could used for a random slide show for images in conky though.

What I'm trying to do is


copy file2.jpg to rename/replace file.jpg
wait 15 minutes
copy file3.jpg to rename/replace file.jpg
wait 15 minutes
copy file4.jpg to rename/replace file.jpg
wait 15 minutes
copy file.jpg to rename/replace file.jpg


the conky script displays the image named file.jpg

I have a test script I've been playing with that looks like this
that does just what I mentioned.

#!/bin/bash
#15 seconds testing

  cp -rf /home/file2.jpg /home/file.jpg;
  sleep 15
  cp -rf /home/file3.jpg /home/file.jpg;
  sleep 15
  cp -rf /home/file4.jpg /home/file.jpg;
  sleep 15
  cp -rf /home/file.jpg /home/file.jpg;
  sleep 15

exit
sleep 3
fi

It only needs to run once because conky will restart it, but
it is functioning as I can see the files changing in the directory, however, the conky window will not open until the script has gone through all the lines and completed.

So that's what I've trying to figure out the 6 hrs with no progress. sad

Last edited by MrEd (2019-07-04 04:20:50)


MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10

Offline

#6 2019-07-04 04:48:29

damo
....moderator....
Registered: 2015-08-20
Posts: 5,172

Re: [SOLVED] Conky help issue

There are several problems with your script, I think.

1) Why are you recursively forcing the copy?
2) There is no need for ";" at the end of the line.
3) Your sleep commands are for 15 seconds. For minutes use 15m
4) Your script exits before the final sleep.
5) There is a random "fi" to finish!

I still haven't quite worked out what you are trying to do though! It looks like your script makes the conky wait for an hour before opening?

Last edited by damo (2019-07-04 21:31:14)


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#7 2019-07-04 05:02:56

damo
....moderator....
Registered: 2015-08-20
Posts: 5,172

Re: [SOLVED] Conky help issue

You could use a flag file to hold the image file number, say 1-4.

Then get your script to read that file first, use a case statement to pick the file to copy, then write the next number to the flag file.

Something like (off the top of my head!). Create the flag file first.

FLAG_FILE="$HOME/flag.txt"

IMG_NUMBER=$(cat "$FLAG_FILE")

case $IMG_NUMBER in
    1) cp /home/file2.jpg /home/file.jpg
        echo "2" > "$FLAG_FILE"
        ;;
    2) cp /home/file3.jpg /home/file.jpg
        echo "3" > "$FLAG_FILE"
        ;;
    3) cp /home/file4.jpg /home/file.jpg
        echo "4" > "$FLAG_FILE"
        ;;
    4) cp /home/file.jpg /home/file.jpg
        echo "1" > "$FLAG_FILE"
        ;;
    *)  echo "Error" && exit 1
        ;;
esac

exit 0

Then run the script every 15mins in the conky.


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#8 2019-07-04 22:03:12

damo
....moderator....
Registered: 2015-08-20
Posts: 5,172

Re: [SOLVED] Conky help issue

This works for me:

#!/bin/bash
##
# img-switch.sh

IMG_PATH="/path/to/images"

FLAG_FILE="$IMG_PATH/flagfile.txt"
# create flagfile if it doesn't exist
[[ -f $FLAG_FILE ]] || echo 1 > "$FLAG_FILE"

IMG_NUMBER=$(cat "$FLAG_FILE")

case $IMG_NUMBER in
    1) cp $IMG_PATH/file1.jpg $IMG_PATH/file.jpg
        echo 2 > "$FLAG_FILE"
        ;;
    2) cp $IMG_PATH/file2.jpg $IMG_PATH/file.jpg
        echo 3 > "$FLAG_FILE"
        ;;
    3) cp $IMG_PATH/file3.jpg $IMG_PATH/file.jpg
        echo 4 > "$FLAG_FILE"
        ;;
    4) cp $IMG_PATH/file4.jpg $IMG_PATH/file.jpg
        echo 1 > "$FLAG_FILE"
        ;;
    *)  echo 1 > "$FLAG_FILE" # write something sensible in the flagfile
        ;;
esac

exit 0

The conky has:

${execi 600 img-switch.sh}
${image /path/to/images/file.jpg}

You may need a short sleep before the script exits, but it runs fine for me (with smallish jpgs)


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#9 2019-07-04 23:11:23

MrEd
Member
Registered: 2018-06-26
Posts: 27

Re: [SOLVED] Conky help issue

AH! by your second post I see you saw what I was trying to do.

and yes at 15 seconds I was doing that to test rotation.

I was looking at case statements right before I posted last and I saw what you posted so I knew I was on the right track tongue

Might be important to note, I am trying to find information on doing this and finding examples but it's not going very well.

here is what I've done so far,

I made a flag.txt file, and put file names in

food2.jpg
food3.jpg
food4.jpg
food.jpg

In conky I did

${execi 3600 ~/.conky/My_conky/scripts/food.sh}
${execi 15 ~/.conky/My_conky/scripts/food-timer.sh} #food timer #15sec for testing rotation

food.sh - here is short version

TMP=$( date +%d | awk '{print tolower($0)}' )

if [ $TMP = 01 ]
then
#curl -o /home/major/.conky/My_conky/food/food1.gif -O -f https://food.fnr.sndimg.com/content/dam/images/food/fullset/2011/6/6/0/FNM-070111-Take-It-From-Here-005_s4x3.jpg.rend.hgtvcom.966.725.suffix/1371597731091.jpeg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/ultimate-ham-sandwich-recipe-2105834 /home/major/.conky/My_conky/food/food_dl/food.jpg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/bobby-flay/perfect-burger-recipe-1957542 /home/major/.conky/My_conky/food/food_dl/food2.jpg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/melissa-darabian/three-cheesesteak-sandwiches-recipe-2119851 /home/major/.conky/My_conky/food/food_dl/food3.jpg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/ree-drummond/cast-iron-pizza-5428725 /home/major/.conky/My_conky/food/food_dl/food4.jpg;

cp /home/major/.conky/My_conky/food/food_dl/food.jpg /home/major/.conky/My_conky/food/food.jpg;

elif [ $TMP = 04 ]
then
wkhtmltoimage -n https://www.foodnetwork.com/recipes/katie-lee/fried-bologna-sandwich-5644724 /home/major/.conky/My_conky/food/food_dl/food.jpg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/food-network-kitchen/perfect-grilled-burgers-recipe-2108173 /home/major/.conky/My_conky/food/food_dl/food2.jpg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/tyler-florence/the-ultimate-steak-sandwich-recipe-1947893 /home/major/.conky/My_conky/food/food_dl/food3.jpg;
wkhtmltoimage -n https://www.foodnetwork.com/recipes/ree-drummond/french-bread-pizzas-2247960 /home/major/.conky/My_conky/food/food_dl/food4.jpg;

cp /home/major/.conky/My_conky/food/food_dl/food.jpg /home/major/.conky/My_conky/food/food.jpg;

else
cp /home/major/.conky/My_conky/food/No-day-in-month700x3000.jpg /home/major/.conky/My_conky/food/food.jpg;

exit
sleep 3
fi


food-timer.sh

FLAG_FILE="$HOME/.conky/My_conky/food/food_dl/flag.txt"

IMG_NUMBER=$(cat "$FLAG_FILE")

case $IMG_NUMBER in
    1) cp /home/major/.conky/My_conky/food/food_dl/food2.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "2" > "$FLAG_FILE"
        ;;
    2) cp /home/major/.conky/My_conky/food/food_dl/food3.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "3" > "$FLAG_FILE"
        ;;
    3) cp /home/major/.conky/My_conky/food/food_dl/food4.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "4" > "$FLAG_FILE"
        ;;
    4) cp /home/major/.conky/My_conky/food/food_dl/food.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "1" > "$FLAG_FILE"
        ;;
    *)  echo "Error" && exit 1
        ;;
esac

exit 0

everything in food.sh "THE FORMAT" script was basically there, I just repourposed and expaned the script
to do something entirely different, so if things need changed to make it proper, I'll be doing it.
So remove all the ; from the ends as are unneeded?

I ran conky and it ran, seems it found the script file, console gives me this

/home/major/.conky/My_conky/scripts/food-timer.sh: line 2: $'\r': command not found
cat: '/home/major/.conky/My_conky/food/food_dl/flag.txt'$'\r': No such file or directory
/home/major/.conky/My_conky/scripts/food-timer.sh: line 4: $'\r': command not found
/home/major/.conky/My_conky/scripts/food-timer.sh: line 5: syntax error near unexpected token `$'in\r''
'home/major/.conky/My_conky/scripts/food-timer.sh: line 5: `case $IMG_NUMBER in

I understand the script was just spur of the moment thing.
This is where I'm at currently and trying to find information, so please point out mistakes but don't hold
back on helping either, I learn better from something that properly works lol

but thank you for anyone that does help.


MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10

Offline

#10 2019-07-05 00:26:52

damo
....moderator....
Registered: 2015-08-20
Posts: 5,172

Re: [SOLVED] Conky help issue

You have line returns which aren't compatible on Unix. Did you write the script on a Windows system?

You can remove the offending chars with

sed -i 's/\r$//' food-timer.sh

And regarding the trailing ";" : they aren't necessary if each command is on a new line. So you can have eg

if [ $a -gt $b ] 
  then echo "bigger"
  else echo "smaller" 
fi

This is the same as

if [ $a -gt $b ]; then echo "bigger"; else echo "smaller"; fi

Last edited by damo (2019-07-05 00:32:42)


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#11 2019-07-05 01:16:19

MrEd
Member
Registered: 2018-06-26
Posts: 27

Re: [SOLVED] Conky help issue

I wondered why ther was r's lol

actually I cut and paste it from here.
That's the first time I've ever seen that lol

Anyway, I ran the
sed -i 's/\r$//' food-timer.sh

now if I run it from konsole, it crashes console window,
I don't see anything missing, but I noticed I forgot the #!/bin/bash at the top

#!/bin/bash
FLAG_FILE="$HOME/.conky/My_conky/food/food_dl/flag.txt"

IMG_NUMBER=$(cat "$FLAG_FILE")

case $IMG_NUMBER in
    1) cp /home/major/.conky/My_conky/food/food_dl/food2.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "2" > "$FLAG_FILE"
        ;;
    2) cp /home/major/.conky/My_conky/food/food_dl/food3.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "3" > "$FLAG_FILE"
        ;;
    3) cp /home/major/.conky/My_conky/food/food_dl/food4.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "4" > "$FLAG_FILE"
        ;;
    4) cp /home/major/.conky/My_conky/food/food_dl/food.jpg /home/major/.conky/My_conky/food/food.jpg
        echo "1" > "$FLAG_FILE"
        ;;
    *)  echo "Error" && exit 1
        ;;
esac

exit 0

and thankyou, now I know what the ";" is for


MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10

Offline

#12 2019-07-07 03:58:04

MrEd
Member
Registered: 2018-06-26
Posts: 27

Re: [SOLVED] Conky help issue

OMG, while I was typing post nine, you made post 8... I never even saw it until a few minutes ago.

I was trying to work out why it was blowing me crap....my headache is starting to go away tongue

This works fantastically!  I've already thought of something else to use this for.

Right now I have it set on 60 seconds just watching it change HAHA....
also added a couple lines so I could see output in console.

I haven't tried yet, but I'll mark the thread solved, then over the next couple days I'll finish up the rest of the links
for the days in the month and zip it all up and share it in Scripts, Tutorials & Tips section.

Here's the way mine ended up

#!/bin/bash
#enable for debugging output
set -x
PS4='$LINENO: '
IMG_PATH="/home/major/.conky/My_conky/food/food_dl"
FLAG_FILE="$IMG_PATH/flag.txt"
# create flagfile if it doesn't exist
[[ -f $FLAG_FILE ]] || echo 1 > "$FLAG_FILE"
IMG_NUMBER=$(cat "$FLAG_FILE")
case $IMG_NUMBER in
    1) cp $IMG_PATH/food2.jpg /home/major/.conky/My_conky/food/food.jpg

        echo "2" > "$FLAG_FILE"
        ;;
    2) cp $IMG_PATH/food3.jpg /home/major/.conky/My_conky/food/food.jpg

        echo "3" > "$FLAG_FILE"
        ;;
    3) cp $IMG_PATH/food4.jpg /home/major/.conky/My_conky/food/food.jpg

        echo "4" > "$FLAG_FILE"
        ;;
    4) cp $IMG_PATH/food.jpg /home/major/.conky/My_conky/food/food.jpg

        echo "1" > "$FLAG_FILE"
        ;;
    *)  echo "Error" && exit 1
        ;;    
  esac
sleep 3
exit 0

Is it possible to put scroll bar on conky window?

Last edited by MrEd (2019-07-07 04:08:48)


MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10

Offline

Board footer

Powered by FluxBB