Код: Выделить всё
const buttonWin = new BrowserWindow({
parent: containerWindow,
show: false,
width: 98,
height: 24,
frame: false,
transparent: true,
focusable: false,
resizable: false,
skipTaskbar: true,
useContentSize: true,
fullscreenable: false,
minimizable: false,
maximizable: false,
hasShadow: false,
acceptFirstMouse: false,
alwaysOnTop: true,
webPreferences: {
preload: path.join(__dirname, '../preload.js'),
contextIsolation: true,
}
});
Код: Выделить всё
import { html, css, LitElement } from '../../ui/assets/lit-core-2.7.4.min.js';
export class ButtonView extends LitElement {
static properties = {};
static styles = css`
* {
font-family: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
cursor: default;
user-select: none;
}
.button-blue {
background: transparent;
color: #00bfff;
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 4px 8px;
border-radius: 3px;
font-size: 13px;
font-weight: 500;
cursor: pointer;
display: flex;
align-items: center;
gap: 4px;
height: 24px;
min-width: fit-content;
transition: background-color 0.15s ease;
white-space: nowrap;
}
.button-blue:hover {
background: rgba(255, 255, 255, 0.15);
}
.button-blue:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.button-blue:disabled:hover {
background: transparent;
}
`;
constructor() {
super();
this.handleClick = this.handleClick.bind(this);
}
async handleClick() {
console.log('[ButtonView] document.hasFocus():', document.hasFocus());
// My app logic
}
render() {
return html`
Next
`;
}
}
customElements.define('button-view', ButtonView);
Окно кнопки прозрачно и не фокусируется, но на него можно нажать. Мой код хорошо работает в Windows, но есть ли способ добиться этого на Mac?
Подробнее здесь: https://stackoverflow.com/questions/798 ... n-electron
Мобильная версия