feat(ags): add anims to current-client
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
4604dcb6fd
commit
2a6b0a1bb2
3 changed files with 52 additions and 32 deletions
|
@ -26,7 +26,7 @@ export default () => (
|
|||
<box hexpand halign={Gtk.Align.START}>
|
||||
<CurrentIcon />
|
||||
|
||||
<Separator size={8} />
|
||||
{/* <Separator size={8} />*/}
|
||||
|
||||
<SysTray />
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { bind, Variable } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
|
||||
import AstalApps from 'gi://AstalApps';
|
||||
import AstalHyprland from 'gi://AstalHyprland';
|
||||
|
@ -15,12 +16,14 @@ export default () => {
|
|||
const focusedIcon = Variable<string>('');
|
||||
const focusedTitle = Variable<string>('');
|
||||
|
||||
let lastFocused: string | undefined;
|
||||
let lastFocusedAddress: string | null;
|
||||
|
||||
|
||||
const updateVars = (
|
||||
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
||||
) => {
|
||||
lastFocused = client?.get_address();
|
||||
lastFocusedAddress = client ? client.get_address() : null;
|
||||
|
||||
const app = applications.fuzzy_query(
|
||||
client?.get_class() ?? '',
|
||||
)[0];
|
||||
|
@ -37,7 +40,7 @@ export default () => {
|
|||
|
||||
focusedTitle.set(client?.get_title() ?? '');
|
||||
const id = client?.connect('notify::title', (c) => {
|
||||
if (c.get_address() !== lastFocused) {
|
||||
if (c.get_address() !== lastFocusedAddress) {
|
||||
c.disconnect(id);
|
||||
}
|
||||
focusedTitle.set(c.get_title());
|
||||
|
@ -57,22 +60,30 @@ export default () => {
|
|||
});
|
||||
|
||||
return (
|
||||
<box
|
||||
className="bar-item current-window"
|
||||
visible={bind(focusedTitle).as((title) => title !== '')}
|
||||
<revealer
|
||||
transitionType={Gtk.RevealerTransitionType.SLIDE_RIGHT}
|
||||
revealChild={bind(focusedTitle).as((title) => title !== '')}
|
||||
>
|
||||
<icon
|
||||
css="font-size: 32px;"
|
||||
icon={bind(focusedIcon)}
|
||||
visible={bind(visibleIcon)}
|
||||
/>
|
||||
<box className="bar-item current-window">
|
||||
<revealer
|
||||
transitionType={Gtk.RevealerTransitionType.SLIDE_RIGHT}
|
||||
revealChild={bind(visibleIcon)}
|
||||
>
|
||||
<box>
|
||||
<icon
|
||||
css="font-size: 32px;"
|
||||
icon={bind(focusedIcon)}
|
||||
/>
|
||||
|
||||
<Separator size={8} />
|
||||
<Separator size={8} />
|
||||
</box>
|
||||
</revealer>
|
||||
|
||||
<label
|
||||
label={bind(focusedTitle)}
|
||||
truncate
|
||||
/>
|
||||
</box>
|
||||
<label
|
||||
label={bind(focusedTitle)}
|
||||
truncate
|
||||
/>
|
||||
</box>
|
||||
</revealer>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { bind, Variable } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
|
||||
import AstalApps from 'gi://AstalApps';
|
||||
import AstalHyprland from 'gi://AstalHyprland';
|
||||
|
||||
import Separator from '../../misc/separator';
|
||||
import { hyprMessage } from '../../../lib';
|
||||
|
||||
|
||||
|
@ -13,15 +15,16 @@ export default () => {
|
|||
const visibleIcon = Variable<boolean>(false);
|
||||
const focusedIcon = Variable<string>('');
|
||||
|
||||
let lastFocused: string | undefined;
|
||||
let lastFocusedAddress: string | null;
|
||||
|
||||
const updateVars = (
|
||||
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
||||
) => {
|
||||
lastFocused = client?.get_address();
|
||||
const app = applications.fuzzy_query(
|
||||
client?.get_class() ?? '',
|
||||
)[0];
|
||||
lastFocusedAddress = client ? client.get_address() : null;
|
||||
|
||||
const app = client ?
|
||||
applications.fuzzy_query(client.get_class())[0] :
|
||||
null;
|
||||
|
||||
const icon = app?.iconName;
|
||||
|
||||
|
@ -34,7 +37,7 @@ export default () => {
|
|||
}
|
||||
|
||||
const id = client?.connect('notify::title', (c) => {
|
||||
if (c.get_address() !== lastFocused) {
|
||||
if (c.get_address() !== lastFocusedAddress) {
|
||||
c.disconnect(id);
|
||||
}
|
||||
});
|
||||
|
@ -53,14 +56,20 @@ export default () => {
|
|||
});
|
||||
|
||||
return (
|
||||
<box
|
||||
className="bar-item current-window"
|
||||
visible={bind(visibleIcon)}
|
||||
<revealer
|
||||
transitionType={Gtk.RevealerTransitionType.SLIDE_RIGHT}
|
||||
revealChild={bind(visibleIcon)}
|
||||
>
|
||||
<icon
|
||||
css="font-size: 32px;"
|
||||
icon={bind(focusedIcon)}
|
||||
/>
|
||||
</box>
|
||||
<box>
|
||||
<box className="bar-item current-window">
|
||||
<icon
|
||||
css="font-size: 32px;"
|
||||
icon={bind(focusedIcon)}
|
||||
/>
|
||||
</box>
|
||||
|
||||
<Separator size={8} />
|
||||
</box>
|
||||
</revealer>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue