Help for MX Fluxbox
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Jerry3904 wrote: Sun Sep 08, 2024 8:46 am
Make it executable and move it to ~/.local/bin so user can easily change delay seconds
Would it be possible to have it in /usr/local/bin instead? I have never populated my home folder with bin directories.
*another possible location: ~/.config/MX-Linux/quickshot_delay
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.
1) /usr/ocal/bin woud not interest me b/c it's hidden away and requires root access to make the change
2) I tought about ~/.config but couldn't remember early this morning how to get the script to pay attention to it (something like source= I seem to recall...will look it up)
3) did you try the script and, if so, what did you think?
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB Personal: MX-25 Fluxbox, ThinkPad X1 Carbon gen 9 with i7 Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Jerry3904 wrote: Sun Sep 08, 2024 12:59 pm
1) /usr/ocal/bin woud not interest me b/c it's hidden away and requires root access to make the change
2) I tought about ~/.config but couldn't remember early this morning how to get the script to pay attention to it (something like source= I seem to recall...will look it up)
3) did you try the script and, if so, what did you think?
Works as expected. Created the file in ~/.config/MX-Linux/ and named it quickshot_delay, then made it an executable.
Added it to my root menu
and when selected, it took a screenshot after the 8 second delay.
You do not have the required permissions to view the files attached to this post.
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.
I think it will be easier just to use the USERS default path (/usr/local/bin)
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.
Create the file, make it executable and (as root) move it to /usr/local/bin.
The user can still edit the delay time but won't need to type in root's password for the change.
Maybe add something to MX Tweak to have a GUI change (instead of manual editing) like what was done for the screensaver timer.
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.
Hello Jerry3904
mxfb-quickshot
When arg1 matches r, then Quickshot extend invitation.
Sample-data mxfb-quickshot include invitation.
Use file name /mxfb-quickshot during trial the sample
replace the active /usr/bin/mxfb-quickshot
#!/bin/bash
## this app is based on one by tenner that can be downloaded at http://tenr.de/snippets/scripts/shot.sh
## it has been modified and expanded for use with MX-Fluxbox
## released under GPLv3
# 2024week37
# mxfb-quickshot version
VERSION="230210"
## the following parameters are set in ${HOME}/.config/MX-Linux/mxfb-quickshot.conf
# OPTION="-s -q 100"
# DESTDIR="$(xdg-user-dir PICTURES)"
# NAME="$(date +'%y%m%d_%H%M%S')"
# SUF="png"
# PRE="quickshot_"
BASE_NAME=$(basename "$0")
DATE=$(date '+%Y%m%d')
CONFIG_DIR="$HOME/.config/MX-Linux"
BACKUP_DIR="$HOME/.restore/MX-Linux"
CONFIG_NAME="mxfb-quickshot.conf"
BACKUP_NAME="${CONFIG_NAME}_${VERSION}_${DATE}"
FLUXBOXKEYS="$HOME/.fluxbox/keys"
USER_CONFIG="${CONFIG_DIR}/${CONFIG_NAME}"
DISMISS_CHK="${CONFIG_DIR}/mxfb-quickshot-dismiss.chk"
BACKUP_CONF="${BACKUP_DIR}/${BACKUP_NAME}"
SYSTEM_CONF="/usr/share/mxfb-quickshot/$CONFIG_NAME"
ICONPATH="/usr/share/icons/Papirus/24x24/devices/camera.svg"
# take icon from theme if needed
[ -e "$ICONPATH" ] || ICONPATH=camera-photo
WM_CLASS=mxfb-quickshot
# messages shown
USAGE="Usage: $BASE_NAME [-p|p|-r|r|-u|u] [-png|png|-jpg|jpg]"
# set up translation
export TEXTDOMAIN=mxfb-accessories
export TEXTDOMAINDIR=/usr/share/locale
source gettext.sh
# Note: Comment lines above gettext lines are visible to translators.
# The capture of a screenshot was aborted.
NONE_SELECTED=$(gettext 'exiting, no image selected')
# The capture of a screenshot was cancelled.
CANCELLED=$(gettext 'Cancelled!')
# The capture of a screenshot was successful.
SUCCESS=$(gettext 'Success!')
# Do you want to allow a new config file to be installed?
OK_TO_PROCEED=$(gettext 'OK to proceed?')
# Do you want to display the Help message again?
DISMISS=$(gettext 'Dismiss')
DISMISS_HELP=$(gettext "Don't display the Help message again!")
# A new config file will be installed.
UPGRADE_MESSAGE=$(gettext 'This will install a new config file')
# The existing config file will be copied into a backup directory.
BACKUP_MESSAGE=$(gettext 'The existing file will be backed up in:')
MESSAGE="$UPGRADE_MESSAGE\n\n$BACKUP_MESSAGE\n\n<b>$BACKUP_DIR/</b>"
HELP_TITLE=$(gettext 'HELP: how to take a screenshot')
# How to take a screenshot...
HELP0=$(gettext 'Press "Print" (or "PrtSc") and use the mouse:')
# Press the Print-Screen-key to capture a window.
# WINDOW: press Print, then click anywhere inside
HELP1=$(gettext 'WINDOW: click anywhere inside')
# Press the Print-Screen-key to capture a wallpaper.
# DESKTOP: press Print, then click the background
HELP2=$(gettext 'DESKTOP: click the background')
# Press the Print-Screen-key to capture a screen selection.
# SELECTION: press Print, then draw a rectangle
HELP3=$(gettext 'SELECTION: draw a rectangle')
HELP_MESSAGE="
$HELP0
--$HELP1
--$HELP2
--$HELP3
"
# Hints for creating a screenshot
# The help message will not be displayed again, if user clicks on "Dismiss" button.
# The capture of a screenshot will start after closing this window.
HELP_HINTS=$(eval_gettext '
Hints
--Click "Dismiss" to hide Help in the future!
--Capture Help by clicking it after agreeing to proceed
--More: search "Quickshot" in the MX Wiki')
display_help() {
printf "%s\n" "$USAGE"
}
if [ ! -f "$DISMISS_CHK" ]; then
HELP=(
/usr/bin/notify-send
-i "$ICONPATH"
-t 30000
"$HELP_TITLE"
"$HELP_MESSAGE"
)
"${HELP[@]}"
sleep 3
YAD=(yad
--title="Quickshot"
--class="$WM_CLASS"
--window-icon="$ICONPATH"
--borders=20
--center
--fixed
--height=300
--width=300
--text-align=left
--text="\n\n<b>$HELP_HINTS</b>\n\n"
--button="$DISMISS"'!!'"$DISMISS_HELP":3
--button=gtk-ok
)
"${YAD[@]}"
if [ $? = 3 ]; then
[ -d "$CONFIG_DIR" ] || mkdir -p "$CONFIG_DIR"
echo "VERSION=$VERSION" > "$DISMISS_CHK"
fi
fi
if [ -r "$SYSTEM_CONF" ] && [ ! -r "$USER_CONFIG" ]; then
[ -d "$CONFIG_DIR" ] || mkdir -p "$CONFIG_DIR"
cp "$SYSTEM_CONF" "$USER_CONFIG"
[ -d "$BACKUP_DIR" ] || mkdir -p "$BACKUP_DIR"
cp "$USER_CONFIG" "$BACKUP_CONF"
fi
if ! ls "${BACKUP_DIR}/${CONFIG_NAME}_${VERSION}"* >/dev/null 2>&1 &&
[ -r "$USER_CONFIG" ] && [ -r "$SYSTEM_CONF" ] &&
! cmp -s "$SYSTEM_CONF" "$USER_CONFIG" ; then
YAD=(yad
--title="Quickshot"
--class="$WM_CLASS"
--window-icon="$ICONPATH"
--width=350
--height=200
--borders=20
--center
--text-align=center
--text="\n\n$MESSAGE\n\n"
--button="gtk-cancel":7
--button="$OK_TO_PROCEED":6
)
"${YAD[@]}"
[ $? = 6 ] || exit 0
[ -d "$BACKUP_DIR" ] || mkdir -p "$BACKUP_DIR"
cp "$USER_CONFIG" "$BACKUP_CONF"
cp "$SYSTEM_CONF" "$USER_CONFIG"
fi
# using "safe-source" instead of source "$USER_CONFIG"
# safe-source - will read only allowed config parameter lines from user config
# as defined in system config. Other paramter and lines are ignored.
#
ALLOWED_CONF_PARAMETER=( $(sed -r '/^\s*[a-zA-Z_]+=/!d; s/=.*//' $SYSTEM_CONF 2>/dev/null) )
if [ ${#ALLOWED_CONF_PARAMETER[@]} != 0 ]; then
CONF_PARAMETER_PATTERN="${ALLOWED_CONF_PARAMETER[*]}"
CONF_PARAMETER_PATTERN="${CONF_PARAMETER_PATTERN// /|}"
USER_CONF_PARAMETER=$(sed -r "/^\s*(${CONF_PARAMETER_PATTERN})=/!d" "$USER_CONFIG" 2>/dev/null )
eval "$USER_CONF_PARAMETER"
fi
# user config sanity check
# set to reasonable vaules with := assignment only if not set already
: ${OPTION:="-s -q 97"}
: ${DESTDIR:=$(xdg-user-dir PICTURES)}
: ${NAME:=$(date +%y%m%d_%H%M%S)}
: ${PRE:=screemx}
: ${SUF:=jpg}
: ${ICONPATH:=/usr/share/icons/Papirus/24x24/devices/camera.svg}
# take icon from theme if needed - in case user change in conf was allowed
[ -e "$ICONPATH" ] || ICONPATH=camera-photo
# use home directory if destdir is not defined
: ${DESTDIR:=$HOME}
take_shot() {
local ret
local filename="${PRE}${NAME}.${SUF}"
local exec_option='mv $f '"$DESTDIR"
[ -w "$PWD" ] || cd "$HOME" # to make shure current directory is writable
if [ "$(readlink -e "$DESTDIR")" = "$(readlink -e "$PWD")" ]; then
scrot ${OPTION} "${PRE}${NAME}.${SUF}"
ret=$?
else
scrot ${OPTION} "${PRE}${NAME}.${SUF}" -e "$exec_option"
ret=$?
fi
if [ $ret = 1 ]; then
/usr/bin/notify-send -i "$ICONPATH" -t 3000 "$CANCELLED"
exit 0
fi
if [ $ret = 2 ] ; then
echo "$NONE_SELECTED"
exit 1
fi
return $ret
}
if [ $# -eq 0 ]; then
take_shot && /usr/bin/notify-send -i "$ICONPATH" -t 3000 " $SUCCESS"
exit 0
fi
if [ $# -gt 2 ]; then
display_help
exit 1
fi
ARG1=${1#-} # remove '-' from start of arg
case "${ARG1,,}" in # lower case
p)
OPTION="-p -q 89"
;;
r|root)
OPTION=""
;;
u|focused)
OPTION="-u"
;;
l)
OPTION="-d 14"
;;
l2)
OPTION="-d 20"
;;
*)
display_help
exit 1
;;
esac
ARG2=${2#-} # remove '-' from start of arg
case "${ARG2,,}" in # lower case
jpg)
SUF="jpg"
;;
png)
SUF="png"
;;
*)
display_help
exit 1
;;
esac
take_shot && /usr/bin/notify-send -i "$ICONPATH" -t 3000 " $SUCCESS"
if [ "$OPTION" ]; then
exit
else
export DIALOG=$(cat <<End_of_Text
<window title="Quickshot" icon-name="player_pause" window-position="1" allow-grow="false" border-width="8">
<vbox>
<frame Take another Quickshot ? >
<button cancel></button>
</frame>
<frame Take another Quickshot ? >
<button ok></button>
<frame Pause Quickshot >
<frame SECONDS interim click interim shot >
<spinbutton range-min="2" range-max="257" range-step="1" range-value="2" xalign="0.5" max-length="3" progress-fraction="0.00">
<variable>DELAYTERM</variable>
</spinbutton>
</frame>
</frame>
</frame>
</vbox>
</window>
End_of_Text
)
I=$IFS; IFS=""
for STATEMENTS in $(gtkdialog --program DIALOG); do
eval $STATEMENTS
done
IFS=$I
if [ "$EXIT" = "OK" ] ; then
sleep ${DELAYTERM}s && mxfb-quickshot p jpg
fi
fi
exit $?
screemxretrocapture mxfb-quickshot tested ok with scrot versions 1.11.1 and 1.8.1
You do not have the required permissions to view the files attached to this post.
Last edited by i_ri on Mon Sep 09, 2024 9:25 am, edited 2 times in total.
Thanks, I will look at it. The big problem for me is that the most recent release of the maintained version of scrot (1.11.1-1~mx23+1) that is currently now in MX Test has deprecated the use of "-d", which is why I have switched to using "sleep"
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB Personal: MX-25 Fluxbox, ThinkPad X1 Carbon gen 9 with i7 Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin
Hello Jerry3904 and Everyone
Made gtkdialog a year ago for delay quickshot. is mx losing gtkdialog?
A yad dialog sleep variable user input delay mxfb-quickshot.
The word postpone? future shot.
Change or dismiss the sample entry, text, icons
A yad entry in .fluxbox /apps can alter yad window geometry.
I remember that you did this. My personal opinion is that quickshot was designed by tenr, and resuscitated during relatively early MXFB development, as a very simple, light and fast tool of the type
don't ask me any questions or show me a GUI, just do what I want!
IMO people who want or need more should just install something like xfce4's very useful tool--which I myself keep available for occasional use.
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB Personal: MX-25 Fluxbox, ThinkPad X1 Carbon gen 9 with i7 Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin