launcher: auto size, fixed header, growing terminal + autoscroll if scrolled to bottom (pr #172)

This commit is contained in:
jean-emmanuel 2018-03-01 15:38:14 +01:00
parent e71b487bc2
commit 7352a99397
3 changed files with 23 additions and 22 deletions

View file

@ -194,16 +194,18 @@ $(document).ready(()=>{
})
// Fake console
var terminal = $(`<div class="terminal"></div>`).appendTo('#launcher').hide()
var terminal = $(`<div class="terminal"></div>`).appendTo(form).hide()
ipcRenderer.on('stdout', function(e, msg){
var scroll = document.body.offsetHeight + document.body.scrollTop == document.body.scrollHeight
terminal.append(`<div class="log">${msg}</div>`)
terminal.scrollTop(terminal.prop('scrollHeight'))
if (scroll) document.body.scrollTop = document.body.offsetHeight + document.body.scrollHeight
})
ipcRenderer.on('stderr', function(e, msg){
var scroll = document.body.offsetHeight + document.body.scrollTop == document.body.scrollHeight
terminal.append(`<div class="error">${msg}</div>`)
terminal.scrollTop(terminal.prop('scrollHeight'))
if (scroll) document.body.scrollTop = document.body.offsetHeight + document.body.scrollHeight
})

View file

@ -66,7 +66,7 @@ if (settings.cli) {
launcher
app.on('ready',function(){
launcher = require('./electron-window')({address:address, shortcuts:false, width:680, height:655, node:true, color:'#283143'})
launcher = require('./electron-window')({address:address, shortcuts:true, width:680, height:(100 + 8*3 + 29 * Object.keys(settings.options).filter(x => settings.options[x].launcher !== false).length), node:true, color:'#283143'})
})
if (process.log) {

View file

@ -28,7 +28,6 @@ input {
html, body {
height:100%;
overflow:hidden;
position:relative;
}
@ -52,6 +51,7 @@ body {
font-weight: 500;
text-transform: uppercase;
letter-spacing: 1rem;
overflow:hidden;
}
.btn {
@ -211,10 +211,12 @@ body {
#launcher {
background: var(--color-fg);
padding:14rem;
display: flex;
flex-direction: column;
overflow: auto;
.form {
padding:8rem;
padding-top:58rem;
position: relative;
width: 100%;
background: var(--color-fg);
overflow: hidden;
@ -292,6 +294,10 @@ body {
}
}
.header {
position: fixed;
top:8rem;
left:8rem;
right:8rem;
background: var(--color-fg);
border: 1rem solid var(--color-bg);
margin-bottom: -1rem;
@ -299,7 +305,8 @@ body {
cursor: default;
z-index: 2;
box-shadow: none;
box-shadow: 0 0 0 1rem var(--color-light) inset;
box-shadow: 0 0 0 1rem var(--color-light) inset,
0 -8rem 0 0 var(--color-fg);
padding: 16rem 15rem 14rem;
#title {
@ -324,7 +331,7 @@ body {
.start {
border: 1rem solid var(--color-bg);
z-index: 1;
margin-top: 5rem;
margin-top: 8rem;
&:after {
content:"";
position: absolute;
@ -360,7 +367,7 @@ body {
}
.save {
float:left;
width:90rem;
width:97rem;
border-right: 0;
&:before {
transition: opacity .5s;
@ -382,7 +389,7 @@ body {
}
.terminal {
margin-top: 5rem;
margin-top: 8rem;
background: var(--color-bg);
font-family: monospace;
text-transform: none;
@ -391,16 +398,8 @@ body {
letter-spacing: normal;
cursor: auto;
flex:1;
height: 100%;
overflow: hidden;
overflow-y: scroll;
height: 50rem;
&::-webkit-scrollbar-button:decrement:start, &::-webkit-scrollbar-button:increment:end {
display:none;
}
&::-webkit-scrollbar {
width: 8rem;
}
height: auto;
div {
user-select:text;
width: 100%;