Users browsing this thread: 2 Guest(s)
pfr
Nixers
So I have recently been updating my dmenu scripts, and the one I referenced in the OP, the link to it is broken, but Its a heavily modified version of cry4x3's dmenu-scrot script:

(07-06-2021, 12:58 PM)cyr4x3 Wrote:
(06-06-2021, 10:35 PM)Ramiferous Wrote: Hey Cyr4x3, would you mind sharing your sxiv/dmenu script to set the wallpaper and also your dmenu screenshot script?

Of course, here you are:

The wallpaper thingy consists of 2 scripts really. First i launch the one i called choosebg, which just searches for images in my wallpapers folder and displays them in sxiv and from within sxiv, using sxiv's keyhandler i launch setbg, which launches a dmenu to choose how the wallpaper should be set and sets it with xwallpaper.

The dmenu screenshot script can be found over here: dmenu-scrot.sh (requires maim and xdotool).

Also, the pb cli tool that i used is this one overhere, by xero.

Here is what I use:

**[please, someone help me make this POSIX >> #!/bin/sh]**
PHP Code:
#!/usr/bin/env bash

set -o pipefail

DMENU
=${DMENU:-dmenu}
IMG_PATH=$HOME/Pictures/dumps/
UL="pb 0x0"    # pb [0x0/envs/catbox]
TIME=5000 #Seconds notification should remain visible
FILENAME=$(date +%Y-%m-%d_@_%H-%M-%S-scrot.png)

prog="1.Fullscreen
2.Delay_Fullscreen
3.Draw_Section
4.Window
5.Fullscreen_UL
6.Delay_Fullscreen_UL
7.Draw_Section_UL
8.Window_UL"

# dmenu vars set in ~/.profile
cmd=$($DMENU -l 20 -'Choose Screenshot Type' <<< "$prog")

cd $IMG_PATH
case ${cmd%% *} in

    1.Fullscreen
)           
                  
scrot -d 1 $FILENAME && notify-send -t $TIME -"Screenshot" "$(echo $IMG_PATH$FILENAME)" ;;
    
2.Delay_Fullscreen)     
                  
scrot -d 4 $FILENAME && notify-send -t $TIME -"Screenshot" "$(echo $IMG_PATH$FILENAME)" ;;
    
3.Draw_Section)            
                  
scrot -s $FILENAME && notify-send -t $TIME -"Screenshot: Section" "$(echo $IMG_PATH$FILENAME)" ;;
    
4.Window)               
                  
scrot -ub -d 1 $FILENAME && notify-send -t $TIME -"Screenshot: Window" "$(echo $IMG_PATH$FILENAME)" ;;
    
5.Fullscreen_UL)        
                  
scrot -d 1 $FILENAME && $UL $FILENAME xclip -sel clip && notify-send -t $TIME -"Screenshot Uploaded" "$(xclip -o -sel clip)" ;;
    
6.Delay_Fullscreen_UL)  
                  
scrot -d 4 $FILENAME && $UL $FILENAME xclip -sel clip && notify-send -t $TIME -"Sreenshot Uploaded" "$(xclip -o -sel clip)" ;;
    
7.Draw_Section_UL)      
                  
scrot -s $FILENAME && $UL $FILENAME xclip -sel clip && notify-send -t $TIME -"Screenshot Uploaded" "$(xclip -o -sel clip)";;
    
8.Window_UL)            
                  
scrot -ub -d 1 $FILENAME && $UL $FILENAME xclip -sel clip && notify-send -t $TIME -"Screenshot Uploaded" "$(xclip -o -sel clip)";;
    
    *)          
exec "${cmd};;
esac 
Thanks cry4x3!


My version of the pb script is pretty stripped down now:

PHP Code:
#!/bin/sh

usage () {
    
cat <<EOF

Services
0x0|nullenvs|pbcatbox|cat
Usage
pb <service> <file>

EOF
  
exit 0
}

ARG="${2:-/dev/stdin}"
UA=${UA:="Pfr_Upload_Script/1.0"}

case $
1 in
    0x0
|null)
        
