Workspace - Linux desktop grid for CraftOS!

Started by LDDestroier, Sep 18, 2024, 05:46 AM

Previous topic - Next topic

LDDestroier

New and improved,
Workspace

wget https://github.com/LDDestroier/workspace/raw/refs/heads/main/workspace.lua
Workspace is a multitasking shell for CraftOS that lets you arrange your programs on a desktop grid, similarly to how most modern Linux desktops work.

GIF of Workspace in action

CTRL+SHIFT+Arrow keys to move between workspaces.
CTRL+SHIFT+TAB+Arrow keys to swap the currently selected workspace with another.
CTRL+SHIFT+[WASD] to add a new workspace.
CTRL+SHIFT+Q to delete a workspace.
CTRL+SHIFT+P to pause a workspace.
You can even use CTRL+SHIFT+Mouse1 to click and drag to navigate between workspaces!

DevilishDawn43

Dang, you beat me to it, anyways its a cool program.
browsedns.com is where you can find me most, I will update it will the link to my profile

My GitHub alt: DevilishDawn431

shorun

it ran exactly once, now refuses to start, nil error on line 930. re-downloading it doesn't fix it.
it also breaks many user programs that use GUI elements, the GUI freezes.

but for the one time it did work it looked amazing for a while, wish it didn't break other programs and ran more then once, it was nice while it worked.

could this be because i'm running it on a MP server?

LDDestroier

Quote from: shorun on Sep 19, 2024, 03:57 PMit ran exactly once, now refuses to start, nil error on line 930. re-downloading it doesn't fix it.
it also breaks many user programs that use GUI elements, the GUI freezes.

but for the one time it did work it looked amazing for a while, wish it didn't break other programs and ran more then once, it was nice while it worked.

could this be because i'm running it on a MP server?

I found out what the crash at line 930 was, that's fixed.
As for those GUI apps that break or freeze, which ones are they?

shorun

Quote from: LDDestroier on Sep 20, 2024, 05:29 AM
Quote from: shorun on Sep 19, 2024, 03:57 PMit ran exactly once, now refuses to start, nil error on line 930. re-downloading it doesn't fix it.
it also breaks many user programs that use GUI elements, the GUI freezes.

but for the one time it did work it looked amazing for a while, wish it didn't break other programs and ran more then once, it was nice while it worked.

could this be because i'm running it on a MP server?

I found out what the crash at line 930 was, that's fixed.
As for those GUI apps that break or freeze, which ones are they?

This one has it's gui freeze. https://github.com/terreng/computercraft-streaming-music

LDDestroier

Quote from: shorun on Sep 20, 2024, 05:54 PM
Quote from: LDDestroier on Sep 20, 2024, 05:29 AM
Quote from: shorun on Sep 19, 2024, 03:57 PMit ran exactly once, now refuses to start, nil error on line 930. re-downloading it doesn't fix it.
it also breaks many user programs that use GUI elements, the GUI freezes.

but for the one time it did work it looked amazing for a while, wish it didn't break other programs and ran more then once, it was nice while it worked.

could this be because i'm running it on a MP server?

I found out what the crash at line 930 was, that's fixed.
As for those GUI apps that break or freeze, which ones are they?

This one has it's gui freeze. https://github.com/terreng/computercraft-streaming-music

Oh yeah, I definitely messed up sleep() and os.sleep(). That music app in particular should be working fine on Workspace now. Sorry about that!

shorun

#6
indeed the music app works now, and the crashes also stopped. it works fine on it's own and so far it's stable to.

there are a few practical problems i'm having and one potential bug.

workspace also doesn't seem to like shell.openTab() much, returns a nil error on that one.
is there a way for software to detect if workspace is running? openTab isn't needed when using workspace so if it can be detected it can be avoided when needed, fixing this issue in a more elegant way then to opening a tab inside a workspace.


another issue, any global variable set after running workspace doesn't store or change, this is quite a problem since i use those to cache data and other people's programs sometimes also use those, breaking those to.
i can read what's in "_G.version" and "_G.server" when these are set before running workplace, but once workplace is running no _G. variables can be set or changed anymore.

is there a way to fix or go around this? i see you made a copy of the _G table to __G, but that should not break _G right?

LDDestroier

Quote from: shorun on Sep 21, 2024, 09:22 PMworkspace also doesn't seem to like shell.openTab() much, returns a nil error on that one.
is there a way for software to detect if workspace is running? openTab isn't needed when using workspace so if it can be detected it can be avoided when needed, fixing this issue in a more elegant way then to opening a tab inside a workspace.

Multishell should be working now, just forgot to add it to the environment. Although it does operate outside of Workspace, so Workspace will only run in whichever tab it started in.

