From 19120d4f9761c67d99ed1ce3da6084b83f5a49c9 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 30 Aug 2025 19:22:59 +0200 Subject: Linux-specific dotfiles --- linux/home/.config/ags/widget/dock/FloatingDock.ts | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 linux/home/.config/ags/widget/dock/FloatingDock.ts (limited to 'linux/home/.config/ags/widget/dock/FloatingDock.ts') diff --git a/linux/home/.config/ags/widget/dock/FloatingDock.ts b/linux/home/.config/ags/widget/dock/FloatingDock.ts new file mode 100644 index 0000000..369f56f --- /dev/null +++ b/linux/home/.config/ags/widget/dock/FloatingDock.ts @@ -0,0 +1,70 @@ +import options from 'options'; +import Dock from './Dock.ts'; +const hyprland = await Service.import('hyprland'); +const apps = await Service.import('applications'); + +const { Gdk, Gtk } = imports.gi; +import type Gtk from 'gi://Gtk?version=3.0'; +import { type WindowProps } from 'types/widgets/window'; +import { type RevealerProps } from 'types/widgets/revealer'; +import { type EventBoxProps } from 'types/widgets/eventbox'; + +/** @param {number} monitor */ +const FloatingDock = (monitor: number): Gtk.Window & WindowProps => { + const update = () => { + const ws = Hyprland.getWorkspace(Hyprland.active.workspace.id); + if (Hyprland.getMonitor(monitor)?.name === ws?.monitor) self.reveal_child = ws?.windows === 0; + }; + const revealer: Gtk.Revealer & RevealerProps = Widget.Revealer({ + transition: 'slide_up', + transitionDuration: 90, + child: Dock(), + setup: self => self.hook(hyprland, update, 'client-added').hook(hyprland, update, 'client-removed').hook(hyprland.active.workspace, update), + }); + + const window = Widget.Window({ + monitor, + //halign: 'fill', + halign: 'end', + //layer: "overlay", + layer: 'dock', + name: `dock${monitor}`, + click_through: false, + class_name: 'floating-dock', + // class_name: 'floating-dock-no-gap', + // class_name: "f-dock-wrap", + + typeHint: Gdk.WindowTypeHint.DOCK, + exclusivity: 'false', + + anchor: ['bottom'], + child: Widget.Box({ + vertical: false, + halign: 'bottom', + hpack: 'start', + children: [ + revealer, + Widget.Box({ + class_name: 'padding', + css: 'padding: 9px; margin: 0;', + vertical: false, + halign: 'bottom', + hpack: 'start', + }), + ], + }), + }); + + window + .on('enter-notify-event', () => { + revealer.reveal_child = true; + }) + .on('leave-notify-event', () => { + revealer.reveal_child = false; + }) + .bind('visible', options.bar.position, 'value', v => v !== 'left'); + + return window; +}; + +export default FloatingDock; -- cgit v1.2.3