Skip to content

Commit e0dbacb

Browse files
committed
Burn My Windows
1 parent 1338043 commit e0dbacb

18 files changed

Lines changed: 1249 additions & 5 deletions

IDEAS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@
268268
## Visuals & Effects
269269

270270
- [Frosted Glass](https://frosted-glass.shud.in/)
271-
- Window Animations
272-
- [Burn My Windows](https://github.com/Schneegans/Burn-My-Windows) ([#358](https://github.com/Schneegans/Burn-My-Windows/discussions/358))
273271
- 3D
274272
- [noclip](https://noclip.website/)
275273
- [Object Viewer](https://rubenandrebarreiro.github.io/projects/threejs/3d-object-viewer-super-mario-bros/3d-object-viewer-super-mario-bros.html)

components/system/Files/FileManager/useFolderContextMenu.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useProcesses } from "contexts/process";
1818
import { useSession } from "contexts/session";
1919
import { useProcessesRef } from "hooks/useProcessesRef";
2020
import { useWebGPUCheck } from "hooks/useWebGPUCheck";
21+
import { CLOSE_EFFECT_NAMES } from "utils/closeEffect";
2122
import {
2223
DESKTOP_PATH,
2324
FOLDER_ICON,
@@ -85,7 +86,9 @@ const useFolderContextMenu = (
8586
updateFolder,
8687
} = useFileSystem();
8788
const {
89+
closeEffect,
8890
iconPositions,
91+
setCloseEffect,
8992
setForegroundId,
9093
setWallpaper: setSessionWallpaper,
9194
setIconPositions,
@@ -471,6 +474,14 @@ const useFolderContextMenu = (
471474
: []
472475
),
473476
},
477+
{
478+
label: "Window close effect",
479+
menu: CLOSE_EFFECT_NAMES.map((effectName) => ({
480+
action: () => setCloseEffect(effectName),
481+
label: effectName,
482+
toggle: closeEffect === effectName,
483+
})),
484+
},
474485
...(canCapture
475486
? [
476487
{
@@ -579,6 +590,7 @@ const useFolderContextMenu = (
579590
addToFolder,
580591
canCapture,
581592
captureScreen,
593+
closeEffect,
582594
contextMenu,
583595
exists,
584596
hasWebGPU,
@@ -594,6 +606,7 @@ const useFolderContextMenu = (
594606
pasteToFolder,
595607
processesRef,
596608
rootFs?.mntMap,
609+
setCloseEffect,
597610
setForegroundId,
598611
setSessionWallpaper,
599612
sortBy,

contexts/process/useProcessContextState.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback, useState } from "react";
1+
import { useCallback, useEffect, useRef, useState } from "react";
22
import {
33
closeProcess,
44
maximizeProcess,
@@ -15,6 +15,7 @@ import {
1515
type ProcessElements,
1616
type Processes,
1717
} from "contexts/process/types";
18+
import { startCloseEffect } from "utils/closeEffect";
1819
import { TRANSITIONS_IN_MILLISECONDS } from "utils/constants";
1920

2021
type ProcessContextState = {
@@ -48,6 +49,12 @@ const useProcessContextState = (): ProcessContextState => {
4849
const [processes, setProcesses] = useState<Processes>(
4950
Object.create(null) as Processes
5051
);
52+
const processesRef = useRef<Processes>({} as Processes);
53+
54+
useEffect(() => {
55+
processesRef.current = processes;
56+
}, [processes]);
57+
5158
const argument = useCallback(
5259
(
5360
id: string,
@@ -108,8 +115,17 @@ const useProcessContextState = (): ProcessContextState => {
108115
);
109116
const closeWithTransition = useCallback(
110117
(id: string): void => {
111-
close(id, true);
112-
window.setTimeout(() => close(id), TRANSITIONS_IN_MILLISECONDS.WINDOW);
118+
const { componentWindow, hasWindow } = processesRef.current[id] || {};
119+
const initClose = (): void => {
120+
close(id, true);
121+
window.setTimeout(() => close(id), TRANSITIONS_IN_MILLISECONDS.WINDOW);
122+
};
123+
124+
if (componentWindow && hasWindow !== false) {
125+
startCloseEffect(componentWindow, initClose);
126+
} else {
127+
initClose();
128+
}
113129
},
114130
[close]
115131
);

contexts/session/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export type IconPositions = Record<string, IconPosition>;
4141
export type SessionData = {
4242
aiEnabled: boolean;
4343
clockSource: ClockSource;
44+
closeEffect: string;
4445
cursor: string | undefined;
4546
iconPositions: IconPositions;
4647
lazySheep?: boolean;
@@ -61,6 +62,7 @@ export type SessionContextState = SessionData & {
6162
sessionLoaded: boolean;
6263
setAiEnabled: React.Dispatch<React.SetStateAction<boolean>>;
6364
setClockSource: React.Dispatch<React.SetStateAction<ClockSource>>;
65+
setCloseEffect: React.Dispatch<React.SetStateAction<string>>;
6466
setCursor: React.Dispatch<React.SetStateAction<string | undefined>>;
6567
setForegroundId: React.Dispatch<React.SetStateAction<string>>;
6668
setHaltSession: React.Dispatch<React.SetStateAction<boolean>>;

contexts/session/useSessionContextState.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ import {
2020
type WindowStates,
2121
} from "contexts/session/types";
2222
import defaultSession from "public/session.json";
23+
import { setCurrentCloseEffect } from "utils/closeEffect";
2324
import {
2425
DEFAULT_ASCENDING,
2526
DEFAULT_CLOCK_SOURCE,
27+
DEFAULT_CLOSE_EFFECT,
2628
DEFAULT_THEME,
2729
DEFAULT_WALLPAPER,
2830
DEFAULT_WALLPAPER_FIT,
@@ -60,6 +62,7 @@ const useSessionContextState = (): SessionContextState => {
6062
const [clockSource, setClockSource] = useState(DEFAULT_CLOCK_SOURCE);
6163
const [cursor, setCursor] = useState<string | undefined>();
6264
const [aiEnabled, setAiEnabled] = useState(false);
65+
const [closeEffect, setCloseEffect] = useState(DEFAULT_CLOSE_EFFECT);
6366
const [lazySheep, setLazySheep] = useState(false);
6467
const [windowStates, setWindowStates] = useState(
6568
Object.create(null) as WindowStates
@@ -216,6 +219,7 @@ const useSessionContextState = (): SessionContextState => {
216219
JSON.stringify({
217220
aiEnabled,
218221
clockSource,
222+
closeEffect,
219223
cursor,
220224
iconPositions,
221225
lazySheep,
@@ -235,6 +239,7 @@ const useSessionContextState = (): SessionContextState => {
235239
}, [
236240
aiEnabled,
237241
clockSource,
242+
closeEffect,
238243
cursor,
239244
haltSession,
240245
iconPositions,
@@ -280,6 +285,7 @@ const useSessionContextState = (): SessionContextState => {
280285
}
281286

282287
if (session.clockSource) setClockSource(session.clockSource);
288+
if (session.closeEffect) setCloseEffect(session.closeEffect);
283289
if (session.cursor) setCursor(session.cursor);
284290
if (session.aiEnabled) setAiEnabled(session.aiEnabled);
285291
if (session.themeName) setThemeName(session.themeName);
@@ -386,9 +392,12 @@ const useSessionContextState = (): SessionContextState => {
386392
}
387393
}, [deletePath, lstat, readFile, rootFs, setWallpaper]);
388394

395+
useEffect(() => setCurrentCloseEffect(closeEffect), [closeEffect]);
396+
389397
return {
390398
aiEnabled,
391399
clockSource,
400+
closeEffect,
392401
cursor,
393402
foregroundId,
394403
iconPositions,
@@ -399,6 +408,7 @@ const useSessionContextState = (): SessionContextState => {
399408
sessionLoaded,
400409
setAiEnabled,
401410
setClockSource,
411+
setCloseEffect,
402412
setCursor,
403413
setForegroundId,
404414
setHaltSession,

next.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ const nextConfig = {
7979
config.module.parser.javascript = config.module.parser.javascript || {};
8080
config.module.parser.javascript.dynamicImportFetchPriority = "high";
8181

82+
config.module.rules.push({
83+
include: path.resolve(__dirname, "node_modules/Burn-My-Windows"),
84+
test: /\.(frag|glsl|xml)$/,
85+
type: "asset/source",
86+
});
87+
8288
return config;
8389
},
8490
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@panzoom/panzoom": "^4.6.0",
4949
"@prettier/plugin-xml": "^3.4.2",
5050
"@wasmer/wasm-transformer": "^0.12.0",
51+
"Burn-My-Windows": "https://github.com/Schneegans/Burn-My-Windows",
5152
"ani-cursor": "^0.0.5",
5253
"browserfs": "https://github.com/jvilk/BrowserFS.git#a96aa2d",
5354
"butterchurn-presets": "^3.0.0-beta.4",

public/CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This project is greatly augmented by code from the open source community. Thank
3030
- [3D Maze](https://github.com/ibid-11962/Windows-95-3D-Maze-Screensaver)
3131
- [7z-wasm](https://github.com/use-strict/7z-wasm)
3232
- [ani-cursor](https://github.com/captbaritone/webamp/tree/master/packages/ani-cursor)
33+
- [Burn-My-Windows](https://github.com/Schneegans/Burn-My-Windows)
3334
- [Coastal Landscape](https://www.shadertoy.com/view/fstyD4)
3435
- [codecbox.js](https://github.com/duanyao/codecbox.js)
3536
- [decode-ico](https://github.com/LinusU/decode-ico)

public/System/BMW/brush.png

806 KB
Loading

public/System/BMW/claws.png

126 KB
Loading

0 commit comments

Comments
 (0)