From c4d0e3de7ad04114797abb14368e4a6f8da04a60 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 8 May 2026 23:55:30 +0200 Subject: Updates from alpine --- scripts/apkworld | 2 +- scripts/old/brightness | 16 -------- scripts/old/dmenu-filepicker-old | 31 --------------- scripts/old/dunst-toggle | 14 ------- scripts/old/gfmt | 9 ----- scripts/old/mail-checknow | 18 --------- scripts/old/mblaze-extras | 61 ----------------------------- scripts/old/notify-battery | 10 ----- scripts/old/notify-status | 7 ---- scripts/old/notify-time | 15 ------- scripts/old/sfeed-browser | 80 -------------------------------------- scripts/old/theme | 23 ----------- scripts/old/togglemute | 18 --------- scripts/old/volume | 13 ------- scripts/old/xkboptions | 6 --- scripts/old/xprop-active-window-id | 6 --- scripts/popup-cal12 | 2 +- scripts/popup-cal3 | 6 --- scripts/popup-terminal | 2 +- scripts/setup-config-alpine | 36 ++++++++++++++++- scripts/unused/popup-cal3 | 6 +++ scripts/unused/xedit | 9 +++++ scripts/unused/xedit-filter | 9 +++++ scripts/xedit | 9 ----- scripts/xedit-filter | 9 ----- 25 files changed, 61 insertions(+), 356 deletions(-) delete mode 100755 scripts/old/brightness delete mode 100755 scripts/old/dmenu-filepicker-old delete mode 100755 scripts/old/dunst-toggle delete mode 100755 scripts/old/gfmt delete mode 100755 scripts/old/mail-checknow delete mode 100755 scripts/old/mblaze-extras delete mode 100755 scripts/old/notify-battery delete mode 100755 scripts/old/notify-status delete mode 100755 scripts/old/notify-time delete mode 100755 scripts/old/sfeed-browser delete mode 100755 scripts/old/theme delete mode 100755 scripts/old/togglemute delete mode 100755 scripts/old/volume delete mode 100755 scripts/old/xkboptions delete mode 100755 scripts/old/xprop-active-window-id delete mode 100755 scripts/popup-cal3 create mode 100755 scripts/unused/popup-cal3 create mode 100755 scripts/unused/xedit create mode 100755 scripts/unused/xedit-filter delete mode 100755 scripts/xedit delete mode 100755 scripts/xedit-filter (limited to 'scripts') diff --git a/scripts/apkworld b/scripts/apkworld index 91deb8e..27483fe 100755 --- a/scripts/apkworld +++ b/scripts/apkworld @@ -12,4 +12,4 @@ tmp_file=$(mktemp) doas cp /etc/apk/world /etc/apk/world.backup cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > $tmp_file doas mv $tmp_file /etc/apk/world -doas apk fix +doas apk fix --interactive diff --git a/scripts/old/brightness b/scripts/old/brightness deleted file mode 100755 index a7294fb..0000000 --- a/scripts/old/brightness +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# Increase / decrease brightness, and pops up a notification -# Requires: xbacklight, a notification program such as herbe or notify-send -# Usage: brightness {inc|dec} n - -# ksh completion -# set -A complete_brightness_1 inc dec -# set -A complete_brightness_2 5 - -#notify="notify-send" -notify="herbe" - -pkill herbe # comment this too if not using herbe - -xbacklight -$1 $2 && $notify "Brightness: $(xbacklight | sed 's/\..*$//')%" diff --git a/scripts/old/dmenu-filepicker-old b/scripts/old/dmenu-filepicker-old deleted file mode 100755 index 532fb82..0000000 --- a/scripts/old/dmenu-filepicker-old +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# A dmenu-based file picker (prints selected file to stdout) -# Requires: dmenu (or similar) -# Usage: dmenu-filepicker [path] - -menu=${MENU:-dmenu} -menuopts="-i -l 15" - -basedir="$(pwd)" - -next="${@:-$(pwd)}" - -while true; do - if [ -z "$next" ]; then - break - elif [ "$next" = "." ]; then - pwd - break - elif [ -d "$next" ]; then - cd "$next" - next=$(ls -a | $menu $menuopts) - else - echo "$next" | while read line; do - echo "$(pwd)/$line" - done - break - fi -done - -cd "$basedir" diff --git a/scripts/old/dunst-toggle b/scripts/old/dunst-toggle deleted file mode 100755 index 2de2343..0000000 --- a/scripts/old/dunst-toggle +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Toggle "do not disturbe" mode with dunst -# Requires: dunst, notify-send - -if [ "$(dunstctl is-paused)" = "false" ]; then - notify-send -t 3000 "Notifications: OFF" "Notifications will be hidden" - sleep 3 - dunstctl set-paused true -else - dunstctl set-paused false - notify-send -t 3000 "Notifications: ON" "Notifications reactivated" -fi - diff --git a/scripts/old/gfmt b/scripts/old/gfmt deleted file mode 100755 index d38351f..0000000 --- a/scripts/old/gfmt +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Format text from gemtext format to short lines with double \n - -# TODO: remove double spacing from within ``` - -sed 's/ //' | \ -sed 'a\\' | \ -fold -sw 80 diff --git a/scripts/old/mail-checknow b/scripts/old/mail-checknow deleted file mode 100755 index 188042b..0000000 --- a/scripts/old/mail-checknow +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Check for new email, save result to file. -# Requires: mpop, notify-send or similar - -file="$XDG_DATA_HOME/newmail" -#notify="notify-send" -notify=herbe - -l=$(cat "$file") -n=$(mpop -s | awk '/new*./{print $2}') - -if [ -n "$n" ]; then - echo "$n" > "$file" - if [ "$n" != "no" ] && [ "$l" != "$n" ]; then - $notify "New email ($n)" - fi -fi diff --git a/scripts/old/mblaze-extras b/scripts/old/mblaze-extras deleted file mode 100755 index 7a4fe8a..0000000 --- a/scripts/old/mblaze-extras +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# Useful extra commands for mblaze - -# Requires: mblaze, mpop - -# Usage: mblaze-extras command -# List of commands: -# get [filter] -# pick [field] -# save -# scan [folder] - -menu=${MENU:-dmenu} -mdir=$HOME/mail -mpopdir=$HOME/.config/mpop - -mbextra_scan() { - folder=${1:-inbox} - mlist -t $mdir/$folder | mthread | mseq -S - mscan -} - -mbextra_get() { - mpop --filter=$mpopdir/filter-$1.sh - minc -q $mdir/inbox - mbextra_scan inbox -} - -mbextra_pick() { - field=$1 - shift - mpick -t "$field =~~ \"$@\"" -} - -mbextra_save() { - dir=$2 - [ -z "$dir" ] && dir=$(dmenu-filepicker) - mkdir -p "$dir" - - if [ ! -d "$dir" ]; then - echo "No directory selected, skipping." - else - cd "$dir" - mshow -x $1 - fi -} - -if [ -z "$1" ]; then - echo "Usage: mblaze-extras COMMAND" -elif [ "$1" = "scan" ]; then - mbextra_scan $2 -elif [ "$1" = "get" ]; then - mbextra_get $2 -elif [ "$1" = "save" ]; then - shift - mbextra_save $@ -elif [ "$1" = "pick" ]; then - shift - mbextra_pick $@ -fi diff --git a/scripts/old/notify-battery b/scripts/old/notify-battery deleted file mode 100755 index 0294b70..0000000 --- a/scripts/old/notify-battery +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Popup battery notification, based on the script battery-status - -# Requires: notify-send or similar - -#notify=notify-send -notify=herbe - -$notify "Battery" "$(battery-status)" diff --git a/scripts/old/notify-status b/scripts/old/notify-status deleted file mode 100755 index 73a9435..0000000 --- a/scripts/old/notify-status +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Simple script to send a notification displaying the output of status - -# Requires: status, herbe (or similar, e.g. notify-send) - -herbe "$(status '\n\n')" diff --git a/scripts/old/notify-time b/scripts/old/notify-time deleted file mode 100755 index 4b77c74..0000000 --- a/scripts/old/notify-time +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Little notification to show time and date - -# Requires: notify-send or similar - -# TODO: check if it still works with notify-send - -#notify=notify-send -notify=herbe - -t=$(date +"%H:%M:%S") -d=$(date +"%d %B %Y, %A") - -$notify "$t" "$d" diff --git a/scripts/old/sfeed-browser b/scripts/old/sfeed-browser deleted file mode 100755 index 774c808..0000000 --- a/scripts/old/sfeed-browser +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -# This script is based on sfeed (https://codemadness.org/sfeed.html), but -# it allows you organize your feeds in directories and subdirectories. -# In your $sfd directory (see below) you should have two folders: -# urls: it can contain more subfolders and files. Each file should contain -# only one line with the url to the feed. The name of the file is the -# name of the feed (it can contains spaces and such). -# files: this one can be empty, it will be filled with the feed files -# An older version of this script also marked viewed items and removed -# them before displaying the choice of feeds. Contact me if you are interested -# in using it. - -# Requires: sfeed, dmenu-file-picker (or similar), open-url (or similar) - -# Usage: sfeed-browser [-m menu] - -filepicker="dmenu-filepicker" # Try "nnn -p -" -menu="dmenu -l 35 -i" -urlopener=open-url -sfd="$HOME/box/sfeed" -showlast=10 - -usage() { - echo "sfeed-browser [-m MENU]" -} - -while getopts "m:" opt; do - case "$opt" in - m) - menu="$OPTARG" - ;; - *) - usage - exit 1 - ;; - esac -done - -# Might add more stuff later -fixurl() { - sed 's/old\.reddit\.com/reddit\.com/' -} - -dirtofeedpaths() { - while read -r line; do - find "$line" | while read -r fname; do - [ -f "$fname" ] && echo "$fname" - done - done -} - -pathstosfeedrc() { - printf 'sfeedpath="%s"\n\nfeeds() {\n' "$sfd/files" - while read -r line; do - feedname=$(echo "$line" | sed 's/.*\///') - read -r feedurl <"$line" - printf '\tfeed "%s" "%s"\n' "$feedname" "$feedurl" - done - printf "}\n" -} - -feedmenu() { - while read -r line; do - feedname=$(echo "$line" | sed 's/.*\///') - sfeed_plain "$sfd/files/$feedname" | head -$showlast - done | $menu -} - -openfeeds() { - while read -r line; do - url=$(echo "$line" | sed 's/.*[\t ]//' | fixurl) - [ -n "$url" ] && echo "$url" - done | xargs $urlopener -} - -$filepicker "$@" "$sfd/urls" | dirtofeedpaths > "$sfd/last" -pathstosfeedrc < "$sfd/last" > "$sfd/sfeedrc" -sfeed_update "$sfd/sfeedrc" -feedmenu < "$sfd/last" | openfeeds diff --git a/scripts/old/theme b/scripts/old/theme deleted file mode 100755 index 7e0107a..0000000 --- a/scripts/old/theme +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# This script is a shortcut to change between a dark and a light theme -# for my terminal emulator (st). - -# Usage: theme (dark|light) - -src=$HOME/.local/src - -case "$@" in - dark) - cd $src/st-darkbg - ;; - light) - cd $src/st-lightbg - ;; - *) - echo "usage: theme (dark|light)" - exit 1 - ;; -esac - -make && sudo make install diff --git a/scripts/old/togglemute b/scripts/old/togglemute deleted file mode 100755 index b799b02..0000000 --- a/scripts/old/togglemute +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# Toggle mute state and notify -# Requires: pulsemixer, notify-send or similar - -#notify=notify-send -notify=herbe - -ismute=$(pulsemixer --toggle-mute --get-mute) - -if [ "$ismute" = "1" ]; then - m="muted" -else - m="unmuted" -fi - -pkill herbe # comment this line too if not using herbe -$notify "Audio $m" diff --git a/scripts/old/volume b/scripts/old/volume deleted file mode 100755 index 8dcd36a..0000000 --- a/scripts/old/volume +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Change volume and notify -# Usage: volume {+n|-n} -# Requires: pulsemixer, notify-send or similar - -#notify=notify-send -notify=herbe - -newvol=$(pulsemixer --change-volume "$1" --get-volume | awk '{print $1}') - -pkill herbe # comment this line too if not using herbe -$notify "Volume" "$newvol%" diff --git a/scripts/old/xkboptions b/scripts/old/xkboptions deleted file mode 100755 index e63456d..0000000 --- a/scripts/old/xkboptions +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Loads my xkboptions - -setxkbmap -option compose:ralt -setxkbmap -option caps:swapescape diff --git a/scripts/old/xprop-active-window-id b/scripts/old/xprop-active-window-id deleted file mode 100755 index 97cf60f..0000000 --- a/scripts/old/xprop-active-window-id +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Get the ID of the current active window (hexadecimal) -# Requires: xprop - -xprop -root | grep _NET_ACTIVE_WINDOW | head -1 | sed 's/.* //' diff --git a/scripts/popup-cal12 b/scripts/popup-cal12 index 1c85b3d..ef37d08 100755 --- a/scripts/popup-cal12 +++ b/scripts/popup-cal12 @@ -3,4 +3,4 @@ # Popup terminal displaying cal -3 # Requires: st (suckless terminal) -st -T "stfloat" -g 69x36+620+250 -e sh -c "cal $(date +%Y); read x" +st -T "stfloat" -g 69x36+580+50 -e sh -c "cal $(date +%Y); read x" diff --git a/scripts/popup-cal3 b/scripts/popup-cal3 deleted file mode 100755 index 6dfed54..0000000 --- a/scripts/popup-cal3 +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Popup terminal displaying cal -3 -# Requires: st (suckless terminal) - -st -T "stfloat" -g 68x11+620+450 -e sh -c 'cal -3; read x' diff --git a/scripts/popup-terminal b/scripts/popup-terminal index 5a9a931..1a8bb22 100755 --- a/scripts/popup-terminal +++ b/scripts/popup-terminal @@ -2,4 +2,4 @@ # TODO maybe I want to run e.g. tmux in this? -st -T "stfloat" -g 85x25+550+300 tmux new-session "$@" +st -T "stfloat" -g 85x25+500+200 tmux new-session "$@" diff --git a/scripts/setup-config-alpine b/scripts/setup-config-alpine index a9a63b9..9db2c35 100755 --- a/scripts/setup-config-alpine +++ b/scripts/setup-config-alpine @@ -42,11 +42,33 @@ for i in dmenu dwm st; do cd $i cp ~/.config/$i/config.h ./config.h make && doas make install + cd .. done cd +tmp_xorg_file=$(mktemp) +cat < $tmp_xorg_file +Section "InputClass" + Identifier "libinput touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "libinput" + Option "Tapping" "on" +EndSection +EOF + +doas mkdir -p /etc/X11/xorg.conf.d +doas mv $tmp_xorg_file /etc/X11/xorg.conf.d/40-libinput.conf + +tmp_doas_file=$(mktemp) +cp /etc/doas.d/20-wheel.conf $tmp_doas_file +for c in poweroff reboot; do + printf 'permit nopass :wheel as root cmd %s\n' "$c" >> $tmp_doas_file +done +doas cp $tmp_doas_file /etc/doas.d/20-wheel.conf + -print_log "Swapping Escape and Caps Lock in console" +print_log "Configuring the console" tmp_kmap_file=$(mktemp) tmp_loadkmap_file=$(mktemp) @@ -58,11 +80,18 @@ doas mv us-swapesc.bmap.gz /etc/keymap/ printf 'KEYMAP=/etc/keymap/us-swapesc.bmap.gz\n' > $tmp_loadkmap_file doas mv $tmp_loadkmap_file /etc/conf.d/loadkmap +tmp_blacklist_file=$(mktemp) +cp /etc/modprobe.d/blacklist.conf $tmp_blacklist_file +printf '\n# Disable PC speaker for real\nblacklist pcspkr\n' >> $tmp_blacklist_file +doas cp $tmp_blacklist_file /etc/modprobe.d/blacklist.conf + print_log "Setting up ACPI (see https://wiki.alpinelinux.org/wiki/Power_management)" tmp_acpi_file=$(mktemp) cat < $tmp_acpi_file +#!/bin/sh + xhci="$(grep XHCI /proc/acpi/wakeup | awk '{print $3}')" [ "$xhci" == '*enabled' ] && echo XHCI > /proc/acpi/wakeup echo mem > /sys/power/state @@ -74,6 +103,8 @@ for dir in LID PWRF; do doas chmod +x /etc/acpi/$dir/00000080 done +doas rc-update add acpid + print_log "Setting up WiFi (iwd) (see https://wiki.alpinelinux.org/wiki/Iwd)" @@ -130,6 +161,7 @@ echo " 1c. github" echo " 3. Share folders in SyncThing, including but not limited to:" echo " 2a. box with Artemisia, pizoc and phone" echo " 2b. file-drop with phone" -echo " 4. Copy your mailbox.org password to .ssh/mailbox.org" +echo " 4. Copy your mailbox.org password to .ssh/mailbox.org." +echo " 5. Log into Firefox account and set up extensions, if needed." echo "" echo "Enjoy!" diff --git a/scripts/unused/popup-cal3 b/scripts/unused/popup-cal3 new file mode 100755 index 0000000..6dfed54 --- /dev/null +++ b/scripts/unused/popup-cal3 @@ -0,0 +1,6 @@ +#!/bin/sh + +# Popup terminal displaying cal -3 +# Requires: st (suckless terminal) + +st -T "stfloat" -g 68x11+620+450 -e sh -c 'cal -3; read x' diff --git a/scripts/unused/xedit b/scripts/unused/xedit new file mode 100755 index 0000000..3f68f24 --- /dev/null +++ b/scripts/unused/xedit @@ -0,0 +1,9 @@ +#!/bin/sh + +# My X editor +# Requires: terminal + +editor=${EDITOR:-${VISUAL:-vi}} +xed=${XEDIT:-"terminal "$editor""} + +$xed "$@" diff --git a/scripts/unused/xedit-filter b/scripts/unused/xedit-filter new file mode 100755 index 0000000..7caf12c --- /dev/null +++ b/scripts/unused/xedit-filter @@ -0,0 +1,9 @@ +#!/bin/sh + +# Open stdin in a text editor and sends modified selection to stdout +# Requires: xedit + +f=$(mktemp) +cat > "$f" +xedit "$f" && cat "$f" + diff --git a/scripts/xedit b/scripts/xedit deleted file mode 100755 index 3f68f24..0000000 --- a/scripts/xedit +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# My X editor -# Requires: terminal - -editor=${EDITOR:-${VISUAL:-vi}} -xed=${XEDIT:-"terminal "$editor""} - -$xed "$@" diff --git a/scripts/xedit-filter b/scripts/xedit-filter deleted file mode 100755 index 7caf12c..0000000 --- a/scripts/xedit-filter +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Open stdin in a text editor and sends modified selection to stdout -# Requires: xedit - -f=$(mktemp) -cat > "$f" -xedit "$f" && cat "$f" - -- cgit v1.3