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

[REQUEST] Bring btop to windows? (Completed) #290

Closed
m1karii opened this issue Mar 16, 2022 · 20 comments
Closed

[REQUEST] Bring btop to windows? (Completed) #290

m1karii opened this issue Mar 16, 2022 · 20 comments
Assignees
Labels
enhancement New feature or request

Comments

@m1karii
Copy link

m1karii commented Mar 16, 2022

TL;DR btop has nice UI and there isnt really any CLI resource monitor for windows

@m1karii m1karii added the enhancement New feature or request label Mar 16, 2022
@aristocratos
Copy link
Owner

aristocratos commented Mar 24, 2022

@m1karii
While I wouldn't mind having btop on Windows since I have the misfortune of managing multiple Windows servers in my work, it's unlikely to happen soon if ever.

Porting btop to a non POSIX operating system would require rewriting a lot of things from scratch, not only the system info collection code but things like threading, input and output.

If I at some point got a week free and are bored, I might give it a go ;)
But if it ever happens it would likely be it's own project aimed only at Windows with a suitable silly name like bTop4Win++ or something...

@zampierilucas
Copy link

@aristocratos you might be able to use b*top on WSL, that would eliminate the requirement of complete rewrite.

@aristocratos
Copy link
Owner

@zampierilucas @m1karii
Turns out input, output and threading was the easy part.
The tricky part is navigating all the different windows functions and API's for collecting system information, there seem to be at least 3 functions for everything that does almost all you want it to do, but you're forced to mix them all to get the desired information...

But I've got it running :)
Key/mouse input, output/drawing and threading all working great. Cpu and memory stats are done, but a lot of stuff to do/fix/cleanup still...

image

@aristocratos
Copy link
Owner

aristocratos commented Apr 22, 2022

So it's coming along...

All collection is done + a separate view for Windows services and GPU stats for nvidia cards :)
Need to fix killing programs and stopping/starting services, temperature sensors and some small stuff and it should be done, but currently in the middle of a move while also dealing with a death in my family so will be a little while before I have time to finish it up.

image

@aristocratos aristocratos changed the title [REQUEST] Bring btop to windows? [REQUEST] Bring btop to windows? (Yes. In development) Apr 22, 2022
@aristocratos aristocratos pinned this issue Apr 22, 2022
@mortenmoulder
Copy link

@aristocratos Well damn, that looks really good. I tried it in WSL yesterday, but wouldn't give me a lot of useful details.

Do you have a working prototype we can try? What you posted in that screenshot looks really, really good.

@WSLUser
Copy link

WSLUser commented Jun 17, 2022

it would likely be it's own project aimed only at Windows

You do realize I brought this up before due to C++ being a platform agnostic language. Why should you need a separate project? Better coding practice would be to make the project portable for even Windows. There are plenty of projects that offer support for all major platforms. Take the terminal Contour for example, it's able to build and run on all 3 major OS and as a terminal utility, this project should be able to support terminals like Contour without need for a separate project. It's understandable if you're not familiar enough with C++ to write it in a portable way that even Windows can use and use IF statements for Windows specific API calls, you surely are doing something similar for Mac. I certainly don't have such familiarity but knowing it has been done and is pretty common should provide the motivation. It would of been easier if you had done this from the start but you will just need to do some refactoring so that you aren't relying as much on OS specific functionalities, which is always sub-optimal.

@aristocratos
Copy link
Owner

@WSLUser
You are making a lot of statements with what seems to be a very uninformed understanding of what this project is, the codebase, C++ and frankly what's happening in this thread.

You do realize I brought this up before due to C++ being a platform agnostic language. Why should you need a separate project? Better coding practice would be to make the project portable for even Windows.

Btop++ was written with the aim of supporting linux, macos and freebsd, all posix compatible operating systems. Windows is not a posix compatible operating system which means alot of code needed to be changed.

I do question your judgement as arbiter of "Better coding practice", since you don't seem to have a that much C++ experience or understanding of the btop++ code.

There are plenty of projects that offer support for all major platforms. Take the terminal Contour for example, it's able to build and run on all 3 major OS and as a terminal utility, this project should be able to support terminals like Contour without need for a separate project.

Because plenty of projects support "all major platforms", every other project should too?
I'm really confused by your mental leaps:

  1. Contour runs on multiple platforms
  2. Contour is a terminal emulator
  3. Btop++ runs in a terminal
  4. Therefore btop++ should run on all platforms Contour does?

I question the sanity of this logic.

It's understandable if you're not familiar enough with C++ to write it in a portable way that even Windows can use and use IF statements for Windows specific API calls, you surely are doing something similar for Mac. I certainly don't have such familiarity but knowing it has been done and is pretty common should provide the motivation.

There are some subtle clues in this thread, like my post above that proclaims that btop4win is almost done + the screenshots, that should in fact make it clear that btop4win (that would be the btop++ version for Windows) is almost done...

It would of been easier if you had done this from the start [...]

