Skip to content

Commit

Permalink
feat: expose whether WM is paused in glazewm provider (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
michidk authored Dec 1, 2024
1 parent 9052353 commit dce8f0d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/client-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@tauri-apps/api": "2.0.2",
"@tauri-apps/plugin-dialog": "2.0.0",
"@tauri-apps/plugin-shell": "2.0.0",
"glazewm": "1.6.0",
"glazewm": "1.7.0",
"luxon": "3.4.4",
"zod": "3.22.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type WorkspaceActivatedEvent,
type WorkspaceDeactivatedEvent,
type WorkspaceUpdatedEvent,
type PauseChangedEvent,
} from 'glazewm';
import { z } from 'zod';

Expand Down Expand Up @@ -52,6 +53,7 @@ export function createGlazeWmProvider(
WmEventType.WORKSPACE_ACTIVATED,
WmEventType.WORKSPACE_DEACTIVATED,
WmEventType.WORKSPACE_UPDATED,
WmEventType.PAUSE_CHANGED,
],
onEvent,
);
Expand All @@ -70,7 +72,8 @@ export function createGlazeWmProvider(
| TilingDirectionChangedEvent
| WorkspaceActivatedEvent
| WorkspaceDeactivatedEvent
| WorkspaceUpdatedEvent,
| WorkspaceUpdatedEvent
| PauseChangedEvent,
) {
switch (e.eventType) {
case WmEventType.BINDING_MODES_CHANGED: {
Expand Down Expand Up @@ -101,6 +104,10 @@ export function createGlazeWmProvider(
state = { ...state, ...(await getMonitorState()) };
break;
}
case WmEventType.PAUSE_CHANGED: {
state = { ...state, isPaused: e.isPaused };
break;
}
}

queue.output(state);
Expand All @@ -117,12 +124,14 @@ export function createGlazeWmProvider(
const { focused: focusedContainer } = await client.queryFocused();
const { bindingModes } = await client.queryBindingModes();
const { tilingDirection } = await client.queryTilingDirection();
const { paused: isPaused } = await client.queryPaused();

return {
...(await getMonitorState()),
focusedContainer,
tilingDirection,
bindingModes,
isPaused,
runCommand,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type Monitor,
type RunCommandResponse,
type Workspace,
type Window,
} from 'glazewm';

import type { Provider } from '../create-base-provider';
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dce8f0d

Please sign in to comment.