Add preloaded SMS, File Manager, and Camera (live viewfinder) DWM plugins
This commit is contained in:
@@ -189,6 +189,9 @@ run_menu() {
|
||||
}
|
||||
|
||||
if [ "$MENU_MODE" -eq 1 ]; then
|
||||
if command -v xcamera >/dev/null 2>&1; then
|
||||
exec xcamera
|
||||
fi
|
||||
run_menu
|
||||
else
|
||||
take_photo "$USE_FLASH" "$OUT_FILE"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -153,12 +153,12 @@ fast_sys_choices() {
|
||||
CHOICES="$icon_trm Terminal^0^st -e ${SHELL:-/bin/sh}
|
||||
$icon_grd Apps^0^sxmo_appmenu.sh applications
|
||||
$icon_grd Scripts^0^sxmo_appmenu.sh scripts
|
||||
$icon_dir Files^0^sxmo_files.sh
|
||||
$icon_dir Files^0^xfiles
|
||||
$icon_phn Dialer^0^xdialer
|
||||
$icon_phl Call Log^0^xcalllog
|
||||
$icon_msg Texts^0^sxmo_modemtext.sh
|
||||
$icon_msg Texts^0^xsms
|
||||
$icon_usr Contacts^0^xcontacts
|
||||
${_bt_line}$icon_cam Camera^0^bananarchy-photo --menu
|
||||
${_bt_line}$icon_cam Camera^0^xcamera
|
||||
${_flash_line}$icon_net Networks^0^sxmo_networks.sh
|
||||
$icon_mus Audio^0^sxmo_audio.sh
|
||||
$icon_phn Modem^0^sxmo_appmenu.sh modem
|
||||
|
||||
Executable
+127
@@ -0,0 +1,127 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
# title="$icon_dir Files"
|
||||
|
||||
case " $* " in
|
||||
*" --select-only "*)
|
||||
;;
|
||||
*)
|
||||
if command -v xfiles >/dev/null 2>&1; then
|
||||
if [ $# -gt 0 ] && [ -d "$1" ]; then
|
||||
exec xfiles "$1"
|
||||
fi
|
||||
exec xfiles
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
. sxmo_common.sh
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
printf "%s <FILES> [--date-sort] [--reverse-sort] [--select-only] [-h help]\n" \
|
||||
"$(basename "$0")"
|
||||
exit 1
|
||||
}
|
||||
|
||||
DIR="$HOME"
|
||||
SORT=
|
||||
REVERSE=
|
||||
SELECTONLY=0
|
||||
|
||||
while [ -n "${1:-}" ]; do
|
||||
case "$1" in
|
||||
--select-only)
|
||||
SELECTONLY=1
|
||||
;;
|
||||
--date-sort)
|
||||
SORT="--sort=t"
|
||||
;;
|
||||
--reverse-sort)
|
||||
REVERSE="-r"
|
||||
;;
|
||||
-h)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
DIR="$1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cd "$DIR"
|
||||
|
||||
sort_loop() {
|
||||
CHOICES="$([ -z "$SORT" ] && printf "date" || printf "name")\n$([ -z "$REVERSE" ] && printf "desc" || printf "asc")\n"
|
||||
|
||||
PICKED="$(
|
||||
printf %b "$CHOICES" |
|
||||
sxmo_dmenu.sh -p "Sort" -i
|
||||
)"
|
||||
|
||||
case "$PICKED" in
|
||||
"date")
|
||||
SORT="--sort=t"
|
||||
;;
|
||||
"name")
|
||||
SORT=
|
||||
;;
|
||||
"desc")
|
||||
REVERSE="-r"
|
||||
;;
|
||||
"asc")
|
||||
REVERSE=
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
while true; do
|
||||
# shellcheck disable=SC2086
|
||||
FILES="$(ls -1p $SORT $REVERSE)"
|
||||
CHOICES="$(printf %b 'Reload\nOpen in terminal\nClose Menu\nSort By\n../\n*\n'"$FILES")"
|
||||
DIR="$(basename "$(pwd)")"
|
||||
TRUNCATED="$(printf %.7s "$DIR")"
|
||||
if [ "$DIR" != "$TRUNCATED" ]; then
|
||||
DIR="$TRUNCATED..."
|
||||
fi
|
||||
|
||||
PICKED="$(
|
||||
printf %b "$CHOICES" |
|
||||
sxmo_dmenu.sh -p "$DIR" -i
|
||||
)"
|
||||
|
||||
case "$PICKED" in
|
||||
"Sort By")
|
||||
sort_loop
|
||||
;;
|
||||
"Open in terminal")
|
||||
exec sxmo_terminal.sh
|
||||
;;
|
||||
"Close Menu")
|
||||
exit 0
|
||||
;;
|
||||
"Reload")
|
||||
continue
|
||||
;;
|
||||
\*)
|
||||
if [ -n "$SELECTONLY" ]; then
|
||||
printf %s "Can't do this"
|
||||
else
|
||||
sxmo_open.sh -a ./*
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
[ -d "$PICKED" ] && cd "$PICKED" && continue
|
||||
if [ -f "$PICKED" ]; then
|
||||
if [ "$SELECTONLY" -eq 1 ]; then
|
||||
printf "%s" "$(pwd)/$PICKED" && exit
|
||||
else
|
||||
sxmo_open.sh -a "$PICKED"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
if command -v xsms >/dev/null 2>&1; then
|
||||
exec xsms "$@"
|
||||
fi
|
||||
exec /usr/bin/dwm-plugin sms "$@"
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
dwm-plugin
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
@@ -766,16 +766,16 @@ case "$WMCLASS" in
|
||||
$icon_trm Terminal ^ 0 ^ st -e ${SHELL:-/bin/sh}
|
||||
$icon_grd Apps ^ 0 ^ sxmo_appmenu.sh applications
|
||||
$icon_grd Scripts ^ 0 ^ sxmo_appmenu.sh scripts
|
||||
$icon_dir Files ^ 0 ^ sxmo_files.sh
|
||||
$icon_dir Files ^ 0 ^ xfiles
|
||||
$icon_phn Dialer ^ 0 ^ xdialer
|
||||
$icon_phl Call Log ^ 0 ^ xcalllog
|
||||
$icon_msg Texts ^ 0 ^ sxmo_modemtext.sh
|
||||
$icon_msg Texts ^ 0 ^ xsms
|
||||
$icon_usr Contacts ^ 0 ^ xcontacts
|
||||
$(
|
||||
bt_is_unblocked &&
|
||||
printf %b "$icon_bth Bluetooth ^ 1 ^ sxmo_bluetoothmenu.sh"
|
||||
)
|
||||
$icon_cam Camera ^ 0 ^ bananarchy-photo --menu
|
||||
$icon_cam Camera ^ 0 ^ xcamera
|
||||
$(
|
||||
brightness=""
|
||||
if [ -r /sys/class/leds/white:torch/brightness ]; then
|
||||
|
||||
@@ -3,55 +3,7 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
# Copyright 2022 Sxmo Contributors
|
||||
|
||||
# This hook displays the sms log for a numbers passed as $1
|
||||
|
||||
LOGDIRNUM="$1"
|
||||
|
||||
# Wrap this in a terminal if not already done
|
||||
if [ -z "$TERMNAME" ]; then
|
||||
TERMNAME="$LOGDIRNUM SMS"
|
||||
|
||||
# If it's already open, switch to it.
|
||||
if [ "$SXMO_WM" = "sway" ] && [ -z "$SSH_CLIENT" ]; then
|
||||
regesc_termname="$(echo "$TERMNAME" | sed 's|+|\\+|g')"
|
||||
if swaymsg -q "[title=\"^$regesc_termname\$\"]" focus; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
export TERMNAME
|
||||
exec sxmo_terminal.sh "$0" "$@"
|
||||
if command -v xsms >/dev/null 2>&1; then
|
||||
exec xsms tailtextlog "$@"
|
||||
fi
|
||||
|
||||
# include common definitions
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
mkcontactssedcmd() {
|
||||
pnc find "$LOGDIRNUM" | while read -r NUMBER; do
|
||||
CONTACT="$(sxmo_contacts.sh --name-or-number "$NUMBER")"
|
||||
if [ ! "$CONTACT" = "$NUMBER" ]; then
|
||||
printf %s "s/$NUMBER/$CONTACT/;"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Replace certain dates with human readable versions
|
||||
TODAY="$(date +%F)"
|
||||
YESTERDAY="$(date -d "- 1 day" +%F)"
|
||||
TWO_DAYS="$(date -d "- 2 day" +%F)"
|
||||
DATESEDCMD="s/ at ${TODAY}T/ today at /; s/ at ${YESTERDAY}T/ yesterday at /; s/ at ${TWO_DAYS}T/ two days ago at /; s/[-+][0-9][0-9][0-9][0-9]://; s/\(-[0-9][0-9]\)T\([0-9][0-9]\)/\1 \2/;"
|
||||
|
||||
# TODO
|
||||
#ALIGNSEDCMD="s/^Sent/<right align>/;s/^Received/<left align>/;"
|
||||
|
||||
# Colorize Sent and Received lines
|
||||
RECEIVED_COLOR="2"
|
||||
SENT_COLOR="3"
|
||||
COLORSEDCMD="s#^\(Sent.*\)#$(tput setaf "$SENT_COLOR")\1$(tput op)#;s#^\(Received.*\)#$(tput setaf "$RECEIVED_COLOR")\1$(tput op)#;"
|
||||
|
||||
# Replace phone numbers in the filename with contacts from contact book
|
||||
CONTACTSSEDCMD="$(mkcontactssedcmd)"
|
||||
|
||||
tail -n9999 -f "$SXMO_LOGDIR/$LOGDIRNUM/sms.txt" |\
|
||||
sed -e "$CONTACTSSEDCMD" -e "$DATESEDCMD" -e "$COLORSEDCMD"
|
||||
exec /usr/bin/dwm-plugin sms tailtextlog "$@"
|
||||
|
||||
Reference in New Issue
Block a user