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

How can I disable Windows sounds in Bash? #715

Closed
mout12 opened this issue Aug 2, 2016 · 21 comments
Closed

How can I disable Windows sounds in Bash? #715

mout12 opened this issue Aug 2, 2016 · 21 comments
Labels

Comments

@mout12
Copy link

mout12 commented Aug 2, 2016

If I try to move the cursor passed the end of a block of text, Windows chimes a sound. How can I disable all such sounds?

@osimons
Copy link

osimons commented Aug 2, 2016

I use set bell-style none in ~/.inputrc to silence all shell beeps.

@xiuluo
Copy link

xiuluo commented Aug 3, 2016

(Sorry,My English is poor)This method does not take effect for VIM, you need to close the Windows Sound.you shuld Open the Control Panel -> Open Hardware and Sound -> Open Sound ->Select Sound -> Modify the critical stop sound scheme(打开控制面板——>打开硬件和声音——>打开声音——>选择声音——>修改关键性停止的声音方案)
201608033

@bennyyip
Copy link

bennyyip commented Aug 6, 2016

set bell-style none doesn't works for me. I use Volume Mixer to mute Console Window Host.

@NelsonMinar
Copy link

bennyyip's suggestion to mute Console Window Host is the only thing that works for me.

But I still want a sound, just a nicer one. I think it's being played by the Beep Driver, which in Windows 10 plays the event "Critical Stop" which is "Windows Foreground.wav". It's a singularly horrible sound to have mapped to a console bell that rings every time bash completion is unhappy. You can set which sound is played in the Sound Driver (Windows Ding is better). Perhaps someone on the WSL team is equally annoyed by the sound and will sneak in a more mellifluous user experience.

@yveslange
Copy link

The solution of @xiuluo worked for me !!!

@paretech
Copy link

paretech commented Sep 8, 2017

I wanted to let folks know that @osimons solution regarding bell in .inputrc worked for me after restarting bash/Ubuntu. I'm using Windows 10 Insider Preview 16278.

As of July 10, 2017 Ubunto Linux is now Available in the Windows Store. As such I could see this page getting some more attention in the near future.

@herrmanthegerman
Copy link

In Linux, I usually disable the audible bell and enable the visual bell by adding set bell-style visible to ~/.inputrc or /etc/inputrc as I find the flashing terminal less annoying than the audible bell.

While this works in WSL in term of silencing the audible bell, it does not enable the visual bell. I wonder whether this is worth filing a separate bug...

@yoctozepto
Copy link

This is not a bug, this is a feature. :-)

For bash (and other readline-based programs) use:
set bell-style visible
in
~/.inputrc

For vim use:
set visualbell
in
~/.vimrc

However, visual bells do not seem to work. I will file another bug report.

nahcnuj pushed a commit to nahcnuj/dotfiles that referenced this issue Jun 3, 2018
aoeu added a commit to aoeu/configurations that referenced this issue Nov 29, 2018
This file can be moved to $HOME/.inputrc or as /etc./inputrc in order to silence the terminal bell.

This is partcularly useful when using the Windows Subsystem for Linux since a rather jarring sound occurs upon every incorrect terminal completion, etc.

microsoft/WSL#715 (comment)
@tlelson
Copy link

tlelson commented Aug 11, 2019

Great solution @yoctozepto.

The problem with @xiuluo 's solution is that it is disabling the 'critical stop' sound for every application on the machine. It is unclear which key combination @xiuluo is using to produce this noise but my problem in WSL/VIM was coming from TAB autocomplete and was playing the 'Default Beep' sound.

@yoctozepto 's solution fixes all sounds on vim (tab complete, ESC etc) and in bash whilst leaving them available outside.

@mbpakalin
Copy link

