# Ubuntu desktop 24.04 Annoyances
This is a collection of annoyances that I have had to fix for myself while using the Ubuntu 24.04 desktop. Snaps are obviously the most annoying thing that Ubuntu does. Especially for Firefox. If you need to use smart cards or other tools with Firefox you may consider removing the snap version. I don't know the steps to completely remove snapd from a desktop system and retain all the functionality provided by those snap applications. I update this doc when I can remember.

## Set vim as default editor
The Ubuntu install defaults to some weird text editor called `nano`. I have no idea how it works. I think it is new. You can change the default text editor.

`sudo update-alternatives --config editor`

You may need to install a more complete vim editor instead of the tiny vim that is installed by default. 

`sudo apt install vim`

After installing a more complete vim you will see more options. I don't actually know what vim.tiny is but it is pretty useless for me.

```
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
* 3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode
```

If you are pedantic you can confirm this by looking at the symbolic links:

```
$ ls -l /usr/bin/editor
lrwxrwxrwx 1 root root 24 Mar 29  2023 /usr/bin/editor -> /etc/alternatives/editor
$ ls -l /etc/alternatives/editor
lrwxrwxrwx 1 root root 18 Sep  2 11:20 /etc/alternatives/editor -> /usr/bin/vim.basic
```

## Gnome blank screen and lock screen settings

Run as local user not the root user.

Get the current blank screen value:

`gsettings get org.gnome.desktop.session idle-delay`

Set the blank screen value in seconds:

`gsettings set org.gnome.desktop.session idle-delay 1800`

After making this change, in Settings GUI editor it will show "Never" as there is no entry for 30 minutes. The GUI only allows up to 15 minutes.

Get the current lock screen after blank screen value:

`gsettings set org.gnome.desktop.screensaver lock-delay`

Set the lock screen after blank screen value in seconds:

`gsettings set org.gnome.desktop.screensaver lock-delay 1800`

To use minutes directly `$((15*60))` i.e. 15 minutes x 60 seconds e.g. `gsettings set org.gnome.desktop.screensaver lock-delay $((15*60))`

## Replace Snap Firefox
see https://gist.github.com/jfeilbach/78d0ef94190fb07dee9ebfc34094702f

## Improve Firefox privcy
see https://make-firefox-private-again.com/

Copy of the page is below. I don't recommend running `curl <url> |sh`
This can be dangerous if you are not paying attention or someone is doing nefarious acts. If you are using the snap version of Firefox these paths are incorrect and will not work. See replacing Snap Firefox above.

```
echo 'user_pref("dom.private-attribution.submission.enabled", false);' | tee -a  $HOME/.mozilla/firefox/$(grep "Default=.*\.default*" "$HOME/.mozilla/firefox/profiles.ini" | cut -d"=" -f2)/user.js
echo 'Restart Firefox for the change to have effect'

# What is this about? Read more here: 
# https://www.theregister.com/2024/06/18/mozilla_buys_anonym_betting_privacy/
# https://blog.mozilla.org/en/mozilla/privacy-preserving-attribution-for-advertising/
#
# How to use: 
# curl https://make-firefox-private-again.com | sh
#
#
#
# Verify, or do it manually:
#
# about:config
#
# dom.private-attribution.submission.enabled
#
# set to false
#
#
#
#
# Report issues to @eloy@hsnl.social, but 
# don't complain about curl | sh please.
# I have only tested this on Fedora, let 
# me know if it worked or not on others.
# 
# I am aware there are Firefox forks that
# have sane defaults with regards to this
# and other aspects. I prefer keep using
# Firefox itself, because maintaining a 
# browser is an incredible difficult job
# and I don't trust small projects to be 
# able to this, despite that my trust in 
# Mozilla is pretty low these days.  
# 
# Inspired by https://web.archive.org/web/0/https://make-linux-fast-again.com/
```
## Disable Firefox telemetry
See https://support.mozilla.org/en-US/kb/telemetry-clientid
Confrim by going to `about:telemetry` You should see something like this:
`Telemetry is collecting release data and upload is disabled.`

