feat(ags overview): make custom reveal anim
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
ef7ddf7398
commit
6436adf7ca
5 changed files with 51 additions and 17 deletions
|
@ -16,7 +16,7 @@ import QSettings from './js/quick-settings/main.js';
|
||||||
|
|
||||||
const scss = `${App.configDir }/scss/main.scss`;
|
const scss = `${App.configDir }/scss/main.scss`;
|
||||||
const css = `${App.configDir }/style.css`;
|
const css = `${App.configDir }/style.css`;
|
||||||
const closeWinDelay = 500;
|
const closeWinDelay = 800;
|
||||||
|
|
||||||
exec(`sassc ${scss} ${css}`);
|
exec(`sassc ${scss} ${css}`);
|
||||||
Setup();
|
Setup();
|
||||||
|
|
|
@ -17,7 +17,7 @@ import AppItem from './app-item.js';
|
||||||
const Applauncher = ({ window_name = 'applauncher' } = {}) => {
|
const Applauncher = ({ window_name = 'applauncher' } = {}) => {
|
||||||
/** @type Array<any> */
|
/** @type Array<any> */
|
||||||
let fzfResults;
|
let fzfResults;
|
||||||
const list = ListBox();
|
const list = ListBox({});
|
||||||
|
|
||||||
/** @param {String} text */
|
/** @param {String} text */
|
||||||
const setSort = (text) => {
|
const setSort = (text) => {
|
||||||
|
@ -33,7 +33,6 @@ const Applauncher = ({ window_name = 'applauncher' } = {}) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
fzfResults = fzf.find(text);
|
fzfResults = fzf.find(text);
|
||||||
// @ts-expect-error
|
|
||||||
list.set_sort_func(
|
list.set_sort_func(
|
||||||
/**
|
/**
|
||||||
* @param {ListBoxRow} a
|
* @param {ListBoxRow} a
|
||||||
|
@ -55,7 +54,6 @@ const Applauncher = ({ window_name = 'applauncher' } = {}) => {
|
||||||
|
|
||||||
const makeNewChildren = () => {
|
const makeNewChildren = () => {
|
||||||
/** @type Array<typeof imports.gi.Gtk.ListBoxRow> */
|
/** @type Array<typeof imports.gi.Gtk.ListBoxRow> */
|
||||||
// @ts-expect-error
|
|
||||||
const rows = list.get_children();
|
const rows = list.get_children();
|
||||||
|
|
||||||
rows.forEach((ch) => {
|
rows.forEach((ch) => {
|
||||||
|
@ -66,7 +64,6 @@ const Applauncher = ({ window_name = 'applauncher' } = {}) => {
|
||||||
.flatMap((app) => AppItem(app));
|
.flatMap((app) => AppItem(app));
|
||||||
|
|
||||||
children.forEach((ch) => {
|
children.forEach((ch) => {
|
||||||
// @ts-expect-error
|
|
||||||
list.add(ch);
|
list.add(ch);
|
||||||
});
|
});
|
||||||
list.show_all();
|
list.show_all();
|
||||||
|
@ -103,7 +100,6 @@ const Applauncher = ({ window_name = 'applauncher' } = {}) => {
|
||||||
let visibleApps = 0;
|
let visibleApps = 0;
|
||||||
|
|
||||||
/** @type Array<ListBoxRow> */
|
/** @type Array<ListBoxRow> */
|
||||||
// @ts-expect-error
|
|
||||||
const rows = list.get_children();
|
const rows = list.get_children();
|
||||||
|
|
||||||
rows.forEach((row) => {
|
rows.forEach((row) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
|
||||||
*/
|
*/
|
||||||
export default ({
|
export default ({
|
||||||
transition = 'slide_down',
|
transition = 'slide_down',
|
||||||
transition_duration = 500,
|
transition_duration = 800,
|
||||||
onOpen = () => {/**/},
|
onOpen = () => {/**/},
|
||||||
onClose = () => {/**/},
|
onClose = () => {/**/},
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import App from 'resource:///com/github/Aylur/ags/app.js';
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
||||||
|
|
||||||
import { Box, Overlay } from 'resource:///com/github/Aylur/ags/widget.js';
|
import { Box, Overlay, Window } from 'resource:///com/github/Aylur/ags/widget.js';
|
||||||
|
|
||||||
import PopupWindow from '../misc/popup.js';
|
|
||||||
import { WorkspaceRow, getWorkspaces, updateWorkspaces } from './workspaces.js';
|
import { WorkspaceRow, getWorkspaces, updateWorkspaces } from './workspaces.js';
|
||||||
import { Highlighter, updateCurrentWorkspace } from './current-workspace.js';
|
import { Highlighter, updateCurrentWorkspace } from './current-workspace.js';
|
||||||
import { updateClients } from './clients.js';
|
import { updateClients } from './clients.js';
|
||||||
|
@ -65,8 +64,10 @@ export const Overview = () => {
|
||||||
|
|
||||||
attribute: {
|
attribute: {
|
||||||
get_child: () => mainBox,
|
get_child: () => mainBox,
|
||||||
|
closing: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Make size of overlay big enough for content
|
||||||
child: Box({
|
child: Box({
|
||||||
class_name: 'overview',
|
class_name: 'overview',
|
||||||
css: `
|
css: `
|
||||||
|
@ -78,7 +79,7 @@ export const Overview = () => {
|
||||||
// TODO: throttle this?
|
// TODO: throttle this?
|
||||||
setup: (self) => {
|
setup: (self) => {
|
||||||
self.on('get-child-position', (_, ch) => {
|
self.on('get-child-position', (_, ch) => {
|
||||||
if (ch === mainBox) {
|
if (ch === mainBox && !self.attribute.closing) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
self.child.setCss(`
|
self.child.setCss(`
|
||||||
transition: min-height 0.2s ease, min-width 0.2s ease;
|
transition: min-height 0.2s ease, min-width 0.2s ease;
|
||||||
|
@ -93,14 +94,52 @@ export const Overview = () => {
|
||||||
return widget;
|
return widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: can't use PopupWindow because this is an overlay already
|
||||||
export default () => {
|
export default () => {
|
||||||
const win = PopupWindow({
|
const transition_duration = 800;
|
||||||
|
const win = Window({
|
||||||
name: 'overview',
|
name: 'overview',
|
||||||
blur: true,
|
visible: false,
|
||||||
close_on_unfocus: 'none',
|
|
||||||
onOpen: () => {
|
// Needs this to have space
|
||||||
win.attribute.set_child(Overview());
|
// allocated at the start
|
||||||
win.attribute.get_child().attribute.get_child().attribute.update();
|
child: Box({
|
||||||
|
css: `
|
||||||
|
min-height: 1px;
|
||||||
|
min-width: 1px;
|
||||||
|
padding: 1px;
|
||||||
|
`,
|
||||||
|
}),
|
||||||
|
|
||||||
|
attribute: { close_on_unfocus: 'none' },
|
||||||
|
|
||||||
|
setup: (self) => {
|
||||||
|
Hyprland.sendMessage('[[BATCH]] ' +
|
||||||
|
`keyword layerrule ignorealpha[0.97],${self.name}; ` +
|
||||||
|
`keyword layerrule blur,${self.name}
|
||||||
|
`);
|
||||||
|
|
||||||
|
self.hook(App, (_, currentName, isOpen) => {
|
||||||
|
if (currentName === self.name) {
|
||||||
|
if (isOpen) {
|
||||||
|
self.child = Overview();
|
||||||
|
self.show_all();
|
||||||
|
// @ts-expect-error
|
||||||
|
self.child.attribute.get_child().attribute.update();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// @ts-expect-error
|
||||||
|
self.child.attribute.closing = true;
|
||||||
|
// @ts-expect-error
|
||||||
|
self.child.child.css = `
|
||||||
|
min-height: 1px;
|
||||||
|
min-width: 1px;
|
||||||
|
transition: all
|
||||||
|
${transition_duration - 10}ms ease;
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,5 @@ const PowermenuWidget = () => CenterBox({
|
||||||
|
|
||||||
export default () => PopupWindow({
|
export default () => PopupWindow({
|
||||||
name: 'powermenu',
|
name: 'powermenu',
|
||||||
transition: 'crossfade',
|
|
||||||
child: PowermenuWidget(),
|
child: PowermenuWidget(),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue