repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

wezterm: vendored in presentation_mode and battery wezterm: new default font Monaspace Neon Var git: scaffolding for cross platform git hooks via poly scripts

aa812a3db6201eb7c5e907b95a178870da7f6c1b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (20)

git-hooks/README

Added
new file mode 100644

No text changes.

git-hooks/poly/poly-launcher.ps1

Added
new file mode 100755
1 +#!/bin/sh
2 +echo `# <#`
3 +final_current_script_file_path="$0"
4 +final_current_script_file_name=$(basename "$final_current_script_file_path")
5 +final_parent_directory_path=$(dirname $(dirname "$final_current_script_file_path"))
6 +final_java_file_path="$final_parent_directory_path/$final_current_script_file_name.java"
7 +if [ -f "$final_java_file_path" ]; then
8 + exec java "$final_java_file_path"
9 +fi
10 +exit
11 +#> > $null
13 +# TODO: figure this out on win32
15 +$finalCurrentScriptFilePath = Split-Path $MyInvocation.PSCommandPath -Leaf
16 +Write-Host $finalCurrentScriptFilePath
17 +$finalCurrentScriptFileName = [System.IO.Path]::GetFileNameWithoutExtension($finalCurrentScriptFilePath)
18 +$finalParentDirectoryPath = [System.IO.Path]::GetDirectoryName($finalCurrentScriptFilePath)
19 +$finalJavaFilePath = Join-Path $finalParentDirectoryPath "$finalCurrentScriptFileName.java"
21 +Write-Host "Executing $finalJavaFilePath"
23 +if (Test-Path $finalJavaFilePath) {
24 + java $finalJavaFilePath

git-hooks/poly/pre-push

Added
new file mode 120000
1 +poly-launcher.ps1

git-hooks/pre-push.java

Added
new file mode 100644
1 +import java.util.Arrays;
3 +interface __ {
4 + static void main( String[] arguments) {
5 + System.out.println("Recevied args: " + Arrays.toString(arguments));
6 + }
7 +}

neovim/lua/bugabinga/lsp.lua

Modified
16 16 -- enable multiline tokens for all lsps
17 -vim.lsp.config("*", { capabilities = { textDocument = { semanticTokens = { multilineTokenSupport = true } } } })
17 +vim.lsp.config("*", {
18 + capabilities = {
19 + textDocument = {
20 + semanticTokens = {
21 + multilineTokenSupport = true
22 + }
23 + }
24 + }
25 +})
19 27 if not const.win32 then
20 28 vim.lsp.enable {
47 55 user_command.LspStart 'Starts the given lsp server for the current buffer' (
48 56 function()
57 + -- TODO
58 + -- FIXME
59 + -- HACK
60 + -- NOTE

neovim/lua/bugabinga/nugu/init.lua

Modified
128 128 _.FloatBorderCorner { fg = ui_accent, bg = _.Normal.bg }
129 129 _.FloatTitle { fg = _.FloatBorder.fg, bg = _.FloatBorder.bg, bold = true }
130 130 _.EndOfBuffer { bg = _.Normal.bg }
131 -_.Comment { fg = content_important_global }
131 +_.Comment { fg = content_important_global, bold = true }
132 132 _.NotifyBackground = _.NormalUi
133 133 _.LineNr { fg = ui_focus, bg = content_backdrop }
134 134 _.LineNrAbove { fg = ui_minor, bg = content_backdrop }
195 195 _.Float = _.String
196 196 _.Identifier { fg = _.Normal.fg }
197 197 _.Function { fg = _.Normal.fg }
198 -_.MutableVariable = _.Debug
199 -_.Parameter { fg = content_focus }
198 +_.FunctionDeclaration { fg = _.Normal.fg, underline = true }
199 +_.MutableVariable = { fg = _.Parameter.fg, underline = true }
200 +_.Parameter { fg = content_important_local }
200 201 _.Type { fg = _.Normal.fg }
201 202 _.Delimiter { fg = content_minor }
217 218 _.Macro = _.PreProc
218 219 _.PreCondit = _.PreProc
220 -_.Special { fg = content_normal, italic = true, bold = true }
221 +_.Special { fg = content_important_global, italic = true, bold = true }
221 222 _.SpecialChar = _.Special
222 223 _.Tag = _.Special
223 224 _.SpecialComment = _.Special
277 278 -- NeoTreeGitStaged Used for git staged symbol.
278 279 _.NeoTreeGitStaged = _.DiffText
280 -_.MiniHipatternsFixme { fg = ui_normal, bg = _.DiagnosticError.fg }
281 -_.MiniHipatternsHack { fg = ui_normal, bg = _.DiagnosticWarn.fg }
282 -_.MiniHipatternsTodo { fg = ui_normal, bg = _.DiagnosticHint.fg }
283 -_.MiniHipatternsNote { fg = ui_normal, bg = _.DiagnosticInfo.fg }
281 +_.MiniHipatternsFixme { fg = ui_backdrop, bg = _.DiagnosticError.fg, bold = true, underline = true }
282 +_.MiniHipatternsHack { fg = ui_backdrop, bg = _.DiagnosticWarn.fg, bold = true, underline = true }
283 +_.MiniHipatternsTodo { fg = ui_backdrop, bg = _.DiagnosticHint.fg, bold = true, underline = true }
284 +_.MiniHipatternsNote { fg = ui_backdrop, bg = _.DiagnosticInfo.fg, bold = true, underline = true }
285 -_['@text.literal'] = _.Comment
286 -_['@text.reference'] = _.Identifier
287 -_['@text.title'] = _.Title
288 -_['@text.underline'] = _.Underlined
289 -_['@text.todo'] = _.Todo
290 -_['@comment'] = _.Comment
291 -_['@punctuation'] = _.Delimiter
292 -_['@constant'] = _.Constant
293 -_['@constant.builtin'] = _.Special
294 -_['@constant.macro'] = _.Define
295 286 _['@attribute'] = _.Keyword
296 -_['@define'] = _.Define
297 -_['@macro'] = _.Macro
298 -_['@string'] = _.String
299 -_['@string.escape'] = _.SpecialChar
300 -_['@string.special'] = _.SpecialChar
287 +_['@boolean'] = _.Boolean
301 288 _['@character'] = _.Character
302 289 _['@character.special'] = _.SpecialChar
303 -_['@number'] = _.Number
304 -_['@boolean'] = _.Boolean
290 +_['@comment'] = _.Comment
291 +_['@conditional'] = _.Conditional
292 +_['@constant'] = _.Constant
293 +_['@constant.builtin'] = _.String
294 +_['@constant.macro'] = _.Define
295 +_['@constructor'] = _.Special
296 +_['@debug'] = _.Debug
297 +_['@define'] = _.Define
298 +_['@exception'] = _.Exception
299 +_['@field'] = _.Identifier
305 300 _['@float'] = _.Float
306 301 _['@function'] = _.Function
307 302 _['@function.builtin'] = _.Special
308 303 _['@function.macro'] = _.Macro
309 -_['@parameter'] = _.Parameter
310 -_['@method'] = _.Function
311 -_['@field'] = _.Identifier
312 -_['@property'] = _.Identifier
313 -_['@constructor'] = _.Special
314 -_['@conditional'] = _.Conditional
315 -_['@repeat'] = _.Repeat
316 -_['@label'] = _.Label
317 -_['@operator'] = _.Operator
304 +_['@include'] = _.Include
318 305 _['@keyword'] = _.Keyword
319 306 _['@keyword.return'] { fg = _.Keyword.fg, bg = _.Keyword.bg, underline = true, bold = true }
320 -_['@exception'] = _.Exception
321 -_['@variable'] = _.Identifier
322 -_['@variable.parameter'] = _.Parameter
307 +_['@label'] = _.Label
308 +_['@macro'] = _.Macro
309 +_['@method'] = _.Function
310 +_['@namespace'] = _.Italic
311 +_['@number'] = _.Number
312 +_['@operator'] = _.Operator
313 +_['@parameter'] = _.Parameter
314 +_['@preproc'] = _.PreProc
315 +_['@property'] = _.Identifier
316 +_['@punctuation'] = _.Delimiter
317 +_['@repeat'] = _.Repeat
318 +_['@storageclass'] = _.StorageClass
319 +_['@string'] = _.String
320 +_['@string.escape'] = _.SpecialChar
321 +_['@string.special'] = _.SpecialChar
322 +_['@structure'] = _.Structure
323 +_['@tag'] = _.Tag
324 +_['@text.literal'] = _.Comment
325 +_['@text.reference'] = _.Identifier
326 +_['@text.title'] = _.Title
327 +_['@text.todo'] = _.Todo
328 +_['@text.underline'] = _.Underlined
323 329 _['@type'] = _.Type
324 330 _['@type.builtin'] = _.Type
325 331 _['@type.definition'] = _.Typedef
326 -_['@storageclass'] = _.StorageClass
327 -_['@structure'] = _.Structure
328 -_['@namespace'] = _.Italic
329 -_['@include'] = _.Include
330 -_['@preproc'] = _.PreProc
331 -_['@debug'] = _.Debug
332 -_['@tag'] = _.Tag
332 +_['@variable'] = _.Identifier
333 +_['@variable.parameter'] = _.Parameter
334 335 _['@markup.raw.block'] { fg = content_normal }
335 336 _['@markup.raw.block.markdown'] { fg = ui_normal }
336 337 _['@markup.raw.block.vimdoc'] { fg = ui_normal }
338 -_['@lsp.type.namespace'] = _['@namespace']
339 -_['@lsp.type.type'] = _['@type']
340 -_['@lsp.type.modifier'] = _['@keyword']
341 339 _['@lsp.type.class'] = _['@type']
340 +_['@lsp.type.decorator'] = _['@function']
342 341 _['@lsp.type.enum'] = _['@type']
343 -_['@lsp.type.interface'] = _['@type']
344 -_['@lsp.type.struct'] = _['@structure']
345 -_['@lsp.type.parameter'] = _['@parameter']
346 -_['@lsp.type.variable'] = _['@variable']
347 -_['@lsp.type.property'] = _['@property']
348 342 _['@lsp.type.enumMember'] = _['@constant']
349 343 _['@lsp.type.function'] = _['@function']
350 -_['@lsp.type.method'] = _['@method']
344 +_['@lsp.type.interface'] = _['@type']
351 345 _['@lsp.type.macro'] = _['@macro']
352 -_['@lsp.type.decorator'] = _['@function']
346 +_['@lsp.type.method'] = _['@method']
347 +_['@lsp.type.modifier'] = _['@keyword']
348 +_['@lsp.type.namespace'] = _['@namespace']
349 +_['@lsp.type.parameter'] = _['@parameter']
350 +_['@lsp.type.property'] = _['@property']
351 +_['@lsp.type.struct'] = _['@structure']
352 +_['@lsp.type.type'] = _['@type']
353 +_['@lsp.type.typeParameter'] = _['@type']
354 +_['@lsp.type.variable'] = _['@variable']
355 +_['@lsp.typemod.function.declaration'] = _.FunctionDeclaration
356 +_['@lsp.typemod.method.declaration'] = _.FunctionDeclaration
354 358 return function()
355 359 local namespace = 0

wezterm/bugabinga/battery.lua

Added
new file mode 100644
1 +--- stolen from https://github.com/rootiest/battery.wez/blob/main/plugin/init.lua
3 +--- Battery module for Wezterm.
4 +---@module "battery"
6 +---@class M The battery module
7 +---@field invert boolean Whether to invert colors
8 +---@function get_batteries() Get the list of batteries
9 +---@function get_battery_icons() Get the battery icons
10 +---@function get_battery_stats() Get the battery stats
12 +local M = {}
14 +local wezterm = require("wezterm")
16 +---@function Automate color inversion
17 +---@return boolean invert Whether to invert the colors for light backgrounds
18 +local function auto_invert()
19 + if wezterm.gui then
20 + if wezterm.gui.get_appearance():find("Dark") then
21 + return false
22 + else
23 + return true
24 + end
25 + end
26 + return false
27 +end
29 +--- Whether to invert the colors for light backgrounds.
30 +M.invert = auto_invert()
32 +--- Converts a hex color to its opposite brightness.
33 +---@param hex_color string The hex color in the format "#RRGGBB".
34 +---@param invert? boolean Whether to invert the colors (optional).
35 +---@return string hex_color The hex color with the opposite brightness.
36 +local function invert_color_brightness(hex_color, invert)
37 + if invert == nil then
38 + invert = M.invert
39 + end
40 + if invert == false then
41 + return hex_color
42 + end
43 + -- Validate the input hex_color format.
44 + if not hex_color:match("^#%x%x%x%x%x%x$") then
45 + error("Invalid hex color format. Use #RRGGBB.")
46 + end
48 + -- Convert hex to RGB.
49 + local r = tonumber(hex_color:sub(2, 3), 16)
50 + local g = tonumber(hex_color:sub(4, 5), 16)
51 + local b = tonumber(hex_color:sub(6, 7), 16)
53 + -- Validate RGB values.
54 + if not (r and g and b and r >= 0 and r <= 255 and g >= 0 and g <= 255 and b >= 0 and b <= 255) then
55 + error("Invalid RGB values extracted from hex color.")
56 + end
58 + -- Calculate brightness.
59 + local brightness = (r * 0.299 + g * 0.587 + b * 0.114)
61 + -- Invert color based on brightness.
62 + if brightness < 128 then
63 + -- Dark color: make it lighter.
64 + r = math.min(r + (255 - r) * 0.33, 255)
65 + g = math.min(g + (255 - g) * 0.33, 255)
66 + b = math.min(b + (255 - b) * 0.33, 255)
67 + else
68 + -- Light color: make it darker.
69 + r = math.max(r - r * 0.66, 0)
70 + g = math.max(g - g * 0.66, 0)
71 + b = math.max(b - b * 0.66, 0)
72 + end
74 + -- Convert RGB back to hex.
75 + return string.format("#%02x%02x%02x", math.floor(r + 0.5), math.floor(g + 0.5), math.floor(b + 0.5))
76 +end
78 +--- RGBColor class representing an RGB color.
79 +---@class RGBColor
80 +---@field r number Red value (0-255).
81 +---@field g number Green value (0-255).
82 +---@field b number Blue value (0-255).
84 +--- Blends two RGB colors together based on a blend factor.
85 +---@param color1 RGBColor The first RGB color.
86 +---@param color2 RGBColor The second RGB color.
87 +---@param factor number The blend factor (between 0 and 1).
88 +---@return RGBColor color The blended RGB color.
89 +local function blend_color(color1, color2, factor)
90 + return {
91 + r = color1.r + (color2.r - color1.r) * factor,
92 + g = color1.g + (color2.g - color1.g) * factor,
93 + b = color1.b + (color2.b - color1.b) * factor,
94 + }
95 +end
97 +--- Rounds a decimal value to the nearest integer.
98 +---@param val number The value to round.
99 +---@return integer The rounded value.
100 +local function round(val)
101 + return math.floor(val + 0.5)
102 +end
104 +--- Converts an RGB color to a hex string.
105 +---@param color RGBColor The RGB color to convert.
106 +---@return string hex_color The hex string representation of the color.
107 +local function rgb_to_hex(color)
108 + return string.format("#%02x%02x%02x", round(color.r), round(color.g), round(color.b))
109 +end
111 +--- Gets the color representing a battery charge level.
112 +---@param charge number The charge level (0.0 to 1.0).
113 +---@return string hex_color The corresponding hex color.
114 +local function get_charge_color(charge)
115 + local red = { r = 255, g = 0, b = 0 }
116 + local yellow = { r = 255, g = 255, b = 0 }
117 + local green = { r = 0, g = 255, b = 0 }
118 + local color = {}
120 + if charge <= 0.5 then
121 + local factor = charge / 0.5
122 + color = blend_color(red, yellow, factor)
123 + else
124 + local factor = (charge - 0.5) / 0.5
125 + color = blend_color(yellow, green, factor)
126 + end
128 + return invert_color_brightness(rgb_to_hex(color))
129 +end
131 +--- BatteryComponent class representing battery information.
132 +---@class BatteryComponent
133 +---@field battery string The battery icon and percentage. (e.g. "󰂉 100%")
134 +---@field remaining fun(): string The remaining time as a string. (e.g. "10:00")
135 +---@field icon string The icon representing the battery status. (e.g. "󰢜 ")
136 +---@field percent number The battery percentage. (0.0 to 1.0)
137 +---@field time number The remaining time in minutes.
138 +---@field condition string The battery condition ("Full", "Empty", "Charging", "Discharging", "Unknown").
140 +--- Returns battery components for each battery.
141 +--- If no batteries are detected, an empty table is returned.
142 +---@return BatteryComponent[] batteries A list of battery components.
143 +---@see BatteryComponent
144 +function M.get_batteries()
145 + local batteries = {}
146 + local battery_info = wezterm.battery_info()
148 + local icons_charging =
149 + { "󰢟 ", "󰢜 ", "󰂆 ", "󰂇 ", "󰂈 ", "󰢝 ", "󰂉 ", "󰢞 ", "󰂊 ", "󰂋 ", "󰂅 " }
150 + local icons_discharging =
151 + { "󰂎 ", "󰁺 ", "󰁻 ", "󰁼 ", "󰁽 ", "󰁾 ", "󰁿 ", "󰂀 ", "󰂁 ", "󰂂 ", "󰁹 " }
153 + for _, b in ipairs(battery_info) do
154 + local condition = b.state
155 + local charge = b.state_of_charge
156 + local remaining = 0
157 + local percent = charge * 100
158 + local icon = -- Default battery state is Unknown
159 + wezterm.format({ { Foreground = { Color = invert_color_brightness("#232634") } }, { Text = "󰂑 " } })
161 + if condition == "Full" then -- Battery is 100% charged
162 + icon =
163 + wezterm.format({ { Foreground = { Color = invert_color_brightness("#93e398") } }, { Text = "󰁹 " } })
164 + elseif condition == "Empty" then -- Battery is 0% charged
165 + icon =
166 + wezterm.format({ { Foreground = { Color = invert_color_brightness("#f37ca0") } }, { Text = "󱃍 " } })
167 + elseif condition == "Charging" then -- Battery is charging
168 + remaining = b.time_to_full
169 + icon = wezterm.format({
170 + { Foreground = { Color = get_charge_color(charge) } },
171 + { Text = icons_charging[math.min(math.ceil(charge * 10), 11)] },
172 + })
173 + elseif condition == "Discharging" then -- Battery is discharging
174 + remaining = b.time_to_empty
175 + icon = wezterm.format({
176 + { Foreground = { Color = get_charge_color(charge) } },
177 + { Text = icons_discharging[math.min(math.ceil(charge * 10), 11)] },
178 + })
179 + elseif condition == "Unknown" and charge > 0.5 then -- Battery is (probably) at charge limit
180 + icon =
181 + wezterm.format({ { Foreground = { Color = invert_color_brightness("#93e398") } }, { Text = "󱈑 " } })
182 + end
184 + table.insert(batteries, {
185 + battery = icon .. string.format("%.2f%%", percent),
186 + remaining = function()
187 + if remaining and remaining > 0 then
188 + return string.format("%d:%02d", math.floor(remaining / 60), math.floor(remaining % 60))
189 + else
190 + return ""
191 + end
192 + end,
193 + icon = icon,
194 + percent = percent,
195 + time = remaining,
196 + condition = condition,
197 + })
198 + end
200 + return batteries
201 +end
203 +--- Returns battery icons for all batteries.
204 +--- If no batteries are detected, an empty string is returned.
205 +---@return string battery_icons A formatted string containing the battery icons.
206 +function M.get_battery_icons()
207 + local battery_states = M.get_batteries()
209 + if #battery_states == 0 then
210 + return ""
211 + end
213 + local result = {}
214 + for _, state in ipairs(battery_states) do
215 + table.insert(result, state.icon)
216 + end
218 + return table.concat(result, " | ")
219 +end
221 +--- Returns battery statistics for all batteries.
222 +--- If no batteries are detected, an empty string is returned.
223 +---@return string battery_stats A formatted string containing the battery stats.
224 +function M.get_battery_stats()
225 + local battery_states = M.get_batteries()
227 + if #battery_states == 0 then
228 + return ""
229 + end
231 + local result = {}
232 + for _, state in ipairs(battery_states) do
233 + local color = get_charge_color(state.percent / 100)
234 + local percent = wezterm.format({
235 + { Foreground = { Color = color } },
236 + { Text = string.format(" (%.2f%%)", state.percent) },
237 + })
238 + local remaining_time = wezterm.format({
239 + { Foreground = { Color = color } },
240 + { Text = state.remaining() },
241 + })
242 + table.insert(result, string.format("%s%s", state.icon, percent) .. remaining_time)
243 + end
245 + return table.concat(result, " | ")
246 +end
248 +return M

wezterm/bugabinga/code_font.lua

Modified
14 14 weight = tonumber( weight )
15 15 if font_name == font_family then
16 - weight = math.max( 0, adjust( weight ) )
16 + weight = math.max( 0, adjust( weight ) )
18 18 table.insert( new_lines, weight .. ',' .. font_name )

wezterm/bugabinga/code_fonts.csv

Modified
1 1 15,M+ 2m
2 2 50,IBM Plex Mono
3 3 21,Generic Mono II
4 +30, Monaspace Neon Var
4 5 20,Hermit
5 6 17,Oxygen Mono

wezterm/bugabinga/dotfiles_workspace.lua

Modified
1 1 local wez = require 'wezterm'
2 3 local is_win32 = wez.target_triple:match 'windows'
3 4 local dotfiles_path = is_win32 and 'W:/dotfiles' or wez.home_dir .. '/Workspace/dotfiles'
5 6 return function ( _ )
6 7 wez.on( 'gui-startup', function ( cmd )
7 - local tab, command_pane, window = wez.mux.spawn_window( cmd or {
8 + local tab, pane, window = wez.mux.spawn_window( cmd or {
8 9 workspace = 'dotfiles',
9 10 cwd = dotfiles_path,
12 - -- wez.mux.set_active_workspace 'dotfiles'
13 - window:gui_window():maximize()
13 + local gui_window = window:gui_window();
14 + gui_window:maximize()
14 15 end )

wezterm/bugabinga/fonts.lua

Modified
58 58 return function ( cfg )
59 59 local font_size = 16.0
60 - local font = wez.font 'Cousine'
60 + local harfbuzz_features = {
61 + 'calt',
62 + 'liga',
63 + 'dlig',
64 + 'ss01',
65 + 'ss02',
66 + 'ss03',
67 + 'ss04',
68 + 'ss05',
69 + 'ss06',
70 + 'ss07',
71 + 'ss08',
72 + }
73 + local font = wez.font {
74 + family = 'Monaspace Neon Var',
75 + weight = 'Medium',
76 + harfbuzz_features = harfbuzz_features,
77 + }
78 + local font_rules = {
79 + { -- Normal
80 + intensity = 'Normal',
81 + italic = false,
82 + font = wez.font {
83 + family = 'Monaspace Neon Var',
84 + weight = 'Medium',
85 + harfbuzz_features = harfbuzz_features,
86 + },
87 + },
88 + { -- Bold
89 + intensity = 'Bold',
90 + italic = false,
91 + font = wez.font {
92 + family = 'Monaspace Argon Var',
93 + weight = 'ExtraBold',
94 + harfbuzz_features = harfbuzz_features,
95 + },
96 + },
97 + { -- Half
98 + intensity = 'Half',
99 + italic = false,
100 + font = wez.font {
101 + family = 'Monaspace Krypton Var',
102 + weight = 'Book',
103 + harfbuzz_features = harfbuzz_features,
104 + },
105 + },
106 + { -- Normal italic
107 + intensity = 'Normal',
108 + italic = true,
109 + font = wez.font {
110 + family = 'Monaspace Argon Var',
111 + weight = 'Regular',
112 + style = 'Italic',
113 + harfbuzz_features = harfbuzz_features,
114 + },
115 + },
116 + { -- Bold italic
117 + intensity = 'Bold',
118 + italic = true,
119 + font = wez.font {
120 + family = 'Monaspace Argon Var',
121 + weight = 'DemiBold',
122 + style = 'Italic',
123 + harfbuzz_features = harfbuzz_features,
124 + },
125 + },
126 + { -- Half italic
127 + intensity = 'Half',
128 + italic = true,
129 + font = wez.font {
130 + family = 'Monaspace Argon Var',
131 + weight = 'Thin',
132 + style = 'Italic',
133 + harfbuzz_features = harfbuzz_features,
134 + },
135 + },
61 137 cfg.font = font
62 138 cfg.font_size = font_size
139 + cfg.font_rules = font_rules
63 140 cfg.warn_about_missing_glyphs = false

wezterm/bugabinga/hosts/fedora.lua

Modified
1 1 local wez = require 'wezterm'
2 3 return function ( cfg )
3 - cfg.window_decorations = 'NONE'
4 - cfg.font = wez.font 'IBM Plex Mono';
4 + cfg.window_decorations = 'RESIZE|NONE'
5 + cfg.font_size = 12
6 + cfg.font = wez.font 'Monaspace Neon Var';
5 7 end

wezterm/bugabinga/hosts/x230.lua

Modified
1 1 local wez = require'wezterm'
3 3 return function ( cfg )
4 - cfg.window_decorations = 'NONE'
4 + cfg.window_decorations = 'RESIZE|NONE'
5 5 cfg.font_size = 11
6 6 cfg.font = wez.font 'M+ 2m'
7 7 -- old version of wezterm in arch has bug preventing to start wezterm wit wayland

wezterm/bugabinga/key_binds.lua

Modified
90 90 mods = 'LEADER',
91 91 action = wez.action.ToggleFullScreen,
93 + {
94 + key = 'F10',
95 + mods = 'LEADER',
96 + action = wez.action_callback(
97 + require 'bugabinga.presentation_mode'.toggle
98 + ),
99 + },
94 101 key = 'F12',
95 102 mods = 'LEADER',

wezterm/bugabinga/launch.lua

Modified
16 16 label = 'Upgrade',
17 - args = { 'topgrade', },
17 + args = { 'topgrade', '--keep'},
18 18 cwd = wez.home_dir,

wezterm/bugabinga/mouse_binds.lua

Modified
2 2 local wez = require 'wezterm'
4 4 local bindings = {
6 - event = { Down = { streak = 3, button = 'Left', }, },
7 - -- FIXME: this needs integration in nushell
6 + event = { Down = { streak = 4, button = 'Left', }, },
8 7 action = wez.action.SelectTextAtMouseCursor 'SemanticZone',
9 8 mods = 'NONE',

wezterm/bugabinga/options.lua

Modified
7 7 brightness = 0.69,
9 9 cfg.check_for_updates = false
10 + cfg.enable_kitty_keyboard = true
10 11 cfg.audible_bell = 'Disabled'
11 12 cfg.visual_bell = {
12 13 fade_in_duration_ms = 69,

wezterm/bugabinga/presentation_mode.lua

Added
new file mode 100644
1 +-- stolen from https://github.com/xarvex/presentation.wez/blob/main/plugin/init.lua
3 +---@param t1 table
4 +---@param t2 table
5 +---@return table t
6 +local function deep_merge_table( t1, t2 )
7 + for k, v in pairs( t2 ) do
8 + if type( v ) == 'table' then
9 + if type( t1[k] or false ) == 'table' then
10 + deep_merge_table( t1[k] or {}, t2[k] or {} )
11 + else
12 + t1[k] = v
13 + end
14 + else
15 + t1[k] = v
16 + end
17 + end
19 + return t1
20 +end
22 +local presentation_active = false
23 +local presentation_prev_font_weight
24 +local presentation_prev_font_size
26 +local function enable( win )
27 + local config = win:effective_config()
28 + local overrides = win:get_config_overrides() or {}
30 + if not overrides.font then overrides.font = {} end
31 + if not overrides.font.font then overrides.font.font = {} end
32 + if not overrides.font.font[1] then overrides.font.font[1] = config.font.font[1] end
34 + presentation_prev_font_weight = config.font.font[1].weight
35 + presentation_prev_font_size = config.font_size
37 + overrides.font.font[1].weight = 'DemiBold'
38 + overrides.font_size = presentation_prev_font_size * 2.0
40 + win:toggle_fullscreen()
42 + presentation_active = true
44 + require 'wezterm'.emit( 'bugabinga.presentation.activate', win )
46 + return overrides
47 +end
49 +local function toggle( win )
50 + local overrides = win:get_config_overrides() or {}
51 + if presentation_active then
52 + overrides.font.font[1].weight = presentation_prev_font_weight
53 + overrides.font_size = presentation_prev_font_size
55 + win:toggle_fullscreen()
56 + presentation_active = false
58 + require 'wezterm'.emit( 'bugabinga.presentation.deactivate', win )
59 + else
60 + deep_merge_table( overrides, enable( win ) )
61 + end
63 + win:set_config_overrides( overrides )
64 +end
66 +return {
67 + toggle = toggle,

wezterm/bugabinga/status.lua

Modified
1 1 local wez = require 'wezterm'
2 +local bat = require 'bugabinga.battery'
3 4 local DELIMITER = ' · '
39 40 local pane_domain = pane:get_domain_name()
41 42 local os_icon = wez.target_triple:find 'windows' and ' ' or ' '
42 - local status = { os_icon, }
43 + local status = { os_icon, leader}
44 45 if key_table then
45 46 table.insert( status, key_table )
66 67 window:set_left_status(
67 68 wez.format {
68 69 { Text = '  ', },
70 + --TODO test on laptop
71 + { Text = bat.get_battery_icons(), },
72 + { Text = bat.get_battery_stats(), },
71 75 end )

wezterm/wezterm.lua

Modified
11 11 require 'bugabinga.status' ( cfg )
12 12 require 'bugabinga.titles' ( cfg )
13 13 require 'bugabinga.launch' ( cfg )
14 -require 'bugabinga.neovim_zen_mode' (cfg)
14 +require 'bugabinga.neovim_zen_mode' ( cfg )
15 15 require 'bugabinga.dotfiles_workspace' ( cfg )
16 16 require 'bugabinga.hosts' ( cfg )
18 18 -- sad sauce
19 19 -- https://github.com/wezterm/wezterm/issues/5103
20 -if os.getenv("XDG_CURRENT_DESKTOP") == "Hyprland" then
21 - cfg.enable_wayland = false
20 +if os.getenv 'XDG_CURRENT_DESKTOP' == 'Hyprland' then
21 + cfg.enable_wayland = false
22 22 else
23 - cfg.enable_wayland = true
23 + cfg.enable_wayland = true
26 26 -- logs key presses
27 27 -- cfg.debug_key_events = true,
28 28 return cfg