## Block invisible trackers
This extension is made by EFF. Privacy Badger is a browser extension that automatically learns to block invisible trackers. Go to https://privacybadger.org/

## Disbale Firefox Review Checker
In about:config set the following to false. If you just use the word `shopping` in your search at the top it should get all of them. There are several that I don't know what they do.
```
browser.shopping.experience2023.ads.enabled
browser.shopping.experience2023.enabled
browser.shopping.experience2023.autoOpen.enabled
browser.shopping.experience2023.autoOpen.userEnabled
```
also consider disabling
```
browser.shopping.experience2023.survey.enabled
browser.shopping.experience2023.survey.hasSeen
browser.shopping.experience2023.active
```
## Disable Firefox WebRTC
In about:config set `media. Peer connection. enable` to false.
## Disable unattended upgrades

```
sudo systemctl status unattended-upgrades
sudo systemctl disable --now unattended-upgrades
sudo systemctl status unattended-upgrades
```

In file `/etc/apt/apt.conf.d/20auto-upgrades`

Change from enabled APT fucntions to disabled:
```
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
```
after, it shoud look like this:
```
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";
```

## Install restricted codecs

To get a good description of what this will install:

`sudo apt info ubuntu-restricted-extras`

To install these packages run:

`sudo apt install ubuntu-restricted-extras`

You will have to agree to a EULA. This will also change quite a few packages. This list will vary depending on whether you upgraded or did a clean installation.

It will remove:
```
cabextract
libaribb24-0t64 
libavcodec-extra 
libavcodec-extra60 
libmspack0t64 
libopencore-amrnb0 
libopencore-amrwb0 
libvo-amrwbenc0
ttf-mscorefonts-installer
unrar
libavcodec60
```

It will install new packages:

```
cabextract
libaribb24-0t64 
libavcodec-extra 
libavcodec-extra60
libmspack0t64 
libopencore-amrnb0
libopencore-amrwb0 
libvo-amrwbenc0 
ttf-mscorefonts-installer 
ubuntu-restricted-extras
unrar
```

If you also want to play and decrypt DVDs follow these instructions: https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs

## Disable ESM Pro
You can try the following, but it will most likely fail. These services do not currently support the `--purge` operation. They never will. `pro <tab> <tab>` will autocomplete the full list of services.
```
sudo pro disable esm-infra
sudo pro disable esm-apps
sudo pro disable livepatch
```
You will find one package with the name `advantage` in the installed list. DO NOT remove the the ubuntu-advantage-desktop-daemon. It will break your desktop by removing dependencies, in a very bad way. There are several `pro` packages installed by default. I do not know if you can safely remove them. Proceed at your own risk. 

```
ubuntu-pro-client
ubuntu-pro-client-l10n
```

### ESM Pro Documentation disabling and purging services
There is documentation here: https://documentation.ubuntu.com/pro/pro-client/purging_services/

### livepatch, realtime-kernel, landscape
These services do not currently support the --purge operation.

### anbox, cc-eal, cis/usg, esm-apps, esm-infra*, ros (and ros-updates)

When these services are disabled with `--purge`, the sources and authentication will be removed first. Then, packages that are only available in the service-specific APT repository will be removed from the system. The origin is detected based on the origin metadata defined in apt for all packages in this repository.

### A more safe option
You might be able to disable the sources in `/var/lib/ubuntu-advantage/apt-esm/etc/apt/sources.list.d/ubuntu-esm-apps.sources` by placing a comment `#`at the beginning of each line. I think errors will be returned by apt. You will need to run `sudo systemctl daemon-reload` to resolve this issue.

## Increase Gnome screen blank setting
Default is limited to 15 minutes I like a little longer. The devs are super elitist about increasing this value so its not worth getting into another annual argument with them about it. Units are in seconds. 


`gsettings set org.gnome.desktop.session idle-delay 3600` # 1 hour

`gsettings set org.gnome.desktop.session idle-delay 1800` # 30 minutes