fix #69 - option to completely hide window buttons

This commit is contained in:
dragonwocky 2020-09-02 21:16:51 +10:00
parent 513b5f4cab
commit 6ff3a96d81
6 changed files with 33 additions and 17 deletions

View File

@ -16,7 +16,7 @@ module.exports = (store) => {
element: helpers.createElement('<div class="window-buttons-area"></div>'),
insert: [
'alwaysontop',
...(store().frameless && !is_mac
...(store().frameless && !store().tiling_mode && !is_mac
? ['minimize', 'maximize', 'close']
: []),
],
@ -86,7 +86,7 @@ module.exports = (store) => {
document.querySelector(`.window-button#btn-${btn}`).onclick =
buttons.actions[btn];
}
if (store().frameless && !is_mac) {
if (store().frameless && !store().tiling_mode && !is_mac) {
window.addEventListener('resize', (event) => {
Promise.resolve(buttons.icons.maximize()).then((icon) => {
icon = icon.toString();

View File

@ -35,7 +35,7 @@ module.exports = (store, __exports) => {
document.body.classList.add('smooth-scrollbars');
// frameless
if (store().frameless) {
if (store().frameless && !store().tiling_mode) {
document.body.classList.add('frameless');
// draggable area
const dragarea = helpers.createElement(
@ -154,7 +154,7 @@ module.exports = (store, __exports) => {
});
let sidebar_width;
function setSidebarWidth(list) {
if (!store().frameless) return;
if (!store().frameless && store().tiling_mode) return;
const new_sidebar_width =
list[0].target.style.height === 'auto'
? '0px'

View File

@ -117,6 +117,9 @@ s {
#menu-titlebar {
background: var(--theme--dragarea);
}
#menu-titlebar:empty {
display: none;
}
/* alerts */

View File

@ -7,6 +7,7 @@
'use strict';
const store = require('../../pkg/store.js'),
{ id } = require('./mod.js'),
helpers = require('../../pkg/helpers.js'),
fs = require('fs-extra'),
path = require('path'),
@ -14,8 +15,10 @@ const store = require('../../pkg/store.js'),
browser = electron.remote.getCurrentWindow();
window['__start'] = async () => {
const buttons = require('./buttons.js')(() => ({ frameless: true }));
document.querySelector('#menu-titlebar').appendChild(buttons.element);
if (!store(id).tiling_mode) {
const buttons = require('./buttons.js')(() => ({ frameless: true }));
document.querySelector('#menu-titlebar').appendChild(buttons.element);
}
document.defaultView.addEventListener('keyup', (event) => {
if (event.code === 'F5') location.reload();

View File

@ -44,6 +44,12 @@ module.exports = {
type: 'input',
value: 15,
},
{
key: 'tiling_mode',
label: 'tiling window manager mode',
type: 'toggle',
value: false,
},
{
key: 'smooth_scrollbars',
label: 'integrated scrollbars',

View File

@ -16,16 +16,20 @@ module.exports = (store, __exports) => {
),
default_styles = dragarea.getAttribute('style');
document
.getElementById('notion')
.addEventListener('ipc-message', (event) => {
if (event.channel !== 'enhancer:sidebar-width') return;
dragarea.setAttribute(
'style',
`${default_styles} top: 2px; height: ${
store().dragarea_height
}px; left: ${event.args[0]};`
);
});
if (store().tiling_mode) {
dragarea.style.display = 'none';
} else {
document
.getElementById('notion')
.addEventListener('ipc-message', (event) => {
if (event.channel !== 'enhancer:sidebar-width') return;
dragarea.setAttribute(
'style',
`${default_styles} top: 2px; height: ${
store().dragarea_height
}px; left: ${event.args[0]};`
);
});
}
};
};