const { Gdk, Gtk } = imports.gi; import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import Service from 'resource:///com/github/Aylur/ags/service.js'; import { Keybinds } from "./keybinds.js"; import { setupCursorHover } from "../.widgetutils/cursorhover.js"; import PopupWindow from '../.widgethacks/popupwindow.js'; const cheatsheetHeader = () => Widget.CenterBox({ vertical: false, startWidget: Widget.Box({}), centerWidget: Widget.Box({ vertical: true, className: "spacing-h-15", children: [ Widget.Box({ hpack: 'center', className: 'spacing-h-5 cheatsheet-title', children: [ Widget.Label({ hpack: 'center', css: 'margin-right: 0.682rem;', className: 'txt-title', label: 'Cheat sheet', }), Widget.Label({ vpack: 'center', className: "cheatsheet-key txt-small", label: "", }), Widget.Label({ vpack: 'center', className: "cheatsheet-key-notkey txt-small", label: "+", }), Widget.Label({ vpack: 'center', className: "cheatsheet-key txt-small", label: "/", }) ] }), Widget.Label({ useMarkup: true, selectable: true, justify: Gtk.Justification.CENTER, className: 'txt-small txt', label: 'Sheet data stored in ~/.config/ags/modules/cheatsheet/data_keybinds.js\nChange keybinds in ~/.config/hypr/hyprland/keybinds.conf' }), ] }), endWidget: Widget.Button({ vpack: 'start', hpack: 'end', className: "cheatsheet-closebtn icon-material txt txt-hugeass", onClicked: () => { App.toggleWindow('cheatsheet'); }, child: Widget.Label({ className: 'icon-material txt txt-hugeass', label: 'close' }), setup: setupCursorHover, }), }); const clickOutsideToClose = Widget.EventBox({ onPrimaryClick: () => App.closeWindow('cheatsheet'), onSecondaryClick: () => App.closeWindow('cheatsheet'), onMiddleClick: () => App.closeWindow('cheatsheet'), }); export default () => PopupWindow({ name: 'cheatsheet', exclusivity: 'ignore', keymode: 'exclusive', visible: false, child: Widget.Box({ vertical: true, children: [ clickOutsideToClose, Widget.Box({ vertical: true, className: "cheatsheet-bg spacing-v-15", children: [ cheatsheetHeader(), Keybinds(), ] }), ], }) });