Skip to content

Commit 4e6998c

Browse files
Update mod-manager.lua
1 parent 54e955e commit 4e6998c

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

gui/mod-manager.lua

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ ModlistMenu.ATTRS {
414414
resizable = true,
415415
}
416416

417-
local function getWorldModlist()
417+
local function getWorldModlist(detailed)
418418
-- ordered map of mod id -> {handled=bool, versions=map of version -> path}
419419
local mods = utils.OrderedTable()
420420
local mod_paths = {}
@@ -433,7 +433,11 @@ local function getWorldModlist()
433433
end
434434
local modlist = {}
435435
for _,mod in ipairs(mod_paths) do
436-
table.insert(modlist,('%s %s (%s)'):format(mod.name, mod.version, mod.id))
436+
if detailed then
437+
table.insert(modlist,('%s %s (%s)'):format(mod.name, mod.version, mod.id))
438+
else
439+
table.insert(modlist,mod.name)
440+
end
437441
end
438442
return modlist
439443
end
@@ -458,9 +462,21 @@ function ModlistMenu:init()
458462
end,
459463
enabled=function() return #self.subviews.modlist:getChoices() > 0 end,
460464
},
465+
widgets.HotkeyLabel{
466+
view_id='copy',
467+
frame={t=1, r=1},
468+
label='Copy mod and details to clipboard',
469+
text_pen=COLOR_YELLOW,
470+
auto_width=true,
471+
on_activate=function()
472+
local mods = table.concat(getWorldModlist(true), NEWLINE)
473+
dfhack.internal.setClipboardTextCp437Multiline(mods)
474+
end,
475+
enabled=function() return #self.subviews.modlist:getChoices() > 0 end,
476+
},
461477
widgets.List{
462478
view_id='modlist',
463-
frame = {t=3},
479+
frame = {t=4},
464480
choices = getWorldModlist()
465481
}
466482
}

0 commit comments

Comments
 (0)