summaryrefslogtreecommitdiff
path: root/mac/.config/yazi/plugins/confirm-quit.yazi/main.lua
blob: f171bc079259c815012a5dfaaf6ea32d2a54b34e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local count = ya.sync(function()
	return #cx.tabs
end)

local function entry()
	if count() < 2 then
		return ya.emit("quit", {})
	end

	local yes = ya.confirm({
		pos = { "center", w = 60, h = 10 },
		title = "Quit?",
		content = ui.Text("There are multiple tabs open. Are you sure you want to quit?"):wrap(ui.Wrap.YES),
	})
	if yes then
		ya.emit("quit", {})
	end
end

return { entry = entry }