@eL0ck Yea, that fixed mine too. But in vim i can still hear that annoying sound :(

@yoctozepto
Copy link

@mbpakalin Make sure vim read ~/.vimrc successfuly.

@mbpakalin
Copy link

@yoctozepto I forgot adding the .vimrc stuff, now i added set visualbell and its working now.
Thanks.

@sargentogato
Copy link

@yoctozepto solution works for me. I added

set bell-style visible

@bjtucker
Copy link

bjtucker commented May 1, 2020

I added the same
set bell-style visible
to my .inputrc
... it stopped the noise, but there's no visible bell. I guess I'll take it.

@JHBalaji
Copy link

JHBalaji commented May 4, 2020

Open Volume Mixer by right clicking on the Volume Control in the Windows taskbar and mute the Console Window Host.
image

@qfan
Copy link

qfan commented Aug 28, 2020

This is a feature but can we have a feature to disable this feature?

Particularly, can we have an option in the WSL itself to permanently remove the "hardware support" presented to the sub system? So that disabling this sound will no longer be system and software dependent?

@hugoam
Copy link

hugoam commented Apr 16, 2021

@yoctozepto solution kind of works, until you do for example a git diff and there again is this obnoxious bell sound

@chilipepper987
Copy link

"Console Window Host" doesn't show up in my volume mixer. I edited the file for "Windows Default Beep" (not Critical Stop) to fix it.

@wellloy1
Copy link

wellloy1 commented May 31, 2022

Tired of fixing this..
Just disabling all system sounds on Win has been the most effective solution of my life.
I can't explain why I didn't do this sooner.
You
just
don't
need
that
sh$t.
NEVER EVER

@JonathanDotCel
Copy link

Yep, can we have an option to shut this up please, and store the setting from the Windows side of things please?
It's a bit tiresome having to re-set the volume via the sound mixer every so often.
Thanks.

@wellloy1
Copy link

Yep, can we have an option to shut this up please, and store the setting from the Windows side of things please? It's a bit tiresome having to re-set the volume via the sound mixer every so often. Thanks.

Bro, you can disable all systems sounds via system settings. I think we don't need it in 2022. 😉

lbr88 pushed a commit to aio-it/mmchatgpt that referenced this issue Apr 6, 2024
diff --git a/test.py b/test.py
deleted file mode 100644
index 395d9f6..0000000
--- a/test.py
+++ /dev/null
@@ -1,109 +0,0 @@
-import newspaper
-from markdownify import markdownify as md
-
-def fetch_and_parse(url):
-    # Create a new article object
-    article = newspaper.Article(url)
-
-    # Download and parse the article
-    article.download()
-    article.parse()
-
-    # Get the markdown content from the parsed HTML article
-    markdown_content = md(article.text)
-
-    return markdown_content
-
-
-def return_urls_from_news_site(site: str):
-    # Return a list of urls from a news site
-    # fetch paper from newspaper3k
-    article_urls = []
-    try:
-        paper = newspaper.build(site, memoize_articles=False)
-        for article in paper.articles:
-            article_urls.append(article.url)
-        return article_urls
-    except:
-        return article_urls
-
-def extract_from_website_using_newspaper(url: str):
-    """return a string with fulltext from a url"""
-    article = newspaper.Article(url)
-    article.download()
-    article.parse()
-    return article
-def extract_from_website_using_beautifulsoup(url: str):
-    """return a string with paragraphs and h1-h5 from a url"""
-    from bs4 import BeautifulSoup
-    import requests
-    page = requests.get(url)
-    soup = BeautifulSoup(page.content, 'html.parser')
-    # remove all script and style elements
-    for script in soup(["script", "style","head"]):
-        script.decompose()    # rip it out
-    # all elements and extract elements that contain "text"
-    strip = [r'nav',r'head', r'foot',r'menu']
-    import re
-    found_elements = []
-    for elem in soup.find_all():
-        # find items with class attribute that contains "text"
-        #print(elem.attrs)
-        for s in strip:
-            if elem.has_attr('class'):
-                for _class in elem['class']:
-                    if re.search(s, _class) is not None:
-                        #print(f"found {s} in {_class}")
-                        found_elements.append(elem)
-                        continue
-    for elem in found_elements:
-        elem.decompose()
-    del found_elements
-    # get text
-    text = soup.get_text()
-    # break into lines and remove leading and trailing space on each
-    lines = (line.strip() for line in text.splitlines())
-    # break multi-headlines into a line each
-    chunks = (phrase.strip() for line in lines for phrase in line.split("  "))
-    # drop blank lines
-    text = '\n'.join(chunk for chunk in chunks if chunk)
-    class article:
-        def __init__(self, title, text, keywords=[], authors=[]):
-            self.title = title
-            self.text = text
-            self.summary = text[:100]
-            self.keywords = keywords
-            self.authors = authors
-    bsarticle = article("", text)
-    return bsarticle
-
-# Test function:
-#url = "https://medium.com/macoclock/9-new-must-have-macos-productivity-apps-for-daily-usage-fec955b1510c"
-#content = fetch_and_parse(url)
-#print(content)
-
-#article = extract_from_website_using_newspaper(url)
-#print(f"{article.title}: {article.summary} by {article.authors} keywords: {','.join(article.keywords)}\n{article.text}")
-def compare_extract(url: str):
-    articlenp = extract_from_website_using_newspaper(url)
-    articlebs = extract_from_website_using_beautifulsoup(url)
-
-    print("np article:")
-    print(articlenp.text)
-    print("bs article:")
-    print(articlebs.text)
-
-    print(f"np len: {len(articlenp.text)}")
-    print(f"bs len: {len(articlebs.text)}")
-
-url = "https://www.dr.dk/nyheder/"
-#urls = return_urls_from_news_site(url)
-#print(urls)
-
-#url = "https://www.dr.dk/nyheder/seneste/gennemsnitstemperatur-maalt-til-det-hoejeste-nogensinde-anden-dag-i-traek"
-#url = "https://docs.aws.amazon.com/IAM/latest/UserGuide/console_search.html"
-url = "https://ekstrabladet.dk/nyheder/samfund/soedestof-paa-kraeftliste-slut-med-coca-cola-zero/9847762"
-#url = "https://stackoverflow.com/questions/36724209/disable-beep-in-wsl-terminal-on-windows-10"
-#url = "microsoft/WSL#715 (comment)"
-#for url in urls:
-compare_extract(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests