Compare commits

..
3 Commits
Author SHA1 Message Date
Daniele Fucini e2fd3e4aa9 xmonad: restore floating windows after leaving fullscreen
Remember each window's float rect when it goes fullscreen and put it back on exit,
instead of always sinking it (Viewnior after F5). Windows with no record are still sunk.
2026-11-14 19:43:37 +01:00
Daniele Fucini 4a96319bb2 Merge the database dump scripts into db-dump
garmin-dump, weather-dump and library-dump differed only in project, database and rotation; one
db-dump PROJECT DATABASE week|day replaces them. The units keep their names and only change ExecStart.
2026-11-14 15:49:48 +01:00
Daniele Fucini faad434dad aurb: keep ThinLTO cache entries until the size cap
lld expires entries unused for a week by default, which empties the cache between most package rebuilds; prune_after=0s leaves only the 10 GB cap.
2026-11-13 21:27:56 +01:00
9 changed files with 71 additions and 70 deletions

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@
# Here rather than in LDFLAGS: old libtool (<2.4.7) drops -fuse-ld=lld, and these then reach GNU ld.
-fuse-ld=lld
-Wl,--thinlto-cache-dir=/home/fuxino/.cache/thinlto
-Wl,--thinlto-cache-policy=cache_size_bytes=10g
-Wl,--thinlto-cache-policy=cache_size_bytes=10g:prune_after=0s
+1 -1
View File
@@ -5,7 +5,7 @@ StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.local/bin/garmin-dump
ExecStart=%h/.local/bin/db-dump negsplit Garmin week
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
Restart=on-failure
RestartSec=5min
+1 -1
View File
@@ -5,7 +5,7 @@ StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.local/bin/library-dump
ExecStart=%h/.local/bin/db-dump library_manager Library day
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
Restart=on-failure
RestartSec=5min
+1 -1
View File
@@ -5,7 +5,7 @@ StartLimitBurst=4
[Service]
Type=oneshot
ExecStart=%h/.local/bin/weather-dump
ExecStart=%h/.local/bin/db-dump ens-forecast Weather week
# MariaDB not up yet (e.g. caught up right after boot)? retry a few times
Restart=on-failure
RestartSec=5min
+29 -1
View File
@@ -2,7 +2,8 @@
import Data.Monoid
import Data.Char (toLower)
import Control.Monad (forM_, liftM2, when)
import Control.Monad (forM_, join, liftM2, when)
import qualified Data.Map.Strict as M
import Data.Maybe (isJust)
import XMonad
import XMonad.Actions.OnScreen (greedyViewOnScreen)
@@ -25,6 +26,7 @@ import XMonad.Layout.ThreeColumns
import qualified XMonad.StackSet as W
import XMonad.Util.ClickableWorkspaces
import XMonad.Util.EZConfig
import qualified XMonad.Util.ExtensibleState as XS
import qualified XMonad.Util.Hacks as Hacks
import XMonad.Util.Loggers
import XMonad.Util.NamedActions
@@ -38,6 +40,7 @@ main :: IO ()
main =
xmonad
. ewmhFullscreen
. setEwmhFullscreenHooks myFullscreenHook myUnfullscreenHook
. setEwmhSwitchDesktopHook safeView
. ewmh
. docks
@@ -415,6 +418,31 @@ myManageHook =
-- Case-insensitive, as GTK4 and firejailed apps capitalise their class differently
classIn names = (`elem` names) . map toLower <$> className
-- Fullscreen toggles: remember each window's float rect (Nothing if tiled) so leaving
-- fullscreen restores it instead of always sinking the window.
newtype PreFullscreen = PreFullscreen (M.Map Window (Maybe W.RationalRect))
instance ExtensionClass PreFullscreen where
initialValue = PreFullscreen M.empty
myFullscreenHook :: ManageHook
myFullscreenHook = do
w <- ask
liftX $ do
old <- gets (M.lookup w . W.floating . windowset)
XS.modify (\(PreFullscreen m) -> PreFullscreen (M.insert w old m))
doFullFloat
-- Windows with no record (e.g. opened fullscreen) are sunk, as before.
myUnfullscreenHook :: ManageHook
myUnfullscreenHook = do
w <- ask
old <- liftX $ do
PreFullscreen m <- XS.get
XS.put (PreFullscreen (M.delete w m))
pure (join (M.lookup w m))
maybe doSink doRectFloat old
-- Handle event hook
myHandleEventHook :: Event -> X All
myHandleEventHook =
+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
# Usage: db-dump PROJECT DATABASE week|day
# Dump a MariaDB database to ~/.local/share/PROJECT/dumps with login ~/.config/PROJECT/dump.cnf.
# week: per-ISO-week files, keeping the two newest; day: per-weekday files (seven self-rotating copies).
set -euo pipefail
if (($# != 3)) || [[ $3 != week && $3 != day ]]; then
echo "usage: ${0##*/} PROJECT DATABASE week|day" >&2
exit 2
fi
project=$1 db=$2 mode=$3
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/$project/dump.cnf
dir=${XDG_DATA_HOME:-$HOME/.local/share}/$project/dumps
if [[ $mode == week ]]; then
out=$dir/$db-$(date +%G-W%V).sql.gz
else
out=$dir/$db-$(LC_ALL=C date +%a).sql.gz
fi
keep=2
umask 077
mkdir -p "$dir"
# Write to a temporary file so a failed dump never replaces a good one
tmp=$(mktemp "$dir/.dump.XXXXXX")
trap 'rm -f "$tmp"' EXIT
mariadb-dump --defaults-extra-file="$cnf" --single-transaction --databases "$db" | gzip > "$tmp"
mv "$tmp" "$out"
# Weekly names sort by week, so all but the last $keep are the old ones
if [[ $mode == week ]]; then
dumps=("$dir/$db"-[0-9][0-9][0-9][0-9]-W[0-9][0-9].sql.gz)
if ((${#dumps[@]} > keep)); then
rm -f -- "${dumps[@]:0:${#dumps[@]}-keep}"
fi
fi
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
# Dump the Garmin database to a per-ISO-week file, keeping the two newest weeks.
set -euo pipefail
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/negsplit/dump.cnf
dir=${XDG_DATA_HOME:-$HOME/.local/share}/negsplit/dumps
out=$dir/Garmin-$(date +%G-W%V).sql.gz
keep=2
umask 077
mkdir -p "$dir"
# Write to a temporary file so a failed dump never replaces a good one
tmp=$(mktemp "$dir/.dump.XXXXXX")
trap 'rm -f "$tmp"' EXIT
mariadb-dump --defaults-extra-file="$cnf" --single-transaction --databases Garmin | gzip > "$tmp"
mv "$tmp" "$out"
# Names sort by week, so all but the last $keep are the old ones
dumps=("$dir"/Garmin-*.sql.gz)
if (( ${#dumps[@]} > keep )); then
rm -f -- "${dumps[@]:0:${#dumps[@]}-keep}"
fi
-17
View File
@@ -1,17 +0,0 @@
#!/bin/bash
# Dump the Library database to a per-weekday file (seven self-rotating copies).
set -euo pipefail
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/library_manager/dump.cnf
dir=${XDG_DATA_HOME:-$HOME/.local/share}/library_manager/dumps
out=$dir/Library-$(LC_ALL=C date +%a).sql.gz
umask 077
mkdir -p "$dir"
# Write to a temporary file so a failed dump never replaces a good one
tmp=$(mktemp "$dir/.dump.XXXXXX")
trap 'rm -f "$tmp"' EXIT
mariadb-dump --defaults-extra-file="$cnf" --single-transaction --databases Library | gzip > "$tmp"
mv "$tmp" "$out"
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
# Dump the Weather database (ens-forecast) to a per-ISO-week file, keeping the two newest weeks.
set -euo pipefail
cnf=${XDG_CONFIG_HOME:-$HOME/.config}/ens-forecast/dump.cnf
dir=${XDG_DATA_HOME:-$HOME/.local/share}/ens-forecast/dumps
out=$dir/Weather-$(date +%G-W%V).sql.gz
keep=2
umask 077
mkdir -p "$dir"
# Write to a temporary file so a failed dump never replaces a good one
tmp=$(mktemp "$dir/.dump.XXXXXX")
trap 'rm -f "$tmp"' EXIT
mariadb-dump --defaults-extra-file="$cnf" --single-transaction --databases Weather | gzip > "$tmp"
mv "$tmp" "$out"
# Names sort by week, so all but the last $keep are the old ones
dumps=("$dir"/Weather-*.sql.gz)
if (( ${#dumps[@]} > keep )); then
rm -f -- "${dumps[@]:0:${#dumps[@]}-keep}"
fi