curl -"$UA-sF 'file=@-' https://0x0.st < $ARG
    
;;
    
envs|pb)
        
curl -"$UA-sF 'file=@-' https://envs.sh < $ARG
    
;;
    
catbox|cat)
        
curl -"$UA-sF 'reqtype=fileupload' -'fileToUpload=@-' https://catbox.moe/user/api.php < $ARG
    
;;
    *)
        
usage
    
;;
esac 
Thanks xero!


I also still use nsxiv/key-handler for setting my wallpaper. While not a dmenu script, I just remembered that I stole this from cry4x3 around the same time so here is mine now:

PHP Code:
#!/bin/sh
#
# Dependencies: dmenu, feh, notify-send, image-magick, gimp, mediainfo, xclip

DMENU=${DMENU:-dmenu}

while 
read file
do
        case 
"$1" in

    
# Set image as wallpaper
    
"w")
        
feh --bg-scale --no-fehbg "$file&
        
printf "\tWall set\t$file>$XNOTIFY_FIFO &
        ;;

    
# Copy file to another location
    
"c")
        [ -
"$destdir] &&
            
destdir="$(sed 's/s.*#.*$//;/^s*$/d' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs |
            awk '{print $2}' |
            
$DMENU -p "Copy file(sto where?" |
            sed "
s|~|$HOME|g")"
        
[ ! -"$destdir] && notify-send -t 5000 -"$destdir" "Not a directory, cancelled" && exit
        
cp "$file" "$destdir&& notify-send -t 5000 -"Copied To" "$destdir&
        ;;

    
# Move file to another location
    
"m")
        [ -
"$destdir] &&
            
destdir="$(sed 's/\s+#.*$//; s/^\s*#//; /^\s*$/d' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs |
            awk '{print $2}' |
            
$DMENU -p "Move file(sto where?" |
            sed "
s|~|$HOME|g")"
        
[ ! -"$destdir] && notify-send -t 5000 -"$destdir" "Not a directory, cancelled" && exit
        
mv "$file" "$destdir&& notify-send -t 5000 -"Moved To" "$destdir&
        ;;

    
# Rotate/flop image
    
"r")
        
convert -rotate 90 "$file" "$file;;
    
"R")
        
convert -rotate -90 "$file" "$file;;
    
"f")
        
convert -flop "$file" "$file;;

    
# Copy file location
    
"y")
        echo -
"$filetr -'\n' xclip -sel clip &&
            
notify-send -t 5000 -"File Location" "$(xclip -o -sel clip)"
        
;;

    
# Delete selected images, confirm using dmenu
    
"d")
        [ 
"$(printf "No\\nYes" |
            
$DMENU -p "Really delete $file?")" "Yes" ] &&
            
rm "$file&& notify-send -t 5000 -"File Deleted" "Bye Bye"
        
;;

    
# Open image in gimp
    
"g")
        if ! 
command -v gimp 2>&>/dev/null
        then
            notify
-send -t 5000 -"Gimp" "Command not found"
            
exit 1
        
else
            
gimp "$file"
        
fi
        
;;

    
# Print mediainfo to notification
    
"i")
        
notify-send -t 15000 -"Media Info" "$(mediainfo "$file")" ;;

    
# Upload image & copy url to clipboard
    
"u")
        
pb 0x0 "$file|
        
xclip -sel clip && notify-send -t 5000 -"Image Uploaded" "$(xclip -o -sel clip)"
        
;;

        
esac
done 
Thank you again, cry4x3 :)


Messages In This Thread
Dmenu Scripts - by pfr - 09-06-2021, 03:38 AM
RE: Dmenu Scripts - by seninha - 09-06-2021, 09:35 AM
RE: Dmenu Scripts - by prx* - 09-06-2021, 09:42 AM
RE: Dmenu Scripts - by pfr - 09-06-2021, 10:48 AM
RE: Dmenu Scripts - by prx* - 10-06-2021, 04:28 AM
RE: Dmenu Scripts - by Gorm - 11-06-2021, 09:17 PM
RE: Dmenu Scripts - by pfr - 07-10-2024, 11:04 PM