Put the nick in the window title
Who you are on a server was in Settings and nowhere else, which is a screen away from every screen you actually use — and two windows of this client were a pair of identical "frq"s in the switcher, told apart by opening them. The title follows the nick now: "frq — nandi" once connected, a bare "frq" until then, since before a connection there is no nick, only the box on the connect screen. It is polled beside the window width and for the reason that one is: the title belongs to the window rather than to the tree, so no render puts it there. Twice a second is far oftener than a nick changes, and a string compare is what a tick costs when it hasn't. The chats list says it too, where the eye already is. Needs jolt-native 5adddc7 for `vidya/set-title!`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
b9725a2 parent: 13e70a4 modified
src/frq/app.jolt +22 -1 | @@ -157,7 +157,10 @@ | ||
| 157 | 157 | (defn chats-screen [] |
| 158 | 158 | (let [buffers (s/channel-list)] |
| 159 | 159 | [:page {:max-width 620} |
| 160 | - [:title {:label "Chats"}] | |
| 160 | + ;; Your nick in the title, where "Chats" alone said nothing you did not | |
| 161 | + ;; already know. It is what every channel calls you and what your own | |
| 162 | + ;; lines are signed with, and the only other place it showed was Settings. | |
| 163 | + [:title {:label (if (s/connected?) (str "Chats as " @s/form-nick) "Chats")}] | |
| 161 | 164 | [error-note] |
| 162 | 165 | [:card {} |
| 163 | 166 | [:title-2 {:label "Join channel"}] |
| @@ -950,4 +953,22 @@ | ||
| 950 | 953 | (vidya/every! 200 #(let [w (vidya/window-width)] |
| 951 | 954 | (when (not= w @s/window-width) |
| 952 | 955 | (reset! s/window-width w)))) |
| 956 | + ;; The nick in the window title, so a second window of this client is told | |
| 957 | + ;; apart from the first by the one thing that differs — and so the answer to | |
| 958 | + ;; "who am I here?" is on screen without opening Settings. | |
| 959 | + ;; | |
| 960 | + ;; Polled, like the width above and for the same reason: the title belongs to | |
| 961 | + ;; the window rather than to the tree, so no render puts it there, and the | |
| 962 | + ;; nick is only settled once a connection has been made. Twice a second is | |
| 963 | + ;; far more often than a nick changes, and a string compare is what a tick | |
| 964 | + ;; costs when it has not. | |
| 965 | + ;; Seeded with the title `run` opens the window under, so the first tick of | |
| 966 | + ;; a launch that has nobody signed in yet sets nothing. | |
| 967 | + (let [shown (atom "frq")] | |
| 968 | + (vidya/every! 500 #(let [title (if (and (s/connected?) (seq @s/form-nick)) | |
| 969 | + (str "frq — " @s/form-nick) | |
| 970 | + "frq")] | |
| 971 | + (when (not= title @shown) | |
| 972 | + (reset! shown title) | |
| 973 | + (vidya/set-title! title))))) | |
| 953 | 974 | (ui/run app :title "frq" :width 520 :height 860)) |
| @@ -157,7 +157,10 @@ | |||
| 157 | (defn chats-screen [] | 157 | (defn chats-screen [] |
| 158 | (let [buffers (s/channel-list)] | 158 | (let [buffers (s/channel-list)] |
| 159 | [:page {:max-width 620} | 159 | [:page {:max-width 620} |
| 160 | - [:title {:label "Chats"}] | 160 | + ;; Your nick in the title, where "Chats" alone said nothing you did not |
| 161 | + ;; already know. It is what every channel calls you and what your own | ||
| 162 | + ;; lines are signed with, and the only other place it showed was Settings. | ||
| 163 | + [:title {:label (if (s/connected?) (str "Chats as " @s/form-nick) "Chats")}] | ||
| 161 | [error-note] | 164 | [error-note] |
| 162 | [:card {} | 165 | [:card {} |
| 163 | [:title-2 {:label "Join channel"}] | 166 | [:title-2 {:label "Join channel"}] |
| @@ -950,4 +953,22 @@ | |||
| 950 | (vidya/every! 200 #(let [w (vidya/window-width)] | 953 | (vidya/every! 200 #(let [w (vidya/window-width)] |
| 951 | (when (not= w @s/window-width) | 954 | (when (not= w @s/window-width) |
| 952 | (reset! s/window-width w)))) | 955 | (reset! s/window-width w)))) |
| 956 | + ;; The nick in the window title, so a second window of this client is told | ||
| 957 | + ;; apart from the first by the one thing that differs — and so the answer to | ||
| 958 | + ;; "who am I here?" is on screen without opening Settings. | ||
| 959 | + ;; | ||
| 960 | + ;; Polled, like the width above and for the same reason: the title belongs to | ||
| 961 | + ;; the window rather than to the tree, so no render puts it there, and the | ||
| 962 | + ;; nick is only settled once a connection has been made. Twice a second is | ||
| 963 | + ;; far more often than a nick changes, and a string compare is what a tick | ||
| 964 | + ;; costs when it has not. | ||
| 965 | + ;; Seeded with the title `run` opens the window under, so the first tick of | ||
| 966 | + ;; a launch that has nobody signed in yet sets nothing. | ||
| 967 | + (let [shown (atom "frq")] | ||
| 968 | + (vidya/every! 500 #(let [title (if (and (s/connected?) (seq @s/form-nick)) | ||
| 969 | + (str "frq — " @s/form-nick) | ||
| 970 | + "frq")] | ||
| 971 | + (when (not= title @shown) | ||
| 972 | + (reset! shown title) | ||
| 973 | + (vidya/set-title! title))))) | ||
| 953 | (ui/run app :title "frq" :width 520 :height 860)) | 974 | (ui/run app :title "frq" :width 520 :height 860)) |