Skip to content

Commit

Permalink
fix: .DS_Store causing blank background on MacOS (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinSilvester committed Oct 6, 2024
1 parent 2537d92 commit ea5fba3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions utils/backdrops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ math.random()
math.random()

local PATH_SEP = platform.is_win and '\\' or '/'
local GLOB_PATTERN = '*.{jpg,jpeg,png,gif,bmp,ico,tiff,pnm,dds,tga}'

---@class BackDrops
---@field current_idx number index of current image
Expand Down Expand Up @@ -43,7 +44,10 @@ end
--- This throws a coroutine error if the function is invoked in outside of `wezterm.lua` in the -
--- initial load of the Terminal config.
function BackDrops:set_files()
self.files = wezterm.read_dir(wezterm.config_dir .. PATH_SEP .. 'backdrops')
self.files = wezterm.glob(GLOB_PATTERN, wezterm.config_dir .. PATH_SEP .. 'backdrops')
for idx, file in ipairs(self.files) do
self.files[idx] = wezterm.config_dir .. PATH_SEP .. 'backdrops' .. PATH_SEP .. file
end
wezterm.GLOBAL.background = self.files[1]
return self
end
Expand Down Expand Up @@ -87,8 +91,10 @@ function BackDrops:_set_focus_opt(window)
background = {
{
source = { Color = self.focus_color },
height = '100%',
width = '100%',
height = '120%',
width = '120%',
vertical_offset = '-10%',
horizontal_offset = '-10%',
opacity = 1,
},
},
Expand Down

0 comments on commit ea5fba3

Please sign in to comment.