From e610c7e1904004ebbc5dd724ec4980df91e91b5c Mon Sep 17 00:00:00 2001 From: Mistium <92952823+Mistium@users.noreply.github.com> Date: Thu, 21 Nov 2024 20:34:51 +0000 Subject: [PATCH] Theme and discord chat --- OSL Programs/apps/System/Origin_Start.osl | 107 +++++++++++++++++----- 1 file changed, 86 insertions(+), 21 deletions(-) diff --git a/OSL Programs/apps/System/Origin_Start.osl b/OSL Programs/apps/System/Origin_Start.osl index 052c24fb..baa5611b 100644 --- a/OSL Programs/apps/System/Origin_Start.osl +++ b/OSL Programs/apps/System/Origin_Start.osl @@ -1,3 +1,5 @@ +import "window_tools" as "wt" + permission "request" "account" window_y = screensize_y * -1.2 window "dimensions" screensize_x screensize_y @@ -38,13 +40,36 @@ 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 @@ -52,20 +77,22 @@ 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" @@ -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 @@ -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 ( @@ -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"