fix weird focus for slideleft & slideright (#502)

This commit is contained in:
end-4
2024-05-18 19:30:51 +07:00
parent 379db0f672
commit ef8109cd10
6 changed files with 28 additions and 10 deletions
@@ -1,10 +1,17 @@
import App from 'resource:///com/github/Aylur/ags/app.js';
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import { monitors } from '../.miscutils/hyprlanddata.js';
const { Box, EventBox } = Widget;
export const clickCloseRegion = ({ name, multimonitor = true, expand = true }) => {
export const clickCloseRegion = ({ name, multimonitor = true, monitor = 0, expand = true, fillMonitor = '' }) => {
return EventBox({
child: Box({ expand: expand }),
child: Box({
expand: expand,
css: fillMonitor ? `
min-width: ${fillMonitor.includes('h') ? monitors[monitor].width : 0}px;
min-height: ${fillMonitor.includes('v') ? monitors[monitor].height : 0}px;
` : null,
}),
setup: (self) => self.on('button-press-event', (self, event) => { // Any mouse button
if (multimonitor) closeWindowOnAllMonitors(name);
else App.closeWindow(name);
@@ -35,7 +35,6 @@ export const TabContainer = ({ icons, names, children, className = '', setup = (
}),
});
const tabIndicatorLine = Box({
hexpand: true,
vertical: true,
homogeneous: true,
setup: (self) => self.hook(shownIndex, (self) => {
@@ -54,7 +53,6 @@ export const TabContainer = ({ icons, names, children, className = '', setup = (
onScrollDown: () => mainBox.nextTab(),
child: Box({
vertical: true,
hexpand: true,
children: [
tabs,
tabIndicatorLine
+1 -3
View File
@@ -3,9 +3,7 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import PopupWindow from '../.widgethacks/popupwindow.js';
import { monitors } from '../.miscutils/hyprlanddata.js';
const WINDOWS_NEED_CLICK2CLOSE = [
'sideleft', 'sideright'
];
const WINDOWS_NEED_CLICK2CLOSE = [];
const range = (length, start = 1) => Array.from({ length }, (_, i) => i + start);
+9 -1
View File
@@ -1,10 +1,18 @@
import PopupWindow from '../.widgethacks/popupwindow.js';
import SidebarLeft from "./sideleft.js";
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
const { Box } = Widget;
import clickCloseRegion from '../.commonwidgets/clickcloseregion.js';
export default () => PopupWindow({
keymode: 'on-demand',
anchor: ['left', 'top', 'bottom'],
name: 'sideleft',
layer: 'overlay',
child: SidebarLeft(),
child: Box({
children: [
SidebarLeft(),
clickCloseRegion({ name: 'sideleft', multimonitor: false, fillMonitor: 'horizontal' }),
]
})
});
-1
View File
@@ -74,7 +74,6 @@ export const widgetContent = TabContainer({
export default () => Box({
// vertical: true,
vexpand: true,
hexpand: true,
css: 'min-width: 2px;',
children: [
widgetContent,
+9 -1
View File
@@ -1,10 +1,18 @@
import PopupWindow from '../.widgethacks/popupwindow.js';
import SidebarRight from "./sideright.js";
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
const { Box } = Widget;
import clickCloseRegion from '../.commonwidgets/clickcloseregion.js';
export default () => PopupWindow({
keymode: 'on-demand',
anchor: ['right', 'top', 'bottom'],
name: 'sideright',
layer: 'overlay',
child: SidebarRight(),
child: Box({
children: [
clickCloseRegion({ name: 'sideright', multimonitor: false, fillMonitor: 'horizontal' }),
SidebarRight(),
]
})
});