Last active
December 31, 2025 21:42
-
-
Save rew62/e41551c901c137e488f1f39efbccb95a to your computer and use it in GitHub Desktop.
Conky Network & Moon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| conky.config = { | |
| -- Basic Settings | |
| update_interval = 2, | |
| total_run_times = 0, | |
| out_to_console = no, | |
| extra_newline = false, | |
| background = true, | |
| double_buffer = true, | |
| no_buffers = true, | |
| cpu_avg_samples = 2, | |
| net_avg_samples = 2, | |
| use_spacer = 'none', | |
| override_utf8_locale = true, | |
| uppercase = false, | |
| -- Window Settings | |
| own_window = true, | |
| own_window_type = 'normal', | |
| own_window_transparent = true, | |
| own_window_class = 'Conky', | |
| own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager', | |
| own_window_argb_visual = true, | |
| own_window_colour = '082103', | |
| -- Positioning & Size | |
| alignment = 'middle_left', | |
| minimum_width = 275, | |
| minimum_height = 5, | |
| maximum_width = 275, | |
| gap_x = 4, -- Horizontal | |
| gap_y = 1, -- Vertical | |
| -- Graphics & Appearance | |
| use_xft = true, | |
| font = 'Bitstream Vera Sans Mono:size=9', | |
| font2 = 'Liberation Sans:size=9', | |
| font3 = 'JetBrains Mono:size=10', | |
| font4 = 'JetBrains Mono:bold:size=10', | |
| font5 = 'Fira Code:size=10', | |
| font6 = 'Liberation Sans:size=10', | |
| font7 = 'Ubuntu::size=10', | |
| xftalpha = 0.8, | |
| default_bar_width = 100, | |
| default_bar_height = 10, | |
| cpu_avg_samples = 2, | |
| net_avg_samples = 2, | |
| -- Drawing & Colors | |
| draw_shades = true, | |
| draw_outline = false, | |
| draw_borders = false, | |
| draw_graph_borders = true, | |
| border_width = 1, | |
| default_color = 'white', | |
| default_shade_color = 'black', | |
| -- Custom Colors | |
| color0 = '98FB98', -- PaleGreen | |
| color1 = '8FBC8F', -- DarkSeaGreen | |
| color2 = '2E8B57', -- SeaGreen | |
| color3 = 'ADFF2F', -- GreenYellow | |
| color4 = 'FF4500', -- DarkOrange1 | |
| color5 = 'FFFFFF', -- white | |
| color6 = '6B8E23', -- DarkOliveGreen3 | |
| color7 = 'F0E68C', -- khaki1 | |
| color8 = 'FFFFFF', -- white | |
| color9 = '228B22', -- ForestGreen | |
| -- Lua Scripting and Templates | |
| template2 = "${exec ip route | grep default | cut -d ' ' -f 5}", | |
| } | |
| conky.text = [[ | |
| $alignr${font Liberation Sans:size=10:style=bold}${color0}${time %a, %b %d %Y} | |
| ## π Moon Phase | |
| ${font5}${voffset -10}${color}MOON: ${color2}${hr} | |
| ${font}${color8}${goto 52}${voffset 15}${color ecdfdd} | |
| ${execi 60 cd "$(dirname "start.rc")" && ./getMoon.sh} | |
| ${image moon.jpg -p 5, 40 -s 65x65 -n} | |
| ${voffset -56}${font3}${goto 84}${color0}${execi 60 awk -F: '{print $1 ":"}' moon-data | sed -n '1p'}$alignr${color}${execi 60 awk -F: '{print $2}' moon-data | sed -n '1p'} | |
| ${goto 84}${color0}${execi 60 awk -F: '{print $1 ":"}' moon-data | sed -n '2p'}$alignr${color}${execi 60 awk -F: '{print $2}' moon-data | sed -n '2p'} | |
| ${goto 84}${color0}${execi 60 awk -F: '{print $1 ":"}' moon-data | sed -n '3p'}$alignr${color}${execi 60 awk -F: '{print $2}' moon-data | sed -n '3p'} | |
| ${goto 84}${color0}${execi 60 awk -F: '{print $1 ":"}' moon-data | sed -n '4p'}$alignr${color}${execi 60 awk -F: '{print $2}' moon-data | sed -n '4p'} | |
| ${voffset 5}${font5} | |
| ## π» System Info | |
| #${voffset -10}${font}${color2}${stippled_hr} | |
| ${color}SYSTEM:${color0} ${nodename}${color2} ${hr} | |
| ${color0}Distro: ${color}$alignr${execi 60000 lsb_release -ds} | |
| ${color0}Kernel: $alignr${color}${kernel} | |
| ${color0}DE:${color}$alignr${exec echo $XDG_CURRENT_DESKTOP} | |
| ${color0}Architcture: ${color}${machine}${goto 156}${color0}Uptime: ${color}$alignr$uptime_short | |
| ${color0}Freq:${color8} ${freq}MHz ${color0}$alignr RAM:${color8} ${mem} ${color yellow1}(${memperc}%)${goto 245}${lua_parse temperature CPU} | |
| ${color9}${cpugraph 3dba19 aecf4c -t -l} | |
| ## π Network Info | |
| ${voffset 3}${color}NETWORK: ${font5}${color0}${gw_iface} ${color2}${hr} | |
| ${color0}LAN IP: ${color}${goto 60}${addr ${gw_iface}} ${goto 168}${color0}gw: $alignr ${color}${gw_ip} | |
| ${color0}WAN IP: ${color}${goto 60}${texeci 36000 curl -s https://api.ipify.org}${goto 168}${color0}dns: $alignr ${color}${nameserver} | |
| ${color0}Link Speed: $alignr${color}${execi 60 cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/speed 2>/dev/null || echo "N/A"} Mb/s | |
| ${color0}Location:${color1}$alignr${color}${execi 60 curl -s ipinfo.io | jq -r '"\(.city), \(.country)"' 2>/dev/null} | |
| ${voffset -3}${color2}${stippled_hr} | |
| ${color9}${downspeedgraph ${gw_iface} 25,132 000000 91ec31} ${color9}${upspeedgraph ${gw_iface} 25,132 000000 ec3131} | |
| ${color}${color0}Down: ${color yellow1} ${downspeed ${gw_iface}}/s${color0}${goto 145}Up:$alignr${color OrangeRed1}${upspeed ${gw_iface}}/s | |
| ${color0}Total:${color yellow1} ${totaldown ${gw_iface}}${goto 145}${color0}Total: $alignr${color OrangeRed1}${totalup ${gw_iface}} | |
| ${color5}${hr} | |
| ]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/bash | |
| # Working directory | |
| shellDir="$HOME/.conky/moon" | |
| wget -q -O raw --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" "http://www.moongiant.com/phase/today" > /dev/null 2>&1 | |
| sed -i -e '/^ *$/d; s/^ *//g; /Illumination/!d; s/<br>/\n/g; s|<[^>]*>||g' "${shellDir}/raw" | |
| sed -i '2,3!d' "${shellDir}/raw" | |
| sed -i '1s/^/Phase: /' "${shellDir}/raw" | |
| cat raw <(./moonDates.sh) > moon-data | |
| #cat moon-data | |
| [ -f ${shellDir}/moon_tmp.jpg ] && rm ${shellDir}/moon_tmp.jpg | |
| [ -f ${shellDir}/moon.jpg ] && rm ${shellDir}/moon.jpg | |
| # Moon image | |
| wget -q -O ${shellDir}/moon_icon_url_tmp "https://moon.nasa.gov/moon-observation/daily-moon-guide/" > /dev/null 2>&1 | |
| now_ico="$(LANG=en_us_88591 date +'%d %b %Y')" | |
| grep -Eio "${now_ico}.{0,428}" "${shellDir}/moon_icon_url_tmp" | \ | |
| sed "s/"/ /g; s/, /\n/g" | sed -e "2,13d; s/image_src ://g; s/^ *//g; s/\.jpg.*/.jpg/" \ | |
| > "${shellDir}/moon_icon_url" | |
| img_icon=$(sed -n 2p ${shellDir}/moon_icon_url) | |
| #cat moon_icon_url | |
| wget -q --output-document=${shellDir}/moon_tmp.jpg https://moon.nasa.gov/$img_icon > /dev/null 2>&1 | |
| [ -f "${shellDir}/moon_tmp.jpg" ] && mv "${shellDir}/moon_tmp.jpg" "${shellDir}/moon.jpg" && touch "${shellDir}/moon.jpg" | |
| [ -f ${shellDir}/moon_icon_url_tmp ] && rm ${shellDir}/moon_icon_url_tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # High-precision Reference: New Moon on Dec 30, 2024 22:27:00 UTC | |
| REF_DATE="2024-12-30 22:27:00 UTC" | |
| REF_EPOCH=$(date -d "$REF_DATE" +%s) | |
| # Precise Synodic Month: 29.53059 days in seconds | |
| SYNODIC_SECONDS=2551443 | |
| # Current time | |
| NOW_EPOCH=$(date +%s) | |
| # Calculate current position in the cycle (in seconds) | |
| SECONDS_SINCE_REF=$(( (NOW_EPOCH - REF_EPOCH) % SYNODIC_SECONDS )) | |
| # Calculate next Full Moon (50% of the cycle) | |
| FULL_MOON_SECONDS=$(( SYNODIC_SECONDS / 2 )) | |
| SECONDS_TO_FULL=$(( (FULL_MOON_SECONDS - SECONDS_SINCE_REF + SYNODIC_SECONDS) % SYNODIC_SECONDS )) | |
| FULL_EPOCH=$((NOW_EPOCH + SECONDS_TO_FULL)) | |
| # Calculate next New Moon (100% of the cycle) | |
| SECONDS_TO_NEW=$(( (SYNODIC_SECONDS - SECONDS_SINCE_REF) % SYNODIC_SECONDS )) | |
| NEW_EPOCH=$((NOW_EPOCH + SECONDS_TO_NEW)) | |
| # Convert to human-readable format | |
| NEXT_FULL=$(date -d "@$FULL_EPOCH" "+%b %d, %Y") | |
| NEXT_NEW=$(date -d "@$NEW_EPOCH" "+%b %d, %Y") | |
| # Display in chronological order | |
| if [ "$FULL_EPOCH" -lt "$NEW_EPOCH" ]; then | |
| echo "Next Full Moon: $NEXT_FULL" | |
| echo "Next New Moon: $NEXT_NEW" | |
| else | |
| echo "Next New Moon: $NEXT_NEW" | |
| echo "Next Full Moon: $NEXT_FULL" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment