Skip to content

Commit

Permalink
Theme and discord chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Mistium authored Nov 21, 2024
1 parent 40fcd68 commit e610c7e
Showing 1 changed file with 86 additions and 21 deletions.
107 changes: 86 additions & 21 deletions OSL Programs/apps/System/Origin_Start.osl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "window_tools" as "wt"

permission "request" "account"
window_y = screensize_y * -1.2
window "dimensions" screensize_x screensize_y
Expand Down Expand Up @@ -38,34 +40,59 @@ use1 = "none"
v = origin.version
version = v.trim(1,v.len - 2) ++ "." ++ v[v.len - 1] ++ "." ++ v[v.len]

repo_data = ""

chat_y = 0
target_chat_y = 0

def "close" (
network "server" "disconnect_rotur_discord"
window "stop"
)

network "server" "connect_rotur_discord"

discord_messages = []

mainloop:

wt:load_theme

if new_network_data (
if network_data_command == "my_files_usage" (
usage = network_data
new_network_data = false
)
if network_data_command == "new_rotur_discord" (
discord_messages.append(network_data)
)
new_network_data = false
)

if repo_data.isType("string") (
repo_data = "https://api.github.com/repos/Mistium/Origin-OS".getAsync().JsonParse()
)

window_y += target_y - window_y / 5
window "refresh_bg"
window "y" window_y.round

square 700 700 15 : c#global_accent
square 700 700 10 1 : c#000
if mouse_down and clicked.not "window stop"
square 700 700 10 1 : c#window_colour
if mouse_down and clicked.not (
close
)

goto 0 0
square 0 700 10 : c#111
square 0 700 10 : c#prim
goto 0 325
square 700 50 10 : c#151515
square 700 50 10 : c#seco
goto 0 -325
square 700 50 10
goto -325 325
image user_icon.str 40

goto 325 -325
icon "power" 1 : hover_size#1.05 c#fff
icon "power" 1 : hover_size#1.05 c#txtc
if clicked (
network "logout"
terminal "shutdown"
Expand All @@ -87,31 +114,31 @@ if hour < 12 (
msg = "Good Afternoon" + username
)
goto -290 325
text msg 13 : c#fff
text msg 13 : c#txtc

goto 325 325
icon "close" 1
if clicked (
window "stop"
close
)

goto -180 230
square 320 100 10 : c#222
square 320 100 10 : c#prim

if usage.len == 0 (
change_x -100
text "Loading Storage Info" 10 : c#fff
text "Loading Storage Info" 10 : c#txtc
) else (
if use1 == "none" "find_sizes"
goto -245 260
text "Storage" 10 : c#fff
text "Storage" 10 : c#txtc
goto -245 230
text `Used ${use1}${unit} / ${use2}${unit2}` 9
goto -140 200
bar 200 20 10 usage[3] : c#111
bar 200 20 10 usage[3] : c#seco
usepercent = (usage[3] * 100).round ++ "%"
goto -295 - (usepercent.len * 8) 230
text usepercent 16 : c#fff
text usepercent 16 : c#txtc
)

goto -180 110
Expand All @@ -124,10 +151,8 @@ if mouse_touching (
)
image "https://discordapp.com/api/guilds/1147362734300725298/widget.png?style=banner2" 320

network "get" "https://api.github.com/repos/Mistium/Origin-OS"
repo_data = data.str
goto -180 -10
square 320 100 10 : c#333
square 320 100 10 : c#prim
if mouse_touching (
cursor "pointer"
if onclick (
Expand All @@ -137,19 +162,59 @@ if mouse_touching (
goto -290 -10
image "https://raw.githubusercontent.com/Mistium/Origin-OS/main/Resources/github_icon.png" 60
goto -230 2
text "Github" 13 : c#fff
text "Github" 13 : c#txtc
goto -222 -27
icon "w 3 line 0 9.5 5 3 cont 10 3 cont 5 -2 cont 7 -10 cont 0 -5 cont -7 -10 cont -5 -2 cont -10 3 cont -5 3 cont 0 9.5" 0.7
text data."stargazers_count" 10 : chx#15
text repo_data.stargazers_count 10 : chx#15
icon "eye" 0.7 : chx#30
text data."subscribers_count" 10 : chx#15
text repo_data.subscribers_count 10 : chx#15

goto -180 -130
square 320 100 10 : c#111
square 320 100 10 : c#prim
change_x -110
icon "origin-logo" 2.5 : c#fff
icon "origin-logo" 2.5 : c#txtc
change 50 10
c #fff
text "originOS" 13
change -50 -20
text "v" ++ version 10


frame -5 295 350 -295
goto 0 0
square frame.width frame.height 10 : c#prim
loc 2 2 50 -540 + chat_y
x = x_position
c txtc
start_y = y_position
if discord_messages.len > 15 (
discord_messages.delete(1)
)
each i message discord_messages (
set_x x
if message.onlycontent.not (
change -30 -30
image message.avatar_url 30
change 30 10
text message.username 10
set_x x
change_y -20
text message.content 9
change_y -20
) else (
text message.content 9
change_y -20
)
)
target_chat_y = start_y - y_position
chat_y += target_chat_y - chat_y / 10

goto 0 frame.bottom + 25
c window_colour
square frame.width - 25 30 10
input frame.width - 35 25 "message" "Type to originOS & roturTW #general"
if "enter".onpress and selected_input == "message" and input_message != "" (
network "server" "send_rotur_discord" input_message
input_message = ""
)
frame "clear"

0 comments on commit e610c7e

Please sign in to comment.