summaryrefslogtreecommitdiff
path: root/scripts/old
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-05-06 08:30:49 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-05-06 08:30:49 +0200
commit60052659b98832c78c902e4f27ecee2663d8e913 (patch)
tree9efc1388569c43456557aa1975b4bec99bf06c94 /scripts/old
parent10e16c2fb2266bb2b46ec7ea64d721de0c29a0d9 (diff)
downloadconfig-60052659b98832c78c902e4f27ecee2663d8e913.tar.gz
config-60052659b98832c78c902e4f27ecee2663d8e913.zip
Added scripts
Diffstat (limited to 'scripts/old')
-rwxr-xr-xscripts/old/brightness16
-rwxr-xr-xscripts/old/dmenu-filepicker-old31
-rwxr-xr-xscripts/old/dunst-toggle14
-rwxr-xr-xscripts/old/gfmt9
-rwxr-xr-xscripts/old/mail-checknow18
-rwxr-xr-xscripts/old/mblaze-extras61
-rwxr-xr-xscripts/old/notify-battery10
-rwxr-xr-xscripts/old/notify-status7
-rwxr-xr-xscripts/old/notify-time15
-rwxr-xr-xscripts/old/sfeed-browser80
-rwxr-xr-xscripts/old/theme23
-rwxr-xr-xscripts/old/togglemute18
-rwxr-xr-xscripts/old/volume13
-rwxr-xr-xscripts/old/xkboptions6
-rwxr-xr-xscripts/old/xprop-active-window-id6
15 files changed, 327 insertions, 0 deletions
diff --git a/scripts/old/brightness b/scripts/old/brightness
new file mode 100755
index 0000000..a7294fb
--- /dev/null
+++ b/scripts/old/brightness
@@ -0,0 +1,16 @@
1#!/bin/sh
2
3# Increase / decrease brightness, and pops up a notification
4# Requires: xbacklight, a notification program such as herbe or notify-send
5# Usage: brightness {inc|dec} n
6
7# ksh completion
8# set -A complete_brightness_1 inc dec
9# set -A complete_brightness_2 5
10
11#notify="notify-send"
12notify="herbe"
13
14pkill herbe # comment this too if not using herbe
15
16xbacklight -$1 $2 && $notify "Brightness: $(xbacklight | sed 's/\..*$//')%"
diff --git a/scripts/old/dmenu-filepicker-old b/scripts/old/dmenu-filepicker-old
new file mode 100755
index 0000000..532fb82
--- /dev/null
+++ b/scripts/old/dmenu-filepicker-old
@@ -0,0 +1,31 @@
1#!/bin/sh
2
3# A dmenu-based file picker (prints selected file to stdout)
4# Requires: dmenu (or similar)
5# Usage: dmenu-filepicker [path]
6
7menu=${MENU:-dmenu}
8menuopts="-i -l 15"
9
10basedir="$(pwd)"
11
12next="${@:-$(pwd)}"
13
14while true; do
15 if [ -z "$next" ]; then
16 break
17 elif [ "$next" = "." ]; then
18 pwd
19 break
20 elif [ -d "$next" ]; then
21 cd "$next"
22 next=$(ls -a | $menu $menuopts)
23 else
24 echo "$next" | while read line; do
25 echo "$(pwd)/$line"
26 done
27 break
28 fi
29done
30
31cd "$basedir"
diff --git a/scripts/old/dunst-toggle b/scripts/old/dunst-toggle
new file mode 100755
index 0000000..2de2343
--- /dev/null
+++ b/scripts/old/dunst-toggle
@@ -0,0 +1,14 @@
1#!/bin/sh
2
3# Toggle "do not disturbe" mode with dunst
4# Requires: dunst, notify-send
5
6if [ "$(dunstctl is-paused)" = "false" ]; then
7 notify-send -t 3000 "Notifications: OFF" "Notifications will be hidden"
8 sleep 3
9 dunstctl set-paused true
10else
11 dunstctl set-paused false
12 notify-send -t 3000 "Notifications: ON" "Notifications reactivated"
13fi
14
diff --git a/scripts/old/gfmt b/scripts/old/gfmt
new file mode 100755
index 0000000..d38351f
--- /dev/null
+++ b/scripts/old/gfmt
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3# Format text from gemtext format to short lines with double \n
4
5# TODO: remove double spacing from within ```
6
7sed 's/ //' | \
8sed 'a\\' | \
9fold -sw 80
diff --git a/scripts/old/mail-checknow b/scripts/old/mail-checknow
new file mode 100755
index 0000000..188042b
--- /dev/null
+++ b/scripts/old/mail-checknow
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3# Check for new email, save result to file.
4# Requires: mpop, notify-send or similar
5
6file="$XDG_DATA_HOME/newmail"
7#notify="notify-send"
8notify=herbe
9
10l=$(cat "$file")
11n=$(mpop -s | awk '/new*./{print $2}')
12
13if [ -n "$n" ]; then
14 echo "$n" > "$file"
15 if [ "$n" != "no" ] && [ "$l" != "$n" ]; then
16 $notify "New email ($n)"
17 fi
18fi
diff --git a/scripts/old/mblaze-extras b/scripts/old/mblaze-extras
new file mode 100755
index 0000000..7a4fe8a
--- /dev/null
+++ b/scripts/old/mblaze-extras
@@ -0,0 +1,61 @@
1#!/bin/sh
2
3# Useful extra commands for mblaze
4
5# Requires: mblaze, mpop
6
7# Usage: mblaze-extras command
8# List of commands:
9# get [filter]
10# pick [field]
11# save
12# scan [folder]
13
14menu=${MENU:-dmenu}
15mdir=$HOME/mail
16mpopdir=$HOME/.config/mpop
17
18mbextra_scan() {
19 folder=${1:-inbox}
20 mlist -t $mdir/$folder | mthread | mseq -S
21 mscan
22}
23
24mbextra_get() {
25 mpop --filter=$mpopdir/filter-$1.sh
26 minc -q $mdir/inbox
27 mbextra_scan inbox
28}
29
30mbextra_pick() {
31 field=$1
32 shift
33 mpick -t "$field =~~ \"$@\""
34}
35
36mbextra_save() {
37 dir=$2
38 [ -z "$dir" ] && dir=$(dmenu-filepicker)
39 mkdir -p "$dir"
40
41 if [ ! -d "$dir" ]; then
42 echo "No directory selected, skipping."
43 else
44 cd "$dir"
45 mshow -x $1
46 fi
47}
48
49if [ -z "$1" ]; then
50 echo "Usage: mblaze-extras COMMAND"
51elif [ "$1" = "scan" ]; then
52 mbextra_scan $2
53elif [ "$1" = "get" ]; then
54 mbextra_get $2
55elif [ "$1" = "save" ]; then
56 shift
57 mbextra_save $@
58elif [ "$1" = "pick" ]; then
59 shift
60 mbextra_pick $@
61fi
diff --git a/scripts/old/notify-battery b/scripts/old/notify-battery
new file mode 100755
index 0000000..0294b70
--- /dev/null
+++ b/scripts/old/notify-battery
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3# Popup battery notification, based on the script battery-status
4
5# Requires: notify-send or similar
6
7#notify=notify-send
8notify=herbe
9
10$notify "Battery" "$(battery-status)"
diff --git a/scripts/old/notify-status b/scripts/old/notify-status
new file mode 100755
index 0000000..73a9435
--- /dev/null
+++ b/scripts/old/notify-status
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3# Simple script to send a notification displaying the output of status
4
5# Requires: status, herbe (or similar, e.g. notify-send)
6
7herbe "$(status '\n\n')"
diff --git a/scripts/old/notify-time b/scripts/old/notify-time
new file mode 100755
index 0000000..4b77c74
--- /dev/null
+++ b/scripts/old/notify-time
@@ -0,0 +1,15 @@
1#!/bin/sh
2
3# Little notification to show time and date
4
5# Requires: notify-send or similar
6
7# TODO: check if it still works with notify-send
8
9#notify=notify-send
10notify=herbe
11
12t=$(date +"%H:%M:%S")
13d=$(date +"%d %B %Y, %A")
14
15$notify "$t" "$d"
diff --git a/scripts/old/sfeed-browser b/scripts/old/sfeed-browser
new file mode 100755
index 0000000..774c808
--- /dev/null
+++ b/scripts/old/sfeed-browser
@@ -0,0 +1,80 @@
1#!/bin/sh
2
3# This script is based on sfeed (https://codemadness.org/sfeed.html), but
4# it allows you organize your feeds in directories and subdirectories.
5# In your $sfd directory (see below) you should have two folders:
6# urls: it can contain more subfolders and files. Each file should contain
7# only one line with the url to the feed. The name of the file is the
8# name of the feed (it can contains spaces and such).
9# files: this one can be empty, it will be filled with the feed files
10# An older version of this script also marked viewed items and removed
11# them before displaying the choice of feeds. Contact me if you are interested
12# in using it.
13
14# Requires: sfeed, dmenu-file-picker (or similar), open-url (or similar)
15
16# Usage: sfeed-browser [-m menu]
17
18filepicker="dmenu-filepicker" # Try "nnn -p -"
19menu="dmenu -l 35 -i"
20urlopener=open-url
21sfd="$HOME/box/sfeed"
22showlast=10
23
24usage() {
25 echo "sfeed-browser [-m MENU]"
26}
27
28while getopts "m:" opt; do
29 case "$opt" in
30 m)
31 menu="$OPTARG"
32 ;;
33 *)
34 usage
35 exit 1
36 ;;
37 esac
38done
39
40# Might add more stuff later
41fixurl() {
42 sed 's/old\.reddit\.com/reddit\.com/'
43}
44
45dirtofeedpaths() {
46 while read -r line; do
47 find "$line" | while read -r fname; do
48 [ -f "$fname" ] && echo "$fname"
49 done
50 done
51}
52
53pathstosfeedrc() {
54 printf 'sfeedpath="%s"\n\nfeeds() {\n' "$sfd/files"
55 while read -r line; do
56 feedname=$(echo "$line" | sed 's/.*\///')
57 read -r feedurl <"$line"
58 printf '\tfeed "%s" "%s"\n' "$feedname" "$feedurl"
59 done
60 printf "}\n"
61}
62
63feedmenu() {
64 while read -r line; do
65 feedname=$(echo "$line" | sed 's/.*\///')
66 sfeed_plain "$sfd/files/$feedname" | head -$showlast
67 done | $menu
68}
69
70openfeeds() {
71 while read -r line; do
72 url=$(echo "$line" | sed 's/.*[\t ]//' | fixurl)
73 [ -n "$url" ] && echo "$url"
74 done | xargs $urlopener
75}
76
77$filepicker "$@" "$sfd/urls" | dirtofeedpaths > "$sfd/last"
78pathstosfeedrc < "$sfd/last" > "$sfd/sfeedrc"
79sfeed_update "$sfd/sfeedrc"
80feedmenu < "$sfd/last" | openfeeds
diff --git a/scripts/old/theme b/scripts/old/theme
new file mode 100755
index 0000000..7e0107a
--- /dev/null
+++ b/scripts/old/theme
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3# This script is a shortcut to change between a dark and a light theme
4# for my terminal emulator (st).
5
6# Usage: theme (dark|light)
7
8src=$HOME/.local/src
9
10case "$@" in
11 dark)
12 cd $src/st-darkbg
13 ;;
14 light)
15 cd $src/st-lightbg
16 ;;
17 *)
18 echo "usage: theme (dark|light)"
19 exit 1
20 ;;
21esac
22
23make && sudo make install
diff --git a/scripts/old/togglemute b/scripts/old/togglemute
new file mode 100755
index 0000000..b799b02
--- /dev/null
+++ b/scripts/old/togglemute
@@ -0,0 +1,18 @@
1#!/bin/sh
2
3# Toggle mute state and notify
4# Requires: pulsemixer, notify-send or similar
5
6#notify=notify-send
7notify=herbe
8
9ismute=$(pulsemixer --toggle-mute --get-mute)
10
11if [ "$ismute" = "1" ]; then
12 m="muted"
13else
14 m="unmuted"
15fi
16
17pkill herbe # comment this line too if not using herbe
18$notify "Audio $m"
diff --git a/scripts/old/volume b/scripts/old/volume
new file mode 100755
index 0000000..8dcd36a
--- /dev/null
+++ b/scripts/old/volume
@@ -0,0 +1,13 @@
1#!/bin/sh
2
3# Change volume and notify
4# Usage: volume {+n|-n}
5# Requires: pulsemixer, notify-send or similar
6
7#notify=notify-send
8notify=herbe
9
10newvol=$(pulsemixer --change-volume "$1" --get-volume | awk '{print $1}')
11
12pkill herbe # comment this line too if not using herbe
13$notify "Volume" "$newvol%"
diff --git a/scripts/old/xkboptions b/scripts/old/xkboptions
new file mode 100755
index 0000000..e63456d
--- /dev/null
+++ b/scripts/old/xkboptions
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3# Loads my xkboptions
4
5setxkbmap -option compose:ralt
6setxkbmap -option caps:swapescape
diff --git a/scripts/old/xprop-active-window-id b/scripts/old/xprop-active-window-id
new file mode 100755
index 0000000..97cf60f
--- /dev/null
+++ b/scripts/old/xprop-active-window-id
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3# Get the ID of the current active window (hexadecimal)
4# Requires: xprop
5
6xprop -root | grep _NET_ACTIVE_WINDOW | head -1 | sed 's/.* //'

Generated with cgit - Back to sebastiano.tronto.net