scripts

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

commit cb8f9102498eddb8cd3cb907a2d64dd344a92910
parent 53f313bbdc7fb7d6af99d3e7f91c3c5a3bc66538
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date:   Thu, 10 Feb 2022 18:38:59 +0100

Removed environment variables for default programs. Some have been replaced by their own script.

Diffstat:
MMakefile | 2++
Mdmenu-websearch | 2+-
Mmail-compose | 6++----
Mopen-file | 20++++++++++----------
Mpopup-cal12 | 2+-
Mpopup-cal3 | 2+-
Mpopup-terminal | 2+-
Aterminal | 5+++++
Axedit | 8++++++++
Mxedit-filter | 5++---
Mxplumb | 9++++-----
11 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile @@ -27,12 +27,14 @@ SCRIPTS = addressgrep \ sfeed-browser \ spawn \ templess \ + terminal \ togglemute \ translate \ trash \ urlgrep \ volume \ websearch \ + xedit \ xedit-filter \ xkboptions \ xplumb \ diff --git a/dmenu-websearch b/dmenu-websearch @@ -1,6 +1,6 @@ #!/bin/sh -# Popup $TERMINAL prompting for websearch +# dmenu prompt for websearch # Requires: dmenu (or similar), websearch menu=${MENU:-dmenu} diff --git a/mail-compose b/mail-compose @@ -1,8 +1,6 @@ #!/bin/sh # Open a mail composer. -# Requires: mblaze +# Requires: mblaze, terminal -terminal=${TERMINAL:-xterm} - -$terminal -e mcom $@ +terminal -e mcom $@ diff --git a/open-file b/open-file @@ -4,19 +4,19 @@ # Launches files based on their mimetypes # Use option -s devour to swallow or -s " " to open normally from terminal # Use -t to specify mimetype -# Requires: dmenu_path or similar (fallback) -# dmenu-filepicker +# Requires: dmenu_path or similar (fallback), dmenu-filepicker menu=${MENU:-dmenu} -video=${VIDEOPLAYER:-mpv} -music=${MUSICPLAYER:-mpv} -pdf=${VIEWER:-zathura} -img=${IMAGEVIEWER:-imv} -word=${TEXTDOCUMENT:-libreoffice} -sheet=${SPREADSHEET:-libreoffice} -html=${HTMLVIEWER:-firefox} -xedit=${XEDITOR:-gedit} +# Change default apps here +video="mpv" +music="mpv --player-operation-mode=pseudo-gui" +pdf="zathura" +img="imv" +word="libreoffice" +sheet="libreoffice" +html="firefox --new-window" +xedit="xedit" openfile() { f="$@" diff --git a/popup-cal12 b/popup-cal12 @@ -1,6 +1,6 @@ #!/bin/sh -# Popup $TERMINAL displaying cal -3 +# Popup terminal displaying cal -3 # Requires: st (suckless terminal) st -T "stfloat" -g 69x36+620+250 -e sh -c 'cal $(date +%Y); read x' diff --git a/popup-cal3 b/popup-cal3 @@ -1,6 +1,6 @@ #!/bin/sh -# Popup $TERMINAL displaying cal -3 +# 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/popup-terminal b/popup-terminal @@ -2,4 +2,4 @@ # TODO maybe I want to run e.g. tmux in this? -st -T "stfloat" -g 85x25+550+300 $@ +st -T "stfloat" -g 85x25+550+300 tmux new-session $@ diff --git a/terminal b/terminal @@ -0,0 +1,5 @@ +#!/bin/sh + +# My default terminal + +st -e tmux new-session $@ diff --git a/xedit b/xedit @@ -0,0 +1,8 @@ +#!/bin/sh + +# My X editor +# Requires: terminal + +editor=${EDITOR:-${VISUAL:-vi}} + +terminal $editor diff --git a/xedit-filter b/xedit-filter @@ -1,10 +1,9 @@ #/!bin/sh # Open stdin in a text editor and sends modified selection to stdout - -xeditor=${XEDITOR:-gedit} +# Requires: xeditor f=$(mktemp) cat > "$f" -$xeditor "$f" && cat "$f" +xeditor "$f" && cat "$f" diff --git a/xplumb b/xplumb @@ -5,7 +5,8 @@ # some possibilities (open file, open url, man page...). If none is matched, # a choice is prompted. -# Requires: dmenu (or similar), mail-compose, open-file, websearch, xsel +# Requires: dmenu (or similar), mail-compose, open-file, terminal, websearch, +# xedit, xsel # TODO: # send mail to email address; @@ -13,8 +14,6 @@ # choice: pipe to another program browser=${BROWSER:-firefox} -terminal=${TERMINAL:-xterm} -xeditor=${XEDITOR:-gedit} menu=${MENU:-dmenu} menuopts="-l 10" @@ -34,7 +33,7 @@ choice() { elif [ "$chosen" = "edit" ]; then f=$(mktemp) xsel > "$f" - $xeditor "$f" + xedit "$f" fi } @@ -47,7 +46,7 @@ tryman() { number=$(echo "$1" | sed 's/[^1-8]//g') name=$(echo "$1" | sed 's/([1-8])//g' | sed 's/ //g') if [ $(man -w "$number" "$name" | wc -l) = 1 ]; then - $terminal -e man "$number" "$name" + terminal -e man "$number" "$name" return 0 else return 1