diff --git a/nixosModules/ags/v2/lib.ts b/nixosModules/ags/v2/lib.ts index e058d889..c5a54c71 100644 --- a/nixosModules/ags/v2/lib.ts +++ b/nixosModules/ags/v2/lib.ts @@ -1,6 +1,4 @@ -import { App, Gdk, Widget } from 'astal/gtk3'; - -import AstalApps from 'gi://AstalApps'; +import { Gdk } from 'astal/gtk3'; import AstalHyprland from 'gi://AstalHyprland'; const Hyprland = AstalHyprland.get_default(); @@ -111,16 +109,3 @@ export const centerCursor = async(): Promise => { await hyprMessage(`dispatch movecursor ${x} ${y}`); }; - -export const get_app_icon = (app: AstalApps.Application): string => { - if (app.get_icon_name() && Widget.Icon.lookup_icon(app.get_icon_name())) { - return app.get_icon_name(); - } - else { - const iconString = app.get_key('Icon'); - - App.add_icons(iconString); - - return iconString; - } -}; diff --git a/nixosModules/ags/v2/widgets/applauncher/app-item.tsx b/nixosModules/ags/v2/widgets/applauncher/app-item.tsx index 9677ef35..52270b98 100644 --- a/nixosModules/ags/v2/widgets/applauncher/app-item.tsx +++ b/nixosModules/ags/v2/widgets/applauncher/app-item.tsx @@ -1,8 +1,6 @@ import { Gtk, Widget } from 'astal/gtk3'; import { register } from 'astal/gobject'; -import { get_app_icon } from '../../lib'; - /* Types */ import AstalApps from 'gi://AstalApps'; type AppItemProps = Widget.BoxProps & { @@ -29,7 +27,7 @@ export class AppItem extends Widget.Box { const icon = ( ); diff --git a/nixosModules/ags/v2/widgets/notifs/gesture.tsx b/nixosModules/ags/v2/widgets/notifs/gesture.tsx index b52560df..6a01bd9d 100644 --- a/nixosModules/ags/v2/widgets/notifs/gesture.tsx +++ b/nixosModules/ags/v2/widgets/notifs/gesture.tsx @@ -162,7 +162,26 @@ export class NotifGestureWrapper extends Widget.EventBox { setup_notif = () => { /**/ }, ...rest }: NotifGestureWrapperProps) { - super(); + super({ + on_button_press_event: () => { + this.setCursor('grabbing'); + }, + + // OnRelease + on_button_release_event: () => { + this.setCursor('grab'); + }, + + // OnHover + on_enter_notify_event: () => { + this.setCursor('grab'); + }, + + // OnHoverLost + on_leave_notify_event: () => { + this.setCursor('grab'); + }, + }); this.id = id; this.slide_in_from = slide_in_from; @@ -171,37 +190,22 @@ export class NotifGestureWrapper extends Widget.EventBox { this.popup_timer = popup_timer; this.is_popup = this.popup_timer !== 0; - // OnClick - this.connect('button-press-event', () => { - this.setCursor('grabbing'); - }); - - // OnRelease - this.connect('button-release-event', () => { - this.setCursor('grab'); - }); - - // OnHover - this.connect('enter-notify-event', () => { - this.setCursor('grab'); - }); - - // OnHoverLost - this.connect('leave-notify-event', () => { - this.setCursor('grab'); - }); - // Handle timeout before sliding away if it is a popup if (this.popup_timer !== 0) { this.timer_object = interval(1000, async() => { - if (!(await this.get_hovered())) { - if (this.popup_timer === 0) { - this.slideAway('Left'); - } - else { - --this.popup_timer; + try { + if (!(await this.get_hovered())) { + if (this.popup_timer === 0) { + this.slideAway('Left'); + } + else { + --this.popup_timer; + } } } + catch (_) { + this.timer_object?.cancel(); + } }); } diff --git a/nixosModules/ags/v2/widgets/screenshot/main.tsx b/nixosModules/ags/v2/widgets/screenshot/main.tsx index 816e176b..4c800512 100644 --- a/nixosModules/ags/v2/widgets/screenshot/main.tsx +++ b/nixosModules/ags/v2/widgets/screenshot/main.tsx @@ -10,7 +10,7 @@ const Hyprland = AstalHyprland.get_default(); import PopupWindow from '../misc/popup-window'; import Separator from '../misc/separator'; -import { get_app_icon, hyprMessage } from '../../lib'; +import { hyprMessage } from '../../lib'; const ICON_SEP = 6; @@ -46,7 +46,7 @@ export default () => { }} > - +