diff --git a/_data/faqs.yml b/_data/faqs.yml index 4bcc7cf..2312c14 100644 --- a/_data/faqs.yml +++ b/_data/faqs.yml @@ -45,13 +45,13 @@ main: answer: | As the unprivileged user, run this command to allow the local user's X session: - ```text + ```sh xhost si:localuser:root ``` When finished, disable the access: - ```text + ```sh xhost -si:localuser:root ``` diff --git a/_layouts/default.html b/_layouts/default.html index f2ae842..5a43ad3 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -60,68 +60,7 @@ - + {%- if site.google_analytics_id != "" %} {% include google_analytics.html %} {%- endif %} diff --git a/_posts/2015-09-25-command-line-interface.md b/_posts/2015-09-25-command-line-interface.md index fa383bc..3da25e1 100644 --- a/_posts/2015-09-25-command-line-interface.md +++ b/_posts/2015-09-25-command-line-interface.md @@ -33,7 +33,9 @@ Running `bleachbit` (which is in the path) with arguments runs BleachBit in comm To see a list of cleaners and their options, run: -`bleachbit --list-cleaners` +```sh +bleachbit --list-cleaners +``` Aliases are `-l` and `--list`. @@ -41,7 +43,9 @@ Aliases are `-l` and `--list`. To preview deleting Firefox cache, run: -`bleachbit --preview firefox.cache` +```sh +bleachbit --preview firefox.cache +``` An alias is `--p`. @@ -49,7 +53,9 @@ An alias is `--p`. When you are ready to delete files and make other permanent changes, replace `--preview` with `--clean`. To delete Firefox cache, for example, run: -`bleachbit --clean firefox.vacuum` +```sh +bleachbit --clean firefox.vacuum +``` An alias is `--c`. @@ -59,39 +65,57 @@ Preview and cleaning modes accept the same options for including and excluding c Multiple arguments are allowed. To preview deleting Firefox cache and Opera cache, list them separated by a space: -`bleachbit --preview firefox.cache opera.cache` +```sh +bleachbit --preview firefox.cache opera.cache +``` Wildcards are allowed for options, so to preview deleting all options for Opera, run: -`bleachbit --preview opera.*` +```sh +bleachbit --preview opera.* +``` Wildcards are not allowed for cleaners, so do _not_ run `bleachbit --preview *.*`. To select the same options as in the GUI, use `--preset`, which may be combined with other options: -`bleachbit --preview --preset firefox.cache` +```sh +bleachbit --preview --preset firefox.cache +``` To enable all cleaners and options that do not have a warning, use `--all-but-warning`, which may be combined with other options. Use this with caution, as it will delete many files. -`bleachbit --preview --all-but-warning firefox.cache` +```sh +bleachbit --preview --all-but-warning firefox.cache +``` ## Excluding options To except cleaning options, combine `--except` with inclusion options. The following previews all of Firefox except cookies. -`bleachbit --preview firefox.* --except firefox.cookies` +```sh +bleachbit --preview firefox.* --except firefox.cookies +``` These three commands are equivalent: they include all Firefox and Chromium options except their passwords. The first option demonstrates that `--except` accepts multiple cleaner options, separated by commas. -```text +```sh bleachbit --clean firefox.* chromium.* --except firefox.passwords,chromium.passwords +``` + +```sh bleachbit --clean firefox.* chromium.* --except firefox.passwords --except chromium.passwords +``` + +```sh bleachbit --clean chromium.* --except firefox.passwords firefox.* --except chromium.passwords ``` However, the following command _will_ delete passwords in Chromium. -`bleachbit --clean firefox.* chromium.* --except firefox.passwords chromium.passwords` +```sh +bleachbit --clean firefox.* chromium.* --except firefox.passwords chromium.passwords +``` Notes: @@ -107,7 +131,9 @@ Notes: To overwrite the contents of files, so they cannot be undeleted later, add `--overwrite`: -`bleachbit --overwrite --clean firefox.vacuum` +```sh +bleachbit --overwrite --clean firefox.vacuum +``` Without `--overwrite`, BleachBit checks the configuration set in the graphical user interface. @@ -115,11 +141,15 @@ Without `--overwrite`, BleachBit checks the configuration set in the graphical u To shred any file, so its contents cannot be recovered, use `--shred`. While `--overwrite` refers to the files identified by `--clean`, the option `--shred` shreds any file anywhere. For example, this shreds one file named `yoga_emails.txt`: -`bleachbit --shred ~/yoga_email.txt` +```sh +bleachbit --shred ~/yoga_email.txt +``` To shred all files under a directory, pass the name of the directory like this: -`bleachbit --shred "C:\Microsoft Exchange\Top Secret Emails\"` +```bat +bleachbit --shred "C:\Microsoft Exchange\Top Secret Emails\" +``` ## Wiping empty space @@ -130,7 +160,9 @@ You might want to wipe empty space for each logical drive. For example, on Windo To wipe any partition, pass any writable directory in that partition to `--wipe-empty-space`. For example: -`bleachbit --wipe-empty-space ~/.cache/` +```sh +bleachbit --wipe-empty-space ~/.cache/ +``` Wiping empty space does not change how much free space is left, when the process is done. For example, if you start with 10GB free, then you will still have 10GB free when the process is done. @@ -141,11 +173,15 @@ BleachBit 5.0.2 and earlier used `--wipe-free-space` instead of `--wipe-empty-sp To vacuum Firefox each night at 03:00, run this to edit cron jobs: -`crontab -e` +```sh +crontab -e +``` and add this line: -`0 3 * * * bleachbit --clean firefox.vacuum` +```text +0 3 * * * bleachbit --clean firefox.vacuum +``` ## Windows Task Scheduler diff --git a/_posts/2015-09-30-install-on-linux.md b/_posts/2015-09-30-install-on-linux.md index 721ef19..dbaa296 100644 --- a/_posts/2015-09-30-install-on-linux.md +++ b/_posts/2015-09-30-install-on-linux.md @@ -153,6 +153,7 @@ gpg: using RSA key A9E582E4054A159315EDC943D6D447B02B4D4C9D gpg: Good signature from "Andrew Ziem " [ultimate] gpg: WARNING: not a detached signature; file 'bleachbit-5.0.2-sha256sum.txt' was NOT verified! ``` + Watch for the "Good signature," and ignore the warning. Second, verify the checksums like this: @@ -182,8 +183,8 @@ bleachbit-5.0.2.tar.gz: OK bleachbit-5.0.2.tar.bz2: OK bleachbit-5.0.2.tar.lzma: OK sha256sum: WARNING: 15 lines are improperly formatted - ``` + If you did not download all the files in the release, you will see "No such file or directory" errors for the missing files. This is expected. Focus on confirming that the file you downloaded shows "OK" in the output. @@ -201,7 +202,9 @@ Double click on the downloaded installation package which has a name like `bleac Install using the command line like this: -`sudo apt install bleachbit_5.0.2-0_all_ubuntu2504.deb` +```sh +sudo apt install bleachbit_5.0.2-0_all_ubuntu2504.deb +``` Using apt is recommended over dpkg because it will automatically install dependencies. @@ -215,5 +218,6 @@ To install BleachBit using the graphical package manager, double click on the do Alternatively, install using the command line like this. -`sudo dnf install bleachbit-5.0.2-1.1.fc43.noarch.rpm` - +```sh +sudo dnf install bleachbit-5.0.2-1.1.fc43.noarch.rpm +``` diff --git a/_posts/2015-09-30-install-on-windows.md b/_posts/2015-09-30-install-on-windows.md index fbb6ca8..7a53897 100644 --- a/_posts/2015-09-30-install-on-windows.md +++ b/_posts/2015-09-30-install-on-windows.md @@ -43,15 +43,21 @@ process of installing an application across many systems. Using BleachBit 5.0.2 as an example, run the following command to install the application for all users. It requires the calling process to have administrator privileges: -`BleachBit-5.0.2-setup.exe /S /allusers` +```bat +BleachBit-5.0.2-setup.exe /S /allusers +``` To install for only the current user, run this command: -`BleachBit-5.0.2-setup.exe /S /currentuser` +```bat +BleachBit-5.0.2-setup.exe /S /currentuser +``` To omit the desktop shortcut, add `/NoDesktopShortcut` directly after `/S`: -`BleachBit-5.0.2-setup.exe /S /NoDesktopShortcut /currentuser` +```bat +BleachBit-5.0.2-setup.exe /S /NoDesktopShortcut /currentuser +``` Because the installer is silent, it will not throw an error such as if you forget to choose between `/allusers` and `/currentuser` or if the calling process has diff --git a/_posts/2018-03-14-troubleshooting.md b/_posts/2018-03-14-troubleshooting.md index c43d4c0..28be50b 100644 --- a/_posts/2018-03-14-troubleshooting.md +++ b/_posts/2018-03-14-troubleshooting.md @@ -42,7 +42,11 @@ file, follow these steps instead: 1. Hold down the `Windows` key while pressing `R`. This brings up the Run dialog. 2. Type or paste the command - `"%ProgramFiles(x86)%\BleachBit\bleachbit_console.exe" --gui --debug-log=%USERPROFILE%\desktop\bleachbit.log` + + ```text + "%ProgramFiles(x86)%\BleachBit\bleachbit_console.exe" --gui --debug-log=%USERPROFILE%\desktop\bleachbit.log + ``` + 3. Click **Run**. ![Screenshot of the Windows run dialog](/images/run-dialog-windows10.png) @@ -58,9 +62,11 @@ console window. On Linux systems, use these steps to show verbose logging information: 1. Open a terminal such as GNOME Terminal. -2. Type or paste the command - `bleachbit --gui --debug-log=/home/username/bleachbit.log` - (replace *username* with your system username). +2. Type or paste the command (replace *username* with your system username) + + ```sh + bleachbit --gui --debug-log=/home/username/bleachbit.log + ``` The log will appear in your home directory. diff --git a/_posts/2021-04-17-testing.md b/_posts/2021-04-17-testing.md index 0041ea7..6607629 100644 --- a/_posts/2021-04-17-testing.md +++ b/_posts/2021-04-17-testing.md @@ -170,27 +170,37 @@ If you are comfortable using the command line and are [prepared to run BleachBit from source code]({% link _posts/2015-09-25-running-from-source-code.md %}), run the unit tests with this command: -`python3 tests/TestAll.py` +```sh +python3 tests/TestAll.py +``` To run a special test case (such as General): -`python3 -m unittest tests.TestGeneral` +```sh +python3 -m unittest tests.TestGeneral +``` To run a specific test: -`python3 -m unittest tests.TestGeneral.GeneralTestCase.test_boolstr_to_bool` +```sh +python3 -m unittest tests.TestGeneral.GeneralTestCase.test_boolstr_to_bool +``` Normally the unit tests skip over any permanent changes to your system, but if you want to enable destructive tests (which make changes without any confirmation) set -the environment variable `DESTRUCTIVE_TEST=T`. **Use with caution!** Normally you +the environment variable `DESTRUCTIVE_TESTS=T`. **Use with caution!** Normally you would only enable destructive tests on a test machine such as a virtual machine. On Linux enable destructive tests like this: -`export DESTRUCTIVE_TESTS=T` +```sh +export DESTRUCTIVE_TESTS=T +``` On Windows enable destructive tests with: -`set DESTRUCTIVE_TESTS=T` +```bat +set DESTRUCTIVE_TESTS=T +``` To avoid changing your normal `bleachbit.ini` configuration file, set the environment variable `BLEACHBIT_TEST_OPTIONS_DIR` to an alternate directory. When diff --git a/_sass/_base.scss b/_sass/_base.scss index f90b0ed..9c5a625 100644 --- a/_sass/_base.scss +++ b/_sass/_base.scss @@ -218,6 +218,10 @@ body.rtl { } /* ── Copy button ───────────────────────────────────────────── */ +div.highlighter-rouge { + position: relative; +} + .copy-button { position: absolute; top: 5px; @@ -231,7 +235,8 @@ body.rtl { opacity: 0; transition: opacity 0.2s ease-in-out, background-color 0.15s ease; - div.highlighter-rouge:hover & { + div.highlighter-rouge:hover &, + &:focus-visible { opacity: 1; } diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..7bb1f95 --- /dev/null +++ b/js/main.js @@ -0,0 +1,60 @@ +(() => { + 'use strict'; + + // The Clipboard API is only available in secure contexts + if (!navigator.clipboard) { + return; + } + + // Console blocks: copy the command after each prompt (.gp), skip the output (.go) + function getCommands(code) { + return [...code.querySelectorAll('.gp')].map(prompt => { + const range = document.createRange(); + range.setStartAfter(prompt); + range.setEnd(code, code.childNodes.length); + return range.toString().split('\n', 1)[0].trim(); + }).join('\n'); + } + + function getText(code) { + if (code.querySelector('.gp')) { + return getCommands(code); + } + + // Rouge always ends the block with a newline + return code.textContent.replace(/\n+$/, ''); + } + + function addCopyButton(block, code) { + const button = document.createElement('button'); + button.type = 'button'; + button.className = 'copy-button'; + button.textContent = 'Copy'; + button.setAttribute('aria-label', 'Copy code to clipboard'); + + let timeout; + button.addEventListener('click', async () => { + try { + await navigator.clipboard.writeText(getText(code)); + button.textContent = 'Copied!'; + } catch (error) { + console.error('Failed to copy:', error); + button.textContent = 'Failed'; + } + + clearTimeout(timeout); + timeout = setTimeout(() => { + button.textContent = 'Copy'; + }, 2000); + }); + + block.append(button); + } + + for (const block of document.querySelectorAll('div.highlighter-rouge')) { + const code = block.querySelector('code'); + if (code) { + addCopyButton(block, code); + } + } +})();