scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

commit 7d3dc968b6183f51dc2594c80450372f0c8fb811
parent 20bbe3418e71556ff2d14623cbbf047c0bd55855
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon, 23 Dec 2024 10:01:15 +0100

Changes for new laptop

Diffstat:
Mbattery-checknow | 2+-
Mdmenu-unmount | 3+--
Mopen-file | 6+++---
Mopen-stdin | 8++++----
Mterminal | 4+++-
Mxedit | 3++-
6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/battery-checknow b/battery-checknow @@ -4,7 +4,7 @@ # Requires: battery-status, notify-battery file="${XDG_DATA_HOME:-$HOME/.local/share}/batterystatus" -notify="notify push" +notify=${NOTIFY:-"notify push"} low=20 crit=15 diff --git a/dmenu-unmount b/dmenu-unmount @@ -7,8 +7,7 @@ # Example: dmenu-unmount -m slmenu -w echo menu=dmenu -#writeout=notify-send -writeout="notify push" +writeout=${NOTIFY:-"notify push"} usage() { echo "Usage: dmenu-unmount [-m MENU] [-w WRITER]" diff --git a/open-file b/open-file @@ -9,9 +9,9 @@ menu="dmenu -i -l 15" # Change default apps here -video="vlc" -music="vlc" -pdf="zathura" +video=${VIDEO:-vlc} +music=${MUSIC:-vlc} +pdf=${PDF:-zathura} img="imv" word="libreoffice" sheet="libreoffice" diff --git a/open-stdin b/open-stdin @@ -1,12 +1,12 @@ #!/bin/sh -# Saves standard input in a download folder and opens it (spawn) +# Saves standard input in a temporary file and opens it (spawn) # Usage: open-stdin -# Requires: open-file +# Requires: open-file (or set $OPENER to e.g. xdg-open) -#folder=$HOME/Downloads/open-stdin folder=${TMPDIR:-/tmp} +open=${OPENER:-open-file} tempfile=$(mktemp -p "$folder") -cat > "$tempfile" && open-file $@ "$tempfile" +cat > "$tempfile" && $open $@ "$tempfile" diff --git a/terminal b/terminal @@ -2,4 +2,6 @@ # My default terminal -st -e tmux new-session "$@" +terminal=${TERMINAL:-'st -e tmux new-session "$@"'} + +$terminal diff --git a/xedit b/xedit @@ -4,5 +4,6 @@ # Requires: terminal editor=${EDITOR:-${VISUAL:-vi}} +xed=${XEDIT:-'terminal "$editor"'} -terminal "$editor" "$@" +$xed "$@"