Skip to content

Commit 9d9a46a

Browse files
committed
move files.osl to use proper glass, fix other apps and some cli
improvements for ls and calc
1 parent b09fcca commit 9d9a46a

12 files changed

Lines changed: 1114 additions & 274 deletions

File tree

:path/calc.osl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
if args.len != 3 (
22
terminal.writeLine("Invalid number of arguments. Expected 3, got " + args.len)
33
)
4-
local left = args[1]
5-
local right = args[3]
4+
local left = args[1].toNum()
5+
local right = args[3].toNum()
66

77
switch args[2] (
88
case "+"
@@ -68,4 +68,4 @@ switch args[2] (
6868
default
6969
terminal.writeLine("Unknown operator: " + args[2])
7070

71-
)
71+
)

:path/exit.osl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
window.close()
1+
window.close()

:path/logout.osl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
eval "localStorage.clear()"
2-
eval "vm.runtime.greenFlag()"
1+
// Clear session and reboot originOS
2+
eval "try{localStorage.setItem('origin_login','');localStorage.removeItem('origin_login')}catch(e){}"
3+
eval "setTimeout(function(){try{vm.runtime.greenFlag()}catch(e){}},50)"

:path/ls.osl

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ local targetPath = terminal.pwd
22
local flags = args.filter(v -> v.startsWith("-"))
33
local paths = args.filter(v -> !v.startsWith("-"))
44

5+
// Combined short flags: -a, -l, -la, -al
6+
local flagStr = flags.join("")
7+
local getAll = flagStr.contains("a")
8+
local longFmt = flagStr.contains("l") or getAll
9+
510
if paths.len > 0 (
611
targetPath = terminal.resolvePath(paths[1])
712
)
@@ -18,7 +23,6 @@ if !exists (
1823
return
1924
)
2025

21-
local getAll = flags.contains("-a")
2226
local entries = listFiles(folderPath)
2327
array files = []
2428

@@ -33,6 +37,71 @@ if files.len == 0 (
3337
return
3438
)
3539

