diff --git a/.config/ags/modules/.commonwidgets/clickcloseregion.js b/.config/ags/modules/.commonwidgets/clickcloseregion.js new file mode 100644 index 000000000..c31114971 --- /dev/null +++ b/.config/ags/modules/.commonwidgets/clickcloseregion.js @@ -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; + diff --git a/.config/ags/modules/cheatsheet/main.js b/.config/ags/modules/cheatsheet/main.js index 9f83e727c..4cc156aeb 100644 --- a/.config/ags/modules/cheatsheet/main.js +++ b/.config/ags/modules/cheatsheet/main.js @@ -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(); + }) }) - }) -}); + }); +} \ No newline at end of file diff --git a/.config/ags/modules/click2close/main.js b/.config/ags/modules/click2close/main.js index 82bb1b3c7..5760abd17 100644 --- a/.config/ags/modules/click2close/main.js +++ b/.config/ags/modules/click2close/main.js @@ -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) => { diff --git a/.config/ags/modules/overview/main.js b/.config/ags/modules/overview/main.js index 2b664ebd4..ee9a3d230 100644 --- a/.config/ags/modules/overview/main.js +++ b/.config/ags/modules/overview/main.js @@ -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 }), ] }), }) +