Writing alternate windows code for all posix centered code at the start would have been the same amount of work as doing it now, but instead of bloating the codebase with windows stuff, I'm writing it in it's own project to make it possible to just open the solution in Visual Studio and easily have all Windows dependencies available and directly compile it with msvc.

[...] but you will just need to do some refactoring so that you aren't relying as much on OS specific functionalities, which is always sub-optimal.

Sir, this is a system monitoring program. It should not be a shock that there is no generic functions for getting cpu percentages, disk usage, memory usage, temperatures, etc... And because Windows isn't posix compatible, the posix functions for terminal i/o (and others) that works on linux, macos and freebsd don't work on Windows.

Honestly, I'm not quite sure what the aim with your post is?

Regardless, btop4win will be released when I've got time and energy to pick it up again, probably within a month or so.

@kolpav
Copy link

kolpav commented Jun 21, 2022

The absolute entitlement of the poster above. It gets better each sentence 😄 my favorite part is

you will just need to do some refactoring so that

I am sure if @aristocratos ever feels unmotivated to work on btop in his free time for others to use for free knowing

it has been done and is pretty common should provide the motivation

will provide enough motivation to carry on doing so.

btw @aristocratos its easier to remember the dumb comments rather than positive/constructive ones personally I installed btop along with buch of other cli tools to try not thinking much of it and it was one of the few that I haven't uninstalled shortly after and its usually one of the first things I install on new systems its fantastic, little things like vim navigation support and so on 🙏

@andrey-zotov
Copy link

I second @kolpav - btop is an awesome tool @aristocratos, clearly made with love and attention to detail!
A grateful user of both bpytop and btop on WSL and Mac here 😀

@aristocratos
Copy link
Owner

@m1karii @andrey-zotov @kolpav @mortenmoulder
First release of btop4win available at https://github.com/aristocratos/btop4win :)

@andrey-zotov
Copy link

Oh nice, you're the man @aristocratos !
BTW OpenHardwareMonitor hasn't been maintaned recently, LibreHardwareMonitor is the maintained fork.

@aristocratos
Copy link
Owner

@andrey-zotov

BTW OpenHardwareMonitor hasn't been maintaned recently, LibreHardwareMonitor is the maintained fork.

Oh, good to know. Will likely rewrite based on LibreHardwareMonitor and try to add an intermediary dll that btop4win can directly import from, to get away from how I currently have implemented it.

@andrey-zotov
Copy link

@andrey-zotov

BTW OpenHardwareMonitor hasn't been maintaned recently, LibreHardwareMonitor is the maintained fork.

Oh, good to know. Will likely rewrite based on LibreHardwareMonitor and try to add an intermediary dll that btop4win can directly import from, to get away from how I currently have implemented it.

LHM has a built-in webserver which serves JSON with sensors data - it might be easier to pull values from it rather than integrating via dll (which I think not just a user mode dll, it injects a kernel driver to read sensors - that's why it needs elevation).
btop could probe it on start on the default port (http://127.0.0.1:8085/data.json) and accept command-line options.
I can try to push a PR for this.

@aristocratos
Copy link
Owner

@andrey-zotov
Already got a working DLL exporting from C# to managed C++ to the unmanaged C++ of btop4win :)

Reading from the webserver would mean the need for adding netcode and json parsing, which i suspect would use a lot of cpu cycles.
But if you would like to work on it as an alternative to the DLL import without the need for admin rights, feel free to create a branch. And if works out we can add it as a third alternative in the releases.

But running btop4win elevated would be the recommendation regardless, otherwise a lot of information for processes not owned by the user will be missing.

@kolpav
Copy link

kolpav commented Aug 30, 2022

Took you long enough @aristocratos. I assume you finally got motivated, picked up some good coding practices, read about if statements and got yourself familiar with C++.
Hope you now realize it has already been done before, reflect on your past mistakes otherwise we will not let it slide so easily next time.

Jokes aside, cg on bringing btop to even more users 🎉

@aristocratos
Copy link
Owner

Closing this since it's completed. Further ideas or discussions regarding btop4win should be redirected to https://github.com/aristocratos/btop4win

Thanks everyone for the support ❤️

@shayneoneill
Copy link

I know you closed this, but dude this is awesome work! Sometimes that just needs to be said.

@aristocratos aristocratos changed the title [REQUEST] Bring btop to windows? (Yes. In development) [REQUEST] Bring btop to windows? (Completed) May 20, 2023
@tony8077616
Copy link

Closing this since it's completed. Further ideas or discussions regarding btop4win should be redirected to https://github.com/aristocratos/btop4win

Thanks everyone for the support ❤️

Do you still support at btop4win ?

@aniketgm
Copy link

@aristocratos Thanks a lot for bringing this to Windows. But how to set the config file on Windows ?
I created the $HOME\.config\btop\btop.conf and added a simple config. But btop did not have any effect from this config.
And the config was very simple:

color_theme = "tomorrow-night"

@jm3
Copy link

jm3 commented Oct 31, 2024

📌 Unpin this issue now that it's completed and merged? ;)

image

PS I love btop!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests