scripts: Move myip and webcam functions to separate scripts. Remove sx.

Add comment in .xinitrc on using vlock with startx.
master
Pierre Neidhardt 2016-10-13 15:21:37 +05:30
parent bc94633efa
commit 5d2c5548d7
4 changed files with 25 additions and 19 deletions

3
.scripts/myip Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
curl ifconfig.me

19
.scripts/webcam Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
if [ $# -ne 0 ]; then
cat <<EOF>&2
Test the webcam using an mplayer-compatible program.
EOF
exit
fi
for i in mpv mplayer2 mplayer; do
if command -v $i >/dev/null 2>&1
$i --tv driver=v4l2:width=640:height=480:device=/dev/video0 tv://
exit
fi
done
echo >&2 "mplayer-compatible program not found"
exit 1

View File

@ -39,24 +39,6 @@ alias mkdir='mkdir -p'
## Reset terminal -- Faster alternative of 'reset'.
alias cls='printf "\ec"'
##==============================================================================
## TODO: Move those to scripts?
# List desktop applications.
[ -d /usr/share/applications ] && XDG_APPS=($XDG_APPS /usr/share/applications)
[ -d /usr/local/share/applications ] && XDG_APPS=($XDG_APPS /usr/local/share/applications)
[ ${#XDG_APPS} -ne 0 ] && alias applist='grep -R "^Name=" $XDG_APPS | cut -d'=' -f2 | sort'
## Get your external IP.
command -v curl >/dev/null 2>&1 && alias myip='curl ifconfig.me'
## Start X and lock current terminal (press ENTER when back in terminal to
## prompt for password). Useless if X is running on the same TTY.
command -v vlock >/dev/null 2>&1 && alias sx='startx & vlock'
## Udiskie
command -v udiskie-umount >/dev/null 2>&1 && alias uua='udiskie-umount -a'
##==============================================================================
## Pacman aliases

View File

@ -1,5 +1,8 @@
#!/bin/sh
## WARNING: If started from TTY on a multi-seat, the user must run 'startx &
## vlock' to ensure the X locker cannot be bypassed.
## Run site init scripts. Usually not necessary.
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
@ -25,4 +28,3 @@ fi
## some login managers. Beside, systemd sessions may sigkill all user apps on
## logoff, preventing a clean termination.
# command -v sessionclean >/dev/null 2>&1 && sessionclean