Skip to content

Commit

Permalink
Merge branch 'master' into monitor-id-workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Jas-SinghFSU authored Jan 30, 2025
2 parents 03047e2 + 74065af commit bb8f4fc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
22 changes: 22 additions & 0 deletions src/components/bar/modules/window_title/helpers/title.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import options from 'src/options';
import { capitalizeFirstLetter } from 'src/lib/utils';
import AstalHyprland from 'gi://AstalHyprland?version=0.1';
import { hyprlandService } from 'src/lib/constants/services';
import { bind, Variable } from 'astal';

export const clientTitle = Variable('');
let clientBinding: Variable<void> | undefined;

function trackClientUpdates(client: AstalHyprland.Client): void {
clientBinding?.drop();
clientBinding = undefined;

if (!client) {
return;
}

clientBinding = Variable.derive([bind(client, 'title')], (currentTitle) => {
clientTitle.set(currentTitle);
});
}

Variable.derive([bind(hyprlandService, 'focusedClient')], (client) => {
trackClientUpdates(client);
});

/**
* Retrieves the matching window title details for a given window.
Expand Down
3 changes: 2 additions & 1 deletion src/components/bar/modules/window_title/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { hyprlandService } from 'src/lib/constants/services';
import AstalHyprland from 'gi://AstalHyprland?version=0.1';
import { onMiddleClick, onPrimaryClick, onScroll, onSecondaryClick } from 'src/lib/shared/eventHandlers';
import { bind, Variable } from 'astal';
import { getTitle, getWindowMatch, truncateTitle } from './helpers/title';
import { clientTitle, getTitle, getWindowMatch, truncateTitle } from './helpers/title';
import { Astal } from 'astal/gtk3';

const { leftClick, rightClick, middleClick, scrollDown, scrollUp } = options.bar.windowtitle;
Expand Down Expand Up @@ -55,6 +55,7 @@ const ClientTitle = (): BarBoxChild => {
bind(icon),
bind(truncation),
bind(truncation_size),
bind(clientTitle),
],
(
client: AstalHyprland.Client,
Expand Down
4 changes: 2 additions & 2 deletions src/globals/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const getWeatherKey = (apiKey: string): string => {
const fileContent = new TextDecoder().decode(fileContentArray);

if (!fileContent) {
console.error('File content is empty');
console.error('weather_api_key file is empty');
return '';
}

Expand Down Expand Up @@ -69,7 +69,7 @@ const weatherIntervalFn = (weatherInterval: number, loc: string, weatherKey: str
weatherIntervalInstance.cancel();
}

const formattedLocation = loc.replace(' ', '%20');
const formattedLocation = loc.replaceAll(' ', '%20');

weatherIntervalInstance = interval(weatherInterval, () => {
execAsync(
Expand Down

0 comments on commit bb8f4fc

Please sign in to comment.