Skip to content

Commit eb4ea81

Browse files
authored
Merge pull request #1412 from TymurGubayev/patch-9
spectate.lua: add "hold-to-show" option
2 parents e927734 + 33f0a9d commit eb4ea81

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

gui/spectate.lua

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ end
4646
Spectate = defclass(Spectate, widgets.Window)
4747
Spectate.ATTRS {
4848
frame_title='Spectate',
49-
frame={l=5, t=5, w=36, h=39},
49+
frame={l=5, t=5, w=36, h=40},
5050
}
5151

5252
local function create_toggle_button(frame, cfg_elem, hotkey, label, cfg_elem_key)
@@ -225,11 +225,26 @@ function Spectate:init()
225225
text='Hover',
226226
},
227227
create_row({t=21}, 'Enabled', 'E', '', colFollow, colHover),
228+
228229
create_numeric_edit_field({t=23}, 'tooltip-follow-blink-milliseconds', 'CUSTOM_B', 'Blink period (ms): '),
229-
create_row({t=25}, 'Job', 'J', 'job', colFollow, colHover),
230-
create_row({t=26}, 'Name', 'N', 'name', colFollow, colHover),
231-
create_row({t=27}, 'Stress', 'S', 'stress', colFollow, colHover),
232-
create_stress_list({t=28}, colFollow, colHover),
230+
widgets.CycleHotkeyLabel{
231+
frame={t=24},
232+
key='CUSTOM_C',
233+
label="Hold to show:",
234+
options={
235+
{label="None", value="none", pen=COLOR_GREY},
236+
{label="Ctrl", value="ctrl", pen=COLOR_LIGHTCYAN},
237+
{label="Alt", value="alt", pen=COLOR_LIGHTCYAN},
238+
{label="Shift", value="shift", pen=COLOR_LIGHTCYAN},
239+
},
240+
initial_option=spectate.get_config_elem('tooltip-follow-hold-to-show'),
241+
on_change=function(new, _) dfhack.run_command('spectate', 'set', 'tooltip-follow-hold-to-show', new) end
242+
},
243+
244+
create_row({t=26}, 'Job', 'J', 'job', colFollow, colHover),
245+
create_row({t=27}, 'Name', 'N', 'name', colFollow, colHover),
246+
create_row({t=28}, 'Stress', 'S', 'stress', colFollow, colHover),
247+
create_stress_list({t=29}, colFollow, colHover),
233248
}
234249
end
235250

0 commit comments

Comments
 (0)