commit
e1d3bd5bc8
5 changed files with 136 additions and 18 deletions
@ -0,0 +1,49 @@ |
||||
#!/bin/bash |
||||
|
||||
# Creates a gif using a list of files from stdin |
||||
tmpdir="/tmp/sxiv-gif/" |
||||
rm -rf "$tmpdir" |
||||
mkdir -p "$tmpdir" |
||||
|
||||
framerate="prompt" |
||||
format="gif" |
||||
extension="" |
||||
|
||||
while [[ $# -gt 0 ]]; do |
||||
case "$1" in |
||||
"-r"|"--framerate") |
||||
framerate="$2" |
||||
shift |
||||
shift |
||||
;; |
||||
"--mp4") |
||||
format="mp4" |
||||
shift |
||||
;; |
||||
esac |
||||
done |
||||
|
||||
if [[ "$framerate" == "prompt" ]]; then |
||||
framerate=$(echo -e "0.25\n0.5\n0.75\n1\n2\n5\n10" | rofi -dmenu -p Timeout) |
||||
fi |
||||
|
||||
i=1 |
||||
while read file; do |
||||
extension="${file##*.}" |
||||
number=$(printf "%03d" $i) |
||||
echo "$number" |
||||
cp "$file" "${tmpdir}file${number}.${extension}" |
||||
i=$((i+1)) |
||||
done |
||||
|
||||
case "$format" in |
||||
"mp4") |
||||
ffmpeg -f image2 -framerate "$framerate" -i "${tmpdir}file%03d.${extension}" -crf 0 "${tmpdir}out.${format}" |
||||
;; |
||||
*) |
||||
ffmpeg -f image2 -framerate "$framerate" -i "${tmpdir}file%03d.${extension}" "${tmpdir}out.${format}" |
||||
esac |
||||
|
||||
mv "${tmpdir}out.${format}" "$HOME/Desktop/" |
||||
|
||||
notify-send "Done" |
@ -0,0 +1,42 @@ |
||||
#!/bin/bash |
||||
# printpdf - script |
||||
# usage: |
||||
# printpdf file.pdf |
||||
# printpdf file1.pdf file2.pdf |
||||
# printpdf *.pdf |
||||
# by i_magnific0 |
||||
# Modified by jab2870 |
||||
|
||||
#COLORS=" -nb #303030 -nf khaki -sb #CCFFAA -sf #303030" |
||||
#if dmenu --help 2>&1 | grep -q '\[-rs\] \[-ni\] \[-nl\] \[-xs\]' |
||||
#then |
||||
# DMENU="dmenu -i -xs -rs -l 10" # vertical patch |
||||
#else |
||||
# DMENU="dmenu -i" # horizontal, oh well! |
||||
#fi |
||||
|
||||
DMENU="rofi -dmenu" |
||||
|
||||
printer=$( lpstat -p | awk '{print $2}' | $DMENU -p 'Printer:' $COLORS | perl -p -e 's/^.*?: ?//' ) |
||||
|
||||
set_options=$( echo -e 'No\nYes' | $DMENU -p 'Set options?' $COLORS | perl -p -e 's/^.*?: ?//' ) |
||||
|
||||
options="" |
||||
|
||||
# standard options to lpr, not in the printer lpstat -l |
||||
standard_options="page-ranges\nlandscape" |
||||
|
||||
while [ $set_options == "Yes" ]; do |
||||
custom_options=$( lpoptions -d $printer -l | grep -v NotInstalled | awk '{ print $1 }' | sed 's/:\+//g' ) |
||||
option_to_set=$( echo -e "$standard_options\n$custom_options" | $DMENU -p 'Option:' $COLORS | perl -p -e 's/^.*?: ?//' ) |
||||
option_value=$( lpoptions -d $printer -l | grep $option_to_set | awk 'BEGIN { FS = ": " } ; { print $2 }' | sed 's/ \+/\n/g' | sed 's/*\+//g' | $DMENU -p 'Setting:' $COLORS | perl -p -e 's/^.*?: ?//' ) |
||||
option_to_set_1d=$( echo $option_to_set | awk 'BEGIN { FS = "/" } ; { print $1 }' ) |
||||
if [ -z $option_value ]; then |
||||
options=$options"-o $option_to_set_1d " |
||||
else |
||||
options=$options"-o $option_to_set_1d=$option_value " |
||||
fi |
||||
set_options=$( echo -e 'No\nYes' | $DMENU -p 'Set more options?' $COLORS | perl -p -e 's/^.*?: ?//' ) |
||||
done |
||||
|
||||
lpr $options -P $printer $@ |
@ -1,18 +1,44 @@ |
||||
#!/bin/sh |
||||
while read file |
||||
do |
||||
case "$1" in |
||||
"greater" ) |
||||
convert -rotate 90 "$file" "$file" ;; |
||||
"less") |
||||
convert -rotate 270 "$file" "$file" ;; |
||||
"y") |
||||
echo -n "$file" | xclip -selection clipboard ;; |
||||
"g") |
||||
gimp "$file" & disown ;; |
||||
"G") |
||||
optirun gimp "$file" & disown ;; |
||||
* ) |
||||
notify-send "$1" |
||||
esac |
||||
done |
||||
|
||||
# This file is run from the sxiv when ctrl+x is pushed and then another key combination |
||||
# |
||||
# The file names are passed to stdin (1 per line) |
||||
# |
||||
# The key combination pushed after ctrl+x is sent as the first argument |
||||
# |
||||
# I have organised this script so when ctrl is pushed, a single command is run using all of the selected images |
||||
# e.g. creating a gif out of all selected images |
||||
# |
||||
# If ctrl is not pushed, the command is run on each image individually |
||||
# e.g. rotating images or opening them in gimp |
||||
|
||||
|
||||
case "$1" in |
||||
"C-g") |
||||
cat | createGif ;; |
||||
"C-v") |
||||
cat | createGif --mp4 ;; |
||||
"C-"*) |
||||
# If none of the above were used and ctrl was pushed, send a notificaton with the key combination |
||||
notify-send "$1" ;; |
||||
*) |
||||
# If the above key combinations were not pushed, loop through each of the images and check the combinations below |
||||
while read file |
||||
do |
||||
case "$1" in |
||||
"greater" ) |
||||
convert -rotate 90 "$file" "$file" ;; |
||||
"less") |
||||
convert -rotate 270 "$file" "$file" ;; |
||||
"y") |
||||
echo -n "$file" | xclip -selection clipboard ;; |
||||
"g") |
||||
gimp "$file" & disown ;; |
||||
"G") |
||||
optirun gimp "$file" & disown ;; |
||||
*) |
||||
# If none of the above were used, send a notificaton with the key combination |
||||
notify-send "$1" |
||||
esac |
||||
done |
||||
esac |
||||
|
@ -1 +1 @@ |
||||
Subproject commit 8b012330898306d1dd40260487082b5e27c41312 |
||||
Subproject commit 6fc7e108bfbb023fa028db299ec8e4b28e2fbcab |
Loading…
Reference in new issue