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

View File

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

View File

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

View File

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

View File

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

View File

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