40+
// Resolve OFSF uuid (+ optional fields) for an entry name under folderPath
41+
def entryMeta(folder, name) (
42+
local full = folder ++ "/" ++ name
43+
try (
44+
local m = open(full, ["uuid", "type", "name", "size", "id"])
45+
return {
46+
uuid: m[1] ?? "?",
47+
type: m[2] ?? "",
48+
name: m[3] ?? name,
49+
size: m[4] ?? "",
50+
id: m[5] ?? ""
51+
}
52+
) catch e (
53+
try (
54+
file "open" full "onlyaccess"
55+
local out = {
56+
uuid: fileGet(14),
57+
type: fileGet(1),
58+
name: fileGet(2),
59+
size: fileGet(12),
60+
id: fileGet(8)
61+
}
62+
file "close"
63+
return out
64+
) catch e2 (
65+
return { uuid: "?", type: "", name: name, size: "", id: "" }
66+
)
67+
)
68+
)
69+
70+
// -a: all entries, one per line with UUID
71+
// -l: long listing (type, size, name); with -a also shows uuid
72+
if longFmt (
73+
for i files.len (
74+
local name = files[i]
75+
local meta = entryMeta(folderPath, name)
76+
local display = name
77+
local color = txtc
78+
79+
if name.endsWith(".folder") or meta.type == ".folder" (
80+
display = name.endsWith(".folder") ? (name.trim(1, -8) ++ "/") (name ++ "/")
81+
color = global_accent
82+
)
83+
if name[1] == ":" (
84+
color = "#aaa"
85+
)
86+
87+
if getAll (
88+
terminal.writeLine([
89+
color, display.padEnd(" ", 28),
90+
"#666", " ",
91+
"#aaa", "" ++ meta.uuid
92+
])
93+
) else (
94+
terminal.writeLine([
95+
"#888", ("" ++ meta.type).padEnd(" ", 10),
96+
"#888", ("" ++ meta.size).padEnd(" ", 10),
97+
color, display
98+
])
99+
)
100+
)
101+
return
102+
)
103+
104+
// default: multi-column names only
36105
local maxLen = 0
37106
for i files.len (
38107
local name = files[i]

:path/stat.osl

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
// Unix-style stat — OFSF record metadata (path or uuid)
2+
if args.len == 0 (
3+
terminal.writeLine("usage: stat <path|uuid>")
4+
return
5+
)
6+
7+
local target = args[1]
8+
local resolved = terminal.resolvePath(target)
9+
local ok = false
10+
11+
// Try path, path.folder, then raw uuid / argument
12+
try (
13+
file "open" resolved "onlyaccess"
14+
ok = true
15+
) catch e (
16+
ok = false
17+
)
18+
19+
if !ok (
20+
try (
21+
file "open" (resolved ++ ".folder") "onlyaccess"
22+
ok = true
23+
resolved = resolved ++ ".folder"
24+
) catch e2 (
25+
ok = false
26+
)
27+
)
28+
29+
if !ok (
30+
try (
31+
file "open" target "onlyaccess"
32+
ok = true
33+
resolved = target
34+
) catch e3 (
35+
ok = false
36+
)
37+
)
38+
39+
if !ok (
40+
terminal.writeLine("stat: cannot stat '" ++ target ++ "': No such file or directory")
41+
return
42+
)
43+
44+
// entryLabels: type name location data data2 x y id created edited icon size permissions uuid
45+
local typ = fileGet(1)
46+
local name = fileGet(2)
47+
local location = fileGet(3)
48+
local dataField = fileGet(4)
49+
local data2 = fileGet(5)
50+
local x = fileGet(6)
51+
local y = fileGet(7)
52+
local id = fileGet(8)
53+
local created = fileGet(9)
54+
local edited = fileGet(10)
55+
local icon = fileGet(11)
56+
local size = fileGet(12)
57+
local perms = fileGet(13)
58+
local uuid = fileGet(14)
59+
file "close"
60+
61+
local fullName = name ++ typ
62+
local path = location ++ "/" ++ name ++ typ
63+
local dataPreview = dataField
64+
65+
if typ == ".folder" (
66+
fullName = name ++ "/"
67+
path = location ++ "/" ++ name
68+
try (
69+
local kids = ("" ++ dataField).JsonParse()
70+
if typeof(kids) == "array" (
71+
dataPreview = kids.len ++ " children"
72+
) else (
73+
dataPreview = "(folder)"
74+
)
75+
) catch e (
76+
dataPreview = "(folder)"
77+
)
78+
) else (
79+
local raw = "" ++ dataField
80+
if raw.len > 80 (
81+
dataPreview = raw.trim(1, 80) ++ "..."
82+
)
83+
)
84+
85+
local createdS = "" ++ created
86+
local editedS = "" ++ edited
87+
try (
88+
eval ("globalThis.__statC = (function(){ try { const n = +" ++ ("" ++ created).JsonStringify() ++ "; return n ? new Date(n).toISOString() : String(n) } catch(e) { return " ++ ("" ++ created).JsonStringify() ++ " } })()")
89+
eval ("globalThis.__statE = (function(){ try { const n = +" ++ ("" ++ edited).JsonStringify() ++ "; return n ? new Date(n).toISOString() : String(n) } catch(e) { return " ++ ("" ++ edited).JsonStringify() ++ " } })()")
90+
createdS = __statC
91+
editedS = __statE
92+
) catch e (
93+
// keep raw timestamps
94+
)
95+
96+
local permsS = perms
97+
try (
98+
if typeof(perms) == "array" or typeof(perms) == "object" (
99+
permsS = perms.JsonStringify()
100+
)
101+
) catch e (
102+
permsS = "" ++ perms
103+
)
104+
105+
terminal.writeLine(" File: " ++ fullName)
106+
terminal.writeLine(" Path: " ++ path)
107+
terminal.writeLine(" UUID: " ++ uuid)
108+
terminal.writeLine(" ID: " ++ id)
109+
terminal.writeLine(" Type: " ++ typ)
110+
terminal.writeLine(" Size: " ++ size)
111+
terminal.writeLine(" Data: " ++ dataPreview)
112+
terminal.writeLine("Access: " ++ permsS)
113+
terminal.writeLine("Create: " ++ createdS)
114+
terminal.writeLine("Modify: " ++ editedS)
115+
if icon != null and ("" ++ icon).len > 0 (
116+
local ic = "" ++ icon
117+
if ic.len > 60 (
118+
ic = ic.trim(1, 60) ++ "..."
119+
)
120+
terminal.writeLine(" Icon: " ++ ic)
121+
)
122+
if data2 != null and data2 != 0 and data2 != "" (
123+
terminal.writeLine(" Data2: " ++ data2)
124+
)
125+
terminal.writeLine(" Pos: " ++ x ++ ", " ++ y)

Fonts/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
- ojff (origin json font file)
44

5+
## Browser font build
6+
7+
The DOM renderer uses a generated TrueType version of the built-in Origin font.
8+
Regenerate it after editing `origin.ojff`:
9+
10+
```sh
11+
python3 -m pip install fonttools
12+
python3 Fonts/ojff_to_ttf.py Fonts/origin.ojff Fonts/origin.ttf
13+
```
14+
515
## About
616

717
/Fonts is a repository for originOS fonts, this allows people to upload custom fonts for users to download into the originOS system, i plan to add a terminal command to install and list fonts directly from this directory

Fonts/origin.ttf

278 KB
Binary file not shown.

OSL Programs/apps/System/.Install_system.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
"path": "Origin/(A) System/User Applications",
229229
"name": "Files.osl",
230230
"icon": "w 10 c #ff724f square 0 0 5 5 w 8 c #111 square 0 0 5 5 w 2.5 c #ff724f square -4 3 1 1 line -2.5 3.5 1.5 0 square 0 -1 5 2.5 w 4 square 0 -1 4 1",
231-
"version": "9.2"
231+
"version": "9.3"
232232
},
233233
{
234234
"url": "https://origin.mistium.com/OSL%20Programs/apps/System/Settings.osl",
@@ -256,7 +256,7 @@
256256
"path": "Origin/(A) System/User Applications",
257257
"name": "Summit.osl",
258258
"icon": "c #6a54b3 w 10 square 0 0 5 5 c #111 w 8 square 0 0 5 5 dot 0 0 c #6a54b3 w 1.5 line -5 -4 -2.5 1 cont -1 -1 line 0 -4 2.7 3 cont 5 -4",
259-
"version": "3.5"
259+
"version": "4.0"
260260
},
261261
{
262262
"url": "https://origin.mistium.com/OSL%20Programs/apps/System/Studio.osl",
@@ -342,4 +342,4 @@
342342
"icon": "",
343343
"version": "1.2"
344344
}
345-
]
345+
]

0 commit comments

Comments
 (0)