chore(ags): update client title stuff
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-25 13:25:14 -05:00
parent 6244f9726e
commit 8c32a7372b
5 changed files with 7 additions and 50 deletions

Binary file not shown.

View file

@ -1,7 +1,6 @@
// TODO: persisting data like bluetooth
// TODO: quick-settings
// TODO: music player stuff
// TODO: on-screen-keyboard
// TODO: see if I can bundle each config separately with nix
import { programArgs } from 'system';

View file

@ -5,7 +5,6 @@ import AstalApps from 'gi://AstalApps';
import AstalHyprland from 'gi://AstalHyprland';
import Separator from '../../misc/separator';
import { hyprMessage } from '../../../lib';
export default () => {
@ -16,14 +15,13 @@ export default () => {
const focusedIcon = Variable<string>('');
const focusedTitle = Variable<string>('');
// FIXME: readd this once client titles are fixed
// let lastFocusedAddress: string | null;
let lastFocusedAddress: string | null;
const updateVars = (
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
) => {
// lastFocusedAddress = client ? client.address : null;
lastFocusedAddress = client ? client.address : null;
const app = applications.fuzzy_query(
client?.class ?? '',
@ -40,25 +38,16 @@ export default () => {
}
focusedTitle.set(client?.title ?? '');
/* const id = client?.connect('notify::title', (c) => {
const id = client?.connect('notify::title', (c) => {
if (c.get_address() !== lastFocusedAddress) {
c.disconnect(id);
}
console.log(c.get_title());
focusedTitle.set(c.get_title());
});*/
});
};
updateVars();
// hyprland.connect('notify::focused-client', () => updateVars());
hyprland.connect('event', async() => {
try {
updateVars(JSON.parse(await hyprMessage('j/activewindow')));
}
catch (e) {
console.log(e);
}
});
hyprland.connect('notify::focused-client', () => updateVars());
return (
<revealer
@ -86,7 +75,7 @@ export default () => {
<label
label={bind(focusedTitle)}
truncate
maxWidthChars={45}
maxWidthChars={40}
/>
</box>
</box>

View file

@ -6,8 +6,6 @@ import AstalHyprland from 'gi://AstalHyprland';
import Separator from '../../misc/separator';
import { hyprMessage } from '../../../lib';
export default () => {
const applications = AstalApps.Apps.new();
@ -16,15 +14,9 @@ export default () => {
const visibleIcon = Variable<boolean>(false);
const focusedIcon = Variable<string>('');
// FIXME: readd this once client titles are fixed
// let lastFocusedAddress: string | null;
const updateVars = (
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
) => {
// lastFocusedAddress = client ? client.address : null;
const app = applications.fuzzy_query(
client?.class ?? '',
)[0];
@ -41,15 +33,7 @@ export default () => {
};
updateVars();
// hyprland.connect('notify::focused-client', () => updateVars());
hyprland.connect('event', async() => {
try {
updateVars(JSON.parse(await hyprMessage('j/activewindow')));
}
catch (e) {
console.log(e);
}
});
hyprland.connect('notify::focused-client', () => updateVars());
return (
<revealer

View file

@ -216,21 +216,6 @@ const RegularKey = (key: Key) => {
gesture.delay_factor = 1.0;
// Long press
widget.hook(gesture, 'pressed', () => {
const pointer = gesture.get_point(null);
const x = pointer[1];
const y = pointer[2];
if ((!x || !y) || (x === 0 && y === 0)) {
return;
}
console.log('Not implemented yet');
// TODO: popup menu for accents
});
// OnPrimaryClickRelease
widget.hook(gesture, 'cancelled', () => {
const pointer = gesture.get_point(null);