diff --git a/conf b/conf index 89619cf..0030e92 100644 --- a/conf +++ b/conf @@ -1,229 +1,230 @@ -################################################################################################################################### -# This configuration file was created by Matt Grotke (mgrotke@gmail.com) for the "mgconky Conky Theme" project: https://github.com/mgrotke/mgconky -# This file is in the public domain. -# --------------------------------------------------------------------------------------------------------------------------------- -# TO RUN THIS CONKY CONFIG, YOU CAN TYPE THE FOLLOWING IN A TERMINAL: -# conky -c ~/.conky/mgconky/conf -# -# TO STOP CONKY, YOU CAN TYPE THE FOLLOWING IN A TERMINAL: -# killall conky -# -# TO HAVE THIS CONKY RUN EVERY TIME AT BOOT, GO INTO "STARTUP SOFTWARE" APP AND ADD THE FOLLOWING COMMAND WITH A DELAY OF 10 SECONDS: -# conky -p 10 -c /home//.conky/mgconky/conf -# NOTE: It seems you must actually use the full path (/home/) as the shortcut (~/) does not work. -# -# !!!IMPORTANT!!! THE FOLLOWING ARE REQUIREMENTS FOR THIS SCRIPT TO WORK PROPERLY: -# (1) Install software, if not already installed: -# "Conky" sudo apt-get install conky-all (or use software manager) -# "Jq" sudo apt-get install jq (or use software manager) -# "Curl" sudo apt-get install curl (or use software manager) -# "Wget" sudo apt-get install wget (or use software manager) -# "lm-sensors" sudo apt-get install lm-sensors (or use software manager) -# (2) Install custom fonts: -# "Neuropolitical" Place .ttf file in ~/.fonts/ https://www.dafont.com/font-comment.php?file=neuropolitical -# "StyleBats" Place .ttf file in ~/.fonts/ https://www.dafont.com/search.php?q=StyleBats -# (3) Set the included bash script(s) as executable -# chmod +x ~/.conky/mgconky/weather/get_weather.sh -# chmod +x ~/.conky/mgconky/weather/parse_weather.sh -# chmod +x ~/.conky/mgconky/weather/parse_forecast.sh -# (4) Make a free account at https://openweathermap.org/ -# (5) Write down your API key, which is found on the "API keys" tab after you log in. (https://home.openweathermap.org/api_keys) -# (6) Find your city's location ID by entering your CITY NAME in the search box and select your city from the search results. -# Your location ID will be the number in the URL (for example: https://openweathermap.org/city/5128581) -# (7) In this conf file below, set the following variables: -# "template6" Set to your API key. -# "template7" Set to your location ID. -# "template8" Set to either "imperial" (for Fahrenheit) or "metric" (for Celsius). -# (8) Modify the drive names below with your device name(s), i.e. "/dev/sda", "/dev/sdb", "/dev/sdc", etc. -# (9) Modify the filesystems below with your mount name(s), i.e. "/" (root), "/mnt/MyData", "/media//MyUSBStick", etc. -# (10) Replace "enp34s0" below with name of your ethernet device. (Find name of ethernet device by typing "ip a" in terminal.) -# (11) If you use Wi-Fi instead of ethernet, change the Network section. The following variables are available from Conky: -# ${wireless_ap } Wireless access point MAC address -# ${wireless_bitrate } Wireless bitrate (ie 11 Mb/s) -# ${wireless_essid } Wireless access point ESSID -# ${wireless_link_bar , } Wireless link quality bar -# ${wireless_link_qual } Wireless link quality -# ${wireless_link_qual_max } Wireless link quality maximum value -# ${wireless_link_qual_perc } Wireless link quality in percents -# ${wireless_mode } Wireless mode (Managed/Ad-Hoc/Master) -################################################################################################################################### +-- ################################################################################################################################### +-- This configuration file was created by Matt Grotke (mgrotke@gmail.com) for the "mgconky Conky Theme" project: https://github.com/mgrotke/mgconky +-- This file is in the public domain. +-- --------------------------------------------------------------------------------------------------------------------------------- +-- TO RUN THIS CONKY CONFIG, YOU CAN TYPE THE FOLLOWING IN A TERMINAL: +-- conky -c ~/.conky/mgconky/conf +-- +-- TO STOP CONKY, YOU CAN TYPE THE FOLLOWING IN A TERMINAL: +-- killall conky +-- +-- TO HAVE THIS CONKY RUN EVERY TIME AT BOOT, GO INTO "STARTUP SOFTWARE" APP AND ADD THE FOLLOWING COMMAND WITH A DELAY OF 10 SECONDS: +-- conky -p 10 -c /home//.conky/mgconky/conf +-- NOTE: It seems you must actually use the full path (/home/) as the shortcut (~/) does not work. +-- +-- !!!IMPORTANT!!! THE FOLLOWING ARE REQUIREMENTS FOR THIS SCRIPT TO WORK PROPERLY: +-- (1) DEPENDENCIES. +-- Install the following software, if not already installed: +-- "Conky" sudo apt-get install conky-all (or use software manager) +-- "Jq" sudo apt-get install jq (or use software manager) +-- "Curl" sudo apt-get install curl (or use software manager) +-- "Wget" sudo apt-get install wget (or use software manager) +-- "lm-sensors" sudo apt-get install lm-sensors (or use software manager) +-- (2) FONTS. +-- Install the following custom fonts: +-- "Neuropolitical" Place .ttf file in ~/.fonts/ https://www.dafont.com/font-comment.php?file=neuropolitical +-- "StyleBats" Place .ttf file in ~/.fonts/ https://www.dafont.com/search.php?q=StyleBats +-- (3) SCRIPTS. +-- Set the following included script(s) as executable: +-- chmod +x ~/.conky/mgconky/weather/get_weather.sh +-- chmod +x ~/.conky/mgconky/weather/parse_weather.sh +-- chmod +x ~/.conky/mgconky/weather/parse_forecast.sh +-- chmod +x ~/.conky/mgconky/weather/parse_forecast.sh +-- chmod +x ~/.conky/mgconky/stocks/get_stocks.py (Requires python3, which is usually pre-installed on your OS) +-- (4) WEATHER. +-- Make a free account at https://openweathermap.org/ +-- Write down your API key, which is found on the "API keys" tab after you log in. (https://home.openweathermap.org/api_key +-- Find your city's location ID by entering your CITY NAME in the search box and select your city from the search results. +-- Your location ID will be the number in the URL (for example: https://openweathermap.org/city/5128581) +-- In the config below, complete template0 through template3. +-- (5) STOCKS. +-- Unfortunately the days of using the Yahoo Finance API are over. It has been shut down. There are two APIs to choose from. +-- Alpha Vantage and Finnhub. You will need an API key to use either. Both offer FREE services, but with restrictions. +-- Alpha Vantage only allows 25 requests per day (!!!) for free. Finnhub allows 60 requests per minute for free! +-- Both services are available here. With Alpha Vantage, we must set the interval to 7200 seconds. That means your stock prices +-- will only update every 2 hours. It makes 1 request per stock, so only include 1 or 2 stocks if you are using free Alpha +-- Vantage. If you go With FinnHub, you cannot get historical prices at all, unless you have a paid plan, but you CAN add many +-- stocks, and you can update your stocks much more frequently. Complete template4 through template7 in the config below. +-- ################################################################################################################################### -#-------------------------- -# Window and drawing properties -#-------------------------- -alignment top_right -minimum_size 225 -maximum_width 225 -gap_x 15 -gap_y 15 -background no -own_window yes -own_window_transparent yes -own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager -own_window_type normal -double_buffer yes -draw_shades no -draw_outline no -draw_borders no -draw_graph_borders yes -no_buffers yes -imlib_cache_size 0 -cpu_avg_samples 2 -update_interval 1.5 -total_run_times 0 +conky.config = { -#-------------------------- -# Define fonts -#-------------------------- -use_xft yes -xftalpha 0.9 -#xftfont DejaVu Sans:size=8 -xftfont Courier:size=9 -override_utf8_locale yes # Force UTF8? Requires XFT (see above)... will displays degree symbol, instead of °, etc. -short_units yes -uppercase no + -- Window and drawing properties + alignment = "top_right", + minimum_width = 225, + maximum_width = 225, + gap_x = 15, + gap_y = 15, + background = false, + own_window = true, + own_window_transparent = true, + own_window_hints = "undecorated,below,sticky,skip_taskbar,skip_pager", + own_window_type = "normal", + double_buffer = true, + draw_shades = false, + draw_outline = false, + draw_borders = false, + draw_graph_borders = true, + no_buffers = true, + imlib_cache_size = 0, + cpu_avg_samples = 2, + update_interval = 1.5, + total_run_times = 0, -#-------------------------- -# Define Colors -#-------------------------- -default_color white -default_shade_color black -default_outline_color green -color0 orange # Titles -color1 slategrey # Horizonal lines -color2 white # Not used -color3 lime # Values -color4 yellow # Important -color5 lime # Bar graphs + -- Define fonts + use_xft = true, + xftalpha = 0.9, + override_utf8_locale = true, -- Force UTF8? Requires XFT (see above)... will display degree symbol, instead of °, etc. + short_units = true, + uppercase = false, -#-------------------------- -# Weather variables -#-------------------------- -template6 "" # OpenWeatherMap API key (https://home.openweathermap.org/api_keys) -template7 "" # OpenWeatherMap City ID (the number in the URL of your city, for example: https://openweathermap.org/city/5128581) -template8 "imperial" # Temp unit ("default" for Kelvin, "metric" for Celcius, "imperial" for Fahrenheit) -template9 "" # Locale (e.g. "es_ES.UTF-8") # Leave empty for default + -- Define Colors + default_color = "#FFFFFF", -- white + default_shade_color = "#000000", -- black + default_outline_color = "#00FF00", -- green + color0 = "#FFA500", -- Titles (orange) + color1 = "#708090", -- Horizontal lines (slategrey) + color2 = "#FFFFFF", -- Not used (white) + color3 = "#00FF00", -- Values (lime) + color4 = "#FFFF00", -- Important (yellow) + color5 = "#00FF00", -- Bar graphs (lime) + color6 = "#1E90FF", -- Good values (blue) + color7 = "#FF0000", -- Bad values (red) -#-------------------------- -# Load Lua script(s) -- If multiple files, separate each path with a space. They should all be loaded on a single lua_load command. -#-------------------------- -lua_load ~/.conky/mgconky/rounding.lua + -- Weather variables + template0 = "YOUR_OPENWEATHERMAP_API_KEY_HERE", -- OpenWeatherMap API key (https://home.openweathermap.org/api_keys) + template1 = "YOUR_OPENWEATHERMAP_CITY_ID_HERE", -- OpenWeatherMap City ID (the number in the URL of your city, for example: https://openweathermap.org/city/5128581) + template2 = "imperial", -- Temp unit ("default" for Kelvin, "metric" for Celsius, "imperial" for Fahrenheit) + template3 = "", -- Locale (e.g., "es_ES.UTF-8") # Leave empty for default -TEXT + -- Stock variables + template4 = "YOUR_FINNHUB_API_KEY_HERE", -- FinnHub API key (https://finnhub.io/) + template5 = "YOUR_ALPHAVANTAGE_API_KEY_HERE", -- Alpha Vantage API key (https://www.alphavantage.co/) + template6 = "goog,amzn,aapl,msft,meta,tsla,avgo,tsm,brk.a,pg,nvda", -- Stock symbols for FinnHub (comma separated, no spaces, i.e. goog,amzn,aapl) + template7 = "nvda", -- Stock symbols for Alpha Vantage (keep to a minimum unless you have a paid API key) + + -- Load Lua script(s) -- If multiple files, separate each path with a space. They should all be loaded on a single lua_load command. + -- lua_load = "~/.conky/mgconky/script1.lua ~/.conky/mgconky/script2.lua", + lua_load = "~/.conky/mgconky/devices/get_device_info.lua", +} + +conky.text = [[ #-------------------------- -# Linux Mint Logo and Text +# Computer Info #-------------------------- +# ***** Linux Mint Logo and Version ***** ${image ~/.conky/mgconky/mint_logo.png -s 35x35 -p 0,0}\ -${voffset 0}${goto 50}${font Neuropolitical:pixelsize=12}${color0}${execi 100000 lsb_release -sd || cat /etc/*release}${color}${font} -${voffset 0}${goto 50}${font Neuropolitical:size=10}${nodename}${font} +${voffset 0}${goto 50}${font Neuropolitical:pixelsize=12}${color0}${execi 100000 lsb_release -sd || cat /etc/*release}${color}${font Courier:size=9} +# ***** Computer Name ***** +${voffset 0}${goto 50}${font Neuropolitical:size=10}${nodename}${font Courier:size=9} +# ***** Kernel Version ***** ${voffset 8}Kernel: ${color3}${alignr}${sysname} ${kernel}${color} +# ***** Up Time ***** ${voffset 2}Uptime: ${color3}${alignr}${uptime_short}${color} -${voffset 2}CPU:${goto 50}${color4}${execi 10 sensors | grep "Tdie" | cut -c16-17}°C${color}${goto 100}${alignr}GPU: ${color4}${nvidia temp}°C${color} +# ***** Temperatures ***** +${voffset 2}CPU:${goto 50}${color4}${hwmon 0 temp 1}°C${color}${goto 100}${alignr}GPU: ${color4}${nvidia temp}°C${color} +#${voffset 2}CPU:${goto 50}${color4}${execi 10 sensors | grep "Tdie" | cut -c16-17}°C${color}${goto 100}${alignr}GPU: ${color4}${nvidia temp}°C${color} +# ***** CPU Make/Model ***** +${voffset 6}${alignc}${color3}${lua_parse conky_get_cpu_info} +${voffset 0}${alignc}${color3}${lua_parse conky_get_gpu_info} #-------------------------- # Weather #-------------------------- # ***** Download weather data and position icons ***** -${execi 300 ~/.conky/mgconky/weather/get_weather.sh ${template6} ${template7} ${template8} ${template9}}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime64/$(~/.conky/mgconky/weather/parse_weather.sh 'iconid').png ~/.cache/mgconky/weather0.png}${image ~/.cache/mgconky/weather0.png -p 40,135 -s 64x64}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '1').png ~/.cache/mgconky/weather1.png}${image ~/.cache/mgconky/weather1.png -p 20,219 -s 32x32}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '2').png ~/.cache/mgconky/weather2.png}${image ~/.cache/mgconky/weather2.png -p 96,219 -s 32x32}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '3').png ~/.cache/mgconky/weather3.png}${image ~/.cache/mgconky/weather3.png -p 175,219 -s 32x32} +${execi 300 ~/.conky/mgconky/weather/get_weather.sh ${template0} ${template1} ${template2} ${template3}}\ +${execi 300 cp -f ~/.conky/mgconky/weather/lime64/$(~/.conky/mgconky/weather/parse_weather.sh 'iconid').png ~/.cache/mgconky/weather0.png}${image ~/.cache/mgconky/weather0.png -p 40,178 -s 64x64}\ +${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '1').png ~/.cache/mgconky/weather1.png}${image ~/.cache/mgconky/weather1.png -p 20,262 -s 32x32}\ +${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '2').png ~/.cache/mgconky/weather2.png}${image ~/.cache/mgconky/weather2.png -p 96,262 -s 32x32}\ +${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '3').png ~/.cache/mgconky/weather3.png}${image ~/.cache/mgconky/weather3.png -p 175,262 -s 32x32} # ***** Today's date ***** -${voffset -15}${color0}${alignc}${font Neuropolitical:size=10}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'location'}${font}${color} -${voffset -4}${color0}${alignc}${font Neuropolitical:size=10}${execi 300 LANG=${template9} LC_TIME=${template9} date +'%^a, %e %^B'}${font}${color} +${voffset -15}${color0}${alignc}${font Neuropolitical:size=15}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'location'}${font Courier:size=9}${color} +${voffset 0}${color0}${alignc}${font Neuropolitical:size=10}${execi 300 LANG=${template3} LC_TIME=${template3} date +'%^a, %e %^B'}${font Courier:size=9}${color} # ***** Temperature right now ***** -${voffset 7}${alignc -40}${color3}${font Courier:size=20:bold}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'temperature'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${font}${color} +${voffset 7}${alignc -40}${color3}${font Courier:size=20:bold}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'temperature'}${if_match "${template2}" == "metric"}°C${else}${if_match "${template2}" == "imperial"}°F${else}${if_match "${template2}" == "default"}K${endif}${endif}${endif}${font Courier:size=9}${color} # ***** Today's high/low temps ***** ${voffset 5}${alignc -40}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '0'}${color}\ /${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '0'}\ -${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} +${if_match "${template2}" == "metric"}°C${else}${if_match "${template2}" == "imperial"}°F${else}${if_match "${template2}" == "default"}K${endif}${endif}${endif}${color} # ***** Description of weather right now ***** #${voffset 0}${alignc}${color3}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'description'}${color} # ***** Forecast day labels (MON, TUES, WED, etc) ***** -${voffset 15}${color0}${font Neuropolitical:size=10}${alignc 77}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +1day +%^a}${font}${color} -${voffset -18}${color0}${font Neuropolitical:size=10}${alignc}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +2day +%^a}${font}${color} -${voffset -18}${color0}${font Neuropolitical:size=10}${alignc -77}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +3day +%^a}${font}${color} +${voffset 15}${color0}${font Neuropolitical:size=10}${alignc 77}${execi 300 LANG=${template3} LC_TIME=${template3} date -d +1day +%^a}${font Courier:size=9}${color} +${voffset -18}${color0}${font Neuropolitical:size=10}${alignc}${execi 300 LANG=${template3} LC_TIME=${template3} date -d +2day +%^a}${font Courier:size=9}${color} +${voffset -18}${color0}${font Neuropolitical:size=10}${alignc -77}${execi 300 LANG=${template3} LC_TIME=${template3} date -d +3day +%^a}${font Courier:size=9}${color} # ***** Forecast high/low temps ***** -${voffset 32}${alignc 77}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '1'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '1'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} -${voffset -13}${alignc}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '2'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '2'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} -${voffset -13}${alignc -77}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '3'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '3'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} +${voffset 32}${alignc 77}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '1'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '1'}${if_match "${template2}" == "metric"}°C${else}${if_match "${template2}" == "imperial"}°F${else}${if_match "${template2}" == "default"}K${endif}${endif}${endif}${color} +${voffset -13}${alignc}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '2'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '2'}${if_match "${template2}" == "metric"}°C${else}${if_match "${template2}" == "imperial"}°F${else}${if_match "${template2}" == "default"}K${endif}${endif}${endif}${color} +${voffset -13}${alignc -77}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '3'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '3'}${if_match "${template2}" == "metric"}°C${else}${if_match "${template2}" == "imperial"}°F${else}${if_match "${template2}" == "default"}K${endif}${endif}${endif}${color} + +#-------------------------- +# Stocks +#-------------------------- +${voffset 6}${color0}${font Neuropolitical:size=8:bold}STOCKS ${color1}${hr 2}${color}${font Courier:size=9} +# ***** FinnHub API ***** +${if_match "${template4}" != "YOUR_FINNHUB_API_KEY_HERE"} +${voffset -6}${execpi 60 $HOME/.conky/mgconky/stocks/get_stocks_finnhub.py --api_key ${template4} --symbols ${template6} --range_in_days 0 --price_dec_places 0 --percent_dec_places 1} +${endif} +# ***** Alpha Vantage API ***** +${if_match "${template5}" != "YOUR_ALPHAVANTAGE_API_KEY_HERE"} +${voffset -12}${execpi 7200 $HOME/.conky/mgconky/stocks/get_stocks_alphavantage.py --api_key ${template5} --symbols ${template7} --range_in_days 30 --price_dec_places 0 --percent_dec_places 1} +${endif} # #-------------------------- # Memory #-------------------------- -#${voffset -10}${color0}${font Neuropolitical:size=8:bold}MEMORY ${color1}${hr 2}${color}${font} -#${voffset 4}RAM:${alignr}${color3}${lua MyRound ${mem} 1 halfup G hideUnit}${color} of ${color3}${lua MyRound ${memmax} 0 ceil G addSpace}B${color} -#${voffset -2}${color5}${membar}${color} -#${voffset 2}Swap:${alignr}${color3}${lua MyRound ${swap} 1 halfup G hideUnit}${color} of ${color3}${lua MyRound ${swapmax} 0 ceil G addSpace}B${color} -#${voffset -2}${color5}${swapbar}${color} - +${voffset 0}${color0}${font Neuropolitical:size=8:bold}MEMORY ${color1}${hr 2}${color}${font Courier:size=9} +# ***** System memory ***** +${voffset 4}System:${alignr}${lua_parse conky_get_memory_usage sys}${color} +${voffset -2}${color5}${membar}${color} +# ***** Swap memory ***** +${if_match "${lua conky_check_swap_status}" == "swapenabled"}\ +${voffset 4}Swap:${alignr}${lua_parse conky_get_memory_usage swap}${color} +${voffset -2}${color5}${swapbar}${color}\ +${endif} #-------------------------- -# Drive #1 +# Drives and Volumes #-------------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font} /dev/nvme0n1${color} ${color1}${hr 2}${color} -# ***** Read and write speeds for this device ***** -#${voffset 4}Read: ${color3}${diskio_read nvme0n1}/s${color}${goto 120}Write: ${color3}${diskio_write nvme0n1}/s${color} -#${voffset -4}${color5}${diskiograph_read nvme0n1 14,110 000000 ff0000}${color}${alignr}${color5}${diskiograph_write nvme0n1 14,110 000000 00ffff}${color} -# ***** Now we show the mounts under this device ***** -${voffset 2}/:${alignr}${color3}${lua MyRound ${fs_used /} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar /}${color} -${voffset 2}/home:${alignr}${color3}${lua MyRound ${fs_used /home} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /home} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar /home}${color} - -#-------------------------- -# Drive #2 -#-------------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font} /dev/sda${color} ${color1}${hr 2}${color} -# ***** Read and write speeds for this device ***** -#${voffset 4}Read: ${color3}${diskio_read sda}/s${color}${goto 120}Write: ${color3}${diskio_write sda}/s${color} -#${voffset -4}${color5}${diskiograph_read sda 14,110 000000 ff0000}${color}${alignr}${color5}${diskiograph_write sda 14,110 000000 00ffff}${color} -# ***** Now we show the mounts under this device ***** -${voffset 2}/mnt/SSD120:${alignr}${color3}${lua MyRound ${fs_used /mnt/SSD120} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /mnt/SSD120} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar 6 /mnt/SSD120}${color} - -#-------------------------- -# Drive #3 -#-------------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font} /dev/sdb${color} ${color1}${hr 2}${color} -# ***** Read and write speeds for this device ***** -#${voffset 4}Read: ${color3}${diskio_read sdb}/s${color}${goto 120}Write: ${color3}${diskio_write sdb}/s${color} -#${voffset -4}${color5}${diskiograph_read sdb 14,110 000000 ff0000}${color}${alignr}${color5}${diskiograph_write sdb 14,110 000000 00ffff}${color} -# ***** Now we show the mounts under this device ***** -${voffset 2}/mnt/SSD180:${alignr}${color3}${lua MyRound ${fs_used /mnt/SSD180} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /mnt/SSD180} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar 6 /mnt/SSD180}${color} - +${voffset 6}${lua_parse conky_get_drives_and_volumes} +# #---------------------- # Top Processes #---------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}TOP PROCESSES ${color1}${hr 2}${color}${font} +${voffset -6}${color0}${font Neuropolitical:size=8:bold}TOP PROCESSES ${color1}${hr 2}${color}${font Courier:size=9} +# ***** By memory usage ***** ${voffset 6}By Memory Usage${goto 142}PID${alignr}RAM -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 1}${goto 140}${top_mem pid 1}${alignr}${top_mem mem_res 1}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 2}${goto 140}${top_mem pid 2}${alignr}${top_mem mem_res 2}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 3}${goto 140}${top_mem pid 3}${alignr}${top_mem mem_res 3}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 4}${goto 140}${top_mem pid 4}${alignr}${top_mem mem_res 4}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 5}${goto 140}${top_mem pid 5}${alignr}${top_mem mem_res 5}${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top_mem name 1}${goto 140}${top_mem pid 1}${alignr}${top_mem mem_res 1}${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top_mem name 2}${goto 140}${top_mem pid 2}${alignr}${top_mem mem_res 2}${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top_mem name 3}${goto 140}${top_mem pid 3}${alignr}${top_mem mem_res 3}${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top_mem name 4}${goto 140}${top_mem pid 4}${alignr}${top_mem mem_res 4}${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top_mem name 5}${goto 140}${top_mem pid 5}${alignr}${top_mem mem_res 5}${color} +# ***** By CPU usage ***** ${voffset 6}By CPU Usage${goto 142}PID${alignr}CPU -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 1}${goto 140}${top pid 1}${alignr}${top cpu 1}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 2}${goto 140}${top pid 2}${alignr}${top cpu 2}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 3}${goto 140}${top pid 3}${alignr}${top cpu 3}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 4}${goto 140}${top pid 4}${alignr}${top cpu 4}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 5}${goto 140}${top pid 5}${alignr}${top cpu 5}%${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top name 1}${goto 140}${top pid 1}${alignr}${top cpu 1}%${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top name 2}${goto 140}${top pid 2}${alignr}${top cpu 2}%${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top name 3}${goto 140}${top pid 3}${alignr}${top cpu 3}%${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top name 4}${goto 140}${top pid 4}${alignr}${top cpu 4}%${color} +${voffset 0}${font StyleBats:size=10}h${font Courier:size=9}${voffset -1}${color3}${offset 5}${top name 5}${goto 140}${top pid 5}${alignr}${top cpu 5}%${color} #-------------------- -# Network -- Replace "enp34s0" below with name of your ethernet device. (Find name of ethernet device by typing "ip a" in terminal.) +# Network -- Find name of ethernet device (e.g. "enp34s0") by typing "ip a" in terminal. #-------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}NETWORK ${color1}${hr 2}${color}${font} -${voffset 6}Ethernet Device:${goto 140}${color3}${gw_iface}${color} -${voffset 0}Internal IP:${goto 140}${color3}${addr enp34s0}${color} +${voffset 6}${color0}${font Neuropolitical:size=8:bold}NETWORK ${color1}${hr 2}${color}${font Courier:size=9} +# ***** IP addresses ***** +${voffset 6}Interface Device:${goto 140}${color3}${gw_iface}${color} +${voffset 0}Internal IP:${goto 140}${color3}${addr ${gw_iface}}${color} ${voffset 0}External IP:${goto 140}${color3}${execi 1800 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'}${color} -${voffset 6}DL: ${color3}${downspeed enp34s0}/s${color}${goto 140}UL:${color} ${color3}${upspeed enp34s0}/s${color} -${voffset -2}${color5}${downspeedgraph enp34s0 25,90 000000 ff0000}${color}${alignr}${color5}${upspeedgraph enp34s0 25,90 000000 00ffff}${color} -${voffset -6}Total: ${color3}${totaldown enp34s0}${color}${goto 140}Total:${color} ${color3}${totalup enp34s0}${color} +# ***** VPN status ***** +${voffset 6}${alignc}${color4}VPN Status: ${lua_parse conky_get_vpn_status} +${voffset 6}DL: ${color3}${downspeed ${gw_iface}}/s${color}${goto 140}UL: ${color3}${upspeed ${gw_iface}}/s${color} +${voffset -2}${color5}${downspeedgraph ${gw_iface} 25,90 000000 ff0000}${color}${alignr}${color5}${upspeedgraph ${gw_iface} 25,90 000000 00ffff}${color} +${voffset -6}Total: ${color3}${totaldown ${gw_iface}}${color}${goto 140}Total: ${color3}${totalup ${gw_iface}}${color} #-------------------- # Connections - netstat shows number of connections from your computer and application/PID making it. Kill spyware! #-------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}CONNECTIONS ${color1}${hr 2}${color}${font} +${voffset 6}${color0}${font Neuropolitical:size=8:bold}CONNECTIONS ${color1}${hr 2}${color}${font Courier:size=9} ${voffset 6}Num. connections / PID / Process ${voffset 2}${color3}${execi 30 netstat -ept | grep ESTAB | awk '{print $9}' | cut -d: -f1 | sort | uniq -c | sort -nr}${color} +]] + diff --git a/conf_full b/conf_full deleted file mode 100644 index 2eff34c..0000000 --- a/conf_full +++ /dev/null @@ -1,248 +0,0 @@ -################################################################################################################################### -# This configuration file was created by Matt Grotke (mgrotke@gmail.com) for the "mgconky Conky Theme" project: https://github.com/mgrotke/mgconky -# This file is in the public domain. -# --------------------------------------------------------------------------------------------------------------------------------- -# TO RUN THIS CONKY CONFIG, YOU CAN TYPE THE FOLLOWING IN A TERMINAL: -# conky -c ~/.conky/mgconky/conf -# -# TO STOP CONKY, YOU CAN TYPE THE FOLLOWING IN A TERMINAL: -# killall conky -# -# TO HAVE THIS CONKY RUN EVERY TIME AT BOOT, GO INTO "STARTUP SOFTWARE" APP AND ADD THE FOLLOWING COMMAND WITH A DELAY OF 10 SECONDS: -# conky -p 10 -c /home//.conky/mgconky/conf -# NOTE: It seems you must actually use the full path (/home/) as the shortcut (~/) does not work. -# -# !!!IMPORTANT!!! THE FOLLOWING ARE REQUIREMENTS FOR THIS SCRIPT TO WORK PROPERLY: -# (1) Install software, if not already installed: -# "Conky" sudo apt-get install conky-all (or use software manager) -# "Jq" sudo apt-get install jq (or use software manager) -# "Curl" sudo apt-get install curl (or use software manager) -# "Wget" sudo apt-get install wget (or use software manager) -# "lm-sensors" sudo apt-get install lm-sensors (or use software manager) -# (2) Install custom fonts: -# "Neuropolitical" Place .ttf file in ~/.fonts/ https://www.dafont.com/font-comment.php?file=neuropolitical -# "StyleBats" Place .ttf file in ~/.fonts/ https://www.dafont.com/search.php?q=StyleBats -# (3) Set the included bash script(s) as executable -# chmod +x ~/.conky/mgconky/weather/get_weather.sh -# chmod +x ~/.conky/mgconky/weather/parse_weather.sh -# chmod +x ~/.conky/mgconky/weather/parse_forecast.sh -# (4) Make a free account at https://openweathermap.org/ -# (5) Write down your API key, which is found on the "API keys" tab after you log in. (https://home.openweathermap.org/api_keys) -# (6) Find your city's location ID by entering your CITY NAME in the search box and select your city from the search results. -# Your location ID will be the number in the URL (for example: https://openweathermap.org/city/5128581) -# (7) In this conf file below, set the following variables: -# "template6" Set to your API key. -# "template7" Set to your location ID. -# "template8" Set to either "imperial" (for Fahrenheit) or "metric" (for Celsius). -# (8) Modify the drive names below with your device name(s), i.e. "/dev/sda", "/dev/sdb", "/dev/sdc", etc. -# (9) Modify the filesystems below with your mount name(s), i.e. "/" (root), "/mnt/MyData", "/media//MyUSBStick", etc. -# (10) Replace "enp34s0" below with name of your ethernet device. (Find name of ethernet device by typing "ip a" in terminal.) -# (11) If you use Wi-Fi instead of ethernet, change the Network section. The following variables are available from Conky: -# ${wireless_ap } Wireless access point MAC address -# ${wireless_bitrate } Wireless bitrate (ie 11 Mb/s) -# ${wireless_essid } Wireless access point ESSID -# ${wireless_link_bar , } Wireless link quality bar -# ${wireless_link_qual } Wireless link quality -# ${wireless_link_qual_max } Wireless link quality maximum value -# ${wireless_link_qual_perc } Wireless link quality in percents -# ${wireless_mode } Wireless mode (Managed/Ad-Hoc/Master) -################################################################################################################################### - -#-------------------------- -# Window and drawing properties -#-------------------------- -alignment top_right -minimum_size 225 -maximum_width 225 -gap_x 15 -gap_y 15 -background no -own_window yes -own_window_transparent yes -own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager -own_window_type normal -double_buffer yes -draw_shades no -draw_outline no -draw_borders no -draw_graph_borders yes -no_buffers yes -imlib_cache_size 0 -cpu_avg_samples 2 -update_interval 1.5 -total_run_times 0 - -#-------------------------- -# Define fonts -#-------------------------- -use_xft yes -xftalpha 0.9 -#xftfont DejaVu Sans:size=8 -xftfont Courier:size=9 -override_utf8_locale yes # Force UTF8? Requires XFT (see above)... will displays degree symbol, instead of °, etc. -short_units yes -uppercase no - -#-------------------------- -# Define Colors -#-------------------------- -default_color white -default_shade_color black -default_outline_color green -color0 orange # Titles -color1 slategrey # Horizonal lines -color2 white # Not used -color3 lime # Values -color4 yellow # Important -color5 lime # Bar graphs - -#-------------------------- -# Weather variables -#-------------------------- -template6 "" # OpenWeatherMap API key (https://home.openweathermap.org/api_keys) -template7 "" # OpenWeatherMap City ID (the number in the URL of your city, for example: https://openweathermap.org/city/5128581) -template8 "imperial" # Temp unit ("default" for Kelvin, "metric" for Celcius, "imperial" for Fahrenheit) -template9 "" # Locale (e.g. "es_ES.UTF-8") # Leave empty for default - -#-------------------------- -# Load Lua script(s) -- If multiple files, separate each path with a space. They should all be loaded on a single lua_load command. -#-------------------------- -lua_load ~/.conky/mgconky/rounding.lua - -TEXT -#-------------------------- -# Linux Mint Logo and Text -#-------------------------- -${image ~/.conky/mgconky/mint_logo.png -s 35x35}${goto 50}${font Neuropolitical:pixelsize=12}${color0}${execi 100000 lsb_release -sd || cat /etc/*release}${color}${font} -${goto 50}${font Neuropolitical:size=10}${nodename}${font} -${voffset 8}Kernel: ${color3}${alignr}${sysname} ${kernel}${color} -${voffset 2}Uptime: ${color3}${alignr}${uptime_short}${color} - -#-------------------------- -# Weather -#-------------------------- -# ***** Download weather data and position icons ***** -${execi 300 ~/.conky/mgconky/weather/get_weather.sh ${template6} ${template7} ${template8} ${template9}}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime64/$(~/.conky/mgconky/weather/parse_weather.sh 'iconid').png ~/.cache/mgconky/weather0.png}${image ~/.cache/mgconky/weather0.png -p 40,140 -s 64x64}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '1').png ~/.cache/mgconky/weather1.png}${image ~/.cache/mgconky/weather1.png -p 20,216 -s 32x32}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '2').png ~/.cache/mgconky/weather2.png}${image ~/.cache/mgconky/weather2.png -p 96,216 -s 32x32}\ -${execi 300 cp -f ~/.conky/mgconky/weather/lime32/$(~/.conky/mgconky/weather/parse_forecast.sh 'first' '.weather[0].id' '3').png ~/.cache/mgconky/weather3.png}${image ~/.cache/mgconky/weather3.png -p 175,216 -s 32x32} -# ***** Today's date ***** -${voffset -15}${color0}${alignc}${font Neuropolitical:size=10}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'location'}${font}${color} -${voffset -4}${color0}${alignc}${font Neuropolitical:size=10}${execi 300 LANG=${template9} LC_TIME=${template9} date +'%^a, %e %^B'}${font}${color} -${voffset 4}${alignc}${color3}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'description'}${color} -# ***** Temperature right now ***** -${voffset 8}${alignc -40}${color3}${font Courier:size=20:bold}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'temperature'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${font}${color} -# ***** Today's high/low temps ***** -${voffset 3}${alignc -40}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '0'}${color}\ -/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '0'}\ -${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} -# ***** Description of weather right now ***** -#${voffset 0}${alignc}${color3}${execi 300 ~/.conky/mgconky/weather/parse_weather.sh 'description'}${color} -# ***** Forecast day labels (MON, TUES, WED, etc) ***** -${voffset 17}${color0}${font Neuropolitical:size=10}${alignc 77}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +1day +%^a}${font}${color} -${voffset -18}${color0}${font Neuropolitical:size=10}${alignc}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +2day +%^a}${font}${color} -${voffset -18}${color0}${font Neuropolitical:size=10}${alignc -77}${execi 300 LANG=${template9} LC_TIME=${template9} date -d +3day +%^a}${font}${color} -# ***** Forecast high/low temps ***** -${voffset 32}${alignc 77}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '1'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '1'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} -${voffset -13}${alignc}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '2'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '2'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} -${voffset -13}${alignc -77}${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'min' '.main.temp_min' '3'}${color}/${color3}${execi 300 ~/.conky/mgconky/weather/parse_forecast.sh 'max' '.main.temp_max' '3'}${if_match $template8 == "metric"}°C${else}${if_match $template8 == "imperial"}°F${else}${if_match $template8 == "default"}K${endif}${endif}${endif}${color} - -#-------------------------- -# Processor -#-------------------------- -${color0}${font Neuropolitical:size=8:bold}PROCESSOR ${color1}${hr 2}${color}${font} -${voffset 4}${color3}${font DejaVu Sans:size=8}${execi 100000 cat /proc/cpuinfo | grep 'model name' | cut -c 14-55 | uniq }${font}${color} -${voffset 2}Temp: ${color4}${execi 10 sensors | grep "Tdie" | cut -c16-19 }°C${color}${alignr}Freq: ${color3}${freq}MHz${color} -${voffset 0}${color5}${cpugraph 000000 00ffff}${color} -${voffset -4}Core 1:${goto 60}${color5}${cpubar cpu1 6,140}${color}${alignr}${color3}${cpu cpu1}%${color} -${voffset 0}Core 2:${goto 60}${color5}${cpubar cpu2 6,140}${color}${alignr}${color3}${cpu cpu2}%${color} -${voffset 0}Core 3:${goto 60}${color5}${cpubar cpu3 6,140}${color}${alignr}${color3}${cpu cpu3}%${color} -${voffset 0}Core 4:${goto 60}${color5}${cpubar cpu4 6,140}${color}${alignr}${color3}${cpu cpu4}%${color} -${voffset 0}Core 5:${goto 60}${color5}${cpubar cpu5 6,140}${color}${alignr}${color3}${cpu cpu5}%${color} -${voffset 0}Core 6:${goto 60}${color5}${cpubar cpu6 6,140}${color}${alignr}${color3}${cpu cpu6}%${color} - -#-------------------------- -# Graphics card -#-------------------------- -${color0}${font Neuropolitical:size=8:bold}GRAPHICS CARD ${color1}${hr 2}${color}${font} -${voffset 4}Temp: ${color4}${nvidia temp}°C${color}${alignr}Threshold: ${color3}${nvidia threshold}°C${color} - -#-------------------------- -# Memory -#-------------------------- -${color0}${font Neuropolitical:size=8:bold}MEMORY ${color1}${hr 2}${color}${font} -${voffset 4}RAM:${alignr}${color3}${lua MyRound ${mem} 1 halfup G hideUnit}${color} of ${color3}${lua MyRound ${memmax} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${membar}${color} -${voffset 2}Swap:${alignr}${color3}${lua MyRound ${swap} 1 halfup G hideUnit}${color} of ${color3}${lua MyRound ${swapmax} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${swapbar}${color} - -#-------------------------- -# Drive #1 -#-------------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font} /dev/nvme0n1${color} ${color1}${hr 2}${color} -# ***** First we show the device ***** -${voffset 4}Read:${color} ${color3}${diskio_read nvme0n1}/s${color}${goto 120}Write: ${color3}${diskio_write nvme0n1}/s${color} -${voffset -4}${color5}${diskiograph_read nvme0n1 25,110 000000 ff0000}${color}${alignr}${color5}${diskiograph_write nvme0n1 25,110 000000 00ffff}${color} -# ***** Now we show the mounts under this device ***** -${voffset 0}/ (root):${alignr}${color3}${lua MyRound ${fs_used /} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar /}${color} -${voffset 2}/home:${alignr}${color3}${lua MyRound ${fs_used /home} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /home} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar /home}${color} - -#-------------------------- -# Drive #2 -#-------------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font} /dev/sda${color} ${color1}${hr 2}${color} -# ***** First we show the device ***** -${voffset 4}Read: ${color3}${diskio_read sda}/s${color}${goto 120}Write: ${color3}${diskio_write sda}/s${color} -${voffset -4}${color5}${diskiograph_read sda 25,110 000000 ff0000}${color}${alignr}${color5}${diskiograph_write sda 25,110 000000 00ffff}${color} -# ***** Now we show the mounts under this device ***** -${voffset 0}/mnt/SSD120:${alignr}${color3}${lua MyRound ${fs_used /mnt/SSD120} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /mnt/SSD120} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar 6 /mnt/SSD120}${color} - -#-------------------------- -# Drive #3 -#-------------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font} /dev/sdb${color} ${color1}${hr 2}${color} -# ***** First we show the device ***** -${voffset 4}Read: ${color3}${diskio_read sdb}/s${color}${goto 120}Write: ${color3}${diskio_write sdb}/s${color} -${voffset -4}${color5}${diskiograph_read sdb 25,110 000000 ff0000}${color}${alignr}${color5}${diskiograph_write sdb 25,110 000000 00ffff}${color} -# ***** Now we show the mounts under this device ***** -${voffset 0}/mnt/SSD180:${alignr}${color3}${lua MyRound ${fs_used /mnt/SSD180} 0 halfup G hideUnit}${color} of ${color3}${lua MyRound ${fs_size /mnt/SSD180} 0 ceil G addSpace}B${color} -${voffset -2}${color5}${fs_bar 6 /mnt/SSD180}${color} - -#---------------------- -# Top Processes -#---------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}TOP PROCESSES ${color1}${hr 2}${color}${font} -${voffset 6}By Memory Usage${goto 142}PID${alignr}RAM -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 1}${goto 140}${top_mem pid 1}${alignr}${top_mem mem_res 1}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 2}${goto 140}${top_mem pid 2}${alignr}${top_mem mem_res 2}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 3}${goto 140}${top_mem pid 3}${alignr}${top_mem mem_res 3}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 4}${goto 140}${top_mem pid 4}${alignr}${top_mem mem_res 4}${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top_mem name 5}${goto 140}${top_mem pid 5}${alignr}${top_mem mem_res 5}${color} -${voffset 6}By CPU Usage${goto 142}PID${alignr}CPU -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 1}${goto 140}${top pid 1}${alignr}${top cpu 1}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 2}${goto 140}${top pid 2}${alignr}${top cpu 2}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 3}${goto 140}${top pid 3}${alignr}${top cpu 3}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 4}${goto 140}${top pid 4}${alignr}${top cpu 4}%${color} -${voffset 0}${font StyleBats:size=10}h${font}${voffset -1}${color3}${offset 5}${top name 5}${goto 140}${top pid 5}${alignr}${top cpu 5}%${color} - -#-------------------- -# Network -- Replace "enp34s0" below with name of your ethernet device. (Find name of ethernet device by typing "ip a" in terminal.) -#-------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}NETWORK ${color1}${hr 2}${color}${font} -${voffset 6}Ethernet Device:${goto 140}${color3}${gw_iface}${color} -${voffset 0}Internal IP:${goto 140}${color3}${addr enp34s0}${color} -${voffset 0}External IP:${goto 140}${color3}${execi 1800 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'}${color} -${voffset 6}DL: ${color3}${downspeed enp34s0}/s${color}${goto 140}UL:${color} ${color3}${upspeed enp34s0}/s${color} -${voffset -2}${color5}${downspeedgraph enp34s0 25,90 000000 ff0000}${color}${alignr}${color5}${upspeedgraph enp34s0 25,90 000000 00ffff}${color} -${voffset -6}Total: ${color3}${totaldown enp34s0}${color}${goto 140}Total:${color} ${color3}${totalup enp34s0}${color} - -#-------------------- -# Connections - netstat shows number of connections from your computer and application/PID making it. Kill spyware! -#-------------------- -${voffset 0}${color0}${font Neuropolitical:size=8:bold}CONNECTIONS ${color1}${hr 2}${color}${font} -${voffset 6}Num. connections / PID / Process -${voffset 2}${color3}${execi 30 netstat -ept | grep ESTAB | awk '{print $9}' | cut -d: -f1 | sort | uniq -c | sort -nr}${color} diff --git a/devices/get_device_info.lua b/devices/get_device_info.lua new file mode 100644 index 0000000..61626cc --- /dev/null +++ b/devices/get_device_info.lua @@ -0,0 +1,357 @@ +--[[ ########################################################################################################################################### +# This script file was created by Matt Grotke (mgrotke@gmail.com) for the "mgconky Conky Theme" project: https://github.com/mgrotke/mgconky +# This file is in the public domain. +# ----------------------------------------------------------------------------------------------------------------------------------------- ]]-- + +-- ########################################################## GET CPU MAKE AND MODEL ########################################################### + +function conky_shorten_cpu_name(cpu_name) + -- Remove unnecessary parts like (R), (TM), "CPU", "@ XGHz", "Processor", and extra spaces + return (cpu_name + :gsub("%(R%)", "") -- Remove (R) + :gsub("%(TM%)", "") -- Remove (TM) + :gsub("CPU", "") -- Remove "CPU" + :gsub("Processor", "") -- Remove "Processor" + :gsub("@[%s%w%.]+", "") -- Remove "@ XGHz" + :gsub("%s%s+", " ") -- Remove extra spaces + :gsub("^%s+", "") -- Trim leading spaces + :gsub("%s+$", "") -- Trim trailing spaces + ) +end + +-- Cache so we only run this once. The CPU will not change. +local conky_cpu_cached_output = nil +function conky_get_cpu_info() + if conky_cpu_cached_output then + return conky_cpu_cached_output + else + -- Open /proc/cpuinfo for reading + local file = io.open("/proc/cpuinfo", "r") + if not file then + conky_cpu_cached_output = "Failed to open /proc/cpuinfo" + return conky_cpu_cached_output + end + + -- Read the contents of /proc/cpuinfo + local cpu_info = file:read("*all") + file:close() + + -- Find the 'model name' line + for line in cpu_info:gmatch("[^\r\n]+") do + local model_name = line:match("^model name%s*:%s*(.+)") + if model_name then + conky_cpu_cached_output = conky_shorten_cpu_name(model_name) + return conky_cpu_cached_output + end + end + + -- Return nil if no model name is found + conky_cpu_cached_output = "CPU model name not found" + return conky_cpu_cached_output + end +end + +-- ########################################################## GET GU MAKE AND MODEL ########################################################### + +function conky_shorten_gpu_name(gpu_name) + return (gpu_name + :gsub("NVIDIA Corporation", "NVIDIA") + :gsub("Advanced Micro Devices, Inc%.", "AMD") + :gsub("AMD Corporation", "AMD") + :gsub("Intel Corporation", "Intel") + :gsub("ATI Technologies Inc%.", "ATI") + :gsub("Qualcomm Technologies, Inc%.", "Qualcomm") + :gsub("ARM Holdings", "ARM") + :gsub("Apple Inc%.", "Apple") + :gsub("Matrox Graphics, Inc%.", "Matrox") + :gsub("S3 Graphics Co%., Ltd%.", "S3 Graphics") + :gsub("VIA Technologies, Inc%.", "VIA") + :gsub("Imagination Technologies Ltd%.", "Imagination") + :gsub("SiS %(Silicon Integrated Systems%)", "SiS") + :gsub("XGI Technology Inc%.", "XGI") + :gsub("3dfx Interactive, Inc%.", "3dfx") + :gsub("Raspberry Pi Foundation", "Raspberry Pi") + :gsub("Broadcom Inc%.", "Broadcom") + :gsub("Lite Hash Rate", "LHR") + :gsub("GA%d+%s%[", "") -- Remove chip identifier like "GA106 [" + :gsub("%].*", "") -- Remove everything after "]" + :gsub("%(.*%)", "") -- Remove revision info like "(rev a1)" + :gsub("%s+", " ") -- Normalize spaces + :match("^%s*(.-)%s*$") -- Trim leading/trailing spaces + ) +end + +-- Cache so we only run this once. The GPU will not change. +local conky_gpu_cached_output = nil +function conky_get_gpu_info() + if conky_gpu_cached_output then + return conky_gpu_cached_output + else + local handle = io.popen("lspci -nn") + if not handle then + conky_gpu_cached_output = "Failed to run lspci" + return conky_gpu_cached_output + end + + -- Read the output of the command + local output = handle:read("*all") + handle:close() + + -- Search for a VGA compatible controller or GPU entry + for line in output:gmatch("[^\r\n]+") do + if line:match("%[0300%]") then + -- Extract the relevant information after the colon + local gpu = line:match(": (.+)$") + if gpu then + conky_gpu_cached_output = conky_shorten_gpu_name(gpu) + return conky_gpu_cached_output + end + end + end + + -- If no graphics card is found + conky_gpu_cached_output = "No graphics card found" + return conky_gpu_cached_output + end +end + + +-- ########################################################## GET DRIVES AND VOLUMES ########################################################### + +-- Cache so we don't spam this every conky tick +local conky_drives_cache_duration = 300 -- Cache output for 5 minutes +local conky_drives_last_update_time = 0 +local conky_drives_cached_output = "" + +function conky_get_drives_and_volumes() + local current_time = os.time() + + -- Check if cache is still valid + if current_time - conky_drives_last_update_time < conky_drives_cache_duration then + return conky_drives_cached_output + end + + -- Start fresh output + local output = "" + + -- Use lsblk to get all devices and their mount points + local handle = io.popen("lsblk -ln -o NAME,TYPE,MOUNTPOINT,PKNAME") + if not handle then + return "Failed to execute lsblk command\n" + end + local result = handle:read("*a") + handle:close() + + -- Parse the lsblk output and group partitions by parent drive + local devices = {} + local parent_drive = nil + + for line in (result or ""):gmatch("[^\r\n]+") do + local name, dtype, mount, pkname = line:match("^(%S+)%s+(%S+)%s*(%S*)%s*(%S*)$") + if dtype == "disk" then + parent_drive = name + devices[parent_drive] = { mountpoints = {} } + elseif dtype == "part" and parent_drive and mount and mount ~= "" then + table.insert(devices[parent_drive].mountpoints, mount) + elseif dtype == "dm" and pkname and mount and mount ~= "" then + -- Associate device-mapper (dm) devices with their parent physical disk + devices[pkname] = devices[pkname] or { mountpoints = {} } + table.insert(devices[pkname].mountpoints, mount) + end + end + + -- Generate the output, only including drives with active mount points + for drive, data in pairs(devices) do + if #data.mountpoints > 0 then + output = output .. '${voffset 0}${color0}${font Neuropolitical:size=8:bold}DRIVE${font Courier:size=9} /dev/' .. drive .. '${color} ${color1}${hr 2}${color}\n' + for _, mount in ipairs(data.mountpoints) do + -- Use df to get the size and used space for the mount + local handle = io.popen("df -h --output=target,size,used " .. mount .. " | tail -n 1") + local df_result = handle:read("*a") + handle:close() + + -- Parse df output + local target, size, used = df_result:match("(%S+)%s+(%S+)%s+(%S+)") + if target and size and used then + output = output .. '${voffset 2}' .. target .. ': ${alignr}${color3}' .. used .. 'B${color} of ${color3}' .. size .. 'B${color}\n' + output = output .. '${voffset -2}${color5}${fs_bar ' .. target .. '}${color}\n' + end + end + output = output .. '\n' -- Add a blank line after the last mount point of the current drive + end + end + + -- Cache and return the output + conky_drives_cached_output = output + conky_drives_last_update_time = current_time + + return conky_drives_cached_output +end + +-- Run and print the output (for standalone testing) +print(conky_get_drives_and_volumes()) + + +-- ########################################################## GET VPN STATUS ################################################################### + +-- Cache so we don't spam this every conky tick +local conky_vpn_cache = { + last_update_time = 0, + cache_duration = 15, -- Cache output for 15 seconds + cached_output = "" +} + +function conky_get_vpn_status() + local current_time = os.time() + + -- Update cache only if more than 30 seconds have passed + if current_time - conky_vpn_cache.last_update_time > conky_vpn_cache.cache_duration then + -- Run the `ip a` command and capture its output + local handle = io.popen("ip a") + if not handle then + return "${color7}Error: Failed to execute 'ip a'${color}" + end + + local result = handle:read("*a") + handle:close() + + -- Check for active VPN + local vpn_status = "Off" + local vpn_color = "${color7}" -- Red for Off + + for line in result:gmatch("[^\r\n]+") do + -- Look for active POINTOPOINT interfaces + if line:find("POINTOPOINT") and line:find("UP") then + local device_name = line:match("^%d+: ([^:]+):") + if device_name then + vpn_status = "On (" .. device_name .. ")" + vpn_color = "${color6}" -- Blue for On + break + end + end + end + + -- Update cache + conky_vpn_cache.cached_output = vpn_color .. vpn_status .. "${color}" + conky_vpn_cache.last_update_time = current_time + end + + -- Return cached status + return conky_vpn_cache.cached_output +end + +-- Test the function by printing the result +print(conky_get_vpn_status()) + +-- ########################################################## GET MEMORY USAGE ################################################################# + +-- Cache so we don't spam this every conky tick +local conky_memory_cache = { + last_update_time_swapstatus = 0, + last_update_time_memval = 0, + last_update_time_swapval = 0, + cache_duration = 15, -- Cache output for 1 minute + cached_output_swapstatus = "", -- Possible values: "swapenabled" | "swapdisabled" + cached_output_memval = "", + cached_output_swapval = "" +} + +function conky_grep_memory(grep_filter) + + -- Run the `free` command and capture its output + local handle = io.popen("free -h --si | grep " .. grep_filter) + if not handle then + return "Error: Failed to execute 'free'" + end + local result = handle:read("*a") + handle:close() + return result +end + +function conky_get_memory_usage(grep_filter) + local current_time = os.time() + + -- Is arg "sys" or "swap" + if grep_filter == "sys" then + + -- Is cache stale? + if current_time - conky_memory_cache.last_update_time_memval > conky_memory_cache.cache_duration then + + -- Extract memory usage details + local grep_result = conky_grep_memory("Mem") + local total, used = grep_result:match("Mem:%s+(%S+)%s+(%S+)") + if not total or not used then + conky_memory_cache.cached_output_memval = "Error: Failed to parse memory usage" + else + -- Format the output as "X of Y" with color formatting + conky_memory_cache.cached_output_memval = "${color3}" .. used .. "B${color} of ${color3}" .. total .. "B${color}" + end + + -- Update cache time + conky_memory_cache.last_update_time_memval = current_time + + -- Debug + --print("DEBUG: UPDATED MEM VAL (" .. conky_memory_cache.cached_output_memval .. ")") + end + + -- return mem cache (the mem cache has been updated if the duration has passed) + return conky_memory_cache.cached_output_memval + + else -- If arg is not "sys" we assume they are looking for swap + + -- Is cache stale? + if current_time - conky_memory_cache.last_update_time_swapval > conky_memory_cache.cache_duration then + + -- Extract swap usage details + local grep_result = conky_grep_memory("Swap") + local total, used = grep_result:match("Swap:%s+(%S+)%s+(%S+)") + if not total or not used then + conky_memory_cache.cached_output_swapval = "Error: Failed to parse swap usage" + else + -- Format the output as "X of Y" with color formatting + conky_memory_cache.cached_output_swapval = "${color3}" .. used .. "B${color} of ${color3}" .. total .. "B${color}" + end + + -- Update cache time + conky_memory_cache.last_update_time_swapval = current_time + + -- Debug + --print("DEBUG: UPDATED SWAP VAL (" .. conky_memory_cache.cached_output_swapval .. ")") + end + + -- return swap cache (the swap cache has been updated if the duration has passed) + return conky_memory_cache.cached_output_swapval + end +end + +function conky_check_swap_status() + local current_time = os.time() + + -- Is cache stale? + if current_time - conky_memory_cache.last_update_time_swapstatus > conky_memory_cache.cache_duration then + + local grep_result = conky_grep_memory("Swap") + local total = grep_result:match("Swap:%s+(%S+)") + if not total or total == "0B" or total == "0" then + conky_memory_cache.cached_output_swapstatus = "swapdisabled" + else + conky_memory_cache.cached_output_swapstatus = "swapenabled" + end + + -- Update cache + conky_memory_cache.last_update_time_swapstatus = current_time + end + + -- Debug + --print("DEBUG: UPDATED SWAP STATUS (" .. conky_memory_cache.cached_output_swapstatus .. ")") + + -- Return cached output + return conky_memory_cache.cached_output_swapstatus +end + +-- Test the function by printing the result +print("Initial Memory Check Function Outputs:") +print(" CHECK SWAP STATUS = " .. conky_check_swap_status()) +print(" GET MEMORY USAGE = " .. conky_get_memory_usage("mem")) +print(" GET SWAP USAGE = " .. conky_get_memory_usage("swap")) + diff --git a/rounding.lua b/rounding.lua deleted file mode 100644 index cc0804c..0000000 --- a/rounding.lua +++ /dev/null @@ -1,146 +0,0 @@ ---[[ ############################################################################################################################## -# This script file was created by Matt Grotke (mgrotke@gmail.com) for the "mgconky Conky Theme" project: https://github.com/mgrotke/mgconky -# This file is in the public domain. -# --------------------------------------------------------------------------------------------------------------------------------- -# The function below is intended to be called by a Conky config file in the following way: -# ${lua MyRound