Skip to content

Commit ff9630c

Browse files
authored
Merge pull request #165 from Flow-Works/feat/add-more-themes
[➕] overrall ui overhaul
2 parents 1aad68f + 12cd47a commit ff9630c

12 files changed

+427
-110
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flowos",
3-
"version": "2.0.0",
3+
"version": "2.1.1",
44
"description": "The most aesthetic webOS.",
55
"main": "src/bootloader.ts",
66
"scripts": {

src/assets/style.less

+47-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import url(https://api.fontshare.com/v2/css?f[]=satoshi@1,2&display=swap);
22

33
:root {
4+
--primary: #89b4fa;
45
--text: #cdd6f4;
56
--surface-2: #585b70;
67
--surface-1: #45475a;
@@ -59,12 +60,30 @@ toolbar {
5960
background: var(--mantle);
6061
margin: 0;
6162
padding: 10px;
63+
border-radius: 20px 20px 0 0;
64+
border: 1px solid var(--surface-0);
65+
box-shadow: 1px 3px 10px rgba(0, 0, 0, 0.2), 0 0px 10px rgba(0, 0, 0, 0.2);
66+
user-select: none;
6267

6368
& > div {
6469
&.outlined {
6570
padding: 10px;
6671
background: var(--base);
6772
border-radius: 10px;
73+
border: 1px solid var(--surface-0);
74+
box-shadow: 1px 3px 10px rgba(0, 0, 0, 0.1), 0 0px 10px rgba(0, 0, 0, 0.1);
75+
align-items: center;
76+
justify-content: center;
77+
}
78+
79+
&[data-toolbar-id="start"] {
80+
cursor: pointer;
81+
& * {
82+
transition: color .1s ease-in-out;
83+
&:hover {
84+
color: var(--primary);
85+
}
86+
}
6887
}
6988

7089
&[data-toolbar-id="controls"] {
@@ -76,6 +95,7 @@ toolbar {
7695

7796
&[data-toolbar-id="plugins"] {
7897
width: 24px;
98+
cursor: pointer;
7999
padding: 10px 0;
80100
}
81101

@@ -164,6 +184,12 @@ launcher {
164184
margin: 0;
165185
left: 0;
166186

187+
&[style*="opacity: 1;"] {
188+
apps * {
189+
pointer-events: all;
190+
}
191+
}
192+
167193
apps {
168194
max-height: 70vh;
169195
padding: 20px;
@@ -172,6 +198,8 @@ launcher {
172198
display: flex;
173199
flex-wrap: wrap;
174200
gap: 40px;
201+
overflow: scroll;
202+
pointer-events: none;
175203

176204
app {
177205
flex: 1 0 21%;
@@ -184,7 +212,22 @@ launcher {
184212
min-width: 125px;
185213
max-width: 125px;
186214
text-align: center;
187-
overflow: hidden;
215+
overflow: visible;
216+
transition: transform 0.1s ease-in-out;
217+
cursor: pointer;
218+
219+
220+
&:hover {
221+
transform: scale(1.1);
222+
223+
div {
224+
background: var(--surface-0);
225+
}
226+
227+
img {
228+
filter: drop-shadow(0px 2px 10px rgba(0, 0, 0, 0.75));
229+
}
230+
}
188231

189232
img {
190233
width: 100%;
@@ -198,7 +241,9 @@ launcher {
198241
width: fit-content;
199242
height: 100%;
200243
white-space: nowrap;
201-
244+
padding: 5px 10px;
245+
border-radius: 5px;
246+
transition: background 0.1s ease-in-out;
202247
}
203248
}
204249
}

src/bootloader.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ try {
122122
writeln('An error occured while booting FlowOS.')
123123
writeln('Please report this error to Flow Works.')
124124
writeln()
125-
terminal.html(terminal.getHtml() + '<a onclick="indexedDB.deleteDatabase('virtualfs')">Clear Virual FileSystem?</a>\n')
126125
console.error(e.stack)
126+
writeln()
127+
terminal.html(terminal.getHTML() + '<a href="#" onclick="indexedDB.deleteDatabase(`virtualfs`);window.location.reload()">Would you like to reset the VirtualFS?</a>')
127128
}

src/kernel.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ export default class Kernel {
6060
private async setTheme (themeName: string): Promise<void> {
6161
if (this.fs === false) throw new Error('Filesystem hasn\'t been initiated.')
6262
const file = await this.fs.readFile(`/etc/themes/${themeName}.theme`)
63-
const { colors } = JSON.parse(Buffer.from(file).toString())
63+
const { extras, colors } = JSON.parse(Buffer.from(file).toString())
6464
for (const color in colors) {
6565
document.documentElement.style.setProperty(`--${color}`, colors[color])
6666
}
67+
document.documentElement.style.setProperty('--primary', extras[parse(Buffer.from(await this.fs.readFile('/etc/flow')).toString()).THEME_PRIMARY as string])
6768
}
6869

6970
async boot (boot: HTML, progress: HTML, args: URLSearchParams): Promise<void> {

src/system/Desktop.ts

+1-72
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import HTML from '../HTML'
2-
import { AppClosedEvent, AppOpenedEvent, Process } from '../types'
3-
import { getTime } from '../utils'
2+
import { Process } from '../types'
43
import nullIcon from '../assets/icons/application-default-icon.svg'
54

65
const BootLoader: Process = {
@@ -62,80 +61,10 @@ const BootLoader: Process = {
6261

6362
const statusBar = await process.loadLibrary('lib/StatusBar')
6463

65-
statusBar.element.html(`
66-
<div class="outlined" data-toolbar-id="start"><span class="material-symbols-rounded">space_dashboard</span></div>
67-
68-
<div data-toolbar-id="apps"></div>
69-
<flex></flex>
70-
<div class="outlined" data-toolbar-id="plugins"><span class="material-symbols-rounded">expand_less</span></div>
71-
<div class="outlined" data-toolbar-id="controls">
72-
<span class="material-symbols-rounded battery">battery_2_bar</span>
73-
<span class="material-symbols-rounded signal">signal_cellular_4_bar</span>
74-
</div>
75-
<div class="outlined" data-toolbar-id="calendar"></div>
76-
77-
`)
78-
79-
setInterval((): any => {
80-
getTime().then((time) => {
81-
statusBar.element.qs('div[data-toolbar-id="calendar"]')?.text(time)
82-
}).catch(e => console.error)
83-
}, 1000)
84-
8564
statusBar.element.qs('div[data-toolbar-id="start"]')?.on('click', () => {
8665
launcher.toggle()
8766
})
8867

89-
if ('getBattery' in navigator) {
90-
(navigator as any).getBattery().then((battery: any) => {
91-
statusBar.updateBatteryIcon(battery)
92-
93-
battery.addEventListener('levelchange', () => {
94-
statusBar.updateBatteryIcon(battery)
95-
})
96-
97-
battery.addEventListener('chargingchange', () => {
98-
statusBar.updateBatteryIcon(battery)
99-
})
100-
})
101-
} else {
102-
const batteryDiv = document.querySelector('div[data-toolbar-id="controls"] > .battery')
103-
if (batteryDiv != null) {
104-
batteryDiv.innerHTML = 'battery_unknown'
105-
}
106-
}
107-
108-
async function ping (startTime: number): Promise<void> {
109-
fetch(`${process.kernel.config.SERVER as string}/bare/`)
110-
.then(() => {
111-
const endTime = performance.now()
112-
const pingTime = endTime - startTime
113-
statusBar.updateIcon(pingTime)
114-
})
115-
.catch(() => {
116-
(document.querySelector('div[data-toolbar-id="controls"] > .signal') as HTMLElement).innerHTML = 'signal_cellular_connected_no_internet_4_bar'
117-
})
118-
}
119-
120-
setInterval((): any => ping(performance.now()), 10_000)
121-
122-
document.addEventListener('app_opened', (e: AppOpenedEvent): void => {
123-
new HTML('app').appendMany(
124-
new HTML('img').attr({
125-
alt: `${e.detail.proc.config.name} icon`,
126-
'data-id': e.detail.token,
127-
src: e.detail.proc.config.icon ?? nullIcon
128-
}).on('click', () => {
129-
e.detail.win.focus()
130-
e.detail.win.toggleMin()
131-
})
132-
).appendTo(statusBar.element.qs('div[data-toolbar-id="apps"]')?.elm as HTMLElement)
133-
})
134-
135-
document.addEventListener('app_closed', (e: AppClosedEvent): void => {
136-
statusBar.element.qs('div[data-toolbar-id="apps"]')?.qs(`img[data-id="${e.detail.token}"]`)?.elm.parentElement?.remove()
137-
})
138-
13968
document.body.style.flexDirection = 'column-reverse'
14069

14170
await statusBar.element.appendTo(document.body)

0 commit comments

Comments
 (0)