Skip to content

Commit 3cca6f5

Browse files
committed
.
1 parent f0e4f91 commit 3cca6f5

File tree

12 files changed

+238
-49
lines changed

12 files changed

+238
-49
lines changed

apps/desktop/public/widgets/app releases/styles.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ main {
4040
box-shadow:
4141
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
4242
0 28px 65px -45px rgba(99, 102, 241, 0.85);
43+
background:
44+
linear-gradient(
45+
180deg,
46+
rgba(10, 12, 24, 0.82) 0%,
47+
rgba(10, 12, 24, 0.64) 100%
48+
),
49+
radial-gradient(
50+
460px 300px at 0% 0%,
51+
rgba(99, 102, 241, 0.12),
52+
transparent 60%
53+
);
4354
flex-direction: column;
4455
gap: 18px;
4556
overflow-y: auto;
@@ -151,6 +162,17 @@ h1,
151162
box-shadow:
152163
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
153164
0 24px 60px -45px rgba(99, 102, 241, 0.85);
165+
background:
166+
linear-gradient(
167+
180deg,
168+
rgba(10, 12, 24, 0.82) 0%,
169+
rgba(10, 12, 24, 0.64) 100%
170+
),
171+
radial-gradient(
172+
460px 300px at 0% 0%,
173+
rgba(99, 102, 241, 0.12),
174+
transparent 60%
175+
);
154176
font-weight: 600;
155177
text-transform: uppercase;
156178
letter-spacing: 0.12em;

apps/desktop/public/widgets/clock/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ body {
3838
box-shadow:
3939
0 0 0 1px rgba(15, 23, 42, 0.65) inset,
4040
0 24px 60px -40px rgba(15, 23, 42, 0.9);
41+
background:
42+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
43+
radial-gradient(
44+
420px 280px at 0% 0%,
45+
rgba(56, 189, 248, 0.12),
46+
transparent 60%
47+
);
4148
text-align: center;
4249
display: flex;
4350
flex-direction: column;

apps/desktop/public/widgets/daily weather/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ body {
4141
box-shadow:
4242
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
4343
0 28px 65px -45px rgba(14, 165, 233, 0.85);
44+
background:
45+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
46+
radial-gradient(
47+
420px 280px at 0% 0%,
48+
rgba(56, 189, 248, 0.12),
49+
transparent 60%
50+
);
4451
-webkit-app-region: drag;
4552
}
4653

apps/desktop/public/widgets/disk usage/styles.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ main {
4242
box-shadow:
4343
0 0 0 1px rgba(15, 23, 42, 0.55) inset,
4444
0 24px 60px -40px rgba(37, 99, 235, 0.8);
45+
background:
46+
linear-gradient(180deg, rgba(2, 6, 23, 0.74) 0%, rgba(2, 6, 23, 0.58) 100%),
47+
radial-gradient(
48+
420px 280px at 0% 0%,
49+
rgba(59, 130, 246, 0.12),
50+
transparent 60%
51+
);
4552
overflow-y: auto;
4653
-webkit-app-region: drag;
4754
}
@@ -54,6 +61,13 @@ main {
5461
box-shadow:
5562
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
5663
0 18px 40px -35px rgba(37, 99, 235, 0.75);
64+
background:
65+
linear-gradient(180deg, rgba(2, 6, 23, 0.7) 0%, rgba(2, 6, 23, 0.54) 100%),
66+
radial-gradient(
67+
380px 240px at 0% 0%,
68+
rgba(59, 130, 246, 0.1),
69+
transparent 60%
70+
);
5771
gap: 14px;
5872
flex-direction: column;
5973
}

apps/desktop/public/widgets/hacker news/styles.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ body {
3838
box-shadow:
3939
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
4040
0 26px 60px -45px rgba(249, 115, 22, 0.82);
41+
background:
42+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
43+
radial-gradient(
44+
460px 300px at 0% 0%,
45+
rgba(251, 146, 60, 0.12),
46+
transparent 60%
47+
);
4148
display: flex;
4249
flex-direction: column;
4350
gap: 20px;

apps/desktop/public/widgets/r-programming/styles.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ main {
4444
gap: 18px;
4545
overflow-y: auto;
4646
-webkit-app-region: drag;
47+
background:
48+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
49+
radial-gradient(
50+
460px 300px at 0% 0%,
51+
rgba(249, 115, 22, 0.12),
52+
transparent 60%
53+
);
4754
}
4855

4956
#header {
@@ -150,6 +157,13 @@ main {
150157
box-shadow:
151158
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
152159
0 24px 60px -45px rgba(248, 113, 113, 0.82);
160+
background:
161+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
162+
radial-gradient(
163+
460px 300px at 0% 0%,
164+
rgba(249, 115, 22, 0.12),
165+
transparent 60%
166+
);
153167
font-weight: 600;
154168
text-transform: uppercase;
155169
letter-spacing: 0.12em;

apps/desktop/public/widgets/search/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ main {
5353
box-shadow:
5454
0 0 0 1px rgba(15, 23, 42, 0.55) inset,
5555
0 24px 55px -45px rgba(96, 165, 250, 0.8);
56+
background:
57+
linear-gradient(180deg, rgba(2, 6, 23, 0.74) 0%, rgba(2, 6, 23, 0.58) 100%),
58+
radial-gradient(
59+
380px 260px at 0% 0%,
60+
rgba(96, 165, 250, 0.12),
61+
transparent 60%
62+
);
5663
-webkit-app-region: drag;
5764
}
5865

apps/desktop/public/widgets/system information/styles.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ main {
3838
box-shadow:
3939
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
4040
0 26px 60px -45px rgba(45, 212, 191, 0.78);
41+
background:
42+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
43+
radial-gradient(
44+
420px 280px at 0% 0%,
45+
rgba(45, 212, 191, 0.12),
46+
transparent 60%
47+
);
4148
display: none;
4249
flex-direction: column;
4350
gap: 22px;
@@ -108,6 +115,13 @@ main > div:not(#gpu-container) {
108115
box-shadow:
109116
0 0 0 1px rgba(15, 23, 42, 0.6) inset,
110117
0 24px 60px -45px rgba(45, 212, 191, 0.78);
118+
background:
119+
linear-gradient(180deg, rgba(2, 6, 23, 0.76) 0%, rgba(2, 6, 23, 0.6) 100%),
120+
radial-gradient(
121+
420px 280px at 0% 0%,
122+
rgba(45, 212, 191, 0.12),
123+
transparent 60%
124+
);
111125
font-weight: 600;
112126
text-transform: uppercase;
113127
letter-spacing: 0.12em;

apps/desktop/public/widgets/transparent clock/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ main {
2828
display: flex;
2929
align-items: center;
3030
justify-content: center;
31+
background: transparent;
3132
}
3233

3334
#clock {

apps/desktop/src/app/main/ipc-operations/widget-visibility.ts

Lines changed: 71 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ import {
88
} from '../../../utils'
99
import { config } from '../../../lib/config'
1010

11+
/**
12+
* Handles getting the window title for the current window.
13+
*/
14+
ipcMain.handle('get-window-title', (event) => {
15+
const win = BrowserWindow.fromWebContents(event.sender)
16+
return win?.getTitle() || null
17+
})
18+
1119
/**
1220
* Handles the reloading of a widget window.
1321
* @param event - The event object.
@@ -29,50 +37,77 @@ ipcMain.handle(IpcChannels.RECREATE_WIDGET, (event, widgetKey) => {
2937
/**
3038
* Handles the resizing of a widget window.
3139
*/
32-
ipcMain.handle(IpcChannels.RESIZE_WIDGET_WINDOW, () => {
33-
const win = BrowserWindow.getFocusedWindow()
34-
if (win?.title !== config.applicationName) {
35-
const title: string = BrowserWindow.getFocusedWindow()?.getTitle() as string
36-
const widgets: WidgetsConfig = getWidgetsJson(config.widgetsJsonPath)
37-
if (
38-
win &&
39-
widgets[title] &&
40-
widgets[title].title !== config.applicationName &&
41-
widgets[title].locked === false
42-
) {
43-
widgets[title].width = win.getSize()[0]
44-
widgets[title].height = win.getSize()[1]
45-
setWidgetsJson(widgets, config.widgetsJsonPath)
46-
} else {
47-
console.error(
48-
`Widget with title "${title}" not found in widgets config.`,
49-
dialog.showErrorBox(
50-
'Widget not found',
51-
`Widget with title "${title}" not found in widgets config.`,
52-
),
53-
)
54-
}
40+
ipcMain.handle(IpcChannels.RESIZE_WIDGET_WINDOW, (event, widgetKey: string) => {
41+
if (!widgetKey) {
42+
console.warn('No widget key provided during resize operation')
43+
}
44+
45+
const win =
46+
BrowserWindow.fromWebContents(event.sender) ||
47+
BrowserWindow.getAllWindows().find((w) => w.getTitle() === widgetKey)
48+
49+
if (!win) {
50+
console.warn(`Window not found for widget: ${widgetKey}`)
51+
return
52+
}
53+
54+
const resolvedKey = widgetKey || win.getTitle()
55+
if (win.getTitle() === config.applicationName) {
56+
return
57+
}
58+
59+
const widgets: WidgetsConfig = getWidgetsJson(config.widgetsJsonPath)
60+
const widget = widgets[resolvedKey]
61+
if (!widget) {
62+
console.error(`Widget "${resolvedKey}" not found in widgets config.`)
63+
return
64+
}
65+
66+
if (widget.locked === true) {
67+
return
5568
}
69+
70+
const [width, height] = win.getSize()
71+
widget.width = width
72+
widget.height = height
73+
setWidgetsJson(widgets, config.widgetsJsonPath)
5674
})
5775

5876
/**
5977
* Handles the dragging of a widget window.
6078
*/
61-
ipcMain.handle(IpcChannels.DRAG_WIDGET_WINDOW, () => {
79+
ipcMain.handle(IpcChannels.DRAG_WIDGET_WINDOW, (event, widgetKey: string) => {
80+
if (!widgetKey) {
81+
console.warn('No widget key provided during drag operation')
82+
}
83+
84+
const win =
85+
BrowserWindow.fromWebContents(event.sender) ||
86+
BrowserWindow.getAllWindows().find((w) => w.getTitle() === widgetKey)
87+
88+
if (!win) {
89+
return
90+
}
91+
92+
const resolvedKey = widgetKey || win.getTitle()
93+
if (win.getTitle() === config.applicationName) {
94+
return
95+
}
96+
6297
const widgets: WidgetsConfig = getWidgetsJson(config.widgetsJsonPath)
63-
const win = BrowserWindow.getFocusedWindow()
64-
const title: string = win?.getTitle() as string
65-
if (
66-
win &&
67-
widgets[title] &&
68-
win?.isFocused() &&
69-
widgets[title].title !== config.applicationName &&
70-
widgets[title].locked === false
71-
) {
72-
widgets[title].x = win.getPosition()[0]
73-
widgets[title].y = win.getPosition()[1]
74-
setWidgetsJson(widgets, config.widgetsJsonPath)
98+
const widget = widgets[resolvedKey]
99+
if (!widget) {
100+
return
75101
}
102+
103+
if (widget.locked === true) {
104+
return
105+
}
106+
107+
const [x, y] = win.getPosition()
108+
widget.x = x
109+
widget.y = y
110+
setWidgetsJson(widgets, config.widgetsJsonPath)
76111
})
77112

78113
/**

0 commit comments

Comments
 (0)