{"id":3369,"date":"2018-01-11T17:15:09","date_gmt":"2018-01-11T15:15:09","guid":{"rendered":"https:\/\/www.systemcodegeeks.com\/?p=3369"},"modified":"2018-01-11T12:05:03","modified_gmt":"2018-01-11T10:05:03","slug":"weather-info-i3status","status":"publish","type":"post","link":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/","title":{"rendered":"Weather info in i3status"},"content":{"rendered":"<p>I recently started using\u00a0<a href=\"https:\/\/i3wm.org\/\">i3wm<\/a> because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status (which came installed with i3) to show system information and date\/time. But there was no out-of-the-box feature to get weather information from i3 status.<\/p>\n<p>I wanted a simple solution that does not require installing an external program like\u00a0<a href=\"https:\/\/github.com\/vivien\/i3blocks\">i3blocks<\/a>,\u00a0<a href=\"https:\/\/github.com\/brndnmtthws\/conky\">conky<\/a>, dzen2, xmobar or lemonbar. It had to also preserve colors I had configured for the i3bar output. So I came up with this simple solution.<\/p>\n<p><b>Step 1:<\/b> Setup a cron job to retrieve weather information every half hour and store it in a temporary file.<\/p>\n<p>*\/5 * * * * curl -s wttr.in\/montreal?T | head -n 7 &gt; ~\/.weather.cache<\/p>\n<p><b>Step 2:<\/b> Write a shell script to add this information to i3status data.<\/p>\n<pre class=\" brush:php\">  \r\n #!\/bin\/sh\r\n# shell script to prepend i3status with weather\r\n\r\ni3status | (read line &amp;&amp; echo \"$line\" &amp;&amp; read line &amp;&amp; echo \"$line\" &amp;&amp; read line &amp;&amp; echo \"$line\" &amp;&amp; while :\r\ndo\r\n  read line\r\n  temp=$(cat ~\/.weather.cache | grep -m 1 -Eo -e '-?[[:digit:]].*\u00b0C')\r\n  status=$(cat ~\/.weather.cache | head -n 3 | tail -n 1 | cut -c 16-)\r\n  echo \",[{\\\"full_text\\\":\\\"${temp} ? ${status}\\\",\\\"color\\\":\\\"#00FF00\\\" },${line#,\\[}\" || exit 1\r\ndone)<\/pre>\n<p><b>Step 3: <\/b>The~\/.config\/i3\/config file needs to be updated for thestatus_command to pipe through this script, as follows.<\/p>\n<pre class=\" brush:php\"> \r\nbar {\r\nstatus_command .config\/i3\/weather.sh\r\ntray_output primary\r\n}<\/pre>\n<p><b>Step 4: <\/b>The~\/.i3status.conf file should also be updated to change the output to the JSON format.<\/p>\n<pre class=\" brush:php\"> \r\ngeneral {\r\noutput_format = \"i3bar\"\r\ncolors = true\r\ninterval = 5\r\n}<\/pre>\n<p>You can find more information from the following links.<\/p>\n<ul>\n<li><a href=\"https:\/\/i3wm.org\/i3status\/manpage.html\">https:\/\/i3wm.org\/i3status\/manpage.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/i3\/i3status\/tree\/master\/contrib\">https:\/\/github.com\/i3\/i3status\/tree\/master\/contrib<\/a><\/li>\n<li><a href=\"https:\/\/i3wm.org\/docs\/i3bar-protocol.html\">https:\/\/i3wm.org\/docs\/i3bar-protocol.html<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/smxi\/inxi\">https:\/\/github.com\/smxi\/inxi<\/a><\/li>\n<\/ul>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on System Code Geeks with permission by Keheliya Gallaba, partner at our <a href=\"http:\/\/www.systemcodegeeks.com\/join-us\/scg\/\" target=\"_blank\" rel=\"noopener\">SCG program<\/a>. See the original article here: <a href=\"http:\/\/keheliya.blogspot.com\/2018\/01\/weather-info-in-i3status.html\" target=\"_blank\" rel=\"noopener\">Weather info in i3status<\/a><\/p>\n<p>Opinions expressed by System Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status (which came installed with i3) to show system information and date\/time. But there was no out-of-the-box feature to get weather information from i3 status. I wanted a simple solution that does not require installing an &hellip;<\/p>\n","protected":false},"author":761,"featured_media":192,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[117],"class_list":["post-3369","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-cli"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Weather info in i3status - System Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Weather info in i3status - System Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\" \/>\n<meta property=\"og:site_name\" content=\"System Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/systemcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-11T15:15:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Keheliya Gallaba\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Keheliya Gallaba\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\"},\"author\":{\"name\":\"Keheliya Gallaba\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/81b79a8e88b8d3f7020e8babfba53df0\"},\"headline\":\"Weather info in i3status\",\"datePublished\":\"2018-01-11T15:15:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\"},\"wordCount\":252,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg\",\"keywords\":[\"cli\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\",\"name\":\"Weather info in i3status - System Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg\",\"datePublished\":\"2018-01-11T15:15:09+00:00\",\"description\":\"I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status\",\"breadcrumb\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.systemcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/linux\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Weather info in i3status\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"name\":\"System Code Geeks\",\"description\":\"Operating System Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/systemcodegeeks\",\"https:\/\/x.com\/systemcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/81b79a8e88b8d3f7020e8babfba53df0\",\"name\":\"Keheliya Gallaba\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6dedcc491fba22fa94f483945cd2b599e841764316399f157578bfa8f493a515?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6dedcc491fba22fa94f483945cd2b599e841764316399f157578bfa8f493a515?s=96&d=mm&r=g\",\"caption\":\"Keheliya Gallaba\"},\"sameAs\":[\"http:\/\/keheliya.blogspot.com\/\"],\"url\":\"https:\/\/www.systemcodegeeks.com\/author\/keheliya-gallaba\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Weather info in i3status - System Code Geeks - 2026","description":"I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/","og_locale":"en_US","og_type":"article","og_title":"Weather info in i3status - System Code Geeks - 2026","og_description":"I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status","og_url":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/","og_site_name":"System Code Geeks","article_publisher":"https:\/\/www.facebook.com\/systemcodegeeks","article_published_time":"2018-01-11T15:15:09+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg","type":"image\/jpeg"}],"author":"Keheliya Gallaba","twitter_card":"summary_large_image","twitter_creator":"@systemcodegeeks","twitter_site":"@systemcodegeeks","twitter_misc":{"Written by":"Keheliya Gallaba","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#article","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/"},"author":{"name":"Keheliya Gallaba","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/81b79a8e88b8d3f7020e8babfba53df0"},"headline":"Weather info in i3status","datePublished":"2018-01-11T15:15:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/"},"wordCount":252,"commentCount":1,"publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg","keywords":["cli"],"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/","url":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/","name":"Weather info in i3status - System Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg","datePublished":"2018-01-11T15:15:09+00:00","description":"I recently started using\u00a0i3wm because it is light-weight, keyboard-friendly and uses the screen real-estate efficiently.\u00a0 I customized i3bar and i3status","breadcrumb":{"@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#primaryimage","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/linux-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemcodegeeks.com\/linux\/weather-info-i3status\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Linux","item":"https:\/\/www.systemcodegeeks.com\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"Weather info in i3status"}]},{"@type":"WebSite","@id":"https:\/\/www.systemcodegeeks.com\/#website","url":"https:\/\/www.systemcodegeeks.com\/","name":"System Code Geeks","description":"Operating System Developers Resource Center","publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.systemcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.systemcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/systemcodegeeks","https:\/\/x.com\/systemcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/81b79a8e88b8d3f7020e8babfba53df0","name":"Keheliya Gallaba","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6dedcc491fba22fa94f483945cd2b599e841764316399f157578bfa8f493a515?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6dedcc491fba22fa94f483945cd2b599e841764316399f157578bfa8f493a515?s=96&d=mm&r=g","caption":"Keheliya Gallaba"},"sameAs":["http:\/\/keheliya.blogspot.com\/"],"url":"https:\/\/www.systemcodegeeks.com\/author\/keheliya-gallaba\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/3369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/users\/761"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/comments?post=3369"}],"version-history":[{"count":0,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/3369\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media\/192"}],"wp:attachment":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media?parent=3369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/categories?post=3369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/tags?post=3369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}