Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support through a web app / or better #328

Open
16 tasks
leMicin opened this issue Dec 18, 2024 · 11 comments
Open
16 tasks

Linux support through a web app / or better #328

leMicin opened this issue Dec 18, 2024 · 11 comments

Comments

@leMicin
Copy link
Contributor

leMicin commented Dec 18, 2024

Disclaimer

This is probably not coming soon, but we will start dumping information and ideas about the eventual support.

Task list

The following task list is probably not complete and we will update it as tasks are discovered and completed.

  • Create a Linux specific project (Sidekick.Linux or Sidekick.Tauri)
  • Implement platform specific services
    • ITrayProvider (Sidekick.Linux)
    • IViewLocator (Sidekick.Linux)
    • IApplicationService (Sidekick.Linux)
    • IProcessProvider (Sidekick.Common.Platform)
  • Use cross platform services for Linux. These services are already used in Windows and should be cross platform already
    • IKeyboardProvider for keybinds
    • IClipboardProvider for access to the clipboard.
  • Tauri (One option)
    • Call rust from the CSharp project to open the tauri view (in the IViewLocator implementation)
  • Workflow update
    • Add linux workflow steps to build new packages
    • Add linux packages to assets
  • Website update
    • Update information about where logs and settings are stored on different platforms
      ENM: System.Environment.SpecialFolder.ApplicationData
      WIN: C:\Users\xxx\AppData\Roaming
      LIN: /home/xxx/.config
      OSX: /Users/xxx/.config
@jeagerx
Copy link

jeagerx commented Dec 19, 2024

what do you need ?

@leMicin
Copy link
Contributor Author

leMicin commented Dec 19, 2024

We have a .Web project that we use for mainly development. We would need to make an easy to install package from the .Web project.

  • Simplify the setup process
  • It is fine if it opens a console window
  • Open an initial webpage to the configured localhost: port
  • Cleanup the initial home screen and improve navigation

Haven't put too much thought yet. If there were an easy to use package, either through a publish profile or build profile, I could then start cleaning it up a little and producing the desired package with each release.

Any help is welcome, and would make this move faster for sure.

@leMicin leMicin changed the title Linux support through a web app Linux support through a web app / or better Dec 20, 2024
@leMicin
Copy link
Contributor Author

leMicin commented Dec 20, 2024

From a Discord comment: Use https://github.com/webview/webview instead of a full-blown browser. it also uses xdotools to move the window to the mouse afterwards, make it always-on-top, and handles the startup of the webserver

@jeagerx
Copy link

jeagerx commented Dec 20, 2024

As writed on discord, it's working for me on Fedora
sudo dnf install -y npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0

Get lastest source, edit Sidekick.sln and comment those 2 lines :

#Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Wpf", "src\Sidekick.Wpf\Sidekick.Wpf.csproj", "{0E8A5165-AFEE-42BB-9C96-EA288F613BDE}"
#EndProject

Run

dotnet build
dotnet ./src/Sidekick.Web/bin/Debug/net8.0/Sidekick.dll
firefox localhost:5000

@leMicin
Copy link
Contributor Author

leMicin commented Dec 22, 2024

Nice library for a potential cross platform wrapper for Blazor: https://github.com/JinShil/BlazorWebView

@veschin
Copy link

veschin commented Dec 22, 2024

As writed on discord, it's working for me on Fedora sudo dnf install -y npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0

Get lastest source, edit Sidekick.sln and comment those 2 lines :

#Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Wpf", "src\Sidekick.Wpf\Sidekick.Wpf.csproj", "{0E8A5165-AFEE-42BB-9C96-EA288F613BDE}"
#EndProject

Run

dotnet build
dotnet ./src/Sidekick.Web/bin/Debug/net8.0/Sidekick.dll && firefox localhost:5000

I followed all the steps on Arch Linux and was able to run the application. However, the static files (for rendering) did not load, and I received the following warning:

warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16]
      The WebRootPath was not found: /tmp/Sidekick/wwwroot. Static files may be unavailable.

image

@veschin
Copy link

veschin commented Dec 22, 2024

As writed on discord, it's working for me on Fedora sudo dnf install -y npm nodejs dotnet-sdk-8.0 aspnetcore-runtime-8.0 gtk4 webkitgtk6.0
Get lastest source, edit Sidekick.sln and comment those 2 lines :

#Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sidekick.Wpf", "src\Sidekick.Wpf\Sidekick.Wpf.csproj", "{0E8A5165-AFEE-42BB-9C96-EA288F613BDE}"
#EndProject

Run

dotnet build
dotnet ./src/Sidekick.Web/bin/Debug/net8.0/Sidekick.dll && firefox localhost:5000

I followed all the steps on Arch Linux and was able to run the application. However, the static files (for rendering) did not load, and I received the following warning:

warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16]
      The WebRootPath was not found: /tmp/Sidekick/wwwroot. Static files may be unavailable.

image

my bad, after build needed to run:

cd src/Sidekick.Web/
dotnet ./bin/Debug/net8.0/Sidekick.dll

And now everything works as expected.
image

I found the required sequence of actions here:
https://discord.com/channels/664252463188279300/1316628179217027133/1317626241674641491

@jeagerx
Copy link

jeagerx commented Dec 22, 2024

Its doesnt like the oneliner

@dotaxis
Copy link

dotaxis commented Dec 25, 2024

I wrote a bash script which searches for items in the default browser. Can be bound to any hotkey.

Server needs to be running already, and this assumes you are on wayland and have wl-clipboard and xdotool installed.

#!/bin/bash
# Copy to clipboard and search in Sidekick

original_clip=$(wl-paste) # store what's currently on the clipboard
xdotool keydown ctrl key c keyup ctrl # type ctrl + c in game window using xdotool because proton uses xwayland
sleep 0.1 # sleep for reasons
new_clip=$(wl-paste)

# Check if we copied an item, then encode it to base64
if [[ $new_clip == *"Item Class"* ]] ; then
  encoded_clip=$(echo -n "$new_clip" | base64) 
  xdg-open "http://localhost:5000/trade/xurl_${encoded_clip}" # search for the item in browser
else
  echo "Did not detect an item from PoE2"
fi

echo -n "$original_clip" | wl-copy # restore clipboard

@leMicin
Copy link
Contributor Author

leMicin commented Dec 26, 2024

Massive progress made by @dotaxis on a script/tool that opens the Sidekick web app automatically.
https://github.com/dotaxis/rs-sidekick-helper

@solacelost
Copy link

Any chance we could get the address/port exposed? I don't want to run this directly on my Linux machine, but would rather containerize the web server portions and the networking involved there requires opening it up beyond binding the socket on localhost only.

I don't know C# very well or Blazor at all, or I'd just go implement that myself. Easier to ask and hope 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants