Yes, as
@stan has said I use Cygwin on my Windows-based work PC. Which works for any terminal based stuff. Bash scripts and such-the-like.
I even run things like tmux (terminal multiplexer), and cmus (terminal based jukebox) under Windows in Cygwin.
I have also got Cygwin/X installed - Which is a version of X11 that has been ported to run on Cygwin.
So I can build and run some graphical linux applications on Cygwin/X too. But in order to run them you need some kind of desktop, or window manager session running, because plain X11 looks horrible!
It is possible to get desktops like XFCE, Gnome and KDE to run in Cygwin/X. But I've never personally tried.
However, I do run suckless dwm tiling window manager (built and installed from source) instead of a desktop. It's light on resources and runs smoothly.
Whenever I want to run a graphical linux program that has been compiled to run in Windows via cygwin, I start X11 using an alias called
wm
in my
.bashrc
:
Bash:
alias wm='startx /usr/local/bin/dwm &> /dev/null &'
And that will start X11 using dwm as a window manager.
Once dwm has started up - I can open up any graphical applications I have built and/or installed.
So I can use Cygwin to compile graphical applications and then run them under Cygwin/X.
Here are some screenshots:
Here's Cygwin64 Terminal running on my Windows work PC:
Above I'm running a tmux session with a few tabs/panes. In my tab 1, my "Home" tab.
I've just ran the commands
cal
(calendar),
date
(date/time) and
moon
- which is a short script I wrote which gets the moon phase from wttr.in.
And here's Cmus running in tab 5 "Music" of my tmux session. Just in case anybody still doesn't believe that Cmus will run on Windows via Cygwin!
And yes, I do have rather a lot of music from Anime soundtracks in my collection! Sorry, not sorry! Ha ha!
Next I went to one of my other tabs and ran wm, to bring up Cygwin/X running dwm. Whilst I was waiting, I switched back to my "home" tab.
When the dwm window popped up in my other monitor - I hit shift+alt+enter to open a new terminal (my version of dwm on windows uses the default keybinds. I haven't added any custom binds.). The default terminal in my dwm installation is st (suckless terminal) - a different terminal emulator to the cygwin64 terminal.
I typed the command
tmux attach
to attach to the tmux session that was already running in my cygwin64 terminal window (pictured above). So now my Cygwin64 terminal window AND the st terminal window were connected to the same tmux session.
Then I hit alt+p to bring up dwm's text based menu/launcher (dmenu) and ran idle2.7 (Python IDE) and loaded a random python script. tictactoe.py - which is from a tkinter tutorial I did a number of years ago.
So that yielded the following screenshot:
Above: dwm running in Cygwin/X, running Idle2.7 and st terminal, attached to my existing tmux session.
Unfortunately, I realised as I was writing this, that I haven't actually got any decent graphical Linux applications installed ATM. I mostly work in the terminal in Cygwin64 terminal nowadays. I don't run graphical Linux based applications very often at all. So I couldn't find any decent examples. Hence loading Idle and an old tictactoe python script.
The tictactoe.py script is a graphical application using tkinter - so it won't run in Cygwin64 terminal - because it needs an X-server.
So it has to be ran inside a Cygwin/X session running dwm (tiling window manager).
If I hit F5 in Idle, to run the tictactoe.py script, I get this:
That brought up an extra Idle2.7 python terminal, with any error messages from the tictactoe.py script and also brought up a graphical window running the tictactoe script.
All of those windows are in "tag 1" of dwm.
dwm was in tiling mode, so it tiled the running applications in "tag 1" to take up all of the space on the screen.
In dwm "tags" are similar to "virtual desktops" in other desktops like Gnome, or KDE. You can see the other "tags" listed in the upper left corner of the screenshot. Tags 1-9 are like separate workspaces. Tag 0 is a special tag that will show ALL applications running in ALL tags. There are other display options, like "Monocle" mode, which displays the active window in full-screen and "floating" mode which allows you to drag and re-size windows. But enough about dwm and dwm's tags. This isn't an article about the awesomeness of dwm. The primary focus here is the awsomeness of Cygwin and Cygwin/X.
As mentioned - I don't really use Cygwin/X for running graphical applications much nowadays. I really only use it if I need to use a lot of tmux sessions and I don't want to have a bunch of Cygwin64 terminal windows all over my desktop.
Instead, I can have multiple terminals open in different "tags" in dwm, each running different tmux sessions. So all of the terminals will be contained inside the single Cygwin/X window.
And because dwm is keyboard controlled - I can use keybinds to navigate between the different tags in dwm. And I can use keybinds inside tmux, to navigate to any sub-panes in the tmux sessions too.
My main reasons for running Cygwin64 and Cygwin/X are:
1. cmd and powershell are little more than toys. Cygwin has a much better and more complete set of tools available.
2. Cygwin/X makes it easier to manage multiple simultaneous tmux sessions.
3. My employers haven't "upgraded" us to Windows 10 yet, so we can't use the Linux sub-system.
Although, even if they do eventually put us on W10, or W11 - I'll probably still stick wtih Cygwin.
4. At work, I can search through our code-base using ag (silver searcher) in Cygwin and get results faster than I can from Visual Studios built in search functionality.
5. Using ag in combination with other common Unix/Linux tools - I can quickly get more fine-grained results than I can get inside Visual studio.
In short - Cygwin provides the warm, gooey, familiar UNIX-like goodness that Windows has sorely lacked for too long. Until W10, I suppose?! But I wouldn't know about that. I've ran Linux on all of my PC's for well over 15 years. The only W10 install I've had to deal with so far was W10 home edition - on one of my relative's machines. And unsurprisingly, they'd somehow completely hosed it with malware! Go figure?! Fortunately - a factory reset on their machine and a quick talking to about their reckless browsing and downloading habits seemed to definitively solve the problem...... :/ I think every family's got at least one person like that, haven't they?! Ha ha!