---
title: "ターミナルがダサいとモテない。WezTermのright-statusで天気を表示する。 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-wezterm-weather"
description: "WezTermのright statusを使っていますか？ Photo by Wolfgang Hasselmann on Unsplash 2025年6月16日の月曜 なんだか週末からめちゃくちゃ暑くなってきました。 昨日29℃、今日は31℃、明日は34℃（え？ｗ） WezTermのright statusで天気を表示できたら良いなと・・・ right status 実はいろいろやってて、やっとできました・・・😅 ５分間隔でがなかな…"
---

# ターミナルがダサいとモテない。WezTermのright-statusで天気を表示する。

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2025年6月16日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)[#WezTerm](/tags/wezterm/)[#天気](/tags/天気/)

![ターミナルがダサいとモテない。WezTermのright-statusで天気を表示する。](/_astro/ogp.n5du-w04_2iqdqY.webp)

Photo by [Wolfgang Hasselmann](https://unsplash.com/@wolfgang_hasselmann?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

WezTermのright-statusを使っていますか？

2025年6月16日の月曜  
なんだか週末からめちゃくちゃ暑くなってきました。  
昨日29℃、今日は31℃、明日は34℃（え？ｗ）

WezTermのright-statusで天気を表示できたら良いなと・・・

## right-status

実はいろいろやってて、やっとできました・・・😅

５分間隔でがなかなかうまくいかなかった😂

Plain textcontent\_copy

```
local wezterm = require 'wezterm'

-- 省略

-------------------------------------------------------------------------------
-- right-status
local colors = {
        "#3c1361",
        "#52307c",
        "#663a82",
        "#7c5295",
        "#b491c8",
        "#d3a0f5",
}
local text_fg = "#c0c0c0"
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)

local weather_cache = "🌦 Loading..."
local last_weather_update = 0
local weather_update_interval = 300

local function fetch_weather()
        wezterm.log_info("Fetching weather data...")
        local handle = io.popen("curl -s 'wttr.in/Tokyo?format=4'")
        if handle then
                local result = handle:read("*a")
                handle:close()
                if result and result ~= "" then
                        weather_cache = result:gsub("\n", "")
                else
                        weather_cache = "🌧 Weather: N/A"
                end
        else
                weather_cache = "🌧 Weather Error"
        end
end

wezterm.on("gui-startup", function()
        last_weather_update = os.time()
        fetch_weather()
end)

wezterm.on("update-right-status", function(window, pane)
        local cells = {}
        local now = os.time()

        if now - last_weather_update > weather_update_interval then
                last_weather_update = now
                fetch_weather()
        end

        table.insert(cells, " " .. weather_cache .. " ")
        table.insert(cells, " " .. wezterm.strftime("⏱️ %F %T") .. " ")

        for _, b in ipairs(wezterm.battery_info()) do
                table.insert(cells, " 🔋 " .. string.format("%.0f%%", b.state_of_charge * 100) .. " ")
        end

        local elements = {}
        local num_cells = 0
        local function push(text, is_last)
                local cell_no = num_cells + 1
                table.insert(elements, { Foreground = { Color = text_fg } })
                table.insert(elements, { Background = { Color = colors[cell_no] or "#000000" } })
                table.insert(elements, { Text = text })
                if not is_last then
                        table.insert(elements, { Foreground = { Color = colors[cell_no + 1] or "#000000" } })
                        table.insert(elements, { Text = SOLID_LEFT_ARROW })
                end
                num_cells = num_cells + 1
        end

        while #cells > 0 do
                local cell = table.remove(cells, 1)
                push(cell, #cells == 0)
        end

        window:set_right_status(wezterm.format(elements))
end)

-------------------------------------------------------------------------------
-- and finally, return the configuration to wezterm
return config
```

![right-statusの画面（1）](/_astro/image-02.BoLkOwun_Z1t6TSh.webp)

試行錯誤して、やっとできた！

![right-statusの画面（2）](/_astro/image-03.nceeBHp3_en5S0.webp)

動作もだいたい５分おき👍

どうでもいいけど、まだ6月中旬なのに暑すぎません？

と毎年言ってる気がする・・・🤔

ターミナル環境について他の記事も書いているので、よろしければこちらもご覧ください！  
[『ターミナルがダサいとモテない』シリーズ一覧](https://blog.grasys.io/tags/series-terminal-update)

転載：[ターミナルがダサいとモテない。WezTermのright-statusで天気を表示する。](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-wezterm%E3%81%AEright-status%E3%81%A7%E5%A4%A9%E6%B0%97%E3%82%92%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B-b37eab3d3a07)

この記事は [Medium（@yusuke\_h）](https://medium.com/@yusuke_h) からの転載です。

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)