parent
690ff6498b
commit
800eee46f2
6 changed files with 67 additions and 136 deletions
|
@ -13,7 +13,7 @@ import SysTray from './items/systray.ts';
|
|||
const PADDING = 20;
|
||||
|
||||
export default () => BarRevealer({
|
||||
gdkmonitor: get_gdkmonitor_from_desc('desc:Samsung Electric Company C27JG5x HTOM100586'),
|
||||
gdkmonitor: get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201'),
|
||||
exclusivity: 'exclusive',
|
||||
anchor: ['bottom', 'left', 'right'],
|
||||
bar: Box({
|
||||
|
|
|
@ -2,6 +2,17 @@ const Hyprland = await Service.import('hyprland');
|
|||
|
||||
import Gdk from 'gi://Gdk?version=3.0';
|
||||
|
||||
/* Types */
|
||||
import { Monitor } from 'types/service/hyprland';
|
||||
|
||||
|
||||
export const get_hyprland_monitor = (monitor: Gdk.Monitor): Monitor | undefined => {
|
||||
const manufacturer = monitor.manufacturer?.replace(',', '');
|
||||
const model = monitor.model?.replace(',', '');
|
||||
const start = `${manufacturer} ${model}`;
|
||||
|
||||
return Hyprland.monitors.find((m) => m.description.startsWith(start));
|
||||
};
|
||||
|
||||
export const get_hyprland_monitor_desc = (monitor: Gdk.Monitor): string => {
|
||||
const manufacturer = monitor.manufacturer?.replace(',', '');
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import Gtk from 'gi://Gtk?version=3.0';
|
||||
const Hyprland = await Service.import('hyprland');
|
||||
|
||||
import { get_hyprland_monitor } from '../lib.ts';
|
||||
|
||||
/* Types */
|
||||
import { Window } from 'resource:///com/github/Aylur/ags/widgets/window.js';
|
||||
import type { WindowProps } from 'types/widgets/window';
|
||||
|
@ -90,8 +92,8 @@ export class PopupWindow<
|
|||
|
||||
constructor({
|
||||
transition = 'slide top',
|
||||
on_open = () => {/**/},
|
||||
on_close = () => {/**/},
|
||||
on_open = () => {/**/ },
|
||||
on_close = () => {/**/ },
|
||||
|
||||
// Window props
|
||||
name,
|
||||
|
@ -143,9 +145,22 @@ export class PopupWindow<
|
|||
alloc: Gtk.Allocation,
|
||||
side = 'right' as 'left' | 'right',
|
||||
) {
|
||||
const width = this.get_display()
|
||||
.get_monitor_at_point(alloc.x, alloc.y)
|
||||
.get_geometry().width;
|
||||
const transform = get_hyprland_monitor(
|
||||
this.get_display().get_monitor_at_point(alloc.x, alloc.y),
|
||||
)?.transform;
|
||||
|
||||
let width: number;
|
||||
|
||||
if (transform && (transform === 1 || transform === 3)) {
|
||||
width = this.get_display()
|
||||
.get_monitor_at_point(alloc.x, alloc.y)
|
||||
.get_geometry().height;
|
||||
}
|
||||
else {
|
||||
width = this.get_display()
|
||||
.get_monitor_at_point(alloc.x, alloc.y)
|
||||
.get_geometry().width;
|
||||
}
|
||||
|
||||
this.margins = [
|
||||
this.margins[0],
|
||||
|
@ -163,6 +178,6 @@ export class PopupWindow<
|
|||
}
|
||||
}
|
||||
|
||||
export default <Child extends Gtk.Widget, Attr> (
|
||||
export default <Child extends Gtk.Widget, Attr>(
|
||||
props: PopupWindowProps<Child, Attr>,
|
||||
) => new PopupWindow(props);
|
||||
|
|
|
@ -11,7 +11,7 @@ export const NotifPopups = () => Window({
|
|||
name: 'notifications',
|
||||
anchor: ['bottom', 'left'],
|
||||
layer: 'overlay',
|
||||
gdkmonitor: get_gdkmonitor_from_desc('desc:Samsung Electric Company C27JG5x HTOM100586'),
|
||||
gdkmonitor: get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201'),
|
||||
|
||||
child: PopUpsWidget(),
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ export const NotifCenter = () => PopupWindow({
|
|||
name: 'notification-center',
|
||||
anchor: ['bottom', 'right'],
|
||||
transition: 'slide bottom',
|
||||
gdkmonitor: get_gdkmonitor_from_desc('desc:Samsung Electric Company C27JG5x HTOM100586'),
|
||||
gdkmonitor: get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201'),
|
||||
|
||||
child: NotifCenterWidget(),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue