Synergy and SDDM

For SDDM to connect to a synergy server on archlinux, edit /usr/share/sddm/scripts/Xsetup and add:

/usr/bin/synergyc <server IP or server hostname>

There’s just a little problem if you have more than one monitor. The default Xorg config mirrors all screens. That’s no problem, since KDE sets it all up properly. Unfortunately synergyc doesn’t register the changes, so you have to restart it. Since by then synergyc is running as root, you can’t kill it as user. But fear not, there’s a workaround:

  • Allow the user to execute /usr/bin/killall synergyc as root without password (see https://tollana.d-tor.org/notes-to-self/?p=620)
  • Kill all synergy instances in an autostart script and start a user instance preferably in the systemd user session:
#!/bin/bash 
sudo /usr/bin/killall synergyc
systemctl --user restart synergyc
  • make it executable, put it somewhere the user can access it and auto-start it. In KDE: System Settings -> Startup and Shutdown -> Autostart -> Script File
  • make sure that you have synergyc.service in $HOME/.config/systemd/user
[Unit]
Description=Synergy Client Daemon
After=network.target

[Service]
ExecStart=/usr/bin/synergyc --no-daemon <Server IP or Hostname>
Restart=always
RestartSec=3

[Install]
WantedBy=default.target

This works with KillUserProcesses=yes in /etc/systemd/logind.conf.

SUDO Rule Preference

sudo has a last match policy, NOT best match! So, if %wheel is allowed to execute everything as anybody with password, but you want a member of %wheel to execute a specific command without password, the rule for the password-less command has to be ordered after the general rule:

%wheel ALL=(ALL) ALL 
wheelmember ALL=(ALL) NOPASSWD: /usr/bin/mycommand

It says so in man 5 sudoers:

When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used (which is not necessarily the most specific match).

Nevertheless, it was counter-intuitive for me. I expected first or best match, but not last match… Another quirk: When using visudo “:w” won’t update the sudoers file. You have to “:wq”.

Formatting cells in LibreOffice

As I just learned, data is not always converted automatically to the new format, e.g. when it’s a number and you want it to be a date. In that case you have to replace the content with itself after setting the new format.

This can be done with “Find and Replace…”: Search for .* and replace it with & (Ampersand, the whole regex match). Make sure that you have “Regular Expression” checked!