Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: glazewm and komorebi providers update on window move/resize #43

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: run effects within root
  • Loading branch information
lars-berger committed Mar 16, 2024
commit ea6c7de3bc0e670191e5d92d1518a62980f90256
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createEffect, on, type Owner } from 'solid-js';
import { createEffect, on, runWithOwner, type Owner } from 'solid-js';
import { createStore } from 'solid-js/store';
import { GwmClient, GwmEventType, type Workspace } from 'glazewm';

Expand All @@ -8,7 +8,7 @@ import { getCoordinateDistance } from '~/utils';

export async function createGlazewmProvider(
_: GlazewmProviderConfig,
__: Owner,
owner: Owner,
) {
const monitors = await getMonitors();
const client = new GwmClient();
Expand Down Expand Up @@ -36,7 +36,9 @@ export async function createGlazewmProvider(
refetch,
);

createEffect(on(() => monitors.currentMonitor, refetch));
runWithOwner(owner, () => {
createEffect(on(() => monitors.currentMonitor, refetch));
});

async function refetch() {
const currentPosition = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createEffect, type Owner } from 'solid-js';
import { createEffect, runWithOwner, type Owner } from 'solid-js';
import { createStore } from 'solid-js/store';

import type { KomorebiProviderConfig } from '~/user-config';
Expand Down Expand Up @@ -121,7 +121,9 @@ export async function createKomorebiProvider(
await getVariables(),
);

createEffect(async () => setKomorebiVariables(await getVariables()));
runWithOwner(owner, () => {
createEffect(async () => setKomorebiVariables(await getVariables()));
});

async function getVariables() {
const state = providerListener();
Expand Down
Loading