fix weird focus for slideleft & slideright (#502)

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