dock launcher button (#433)

This commit is contained in:
end-4
2024-04-23 05:55:36 +07:00
parent 53b78bc437
commit 6774fdb2cb
Regular → Executable
+17 -8
View File
@@ -1,5 +1,6 @@
const { Gtk, GLib } = imports.gi; const { Gtk, GLib } = imports.gi;
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js'; import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../variables.js';
import App from 'resource:///com/github/Aylur/ags/app.js';
import Widget from 'resource:///com/github/Aylur/ags/widget.js'; import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'; import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { EventBox, Button } = Widget; const { EventBox, Button } = Widget;
@@ -66,18 +67,11 @@ const DockSeparator = (props = {}) => Box({
const PinButton = () => Widget.Button({ const PinButton = () => Widget.Button({
className: 'dock-app-btn dock-app-btn-animate', className: 'dock-app-btn dock-app-btn-animate',
tooltipText: 'Pin Dock', tooltipText: 'Pin Dock',
child: Widget.Overlay({
child: Widget.Box({ child: Widget.Box({
homogeneous: true, homogeneous: true,
className: 'dock-app-icon txt', className: 'dock-app-icon txt',
child: MaterialIcon('push_pin', 'hugeass') child: MaterialIcon('push_pin', 'hugeass')
}), }),
overlays: [Widget.Box({
class_name: 'indicator',
vpack: 'end',
hpack: 'center',
})],
}),
onClicked: (self) => { onClicked: (self) => {
isPinned = !isPinned isPinned = !isPinned
self.className = `${isPinned ? "pinned-dock-app-btn" : "dock-app-btn animate"} dock-app-btn-animate` self.className = `${isPinned ? "pinned-dock-app-btn" : "dock-app-btn animate"} dock-app-btn-animate`
@@ -85,6 +79,20 @@ const PinButton = () => Widget.Button({
setup: setupCursorHover, setup: setupCursorHover,
}) })
const LauncherButton = () => Widget.Button({
className: 'dock-app-btn dock-app-btn-animate',
tooltipText: 'Open launcher',
child: Widget.Box({
homogeneous: true,
className: 'dock-app-icon txt',
child: MaterialIcon('apps', 'hugerass')
}),
onClicked: (self) => {
App.toggleWindow('overview');
},
setup: setupCursorHover,
})
const AppButton = ({ icon, ...rest }) => Widget.Revealer({ const AppButton = ({ icon, ...rest }) => Widget.Revealer({
attribute: { attribute: {
'workspace': 0 'workspace': 0
@@ -245,10 +253,11 @@ export default (monitor = 0) => {
const dockContent = Box({ const dockContent = Box({
className: 'dock-bg spacing-h-5', className: 'dock-bg spacing-h-5',
children: [ children: [
PinButton(),
PinnedApps(), PinnedApps(),
DockSeparator(), DockSeparator(),
Taskbar(), Taskbar(),
PinButton(), LauncherButton(),
] ]
}) })
const dockRevealer = Revealer({ const dockRevealer = Revealer({