Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 50 additions & 5 deletions config/desktop-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
# Shared ground truth for the desktop sets — gnome, kde and xfce.
#
# Those three sets say the same things to three completely different
# backends (gsettings, kwriteconfig, xfconf-query), so there's no code worth
# sharing between them. What *is* worth sharing is the decision behind the
# code: which settings this repo has an opinion about, and what that opinion
# is. Without that written down once, adding a setting to one desktop and
# forgetting the other two is invisible.
# backends (gsettings, kwriteconfig, xfconf-query), so there's little code
# worth sharing between them. What *is* worth sharing is the decision behind
# the code: which settings this repo has an opinion about, and what that
# opinion is. Without that written down once, adding a setting to one desktop
# and forgetting the other two is invisible.
#
# The one exception is install_alt_cv_remap below: it's evdev-level (via
# keyd), below X11/Wayland and every desktop's own config backend, so the
# shell to apply it is identical for all three and lives here once instead
# of being copy-pasted three times.
#
# So: every setting all three desktops are expected to cover gets an entry in
# DESKTOP_INTENTS below, and each apply.sh marks where it handles it with a
Expand Down Expand Up @@ -40,4 +45,44 @@ DESKTOP_INTENTS=(
"no-automount:Removable devices are not automounted"
"editable-path-bar:File dialogs offer an editable path entry, not breadcrumbs"
"dark-theme:A dark colour scheme"
"alt-cvr-as-ctrl-cvr:Alt+C/V/R send Ctrl+C/V/R, system-wide"
)

# Installs keyd (if missing) and points it at a config that remaps Alt+C to
# Ctrl+C, Alt+V to Ctrl+V, and Alt+R to Ctrl+R, system-wide. This is below
# any window system, so it's the same on every desktop (and every
# Wayland/X11 session on it) — called by each desktop's apply.sh under its
# own "# intent: alt-cvr-as-ctrl-cvr" marker.
install_alt_cvr_remap() {
if ! command -v keyd >/dev/null 2>&1; then
if [ -f /etc/arch-release ]; then
sudo pacman -S --noconfirm keyd
elif [ -f /etc/debian_version ]; then
export DEBIAN_FRONTEND=noninteractive
sudo apt update && sudo apt install -y keyd
elif [ -f /etc/alpine-release ]; then
sudo apk add keyd
elif [ -f /etc/redhat-release ]; then
sudo dnf install -y keyd
elif [ -f /etc/gentoo-release ]; then
sudo emerge app-misc/keyd
else
echo "Warning: don't know how to install keyd on this system; install it manually." >&2
return 1
fi
fi

sudo mkdir -p /etc/keyd
sudo tee /etc/keyd/dotfiles-alt-cvr.conf >/dev/null <<'EOF'
[ids]
*

[alt]
c = C-c
v = C-v
r = C-r
EOF

sudo systemctl enable --now keyd >/dev/null 2>&1 || true
sudo keyd reload || true
}
4 changes: 4 additions & 0 deletions config/sets/gnome/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ gset org.gnome.desktop.peripherals.keyboard repeat-interval "$(( 1000 / KEY_REPE
# Behavior.
gset org.gnome.desktop.input-sources xkb-options "['caps:escape']"

# intent: alt-cvr-as-ctrl-cvr
# Evdev-level, via keyd; see install_alt_cvr_remap in desktop-common.sh.
install_alt_cvr_remap

# intent: no-screen-lock
# Settings > Privacy & Security > Screen Lock.
gset org.gnome.desktop.screensaver lock-enabled false
Expand Down
7 changes: 4 additions & 3 deletions config/sets/gnome/description
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
GNOME: keyboard repeat rate 50/s + 250ms delay, Caps Lock as Escape, screen
locking and idle display dim/off disabled, device automounting disabled,
editable path bar in file dialogs, dark color scheme
GNOME: keyboard repeat rate 50/s + 250ms delay, Caps Lock as Escape, Alt+C/
Alt+V/Alt+R as Ctrl+C/Ctrl+V/Ctrl+R, screen locking and idle display dim/off
disabled, device automounting disabled, editable path bar in file dialogs,
dark color scheme
4 changes: 4 additions & 0 deletions config/sets/kde/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ fi
"$kwriteconfig" --file kxkbrc --group Layout --key Options "caps:escape"
"$kwriteconfig" --file kxkbrc --group Layout --key ResetOldOptions true

# intent: alt-cvr-as-ctrl-cvr
# Evdev-level, via keyd; see install_alt_cvr_remap in desktop-common.sh.
install_alt_cvr_remap

# intent: no-screen-lock
# System Settings > Screen Locking.
"$kwriteconfig" --file kscreenlockerrc --group Daemon --key Autolock false
Expand Down
5 changes: 3 additions & 2 deletions config/sets/kde/description
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
KDE Plasma: keyboard repeat rate 50/s + 250ms delay, Caps Lock as Escape,
screen locking and idle display dim/off disabled, device automounter
disabled, Dolphin menu bar hidden + editable path bar, Breeze Dark theme
Alt+C/Alt+V/Alt+R as Ctrl+C/Ctrl+V/Ctrl+R, screen locking and idle display
dim/off disabled, device automounter disabled, Dolphin menu bar hidden +
editable path bar, Breeze Dark theme
4 changes: 4 additions & 0 deletions config/sets/xfce/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ X-GNOME-Autostart-enabled=true
EOF
fi

# intent: alt-cvr-as-ctrl-cvr
# Evdev-level, via keyd; see install_alt_cvr_remap in desktop-common.sh.
install_alt_cvr_remap

# --- Screen locking & power --------------------------------------------

# intent: no-screen-lock
Expand Down
10 changes: 5 additions & 5 deletions config/sets/xfce/description
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
XFCE: keyboard repeat rate 50/s + 250ms delay, Caps Lock as Escape, screen
locking and idle display dim/off disabled, device automounting disabled,
editable path bar in Thunar and GTK file dialogs, dark theme, second panel
removed and the primary panel moved to the bottom, plus Kitty installed and
set as the default terminal
XFCE: keyboard repeat rate 50/s + 250ms delay, Caps Lock as Escape, Alt+C/
Alt+V/Alt+R as Ctrl+C/Ctrl+V/Ctrl+R, screen locking and idle display dim/off
disabled, device automounting disabled, editable path bar in Thunar and GTK
file dialogs, dark theme, second panel removed and the primary panel moved
to the bottom, plus Kitty installed and set as the default terminal
Loading