From 02e22a771151cf422ada97b1e1d3934d688fc18d Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 20 Apr 2021 08:21:56 -0500 Subject: [PATCH] adding sxiv and changing screenshot prog --- awesome/keybindings.fnl | 2 +- picom.conf | 2 +- qutebrowser/qsettings/QtProject.conf | 4 ++-- scripts/screenshot | 29 ++++++++++++++++++++++-- sxiv/exec/image-info | 19 ++++++++++++++++ sxiv/exec/key-handler | 33 ++++++++++++++++++++++++++++ 6 files changed, 83 insertions(+), 6 deletions(-) create mode 100755 sxiv/exec/image-info create mode 100755 sxiv/exec/key-handler diff --git a/awesome/keybindings.fnl b/awesome/keybindings.fnl index 75bb9b5..4d83645 100644 --- a/awesome/keybindings.fnl +++ b/awesome/keybindings.fnl @@ -143,7 +143,7 @@ {:description "launch eshell in new emacs frame" :group "apps" }) (awful.key [ modkey ] "e" (fn [] (awful.spawn "emacsclient -c -a 'emacs'")) {:description "launch new emacs frame" :group "apps" }) - (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-pass")) + (awful.key [ modkey ] "p" (fn [] (awful.spawn "rofi-rbw --action autotype")) {:description "select pass" :group "apps" }) (awful.key [ modkey shift ] "w" (fn [] (awful.spawn "libreoffice --writer")) {:description "Open Writer" :group "apps" }) diff --git a/picom.conf b/picom.conf index 52bbd91..23bbc1e 100644 --- a/picom.conf +++ b/picom.conf @@ -264,7 +264,7 @@ blur: { # requires: https://github.com/ibhagwan/picom method = "dual_kawase"; #method = "kernel"; - strength = 10; + strength = 8; # deviation = 1.0; # kernel = "11x11gaussian"; background = false; diff --git a/qutebrowser/qsettings/QtProject.conf b/qutebrowser/qsettings/QtProject.conf index 0adb6d0..0956bd7 100644 --- a/qutebrowser/qsettings/QtProject.conf +++ b/qutebrowser/qsettings/QtProject.conf @@ -1,6 +1,6 @@ [FileDialog] -history=file:///home/chris/Downloads, file:///home/chris, file:///home/chris/Documents/TFC Stuff/newsletterpics, file:///home/chris/Videos/vimeo, file:///home/chris/Pictures/tfc, file:///home/chris/Pictures -lastVisited=file:///home/chris/Pictures +history=file:///home/chris, file:///home/chris/Documents/TFC Stuff/newsletterpics, file:///home/chris/Videos/vimeo, file:///home/chris/Pictures/tfc, file:///home/chris/Pictures, file:///home/chris/Videos +lastVisited=file:///home/chris/Videos qtVersion=5.15.2 shortcuts=file:, file:///home/chris sidebarWidth=116 diff --git a/scripts/screenshot b/scripts/screenshot index bbc4342..e508b90 100755 --- a/scripts/screenshot +++ b/scripts/screenshot @@ -1,3 +1,28 @@ -#!/bin/sh +#!/bin/bash -maim --hidecursor --select | xclip -selection clipboard -target image/png +timestamp=$(date +%F-%T) + +picture=$(maim --hidecursor --select /tmp/$timestamp.png) + +declare -a options=( + "clipboard" + "filesave" + "cancel" +) + +choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -p 'Clip or Save') + +if [[ "$choice" == "cancel" ]]; then + rm /tmp/$timestamp.png + echo "Canceled." && exit 1 + +elif [ "$choice" == "clipboard" ]; then + xclip -selection clipboard -target image/png -i /tmp/$timestamp.png + rm /tmp/$timestamp.png + echo 'saved to clipboard' + +elif [ "$choice" == "filesave" ]; then + mv /tmp/$timestamp.png ~/Pictures/$timestamp.png + echo 'saved to ~/Pictures/'$timestamp'.png' + +fi diff --git a/sxiv/exec/image-info b/sxiv/exec/image-info new file mode 100755 index 0000000..0e22bb0 --- /dev/null +++ b/sxiv/exec/image-info @@ -0,0 +1,19 @@ +#!/bin/sh + +# Example for ~/.config/sxiv/exec/image-info +# Called by sxiv(1) whenever an image gets loaded, +# with the name of the image file as its first argument. +# The output is displayed in sxiv's status bar. + +s=" | " # field separator + +filename=$(basename "$1") +filesize=$(du -Hh "$1" | cut -f 1) + +# The '[0]' stands for the first frame of a multi-frame file, e.g. gif. +geometry=$(identify -format '%wx%h' "$1[0]") + +tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }') +tags=${tags%,} + +echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${filename}" diff --git a/sxiv/exec/key-handler b/sxiv/exec/key-handler new file mode 100755 index 0000000..fa046cf --- /dev/null +++ b/sxiv/exec/key-handler @@ -0,0 +1,33 @@ +#!/bin/sh +while read file +do + case "$1" in + "w") setbg "$file" & ;; + "c") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | rofi -dmenu -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & + ;; + "m") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & + ;; + "r") + convert -rotate 90 "$file" "$file" ;; + "R") + convert -rotate -90 "$file" "$file" ;; + "f") + convert -flop "$file" "$file" ;; + "y") + echo -n "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$file copied to clipboard" & ;; + "Y") + readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$(readlink -f "$file") copied to clipboard" & ;; + "d") + [ "$(printf "No\\nYes" | rofi -dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; + "g") ifinstalled gimp && setsid -f gimp "$file" ;; + "i") notify-send "File information" "$(mediainfo "$file")" ;; + esac +done