From 9b63be7856e0b4af0a295937a4c9d02786a08944 Mon Sep 17 00:00:00 2001 From: Jason Hilder Date: Thu, 15 Oct 2026 07:48:37 +0200 Subject: [PATCH] Updates for the xfce4 emacs setup. --- config/emacs/development.el | 8 +++ install.sh | 2 +- scripts/xfce_theme/square-xfwm4-corners.sh | 67 ++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100755 scripts/xfce_theme/square-xfwm4-corners.sh diff --git a/config/emacs/development.el b/config/emacs/development.el index 00864da..901284c 100644 --- a/config/emacs/development.el +++ b/config/emacs/development.el @@ -32,9 +32,17 @@ ;; OLS built-in definitions. (setenv "OLS_BUILTIN_FOLDER" "/home/jason/ThirdParty/ols/builtin") +;;;; Code navigation ;; Vim-style code navigation. (evil-define-key '(normal motion) 'global "gd" #'xref-find-definitions "gD" #'xref-find-references "K" #'eldoc (kbd "C-t") #'xref-go-back) + +;; ESC closes any open eldoc window. +(defun my/eldoc-close (&rest _) + (dolist (w (window-list)) + (when (string-prefix-p "*eldoc" (buffer-name (window-buffer w))) + (quit-window nil w)))) +(advice-add 'evil-force-normal-state :after #'my/eldoc-close) diff --git a/install.sh b/install.sh index c0c2225..861b58c 100755 --- a/install.sh +++ b/install.sh @@ -153,7 +153,7 @@ if [ "$DO_INSTALL" = true ]; then bat unzip 7zip tar gzip bzip2 xz ark # build & dev tools emacs-x11 alacritty base-devel valgrind - xfce4-screenshooter xkill xdotool wmctrl + xfce4-screenshooter xkill xwininfo xdotool wmctrl ) MISSING_PACKAGES=() diff --git a/scripts/xfce_theme/square-xfwm4-corners.sh b/scripts/xfce_theme/square-xfwm4-corners.sh new file mode 100755 index 0000000..a7d2fca --- /dev/null +++ b/scripts/xfce_theme/square-xfwm4-corners.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# square-xfwm4-corners.sh (v2) +# Makes ~/.themes/Default-Square: an exact copy of the xfwm4 "Default" theme +# with square top corners, keeping the thin dark outline and highlight. +# Usage: ./square-xfwm4-corners.sh [ACTIVE_TITLE_COLOR] +# e.g. ./square-xfwm4-corners.sh '#ff9900' (or a name like orange) +# no argument = keep the theme's normal title colour +set -eu + +ACTIVE_TITLE_COLOR="${1:-}" +case "$ACTIVE_TITLE_COLOR" in + ''|\#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]|\#[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) ;; + *[!a-zA-Z]*) echo "Colour must be #rgb, #rrggbb or a plain name like orange"; exit 1 ;; +esac + +SRC=/usr/share/themes/Default/xfwm4 +DST_THEME="$HOME/.themes/Default-Square" +DST="$DST_THEME/xfwm4" +[ -d "$SRC" ] || { echo "Missing $SRC"; exit 1; } + +# Warn if the installed theme differs from the version these overlays were made from +want=349096e386ab06feddff55aa404bed0a +have=$(md5sum "$SRC/top-left-active.png" 2>/dev/null | cut -d' ' -f1 || true) +[ "$have" = "$want" ] || echo "Warning: your Default theme differs from the expected version; result may be slightly off." + +# Fresh copy (also cleans up the result of the first version of this script) +rm -rf "$DST_THEME" +mkdir -p "$DST_THEME" +cp -r "$SRC" "$DST" + +# 1) Base layer (XPM): make the transparent corner pixels use the frame colour +for f in "$DST"/top-left-*.xpm "$DST"/top-right-*.xpm; do + awk ' + /"[^"]*"/ && !hdr { hdr = 1; split(substr($0, index($0,"\"")+1), a, /[ \t"]+/); nc = a[3]; cpp = a[4]; print; next } + hdr && seen < nc && /"/ { + seen++; s = substr($0, index($0,"\"")+1); s = substr(s, 1, index(s,"\"")-1) + key[seen] = substr(s, 1, cpp); spec[seen] = substr(s, cpp+1); pre[seen] = substr($0, 1, index($0,"\"")-1) + isnone[seen] = (tolower(spec[seen]) ~ /c[ \t]+none/) + if (!isnone[seen] && fill == "") fill = spec[seen] + if (seen == nc) for (i = 1; i <= nc; i++) print pre[i] "\"" key[i] (isnone[i] ? fill : spec[i]) "\"," + next } + { print }' "$f" > "$f.tmp" && mv "$f.tmp" "$f" +done + +# 2) Overlay (PNG): square versions of the outline/highlight images +write_png() { printf '%s' "$2" | base64 -d > "$DST/$1"; } +write_png top-left-active.png 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAdCAYAAACXFC2jAAAASklEQVR42mNkYGBoYMADWLi5udm+fPnShlPB/////zMwMPzHqQBK41TAxEAAsPz79+8/ZSYQcgMdrBj1JpIbGBkZ/5FtwqgCCAAAJ9onK5/spQ0AAAAASUVORK5CYII=' +write_png top-left-inactive.png 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAdCAYAAACXFC2jAAAASklEQVR42mNkYGBoYMADWLi5udm+fPnShlPB/////zMwMPzHqQBK41TAxEAAsPz79+8/ZSYQcgMdrBj1JpIbGBkZ/5FtwqgCCAAAJ9onK5/spQ0AAAAASUVORK5CYII=' +write_png top-right-active.png 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAdCAYAAACXFC2jAAAAR0lEQVR42u2PMQ7AIAwDz6hjXszEy+MOZSUMlZi41dY5ETAokO1YhRHRH8Crgm2XBYDGhtKQmf5nODRx35wGSVnk+xtu4eMFmCwkTAAQh0MAAAAASUVORK5CYII=' +write_png top-right-inactive.png 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAdCAYAAACXFC2jAAAAR0lEQVR42u2PMQ7AIAwDz6hjXszEy+MOZSUMlZi41dY5ETAokO1YhRHRH8Crgm2XBYDGhtKQmf5nODRx35wGSVnk+xtu4eMFmCwkTAAQh0MAAAAASUVORK5CYII=' + +# 3) Optional: colour of the focused window's title text +if [ -n "$ACTIVE_TITLE_COLOR" ]; then + rc="$DST/themerc" + if grep -q '^active_text_color=' "$rc"; then + sed -i "s|^active_text_color=.*|active_text_color=$ACTIVE_TITLE_COLOR|" "$rc" + else + echo "active_text_color=$ACTIVE_TITLE_COLOR" >> "$rc" + fi + echo "Active title colour: $ACTIVE_TITLE_COLOR" +fi + +echo "Created $DST_THEME" +xfconf-query -c xfwm4 -p /general/theme -s Default 2>/dev/null || true +xfconf-query -c xfwm4 -p /general/theme -s Default-Square 2>/dev/null \ + && echo "Applied theme 'Default-Square'." \ + || echo "Select 'Default-Square' in Settings > Window Manager > Style."