Improve modal/non-modal support

* Add (partial) input passthrough for non-modal
* Dim text for non-modal
* Adjust styling
This commit is contained in:
LoafyLemon 2024-05-18 21:55:31 +01:00
parent d5178bd741
commit e6718c445c

View File

@ -609,12 +609,16 @@ screen console:
viewport: viewport:
style_prefix "_console" style_prefix "_console"
mousewheel True mousewheel is_modal
scrollbars "vertical" scrollbars "vertical"
yinitial 1.0 yinitial 1.0
ymaximum 1040 ymaximum 1040
id "consolevp" id "consolevp"
if not is_modal:
at transform:
alpha 0.5
has vbox has vbox
for entry in history: for entry in history:
@ -626,14 +630,24 @@ screen console:
$ stdout = " $ " if entry.is_stdio else " " $ stdout = " $ " if entry.is_stdio else " "
$ info = f"{{size=-2}}{{color=#ffffff80}}{timestamp}{{/color}}{{color=#228b22}}{stdout}{{/color}}{{/size}}" $ info = f"{{size=-2}}{{color=#ffffff80}}{timestamp}{{/color}}{{color=#228b22}}{stdout}{{/color}}{{/size}}"
if entry.command is not None: if is_modal:
textbutton "[info!i][entry.command!q]" style "console_command" action [CopyToClipboard(entry.command), Notify("Copied to clipboard.")] if entry.command is not None:
textbutton "[info!i][entry.command!q]" style "console_command" action [CopyToClipboard(entry.command), Notify("Copied to clipboard.")]
if entry.result is not None: if entry.result is not None:
if entry.is_error: if entry.is_error:
textbutton "[info!i]{unicode}➥{/unicode} [entry.result!q]" style "console_error" action [CopyToClipboard(entry.result), Notify("Copied to clipboard.")] textbutton "[info!i]{unicode}➥{/unicode} [entry.result!q]" style "console_error" action [CopyToClipboard(entry.result), Notify("Copied to clipboard.")]
else: else:
textbutton "[info!i]{unicode}➥{/unicode} [entry.result!q]" style "console_result" action [CopyToClipboard(entry.result), Notify("Copied to clipboard.")] textbutton "[info!i]{unicode}➥{/unicode} [entry.result!q]" style "console_result" action [CopyToClipboard(entry.result), Notify("Copied to clipboard.")]
else:
if entry.command is not None:
text "[info!i][entry.command!q]" style "console_command_text"
if entry.result is not None:
if entry.is_error:
text "[info!i]{unicode}➥{/unicode} [entry.result!q]" style "console_error_text"
else:
text "[info!i]{unicode}➥{/unicode} [entry.result!q]" style "console_result_text"
hbox: hbox:
text "Command:" text "Command:"
@ -653,6 +667,9 @@ style console_text:
font "gui/creamy_pumpkin_pie/fonts/Hack-Regular.ttf" font "gui/creamy_pumpkin_pie/fonts/Hack-Regular.ttf"
adjust_spacing False adjust_spacing False
style console_button is empty:
hover_background "#ffffff25"
style console_line_button is empty: style console_line_button is empty:
xfill True xfill True
hover_background "#ffffff25" hover_background "#ffffff25"
@ -661,7 +678,8 @@ style console_command is console_line_button
style console_error is console_line_button style console_error is console_line_button
style console_result is console_line_button style console_result is console_line_button
style console_button_text is console_text style console_button_text is console_text:
adjust_spacing True
style console_command_text is console_text style console_command_text is console_text