chore(ags): update client title stuff
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
6244f9726e
commit
8c32a7372b
5 changed files with 7 additions and 50 deletions
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
|
@ -1,7 +1,6 @@
|
||||||
// TODO: persisting data like bluetooth
|
// TODO: persisting data like bluetooth
|
||||||
// TODO: quick-settings
|
// TODO: quick-settings
|
||||||
// TODO: music player stuff
|
// TODO: music player stuff
|
||||||
// TODO: on-screen-keyboard
|
|
||||||
// TODO: see if I can bundle each config separately with nix
|
// TODO: see if I can bundle each config separately with nix
|
||||||
|
|
||||||
import { programArgs } from 'system';
|
import { programArgs } from 'system';
|
||||||
|
|
|
@ -5,7 +5,6 @@ import AstalApps from 'gi://AstalApps';
|
||||||
import AstalHyprland from 'gi://AstalHyprland';
|
import AstalHyprland from 'gi://AstalHyprland';
|
||||||
|
|
||||||
import Separator from '../../misc/separator';
|
import Separator from '../../misc/separator';
|
||||||
import { hyprMessage } from '../../../lib';
|
|
||||||
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
@ -16,14 +15,13 @@ export default () => {
|
||||||
const focusedIcon = Variable<string>('');
|
const focusedIcon = Variable<string>('');
|
||||||
const focusedTitle = Variable<string>('');
|
const focusedTitle = Variable<string>('');
|
||||||
|
|
||||||
// FIXME: readd this once client titles are fixed
|
let lastFocusedAddress: string | null;
|
||||||
// let lastFocusedAddress: string | null;
|
|
||||||
|
|
||||||
|
|
||||||
const updateVars = (
|
const updateVars = (
|
||||||
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
||||||
) => {
|
) => {
|
||||||
// lastFocusedAddress = client ? client.address : null;
|
lastFocusedAddress = client ? client.address : null;
|
||||||
|
|
||||||
const app = applications.fuzzy_query(
|
const app = applications.fuzzy_query(
|
||||||
client?.class ?? '',
|
client?.class ?? '',
|
||||||
|
@ -40,25 +38,16 @@ export default () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
focusedTitle.set(client?.title ?? '');
|
focusedTitle.set(client?.title ?? '');
|
||||||
/* const id = client?.connect('notify::title', (c) => {
|
const id = client?.connect('notify::title', (c) => {
|
||||||
if (c.get_address() !== lastFocusedAddress) {
|
if (c.get_address() !== lastFocusedAddress) {
|
||||||
c.disconnect(id);
|
c.disconnect(id);
|
||||||
}
|
}
|
||||||
console.log(c.get_title());
|
|
||||||
focusedTitle.set(c.get_title());
|
focusedTitle.set(c.get_title());
|
||||||
});*/
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateVars();
|
updateVars();
|
||||||
// hyprland.connect('notify::focused-client', () => updateVars());
|
hyprland.connect('notify::focused-client', () => updateVars());
|
||||||
hyprland.connect('event', async() => {
|
|
||||||
try {
|
|
||||||
updateVars(JSON.parse(await hyprMessage('j/activewindow')));
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<revealer
|
<revealer
|
||||||
|
@ -86,7 +75,7 @@ export default () => {
|
||||||
<label
|
<label
|
||||||
label={bind(focusedTitle)}
|
label={bind(focusedTitle)}
|
||||||
truncate
|
truncate
|
||||||
maxWidthChars={45}
|
maxWidthChars={40}
|
||||||
/>
|
/>
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
|
|
|
@ -6,8 +6,6 @@ import AstalHyprland from 'gi://AstalHyprland';
|
||||||
|
|
||||||
import Separator from '../../misc/separator';
|
import Separator from '../../misc/separator';
|
||||||
|
|
||||||
import { hyprMessage } from '../../../lib';
|
|
||||||
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const applications = AstalApps.Apps.new();
|
const applications = AstalApps.Apps.new();
|
||||||
|
@ -16,15 +14,9 @@ export default () => {
|
||||||
const visibleIcon = Variable<boolean>(false);
|
const visibleIcon = Variable<boolean>(false);
|
||||||
const focusedIcon = Variable<string>('');
|
const focusedIcon = Variable<string>('');
|
||||||
|
|
||||||
// FIXME: readd this once client titles are fixed
|
|
||||||
// let lastFocusedAddress: string | null;
|
|
||||||
|
|
||||||
|
|
||||||
const updateVars = (
|
const updateVars = (
|
||||||
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
||||||
) => {
|
) => {
|
||||||
// lastFocusedAddress = client ? client.address : null;
|
|
||||||
|
|
||||||
const app = applications.fuzzy_query(
|
const app = applications.fuzzy_query(
|
||||||
client?.class ?? '',
|
client?.class ?? '',
|
||||||
)[0];
|
)[0];
|
||||||
|
@ -41,15 +33,7 @@ export default () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
updateVars();
|
updateVars();
|
||||||
// hyprland.connect('notify::focused-client', () => updateVars());
|
hyprland.connect('notify::focused-client', () => updateVars());
|
||||||
hyprland.connect('event', async() => {
|
|
||||||
try {
|
|
||||||
updateVars(JSON.parse(await hyprMessage('j/activewindow')));
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<revealer
|
<revealer
|
||||||
|
|
|
@ -216,21 +216,6 @@ const RegularKey = (key: Key) => {
|
||||||
|
|
||||||
gesture.delay_factor = 1.0;
|
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
|
// OnPrimaryClickRelease
|
||||||
widget.hook(gesture, 'cancelled', () => {
|
widget.hook(gesture, 'cancelled', () => {
|
||||||
const pointer = gesture.get_point(null);
|
const pointer = gesture.get_point(null);
|
||||||
|
|
Loading…
Reference in a new issue