From 786493fbdaa0a5a9b9bfea5e6784f1f62b663685 Mon Sep 17 00:00:00 2001 From: cizordj <32869222+cizordj@users.noreply.github.com> Date: Fri, 15 Jan 2021 17:19:43 -0300 Subject: [PATCH] Add my own version of i3-scrot and i3-exit --- i3-exit | 22 ++++++++++++++++++++++ i3-scrot | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100755 i3-exit create mode 100755 i3-scrot diff --git a/i3-exit b/i3-exit new file mode 100755 index 00000000..e9ec336b --- /dev/null +++ b/i3-exit @@ -0,0 +1,22 @@ +#!/bin/sh + +lock(){ + screenshot="/tmp/qI5MkdEu.png" + screenshotblur="/tmp/Vur4EooC.png" + import -window root "$screenshot" + convert "$screenshot" -blur 0x5 "$screenshotblur" + rm "$screenshot" + i3lock -i "$screenshotblur" + xset dpms force off +} + +case "$1" in + lock) + lock ;; + logout) + i3-msg exit ;; + reboot) + systemctl reboot ;; + shutdown) + systemctl poweroff ;; +esac diff --git a/i3-scrot b/i3-scrot new file mode 100755 index 00000000..927060ec --- /dev/null +++ b/i3-scrot @@ -0,0 +1,53 @@ +#!/bin/sh + +initialize(){ + cd "$(xdg-user-dir PICTURES)" +} +notify(){ + notify-send "The screenshot has been made" + exit 0 +} +desk(){ + initialize + scrot + notify +} +select(){ + initialize + notify-send "Select an area for the screenshot" + sleep 0.5 + scrot -s && end || exit 0 +} +window(){ + initialize + scrot -u + notify +} +help(){ + cat << EOF +Options: + -h| --help Show this message + -d| --desk Fullscreen screenshot + -w| --window Active window only + -s| --select Select an area +EOF + exit 0 +} + +case "$1" in + -d | --desk) + desk + ;; + -s | --select) + select + ;; + -w | --window) + window + ;; + -h | --help) + help + ;; + *) + help + ;; +esac