migrate to specific folder & add fish conf
This commit is contained in:
parent
7c63ae9df9
commit
687a8696e3
45 changed files with 74 additions and 0 deletions
20
home/private_dot_config/hypr/scripts/grimblast/Makefile
Normal file
20
home/private_dot_config/hypr/scripts/grimblast/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
DESTDIR ?= /
|
||||
PREFIX ?= $(DESTDIR)usr/local
|
||||
EXEC_PREFIX ?= $(PREFIX)
|
||||
DATAROOTDIR ?= $(PREFIX)/share
|
||||
BINDIR ?= $(EXEC_PREFIX)/bin
|
||||
MANDIR ?= $(DATAROOTDIR)/man
|
||||
MAN1DIR ?= $(MANDIR)/man1
|
||||
|
||||
all: grimblast.1
|
||||
|
||||
grimblast.1: grimblast.1.scd
|
||||
scdoc < $< > $@
|
||||
|
||||
install: grimblast.1 grimblast
|
||||
@install -v -D -m 0644 grimblast.1 --target-directory "$(MAN1DIR)"
|
||||
@install -v -D -m 0755 grimblast --target-directory "$(BINDIR)"
|
||||
|
||||
uninstall: grimblast.1 grimblast
|
||||
rm "$(MAN1DIR)/grimblast.1"
|
||||
rm "$(BINDIR)/grimblast"
|
6
home/private_dot_config/hypr/scripts/grimblast/README.md
Normal file
6
home/private_dot_config/hypr/scripts/grimblast/README.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Grimblast
|
||||
|
||||
A Hyprland version of Grimshot.
|
||||
|
||||
Install by running the Makefile or just copying the `grimblast` script in your
|
||||
`~/.bin`.
|
52
home/private_dot_config/hypr/scripts/grimblast/default.nix
Normal file
52
home/private_dot_config/hypr/scripts/grimblast/default.nix
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
makeWrapper,
|
||||
scdoc,
|
||||
coreutils,
|
||||
grim,
|
||||
jq,
|
||||
libnotify,
|
||||
slurp,
|
||||
wl-clipboard,
|
||||
hyprpicker,
|
||||
hyprland ? null,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "grimblast";
|
||||
version = "0.1";
|
||||
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
scdoc
|
||||
];
|
||||
|
||||
makeFlags = ["PREFIX=$(out)"];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/grimblast --prefix PATH ':' \
|
||||
"${lib.makeBinPath ([
|
||||
coreutils
|
||||
grim
|
||||
jq
|
||||
libnotify
|
||||
slurp
|
||||
wl-clipboard
|
||||
hyprpicker
|
||||
]
|
||||
++ lib.optional (hyprland != null) hyprland)}"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A helper for screenshots within Hyprland, based on grimshot";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [misterio77];
|
||||
mainProgram = "grimblast";
|
||||
};
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
grimblast.1
|
|
@ -0,0 +1,280 @@
|
|||
#!/usr/bin/env bash
|
||||
## Grimblast: a helper for screenshots within hyprland
|
||||
## Requirements:
|
||||
## - `grim`: screenshot utility for wayland
|
||||
## - `slurp`: to select an area
|
||||
## - `hyprctl`: to read properties of current window (provided by Hyprland)
|
||||
## - `hyprpicker`: to freeze the screen when selecting area
|
||||
## - `wl-copy`: clipboard utility (provided by wl-clipboard)
|
||||
## - `jq`: json utility to parse hyprctl output
|
||||
## - `notify-send`: to show notifications (provided by libnotify)
|
||||
## Those are needed to be installed, if unsure, run `grimblast check`
|
||||
##
|
||||
## See `man 1 grimblast` or `grimblast usage` for further details.
|
||||
|
||||
## Author: Misterio (https://github.com/misterio77)
|
||||
|
||||
## This tool is based on grimshot, with swaymsg commands replaced by their
|
||||
## hyprctl equivalents.
|
||||
## https://github.com/swaywm/sway/blob/master/contrib/grimshot
|
||||
|
||||
getTargetDirectory() {
|
||||
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" &&
|
||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
|
||||
|
||||
echo "${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR/screenshots:-$HOME}}"
|
||||
}
|
||||
|
||||
tmp_editor_directory() {
|
||||
echo "/tmp"
|
||||
}
|
||||
|
||||
#Detect if $GRIMBLAST_EDITOR env exist
|
||||
env_editor_confirm() {
|
||||
if [ -n "$GRIMBLAST_EDITOR" ]; then
|
||||
echo "GRIMBLAST_EDITOR is set. Continuing..."
|
||||
else
|
||||
echo "GRIMBLAST_EDITOR is not set. Defaulting to satty..."
|
||||
GRIMBLAST_EDITOR=satty
|
||||
fi
|
||||
}
|
||||
|
||||
NOTIFY=no
|
||||
CURSOR=
|
||||
FREEZE=
|
||||
WAIT=no
|
||||
SCALE=
|
||||
HYPRPICKER_PID=-1
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-n | --notify)
|
||||
NOTIFY=yes
|
||||
shift # past argument
|
||||
;;
|
||||
-c | --cursor)
|
||||
CURSOR=yes
|
||||
shift # past argument
|
||||
;;
|
||||
-f | --freeze)
|
||||
FREEZE=yes
|
||||
shift # past argument
|
||||
;;
|
||||
-w | --wait)
|
||||
shift
|
||||
WAIT=$1
|
||||
if echo "$WAIT" | grep "[^0-9]" -q; then
|
||||
echo "Invalid value for wait '$WAIT'" >&2
|
||||
exit 3
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
-s | --scale)
|
||||
shift # past argument
|
||||
if [ $# -gt 0 ]; then
|
||||
SCALE="$1" # assign the next argument to SCALE
|
||||
shift # past argument
|
||||
else
|
||||
echo "Error: Missing argument for --scale option."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*) # unknown option
|
||||
break # done with parsing --flags
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
ACTION=${1:-usage}
|
||||
SUBJECT=${2:-screen}
|
||||
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
|
||||
FILE_EDITOR=${3:-$(tmp_editor_directory)/$(date -Ins).png}
|
||||
|
||||
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "edit" ] && [ "$ACTION" != "copysave" ] && [ "$ACTION" != "check" ]; then
|
||||
echo "Usage:"
|
||||
echo " grimblast [--notify] [--cursor] [--freeze] [--wait N] [--scale <scale>] (copy|save|copysave|edit) [active|screen|output|area] [FILE|-]"
|
||||
echo " grimblast check"
|
||||
echo " grimblast usage"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " copy: Copy the screenshot data into the clipboard."
|
||||
echo " save: Save the screenshot to a regular file or '-' to pipe to STDOUT."
|
||||
echo " copysave: Combine the previous 2 options."
|
||||
echo " edit: Open screenshot in the image editor of your choice (default is satty). See man page for info."
|
||||
echo " check: Verify if required tools are installed and exit."
|
||||
echo " usage: Show this message and exit."
|
||||
echo ""
|
||||
echo "Targets:"
|
||||
echo " active: Currently active window."
|
||||
echo " screen: All visible outputs."
|
||||
echo " output: Currently active output."
|
||||
echo " area: Manually select a region or window."
|
||||
exit
|
||||
fi
|
||||
|
||||
notify() {
|
||||
notify-send -t 3000 -a grimblast "$@"
|
||||
}
|
||||
|
||||
notifyOk() {
|
||||
[ "$NOTIFY" = "no" ] && return
|
||||
|
||||
notify "$@"
|
||||
}
|
||||
|
||||
notifyError() {
|
||||
if [ $NOTIFY = "yes" ]; then
|
||||
TITLE=${2:-"Screenshot"}
|
||||
MESSAGE=${1:-"Error taking screenshot with grim"}
|
||||
notify -u critical "$TITLE" "$MESSAGE"
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
resetFade() {
|
||||
if [[ -n $FADELAYERS ]]; then
|
||||
hyprctl keyword animation "$FADELAYERS" >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
killHyprpicker() {
|
||||
if [ ! $HYPRPICKER_PID -eq -1 ]; then
|
||||
kill $HYPRPICKER_PID
|
||||
fi
|
||||
}
|
||||
|
||||
die() {
|
||||
killHyprpicker
|
||||
MSG=${1:-Bye}
|
||||
notifyError "Error: $MSG"
|
||||
exit 2
|
||||
}
|
||||
|
||||
check() {
|
||||
COMMAND=$1
|
||||
if command -v "$COMMAND" >/dev/null 2>&1; then
|
||||
RESULT="OK"
|
||||
else
|
||||
RESULT="NOT FOUND"
|
||||
fi
|
||||
echo " $COMMAND: $RESULT"
|
||||
}
|
||||
|
||||
takeScreenshot() {
|
||||
FILE=$1
|
||||
GEOM=$2
|
||||
OUTPUT=$3
|
||||
if [ -n "$OUTPUT" ]; then
|
||||
grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
|
||||
elif [ -z "$GEOM" ]; then
|
||||
grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} "$FILE" || die "Unable to invoke grim"
|
||||
else
|
||||
grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -g "$GEOM" "$FILE" || die "Unable to invoke grim"
|
||||
resetFade
|
||||
fi
|
||||
}
|
||||
|
||||
wait() {
|
||||
if [ "$WAIT" != "no" ]; then
|
||||
sleep "$WAIT"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$ACTION" = "check" ]; then
|
||||
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
|
||||
check grim
|
||||
check slurp
|
||||
check hyprctl
|
||||
check hyprpicker
|
||||
check wl-copy
|
||||
check jq
|
||||
check notify-send
|
||||
exit
|
||||
elif [ "$SUBJECT" = "active" ]; then
|
||||
wait
|
||||
FOCUSED=$(hyprctl activewindow -j)
|
||||
GEOM=$(echo "$FOCUSED" | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
||||
APP_ID=$(echo "$FOCUSED" | jq -r '.class')
|
||||
WHAT="$APP_ID window"
|
||||
elif [ "$SUBJECT" = "screen" ]; then
|
||||
wait
|
||||
GEOM=""
|
||||
WHAT="Screen"
|
||||
elif [ "$SUBJECT" = "output" ]; then
|
||||
wait
|
||||
GEOM=""
|
||||
OUTPUT=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)' | jq -r '.name')
|
||||
WHAT="$OUTPUT"
|
||||
elif [ "$SUBJECT" = "area" ]; then
|
||||
if [ "$FREEZE" = "yes" ] && [ "$(command -v "hyprpicker")" ] >/dev/null 2>&1; then
|
||||
hyprpicker -r -z &
|
||||
sleep 0.2
|
||||
HYPRPICKER_PID=$!
|
||||
fi
|
||||
|
||||
# get fade & fadeOut animation and unset it
|
||||
# this removes the black border seen around screenshots
|
||||
FADELAYERS="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fadeLayers") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')"
|
||||
hyprctl keyword animation 'fadeLayers,0,1,default' >/dev/null
|
||||
|
||||
WORKSPACES="$(hyprctl monitors -j | jq -r 'map(.activeWorkspace.id)')"
|
||||
WINDOWS="$(hyprctl clients -j | jq -r --argjson workspaces "$WORKSPACES" 'map(select([.workspace.id] | inside($workspaces)))')"
|
||||
# shellcheck disable=2086 # if we don't split, spaces mess up slurp
|
||||
GEOM=$(echo "$WINDOWS" | jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | slurp $SLURP_ARGS)
|
||||
|
||||
# Check if user exited slurp without selecting the area
|
||||
if [ -z "$GEOM" ]; then
|
||||
killHyprpicker
|
||||
resetFade
|
||||
exit 1
|
||||
fi
|
||||
WHAT="Area"
|
||||
wait
|
||||
elif [ "$SUBJECT" = "window" ]; then
|
||||
die "Subject 'window' is now included in 'area'"
|
||||
else
|
||||
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
||||
fi
|
||||
|
||||
if [ "$ACTION" = "copy" ]; then
|
||||
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
|
||||
notifyOk "$WHAT copied to buffer"
|
||||
elif [ "$ACTION" = "save" ]; then
|
||||
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
||||
TITLE="Screenshot of $SUBJECT"
|
||||
MESSAGE=$(basename "$FILE")
|
||||
notifyOk "$TITLE" "$MESSAGE" -i "$FILE"
|
||||
echo "$FILE"
|
||||
else
|
||||
notifyError "Error taking screenshot with grim"
|
||||
fi
|
||||
elif [ "$ACTION" = "edit" ]; then
|
||||
env_editor_confirm
|
||||
if takeScreenshot "$FILE_EDITOR" "$GEOM" "$OUTPUT"; then
|
||||
TITLE="Screenshot of $SUBJECT"
|
||||
MESSAGE="Open screenshot in image editor"
|
||||
notifyOk "$TITLE" "$MESSAGE" -i "$FILE_EDITOR"
|
||||
if [ "$GRIMBLAST_EDITOR" != 'satty' ]; then
|
||||
$GRIMBLAST_EDITOR $FILE_EDITOR
|
||||
else
|
||||
$GRIMBLAST_EDITOR -f "$FILE_EDITOR" --copy-command wl-copy --early-exit --output-filename $(xdg-user-dir PICTURES)/ScreenShoots/satty_$(date +"%Y%m%d%H%M%S").png
|
||||
fi
|
||||
echo "$FILE_EDITOR"
|
||||
rm "$FILE_EDITOR"
|
||||
else
|
||||
notifyError "Error taking screenshot"
|
||||
fi
|
||||
else
|
||||
if [ "$ACTION" = "copysave" ]; then
|
||||
takeScreenshot - "$GEOM" "$OUTPUT" | tee "$FILE" | wl-copy --type image/png || die "Clipboard error"
|
||||
notifyOk "$WHAT copied to buffer and saved to $FILE" -i "$FILE"
|
||||
echo "$FILE"
|
||||
else
|
||||
notifyError "Error taking screenshot with grim"
|
||||
fi
|
||||
fi
|
||||
|
||||
killHyprpicker
|
|
@ -0,0 +1,220 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya (adi1090x)
|
||||
## Github : @adi1090x
|
||||
#
|
||||
## Applets : Screenshot (Ported to use Grimblast)
|
||||
|
||||
## Modify
|
||||
## Author : Gonçalo Duarte (MrDuartePT)
|
||||
## Github : @MrDuartePT
|
||||
|
||||
## Port for Grimblast (https://github.com/hyprwm/contrib/tree/main/grimblast)
|
||||
## Aur Package: grimblast-git (https://aur.archlinux.org/packages/grimblast-git)
|
||||
|
||||
## Add this to the ~/.config/user-dirs.dirs to save in the Screenshots folder: XDG_SCREENSHOTS_DIR="$HOME/Screenshots"
|
||||
|
||||
prompt='Screenshot'
|
||||
mesg="DIR: ~/Pictures/screenshots"
|
||||
|
||||
# Options
|
||||
option_1=" Capture"
|
||||
option_2=" Timer capture"
|
||||
|
||||
option_capture_1=" All Screen"
|
||||
option_capture_2=" Capture Active Screen"
|
||||
option_capture_3=" Capture Area/Window/Application"
|
||||
|
||||
option_time_1="5s"
|
||||
option_time_2="10s"
|
||||
option_time_3="20s"
|
||||
option_time_4="30s"
|
||||
option_time_5="60s"
|
||||
#option_time_4="Custom (in seconds)" # Roadmap or someone contribute :)
|
||||
|
||||
list_col='1'
|
||||
list_row='2'
|
||||
win_width='500px'
|
||||
|
||||
copy=' Copy'
|
||||
save=' Save'
|
||||
copy_save='Copy & Save'
|
||||
edit='Edit Screenshot'
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi -theme-str "window {width: $win_width;}" \
|
||||
-theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
||||
-theme-str 'textbox-prompt-colon {str: "";}' \
|
||||
-dmenu \
|
||||
-p "$prompt" \
|
||||
-mesg "$mesg" \
|
||||
-markup-rows
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$option_1\n$option_2" | rofi_cmd
|
||||
}
|
||||
|
||||
####
|
||||
# Choose Timer
|
||||
# CMD
|
||||
timer_cmd() {
|
||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 400px;}' \
|
||||
-theme-str 'mainbox {orientation: vertical; children: [ "message", "listview" ];}' \
|
||||
-theme-str 'listview {columns: 1; lines: 5;}' \
|
||||
-theme-str 'element-text {horizontal-align: 0.5;}' \
|
||||
-theme-str 'textbox {horizontal-align: 0.5;}' \
|
||||
-dmenu \
|
||||
-p 'Choose Option' \
|
||||
-mesg 'Choose timer:'
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
timer_exit() {
|
||||
echo -e "$option_time_1\n$option_time_2\n$option_time_3\n$option_time_4\n$option_time_5" | timer_cmd
|
||||
}
|
||||
|
||||
# Confirm and execute
|
||||
timer_run() {
|
||||
selected_timer="$(timer_exit)"
|
||||
if [[ "$selected_timer" == "$option_time_1" ]]; then
|
||||
countdown=5
|
||||
${1}
|
||||
elif [[ "$selected_timer" == "$option_time_2" ]]; then
|
||||
countdown=10
|
||||
${1}
|
||||
elif [[ "$selected_timer" == "$option_time_3" ]]; then
|
||||
countdown=20
|
||||
${1}
|
||||
elif [[ "$selected_timer" == "$option_time_4" ]]; then
|
||||
countdown=30
|
||||
${1}
|
||||
elif [[ "$selected_timer" == "$option_time_5" ]]; then
|
||||
countdown=60
|
||||
${1}
|
||||
fi
|
||||
}
|
||||
###
|
||||
|
||||
####
|
||||
# Chose Screenshot Type
|
||||
# CMD
|
||||
type_screenshot_cmd() {
|
||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 400px;}' \
|
||||
-theme-str 'mainbox {orientation: vertical; children: [ "message", "listview" ];}' \
|
||||
-theme-str 'listview {columns: 1; lines: 3;}' \
|
||||
-theme-str 'element-text {horizontal-align: 0.5;}' \
|
||||
-theme-str 'textbox {horizontal-align: 0.5;}' \
|
||||
-dmenu \
|
||||
-p 'Choose Option' \
|
||||
-mesg 'Type Of Screenshot:'
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
type_screenshot_exit() {
|
||||
echo -e "$option_capture_1\n$option_capture_2\n$option_capture_3" | type_screenshot_cmd
|
||||
}
|
||||
|
||||
# Confirm and execute
|
||||
type_screenshot_run() {
|
||||
selected_type_screenshot="$(type_screenshot_exit)"
|
||||
if [[ "$selected_type_screenshot" == "$option_capture_1" ]]; then
|
||||
option_type_screenshot=screen
|
||||
${1}
|
||||
elif [[ "$selected_type_screenshot" == "$option_capture_2" ]]; then
|
||||
option_type_screenshot=output
|
||||
${1}
|
||||
elif [[ "$selected_type_screenshot" == "$option_capture_3" ]]; then
|
||||
option_type_screenshot=area
|
||||
${1}
|
||||
fi
|
||||
}
|
||||
###
|
||||
|
||||
####
|
||||
# Choose to save or copy photo
|
||||
# CMD
|
||||
copy_save_editor_cmd() {
|
||||
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 400px;}' \
|
||||
-theme-str 'mainbox {orientation: vertical; children: [ "message", "listview" ];}' \
|
||||
-theme-str 'listview {columns: 2; lines: 2;}' \
|
||||
-theme-str 'element-text {horizontal-align: 0.5;}' \
|
||||
-theme-str 'textbox {horizontal-align: 0.5;}' \
|
||||
-dmenu \
|
||||
-p 'Choose Option' \
|
||||
-mesg 'Copy/save the screenshot or open in image editor'
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
copy_save_editor_exit() {
|
||||
echo -e "$copy\n$save\n$copy_save\n$edit" | copy_save_editor_cmd
|
||||
}
|
||||
|
||||
# Confirm and execute
|
||||
copy_save_editor_run() {
|
||||
selected_chosen="$(copy_save_editor_exit)"
|
||||
if [[ "$selected_chosen" == "$copy" ]]; then
|
||||
option_chosen=copy
|
||||
${1}
|
||||
elif [[ "$selected_chosen" == "$save" ]]; then
|
||||
option_chosen=save
|
||||
${1}
|
||||
elif [[ "$selected_chosen" == "$copy_save" ]]; then
|
||||
option_chosen=copysave
|
||||
${1}
|
||||
elif [[ "$selected_chosen" == "$edit" ]]; then
|
||||
option_chosen=edit
|
||||
${1}
|
||||
fi
|
||||
}
|
||||
###
|
||||
|
||||
timer() {
|
||||
if [[ $countdown -gt 10 ]]; then
|
||||
notify-send -t 1000 "Taking Screenshot in ${countdown} seconds"
|
||||
countdown_less_10=$((countdown - 10))
|
||||
sleep $countdown_less_10
|
||||
countdown=10
|
||||
fi
|
||||
while [[ $countdown -ne 0 ]]; do
|
||||
notify-send -t 1000 "Taking Screenshot in ${countdown}"
|
||||
countdown=$((countdown - 1))
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
# take shots
|
||||
takescreenshot() {
|
||||
sleep 1
|
||||
$HOME/.config/hypr/scripts/grimblast/grimblast --notify "$option_chosen" "$option_type_screenshot"
|
||||
}
|
||||
|
||||
takescreenshot_timer() {
|
||||
timer
|
||||
$HOME/.config/hypr/scripts/grimblast/grimblast --notify "$option_chosen" "$option_type_screenshot"
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
if [[ "$1" == '--opt1' ]]; then
|
||||
type_screenshot_run
|
||||
copy_save_editor_run "takescreenshot"
|
||||
elif [[ "$1" == '--opt2' ]]; then
|
||||
timer_run
|
||||
type_screenshot_run
|
||||
copy_save_editor_run "takescreenshot_timer"
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case ${chosen} in
|
||||
$option_1)
|
||||
run_cmd --opt1
|
||||
;;
|
||||
$option_2)
|
||||
run_cmd --opt2
|
||||
;;
|
||||
esac
|
110
home/private_dot_config/hypr/scripts/grimblast/grimblast.1.scd
Normal file
110
home/private_dot_config/hypr/scripts/grimblast/grimblast.1.scd
Normal file
|
@ -0,0 +1,110 @@
|
|||
grimblast(1)
|
||||
|
||||
# NAME
|
||||
|
||||
grimblast - a helper for screenshots within hyprland
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
*grimblast* [--notify] [--cursor] [--freeze] [--wait N] [--scale <scale>] (copy|save|copysave|edit) [TARGET] [FILE]++
|
||||
*grimblast* check++
|
||||
*grimblast* usage
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*--notify*
|
||||
Show notifications to the user that a screenshot has been taken.
|
||||
|
||||
*--cursor*
|
||||
Include cursors in the screenshot.
|
||||
|
||||
*--freeze*
|
||||
Freezes the screen before area selection.
|
||||
|
||||
*--wait N*
|
||||
Wait for N seconds before taking a screenshot. Waits after any
|
||||
manual selection is made. Recommended to combine with --notify in
|
||||
order to know when the screenshot has been taken.
|
||||
|
||||
*--scale <scale>*
|
||||
Passes the `-s` argument to `grim`.
|
||||
|
||||
*save*
|
||||
Save the screenshot into a regular file. Grimblast will write image
|
||||
files to *XDG_SCREENSHOTS_DIR* if this is set (or defined
|
||||
in *user-dirs.dir*), or otherwise fall back to *XDG_PICTURES_DIR*.
|
||||
Set FILE to '-' to pipe the output to STDOUT.
|
||||
|
||||
*copy*
|
||||
Copy the screenshot data (as image/png) into the clipboard.
|
||||
|
||||
*copysave*
|
||||
Combine the previous 2 options.
|
||||
|
||||
*edit*
|
||||
Open screenshot in the image editor of your choice. The default is
|
||||
gimp, but you can set a different one with the enviroment variable
|
||||
$GRIMBLAST_EDITOR. Example: `export GRIMBLAST_EDITOR=gimp`.
|
||||
|
||||
*check*
|
||||
Verify whether the required tools are installed.
|
||||
|
||||
*usage*
|
||||
Show help message.
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Grimblast is an easy-to-use screenshot utility for hyprland, based on grimshot.
|
||||
It provides a convenient interface over grim, slurp and jq, and supports
|
||||
storing the screenshot either directly to the clipboard using wl-copy or to a
|
||||
file.
|
||||
|
||||
# TARGETS
|
||||
|
||||
grimblast can capture the following named targets:
|
||||
|
||||
_active_
|
||||
Captures the currently active window.
|
||||
|
||||
_screen_
|
||||
Captures the entire screen. This includes all visible outputs.
|
||||
|
||||
_area_
|
||||
Allows manually selecting a rectangular region or window (by clicking on it),
|
||||
and captures that.
|
||||
Slurp can be customized by setting its arguments in the *SLURP_ARGS*
|
||||
environment variable.
|
||||
|
||||
_output_
|
||||
Captures the currently active output.
|
||||
|
||||
# OUTPUT
|
||||
|
||||
Grimblast will print the filename of the captured screenshot to stdout if called
|
||||
with the _save_ subcommand.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
An example usage pattern is to add these bindings to your hyprland config:
|
||||
|
||||
```
|
||||
# Screenshots:
|
||||
# Super+P: Current window
|
||||
# Super+Shift+p: Select area
|
||||
# Super+Alt+p Current output
|
||||
# Super+Ctrl+p All outputs
|
||||
|
||||
# Optionally, customize slurp's appearance
|
||||
env = SLURP_ARGS, -d -b -B F050F022 -b 10101022 -c ff00ff
|
||||
|
||||
bind = SUPER, p, exec, grimblast save active
|
||||
bind = SUPER SHIFT, p, exec, grimblast save area
|
||||
bind = SUPER ALT, p, exec, grimblast save output
|
||||
bind = SUPER CTRL, p, exec, grimblast save screen
|
||||
```
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*grim*(1)
|
||||
*slurp*(1)
|
||||
*grimshot*(1)
|
Loading…
Add table
Add a link
Reference in a new issue