Quote from: shorun on Sep 21, 2024, 09:22 PManother issue, any global variable set after running workspace doesn't store or change, this is quite a problem since i use those to cache data and other people's programs sometimes also use those, breaking those to.
i can read what's in "_G.version" and "_G.server" when these are set before running workplace, but once workplace is running no _G. variables can be set or changed anymore.

is there a way to fix or go around this? i see you made a copy of the _G table to __G, but that should not break _G right?

I'm not sure how to replicate this. Within Workspace I can still make new entries into _G, and whatever I set is noticeable from other workspaces. Any value set to _G before running workspace is accessible after running it too. Any values added to the fake _G just won't be propagated to the real _G. Is that the root of your issue?

shorun

#8
Quote from: LDDestroier on Sep 22, 2024, 04:13 AM
Quote from: shorun on Sep 21, 2024, 09:22 PMworkspace also doesn't seem to like shell.openTab() much, returns a nil error on that one.
is there a way for software to detect if workspace is running? openTab isn't needed when using workspace so if it can be detected it can be avoided when needed, fixing this issue in a more elegant way then to opening a tab inside a workspace.

Multishell should be working now, just forgot to add it to the environment. Although it does operate outside of Workspace, so Workspace will only run in whichever tab it started in.

Quote from: shorun on Sep 21, 2024, 09:22 PManother issue, any global variable set after running workspace doesn't store or change, this is quite a problem since i use those to cache data and other people's programs sometimes also use those, breaking those to.
i can read what's in "_G.version" and "_G.server" when these are set before running workplace, but once workplace is running no _G. variables can be set or changed anymore.

is there a way to fix or go around this? i see you made a copy of the _G table to __G, but that should not break _G right?

I'm not sure how to replicate this. Within Workspace I can still make new entries into _G, and whatever I set is noticeable from other workspaces. Any value set to _G before running workspace is accessible after running it too. Any values added to the fake _G just won't be propagated to the real _G. Is that the root of your issue?

so, my OS sets some global variables that can be accessed easely by other programs, eg: "nslookup", wich is used to look up a computers id or name much like the real nslookup does stores it's data in _G.lookupid and some other variables.
when run from inside workspace, these variables never update, all programs using them break, including missouni's "goldcube" meaning no more blackjack either!


if you want to see for yourself and replicate the issue, you'll have to replicate the entire thing, so i'll guide you trough installing minux with workspace quickly, for now i've set it as an optional setting.

on a CC computer,
"wget https://minux.vtchost.com/apt/netinstall.sh"
run netinstall.sh
follow the installer, use either local or disabled login.
reboot, then in ui/menu selection, chose "prompt".
run "config ui workspace"
reboot

now, open lua shell, do "print(_G.login)", it should print either your username or "foo" if login is disabled.
try to change this variable, do _G.login = "test", then print it again, it's now nil.

now do print(_G.version) , it should print the version number, change this value to anything else and print it again, it's now nil.

if it was loaded before workspace is loaded (wich is right after login and the very last stepp of the OS bootup process) then the variable remains set and works, untill you either try to change it. changing it manually reset it to nil, programs can't change it at all, for them it's "read only".

this is like this for all programs, nothing can change any global value anymore. all "_G."'s are broken.
there are a few programs in minux's apt repo that are 3rd party, i can't change those variables, i can change them in minux but it would still break all other programs.
once you turn off workspace (run "config ui prompt") and get back to the adapted shell i had to make to get aliases running in workspace, all the _G. variables work fine again as if nothing happened.

if you run "config debug full" minux will print more output and write this output in the logfiles in /var/, in case you want to see what happens before workspace is loaded.

could the problem be because i did change the config folder to "/etc/minux-main/workspace/" ?

all the files adjusted or involved are located at https://minux.vtchost.com/apt/repository/minux-main/etc/minux-main/workspace/

This is for testing and not the final implementation, documentation, full intigration and credits will follow after it all works as intended. It's also based on the version you had before fixing openTab. Tought i didn't change it and rather show it first, seems like this is a bug you should know about

either way, exploring how to get this far did lead to learning a lot of new things about CC and shell.lua in particular, so thanks for this.

shorun

after last update, works like a charm.

10/10 would install on every system.

QuickMuffin8782

Quote from: LDDestroier on Sep 22, 2024, 04:13 AM
Quote from: shorun on Sep 21, 2024, 09:22 PMworkspace also doesn't seem to like shell.openTab() much, returns a nil error on that one.
is there a way for software to detect if workspace is running? openTab isn't needed when using workspace so if it can be detected it can be avoided when needed, fixing this issue in a more elegant way then to opening a tab inside a workspace.

Multishell should be working now, just forgot to add it to the environment. Although it does operate outside of Workspace, so Workspace will only run in whichever tab it started in.

Perfect! I needed this small little change for my operating system base that's coming up!
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782