# Xubuntu notes

Notes while setting up Xubuntu 18.04.3 on a re-purposed laptop

jms1 2020-02-16


## Disable touchpad when mouse is connected

I'm not sure why this setting isn't exposed via the normal configuration GUI, but it seems like pretty basic functionality to me - if there's a mouse plugged in, disable the touchpad. That way I don't have to worry about accidentally tapping the touchpad, having it register as a click, and sending the keyboard focus away while typing (which happened several times while typing this document.)

I found dozens of web pages which point to this command:

```
gsettings set org.gnome.desktop.peripherals.touchpad send-events disabled-on-external-mouse
```

I found that where these pages say "for Ubuntu", they really mean **for Gnome**.

This setting can also be changed using `dconf-editor`, which can be installed via "`apt install dconf-editor`". Again, this is also a Gnome-specific thing.

**For XFCE**...


* [The docs](https://docs.xfce.org/xfce/xfce4-settings/mouse) explain that when you turn on the "Disable touchpad while typing" setting, it runs "`syndaemon -i 2.0 -K -R`", and reading the man page for `syndaemon` it sounds like this is *almost* what I want. However when I tried it, nothing changed immediately. I'll have to look at this one again later.

    Also, I found that the following commands will set these settings from the command line, if you're like me and prefer the command line over having to hunt down options in a GUI...
    
    ```
    xfconf-query -c pointers -p /DisableTouchpadWhileTyping -n -t bool -s true
    xfconf-query -c pointers -p /DisableTouchpadDuration -n -t double -s 2.0
    ```

* XFCE doesn't seem to have a setting to disable the touchpad *when a mouse is connected*.

## Use YubiKey for SSH keys

My SSH secret keys are on a YubiKey, which means that even if my machines are compromised, the attackers can't get my secret keys.

I spent over an hour figuring out all of the different ways that the system tries to be helpful by running `ssh-agent` or `gnome-keyring-daemon` for you, and it ended up coming down to this set of commands:

```
sudo apt install scdaemon gpg-agent

mkdir -p ~/.gnupg
echo use-agent >> ~/.gnupg/gpg.conf
echo enable-ssh-support >> ~/.gnupg/gpg-agent.conf

xfconf-query -c xfce4-session -p /compat/LaunchGNOME -n -t bool -s false
xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
```

Thanks to Niklaas Baudet von Gersdorff for taking the time to figure out [and document](https://notebook.niklaas.eu/xfce-disable-ssh-agent/) how to make XFCE not start `ssh-agent` (i.e. the last command on the list).

## `apt-file`

The `apt-file` utility tells which package installed a given file, like "`rpm -qf`" on RedHat-flavoured systems.

```
sudo apt install apt-file
sudo apt-file update
```

Note that the second command downloads database files from all of the configured `apt` sources. This takes a while, and it uses a non-trivial amount of disk space (which may be an issue if you're running Xubuntu on a low-powered machine).

Once it's done, you can use the `apt-file` command to identify the package which installed a given file.

```
$ apt-file search gpg-agent-ssh.socket
gpg-agent: /usr/lib/systemd/user/gpg-agent-ssh.socket
gpg-agent: /usr/lib/systemd/user/sockets.target.wants/gpg-agent-ssh.socket
```

Keep in mind...

* It's doing a pattern search rather than matching a filename or path.

* It's searching through these downloaded database files from the `apt` sources, so it will "find" files in packages which are not installed.
