mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
overview & cheatsheet: fix window focus after open/close layer with kb (#502)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
const { Box, EventBox } = Widget;
|
||||
|
||||
export const clickCloseRegion = ({ name, multimonitor = true, expand = true }) => {
|
||||
return EventBox({
|
||||
child: Box({ expand: expand }),
|
||||
setup: (self) => self.on('button-press-event', (self, event) => { // Any mouse button
|
||||
if (multimonitor) closeWindowOnAllMonitors(name);
|
||||
else App.closeWindow(name);
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
export default clickCloseRegion;
|
||||
|
||||
@@ -5,6 +5,7 @@ import Keybinds from "./keybinds.js";
|
||||
import PeriodicTable from "./periodictable.js";
|
||||
import { ExpandingIconTabContainer } from '../.commonwidgets/tabcontainer.js';
|
||||
import { checkKeybind } from '../.widgetutils/keybind.js';
|
||||
import clickCloseRegion from '../.commonwidgets/clickcloseregion.js';
|
||||
|
||||
const cheatsheets = [
|
||||
{
|
||||
@@ -86,29 +87,41 @@ const SheetContent = (id) => {
|
||||
return sheetContents[id];
|
||||
}
|
||||
|
||||
export default (id) => PopupWindow({
|
||||
monitor: id,
|
||||
name: `cheatsheet${id}`,
|
||||
layer: 'overlay',
|
||||
keymode: 'on-demand',
|
||||
visible: false,
|
||||
child: Widget.Box({
|
||||
export default (id) => {
|
||||
const widgetContent = Widget.Box({
|
||||
vertical: true,
|
||||
className: "cheatsheet-bg spacing-v-5",
|
||||
children: [
|
||||
Widget.Box({
|
||||
vertical: true,
|
||||
className: "cheatsheet-bg spacing-v-5",
|
||||
children: [
|
||||
CheatsheetHeader(),
|
||||
SheetContent(id),
|
||||
]
|
||||
}),
|
||||
],
|
||||
setup: (self) => self.on('key-press-event', (widget, event) => { // Typing
|
||||
if (checkKeybind(event, userOptions.keybinds.cheatsheet.nextTab))
|
||||
sheetContents[id].nextTab();
|
||||
else if (checkKeybind(event, userOptions.keybinds.cheatsheet.prevTab))
|
||||
sheetContents[id].prevTab();
|
||||
CheatsheetHeader(),
|
||||
SheetContent(id),
|
||||
]
|
||||
});
|
||||
return PopupWindow({
|
||||
monitor: id,
|
||||
name: `cheatsheet${id}`,
|
||||
layer: 'overlay',
|
||||
keymode: 'on-demand',
|
||||
visible: false,
|
||||
anchor: ['top', 'bottom', 'left', 'right'],
|
||||
child: Widget.Box({
|
||||
vertical: true,
|
||||
children: [
|
||||
clickCloseRegion({ name: 'cheatsheet' }),
|
||||
Widget.Box({
|
||||
children: [
|
||||
clickCloseRegion({ name: 'cheatsheet' }),
|
||||
widgetContent,
|
||||
clickCloseRegion({ name: 'cheatsheet' }),
|
||||
]
|
||||
}),
|
||||
clickCloseRegion({ name: 'cheatsheet' }),
|
||||
],
|
||||
setup: (self) => self.on('key-press-event', (widget, event) => { // Typing
|
||||
if (checkKeybind(event, userOptions.keybinds.cheatsheet.nextTab))
|
||||
sheetContents[id].nextTab();
|
||||
else if (checkKeybind(event, userOptions.keybinds.cheatsheet.prevTab))
|
||||
sheetContents[id].prevTab();
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import PopupWindow from '../.widgethacks/popupwindow.js';
|
||||
import { monitors } from '../.miscutils/hyprlanddata.js';
|
||||
|
||||
const WINDOWS_NEED_CLICK2CLOSE = [
|
||||
'sideleft', 'sideright', 'overview', 'cheatsheet'
|
||||
'sideleft', 'sideright'
|
||||
];
|
||||
|
||||
const range = (length, start = 1) => Array.from({ length }, (_, i) => i + start);
|
||||
@@ -15,6 +15,7 @@ export default (monitor = 0) => PopupWindow({
|
||||
layer: 'top',
|
||||
anchor: ['top', 'bottom', 'left', 'right'],
|
||||
exclusivity: 'ignore',
|
||||
keymode: 'none',
|
||||
child: Widget.EventBox({
|
||||
attribute: {
|
||||
checkWindowRelevance: (currentName) => {
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import { SearchAndWindows } from "./windowcontent.js";
|
||||
import PopupWindow from '../.widgethacks/popupwindow.js';
|
||||
import { clickCloseRegion } from '../.commonwidgets/clickcloseregion.js';
|
||||
|
||||
export default (id = '') => PopupWindow({
|
||||
name: `overview${id}`,
|
||||
// exclusivity: 'ignore',
|
||||
keymode: 'on-demand',
|
||||
visible: false,
|
||||
anchor: ['top'],
|
||||
anchor: ['top', 'bottom', 'left', 'right'],
|
||||
layer: 'overlay',
|
||||
child: Widget.Box({
|
||||
vertical: true,
|
||||
children: [
|
||||
SearchAndWindows(),
|
||||
clickCloseRegion({ name: 'overview', multimonitor: false, expand: false }),
|
||||
Widget.Box({
|
||||
children: [
|
||||
clickCloseRegion({ name: 'overview', multimonitor: false }),
|
||||
SearchAndWindows(),
|
||||
clickCloseRegion({ name: 'overview', multimonitor: false }),
|
||||
]
|
||||
}),
|
||||
clickCloseRegion({ name: 'overview', multimonitor: false }),
|
||||
]
|
||||
}),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user