Nixfiles! :3
0

Configure Feed

Select the types of activity you want to include in your feed.

isabel, I hate this


Signed-off-by: MLC Bloeiman <mar@strawmelonjuice.com>

MLC Bloeiman (Apr 22, 2026, 6:06 PM +0200) c511ba60 c7b90038

+464 -30
+464 -30
home/modules/wezterm.nix
··· 4 4 programs.wezterm = { 5 5 enable = true; 6 6 extraConfig = '' 7 - local get_time_of_day = function() 8 - local hour = tonumber(os.date("%H")) 9 - if hour >= 6 and hour < 12 then 10 - -- morning 11 - return "Rosé Pine Dawn (Gogh)" 12 - elseif hour >= 12 and hour < 19 then 13 - -- afternoon 14 - return "Breadog (Gogh)" 15 - elseif hour >= 19 and hour < 24 then 16 - -- evening 17 - return "tokyonight_night" 7 + local config = wezterm.config_builder() 8 + local act = wezterm.action 9 + 10 + -- Visuals -------------------------------------------------------------------------------------------------------------- 11 + require("bar").apply_to_config(config) 12 + local get_time_of_day = function() 13 + local hour = tonumber(os.date("%H")) 14 + if hour >= 6 and hour < 12 then 15 + -- morning 16 + return "Rosé Pine Dawn (Gogh)" 17 + elseif hour >= 12 and hour < 19 then 18 + -- afternoon 19 + return "Breadog (Gogh)" 20 + elseif hour >= 19 and hour < 24 then 21 + -- evening 22 + return "tokyonight_night" 23 + else 24 + -- night 25 + return "tokyonight_night" 26 + end 27 + end 28 + config.color_scheme = get_time_of_day() 29 + config.window_decorations = "NONE" 30 + config.font = wezterm.font("Hermit") 31 + config.window_padding = { 32 + left = 5, 33 + right = 5, 34 + top = 5, 35 + bottom = 5, 36 + } 37 + config.font_size = 8 38 + config.font = wezterm.font_with_fallback({ 39 + "Hermit", 40 + "Lilex", 41 + "Lotion", 42 + }) 43 + config.adjust_window_size_when_changing_font_size = false 44 + config.window_frame = { 45 + font = wezterm.font("Lotion"), 46 + -- font_size = config.font_size, 47 + } 48 + -- Keybinds ------------------------------------------------------------------------------------------------------------- 49 + 50 + local openUrl = act.QuickSelectArgs({ 51 + label = "open url", 52 + patterns = { "https?://\\S+" }, 53 + action = wezterm.action_callback(function(window, pane) 54 + local url = window:get_selection_text_for_pane(pane) 55 + wezterm.open_with(url) 56 + end), 57 + }) 58 + 59 + local namePicker = act.PromptInputLine({ 60 + description = "Enter new name for tab", 61 + action = wezterm.action_callback(function(window, pane, line) 62 + if line then 63 + window:active_tab():set_title(line) 64 + end 65 + end), 66 + }) 67 + local colorPicker = act.InputSelector({ 68 + title = "Change Catppuccin flavor", 69 + choices = { 70 + { label = "tokyonight_night" }, 71 + { label = "Breadog (Gogh)" }, 72 + }, 73 + action = wezterm.action_callback(function(window, _, _, label) 74 + if label then 75 + window:set_config_overrides({ color_scheme = label }) 76 + end 77 + end), 78 + }) 79 + local keys = {} 80 + local map = function(key, mods, action) 81 + if type(mods) == "string" then 82 + table.insert(keys, { key = key, mods = mods, action = action }) 83 + elseif type(mods) == "table" then 84 + for _, mod in pairs(mods) do 85 + table.insert(keys, { key = key, mods = mod, action = action }) 86 + end 87 + end 88 + end 89 + map("e", {"CTRL|SHIFT", "LEADER" }, namePicker) 90 + map("m", "CTRL|SHIFT", colorPicker) 91 + map("o", "LEADER" , openUrl) 92 + config.leader = { 93 + key = "a", 94 + mods = "CTRL", 95 + } 96 + config.keys = keys 97 + -- c.disable_default_key_bindings = true 98 + 99 + -- Misc. ---------------------------------------------------------------------------------------------------------------- 100 + config.window_close_confirmation = "NeverPrompt" 101 + -- config.prefer_to_spawn_tabs = true 102 + config.front_end = "WebGpu" 103 + config.enable_wayland = true 104 + config.check_for_updates = false 105 + 106 + return config 107 + ''; 108 + 109 + }; 110 + xdg.configFile."wezterm/bar.lua" = { 111 + text = '' 112 + -- stole this from isabelroses, who seems to have stolen it from https://github.com/nekowinston/wezterm-bar 113 + -- I hate when I have this as a separate file so may change this up later. 114 + local wezterm = require("wezterm") 115 + 116 + local M = {} 117 + 118 + -- default configuration 119 + local config = { 120 + position = "bottom", -- or "top" 121 + max_width = 32, 122 + dividers = "slant_right", -- "slant_right" or "slant_left", "arrows", "rounded", false 123 + indicator = { 124 + leader = { 125 + enabled = true, 126 + off = " ", 127 + on = " ", 128 + }, 129 + mode = { 130 + enabled = true, 131 + names = { 132 + resize_mode = "RESIZE", 133 + copy_mode = "VISUAL", 134 + search_mode = "SEARCH", 135 + }, 136 + }, 137 + }, 138 + tabs = { 139 + numerals = "arabic", -- or "roman" 140 + pane_count = "superscript", -- or "subscript", false 141 + brackets = { 142 + active = { "", ":" }, 143 + inactive = { "", ":" }, 144 + }, 145 + }, 146 + clock = { 147 + enabled = false, 148 + format = "%I:%M %P", -- https://docs.rs/chrono/latest/chrono/format/strftime/index.html 149 + }, 150 + } 151 + 152 + -- parsed config 153 + local C = {} 154 + 155 + local function tableMerge(t1, t2) 156 + for k, v in pairs(t2) do 157 + if type(v) == "table" then 158 + if type(t1[k] or false) == "table" then 159 + tableMerge(t1[k] or {}, t2[k] or {}) 160 + else 161 + t1[k] = v 162 + end 163 + else 164 + t1[k] = v 165 + end 166 + end 167 + return t1 168 + end 169 + 170 + local dividers = { 171 + slant_right = { 172 + left = utf8.char(0xe0be), 173 + right = utf8.char(0xe0bc), 174 + }, 175 + slant_left = { 176 + left = utf8.char(0xe0bb), 177 + right = utf8.char(0xe0b8), 178 + }, 179 + arrows = { 180 + left = utf8.char(0xe0b2), 181 + right = utf8.char(0xe0b0), 182 + }, 183 + rounded = { 184 + left = utf8.char(0xe0b6), 185 + right = utf8.char(0xe0b4), 186 + }, 187 + } 188 + 189 + -- conforming to https://github.com/wez/wezterm/commit/e4ae8a844d8feaa43e1de34c5cc8b4f07ce525dd 190 + -- exporting an apply_to_config function, even though we don't change the users config 191 + M.apply_to_config = function(c, opts) 192 + -- make the opts arg optional 193 + if not opts then 194 + opts = {} 195 + end 196 + 197 + -- combine user config with defaults 198 + config = tableMerge(config, opts) 199 + C.div = { 200 + l = "", 201 + r = "", 202 + } 203 + 204 + if config.dividers then 205 + C.div.l = dividers[config.dividers].left 206 + C.div.r = dividers[config.dividers].right 207 + end 208 + 209 + C.leader = { 210 + enabled = config.indicator.leader.enabled and true, 211 + off = config.indicator.leader.off, 212 + on = config.indicator.leader.on, 213 + } 214 + 215 + C.mode = { 216 + enabled = config.indicator.mode.enabled, 217 + names = config.indicator.mode.names, 218 + } 219 + 220 + C.tabs = { 221 + numerals = config.tabs.numerals, 222 + pane_count_style = config.tabs.pane_count, 223 + brackets = { 224 + active = config.tabs.brackets.active, 225 + inactive = config.tabs.brackets.inactive, 226 + }, 227 + } 228 + 229 + C.clock = { 230 + enabled = config.clock.enabled, 231 + format = config.clock.format, 232 + } 233 + 234 + -- set the right-hand padding to 0 spaces, if the rounded style is active 235 + C.p = (config.dividers == "rounded") and "" or " " 236 + 237 + -- set wezterm config options according to the parsed config 238 + c.use_fancy_tab_bar = false 239 + c.tab_bar_at_bottom = config.position == "bottom" 240 + c.tab_max_width = config.max_width 241 + end 242 + 243 + -- superscript/subscript 244 + local function numberStyle(number, script) 245 + local scripts = { 246 + superscript = { 247 + "⁰", 248 + "¹", 249 + "²", 250 + "³", 251 + "⁴", 252 + "⁵", 253 + "⁶", 254 + "⁷", 255 + "⁸", 256 + "⁹", 257 + }, 258 + subscript = { 259 + "₀", 260 + "₁", 261 + "₂", 262 + "₃", 263 + "₄", 264 + "₅", 265 + "₆", 266 + "₇", 267 + "₈", 268 + "₉", 269 + }, 270 + } 271 + local numbers = scripts[script] 272 + local number_string = tostring(number) 273 + local result = "" 274 + for i = 1, #number_string do 275 + local char = number_string:sub(i, i) 276 + local num = tonumber(char) 277 + if num then 278 + result = result .. numbers[num + 1] 279 + else 280 + result = result .. char 281 + end 282 + end 283 + return result 284 + end 285 + 286 + local roman_numerals = { 287 + "Ⅰ", 288 + "Ⅱ", 289 + "Ⅲ", 290 + "Ⅳ", 291 + "Ⅴ", 292 + "Ⅵ", 293 + "Ⅶ", 294 + "Ⅷ", 295 + "Ⅸ", 296 + "Ⅹ", 297 + "Ⅺ", 298 + "Ⅻ", 299 + } 300 + 301 + -- custom tab bar 302 + wezterm.on("format-tab-title", function(tab, tabs, _panes, conf, _hover, _max_width) 303 + local colours = conf.resolved_palette.tab_bar 304 + 305 + local active_tab_index = 0 306 + for _, t in ipairs(tabs) do 307 + if t.is_active == true then 308 + active_tab_index = t.tab_index 309 + end 310 + end 311 + 312 + local rainbow = { 313 + conf.resolved_palette.ansi[2], 314 + conf.resolved_palette.indexed[16], 315 + conf.resolved_palette.ansi[4], 316 + conf.resolved_palette.ansi[3], 317 + conf.resolved_palette.ansi[5], 318 + conf.resolved_palette.ansi[6], 319 + } 320 + 321 + local i = tab.tab_index % 6 322 + local active_bg = rainbow[i + 1] 323 + local active_fg = colours.background 324 + local inactive_bg = colours.inactive_tab.bg_color 325 + local inactive_fg = colours.inactive_tab.fg_color 326 + local new_tab_bg = colours.new_tab.bg_color 327 + 328 + local s_bg, s_fg, e_bg, e_fg 329 + 330 + -- the last tab 331 + if tab.tab_index == #tabs - 1 then 332 + if tab.is_active then 333 + s_bg = active_bg 334 + s_fg = active_fg 335 + e_bg = new_tab_bg 336 + e_fg = active_bg 337 + else 338 + s_bg = inactive_bg 339 + s_fg = inactive_fg 340 + e_bg = new_tab_bg 341 + e_fg = inactive_bg 342 + end 343 + elseif tab.tab_index == active_tab_index - 1 then 344 + s_bg = inactive_bg 345 + s_fg = inactive_fg 346 + e_bg = rainbow[(i + 1) % 6 + 1] 347 + e_fg = inactive_bg 348 + elseif tab.is_active then 349 + s_bg = active_bg 350 + s_fg = active_fg 351 + e_bg = inactive_bg 352 + e_fg = active_bg 18 353 else 19 - -- night 20 - return "tokyonight_night" 354 + s_bg = inactive_bg 355 + s_fg = inactive_fg 356 + e_bg = inactive_bg 357 + e_fg = inactive_bg 358 + end 359 + 360 + local pane_count = "" 361 + if C.tabs.pane_count_style then 362 + local tabi = wezterm.mux.get_tab(tab.tab_id) 363 + local muxpanes = tabi:panes() 364 + local count = #muxpanes == 1 and "" or tostring(#muxpanes) 365 + pane_count = numberStyle(count, C.tabs.pane_count_style) 366 + end 367 + 368 + local index_i 369 + if C.tabs.numerals == "roman" then 370 + index_i = roman_numerals[tab.tab_index + 1] 371 + else 372 + index_i = tab.tab_index + 1 373 + end 374 + 375 + local index 376 + if tab.is_active then 377 + index = string.format("%s%s%s ", C.tabs.brackets.active[1], index_i, C.tabs.brackets.active[2]) 378 + else 379 + index = string.format("%s%s%s ", C.tabs.brackets.inactive[1], index_i, C.tabs.brackets.inactive[2]) 380 + end 381 + 382 + -- start and end hardcoded numbers are the Powerline + " " padding 383 + local fillerwidth = 2 + string.len(index) + string.len(pane_count) + 2 384 + 385 + -- prefer renamed table titles to the default title 386 + local tabtitle = tab.tab_title 387 + if #tabtitle <= 0 then 388 + tabtitle = tab.active_pane.title 389 + end 390 + 391 + local width = conf.tab_max_width - fillerwidth - 1 392 + if (#tabtitle + fillerwidth) > conf.tab_max_width then 393 + tabtitle = wezterm.truncate_right(tabtitle, width) .. "…" 394 + end 395 + 396 + local title = string.format(" %s%s%s%s", index, tabtitle, pane_count, C.p) 397 + 398 + return { 399 + { Background = { Color = s_bg } }, 400 + { Foreground = { Color = s_fg } }, 401 + { Text = title }, 402 + { Background = { Color = e_bg } }, 403 + { Foreground = { Color = e_fg } }, 404 + { Text = C.div.r }, 405 + } 406 + end) 407 + 408 + wezterm.on("update-status", function(window, _pane) 409 + local active_kt = window:active_key_table() ~= nil 410 + local show = C.leader.enabled or (active_kt and C.mode.enabled) 411 + if not show then 412 + window:set_left_status("") 413 + return 414 + end 415 + 416 + local present, conf = pcall(window.effective_config, window) 417 + if not present then 418 + return 419 + end 420 + local palette = conf.resolved_palette 421 + 422 + local leader = "" 423 + if C.leader.enabled then 424 + local leader_text = C.leader.off 425 + if window:leader_is_active() then 426 + leader_text = C.leader.on 427 + end 428 + leader = wezterm.format({ 429 + { Foreground = { Color = palette.background } }, 430 + { Background = { Color = palette.ansi[5] } }, 431 + { Text = " " .. leader_text .. C.p }, 432 + }) 433 + end 434 + 435 + local mode = "" 436 + if C.mode.enabled then 437 + local mode_text = "" 438 + local active = window:active_key_table() 439 + if C.mode.names[active] ~= nil then 440 + mode_text = C.mode.names[active] .. "" 441 + end 442 + mode = wezterm.format({ 443 + { Foreground = { Color = palette.background } }, 444 + { Background = { Color = palette.ansi[5] } }, 445 + { Attribute = { Intensity = "Bold" } }, 446 + { Text = mode_text }, 447 + "ResetAttributes", 448 + }) 449 + end 450 + 451 + local first_tab_active = window:mux_window():tabs_with_info()[1].is_active 452 + local divider_bg = first_tab_active and palette.ansi[2] or palette.tab_bar.inactive_tab.bg_color 453 + 454 + local divider = wezterm.format({ 455 + { Background = { Color = divider_bg } }, 456 + { Foreground = { Color = palette.ansi[5] } }, 457 + { Text = C.div.r }, 458 + }) 459 + 460 + window:set_left_status(leader .. mode .. divider) 461 + 462 + if C.clock.enabled then 463 + local time = wezterm.time.now():format(C.clock.format) 464 + window:set_right_status(wezterm.format({ 465 + { Background = { Color = palette.tab_bar.background } }, 466 + { Foreground = { Color = palette.ansi[6] } }, 467 + { Text = time }, 468 + })) 21 469 end 22 - end 23 - local wezterm = require('wezterm') 24 - local config = wezterm.config_builder() 25 - config.color_scheme = get_time_of_day() 26 - config.enable_tab_bar = false 27 - config.window_background_opacity = 1.0 28 - config.font = wezterm.font('Hermit') 29 - config.window_padding = { 30 - left = 5, 31 - right = 5, 32 - top = 5, 33 - bottom = 5, 34 - } 35 - config.font_size = 8 36 - config.window_close_confirmation = 'NeverPrompt' 37 - -- and finally, return the configuration to wezterm 38 - return config 470 + end) 471 + 472 + return M 39 473 ''; 40 474 }; 41 475 }