Score:0

Gtk-WARNING when running Gedit in WSL

bz flag

I am getting this error whenever I try to open Gedit on WSL on Ubuntu terminal:

(gedit:3271): Gtk-WARNING **: 00:10:01.110: cannot open display: 

Please suggest a fix to it. Thank you.

ChanganAuto avatar
us flag
Ubuntu in WSL is by default CLI only so the error message is correct because there is no display. Not an error, it's exactly how it should be.
Ramit Bose 21BCE1316 avatar
bz flag
So, how can i use gedit in wsl linux?
ChanganAuto avatar
us flag
Why do you think you need to use gedit?
Ramit Bose 21BCE1316 avatar
bz flag
Then in which editor do I type my c program and stuff?
NotTheDr01ds avatar
vn flag
@RamitBose21BCE1316 You are probably just running on a slightly outdated WSL release. WSL now supports the ability to run GUI applications for both Windows 10 and 11, but you'll need to upgrade first. If you've already upgraded, though, let me know and we'll look for other causes. As for "which editor", the typical recommendation on WSL is to use the *Windows* version of Visual Studio Code, with the [WSL extension](https://marketplace.visualstudio.com/items?itemName=m). This will fully integrate the Windows VSCode with WSL.
NotTheDr01ds avatar
vn flag
@ChanganAuto Just for clarity/update, WSL *by default* now has GUI support. It's likely the OP just hasn't updated to the latest Windows/WSL release, but it's available for all users now.
NotTheDr01ds avatar
vn flag
@RamitBose21BCE1316 One final note, though - If you are going to be editing C code, I highly recommend that you get used to the `vi` key bindings anyway. You can run `vi` (or Neovim) directly from the terminal without requiring any overhead of a graphical application. But even when using VSCode, I recommend the `vi` keybindings -- Once you invest the time in learning them, it will make editing so much faster in the future.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.