Compare commits
2
Commits
4282a9e541
...
091259da79
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
091259da79 | ||
|
|
b2ffead66b |
@@ -11,6 +11,7 @@ export_paths+=("${HOME}/dotfiles/scripts")
|
|||||||
export_paths+=("${HOME}/dotfiles/desktop-files")
|
export_paths+=("${HOME}/dotfiles/desktop-files")
|
||||||
export_paths+=("/opt/jlink")
|
export_paths+=("/opt/jlink")
|
||||||
export_paths+=("${HOME}/.cargo/bin")
|
export_paths+=("${HOME}/.cargo/bin")
|
||||||
|
export_paths+=("/opt/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin")
|
||||||
|
|
||||||
for entry in ${export_paths[@]}; do
|
for entry in ${export_paths[@]}; do
|
||||||
if ! [[ -d "${entry}" ]]; then
|
if ! [[ -d "${entry}" ]]; then
|
||||||
|
|||||||
@@ -168,8 +168,9 @@ bindsym $mod+o move workspace to output up
|
|||||||
bindsym $mod+p move workspace to output right
|
bindsym $mod+p move workspace to output right
|
||||||
|
|
||||||
# take screenshots
|
# take screenshots
|
||||||
bindsym $mod+s exec --no-startup-id bash x11-screenshot.sh --clipboard
|
bindsym $mod+s exec --no-startup-id bash x11-screenshot.sh "clipboard"
|
||||||
bindsym $mod+Shift+s exec --no-startup-id bash x11-screenshot.sh
|
bindsym $mod+Shift+s exec --no-startup-id bash x11-screenshot.sh
|
||||||
|
bindsym $mod+c exec --no-startup-id bash x11-screenshot.sh "colour"
|
||||||
|
|
||||||
# use pactl for media keys
|
# use pactl for media keys
|
||||||
set $refresh_i3status killall -SIGUSR1 i3status
|
set $refresh_i3status killall -SIGUSR1 i3status
|
||||||
|
|||||||
+38
-12
@@ -1,12 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
unset use_clipboard
|
unset use_clipboard
|
||||||
if [[ "$1" == "-c" ]] || [[ "$1" == "--clipboard" ]]; then
|
if [[ "$1" == "--clipboard" ]]; then
|
||||||
use_clipboard="true"
|
use_clipboard="true"
|
||||||
|
elif [[ "$1" == "--colour" ]]; then
|
||||||
|
pick_colour="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $(which maim &>/dev/null); then
|
if ! $(which slop &>/dev/null); then
|
||||||
notify-send "[screenshot]" "missing \`maim\`"
|
notify-send "[screenshot]" "missing \`slop\`"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ -n "${use_clipboard}" ]] && ! $(which xclip &>/dev/null); then
|
if [[ -n "${use_clipboard}" ]] && ! $(which xclip &>/dev/null); then
|
||||||
@@ -14,13 +16,37 @@ if [[ -n "${use_clipboard}" ]] && ! $(which xclip &>/dev/null); then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${use_clipboard}" ]]; then
|
screenshots_path="${HOME}/screenshots"
|
||||||
screenshots_path="${HOME}/screenshots"
|
if [[ ! -d "${screenshots_path}" ]]; then
|
||||||
echo "${screenshots_path}"
|
mkdir "${screenshots_path}"
|
||||||
if [[ ! -d "${screenshots_path}" ]]; then
|
|
||||||
mkdir "${screenshots_path}"
|
|
||||||
fi
|
|
||||||
maim -suo "${screenshots_path}/$(date '+%Y%m%d_%H%M%S').png"
|
|
||||||
else
|
|
||||||
maim -suo | xclip -selection clipboard -t image/png
|
|
||||||
fi
|
fi
|
||||||
|
temp_file="${screenshots_path}/temporary.png"
|
||||||
|
|
||||||
|
maim -suo -f png -t 0 "${temp_file}"
|
||||||
|
|
||||||
|
# meh!
|
||||||
|
function colour_picker {
|
||||||
|
colour_value="$(magick "${temp_file}" -scale 1x1\! -format "#%[hex:p{0,0}]" info:)"
|
||||||
|
notify-send "[colour picker]" "${colour_value}"
|
||||||
|
echo "${colour_value}" | xclip -selection clipboard
|
||||||
|
remove_temporary_file
|
||||||
|
}
|
||||||
|
|
||||||
|
function clipboard {
|
||||||
|
xclip -selection clipboard -t image/png <"${temp_file}"
|
||||||
|
remove_temporary_file
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_screenshot {
|
||||||
|
mv "${temp_file}" "${screenshots_path}/$(date '+%Y%m%d_%H%M%S').png"
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_temporary_file {
|
||||||
|
rm "${temp_file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"clipboard") clipboard ;;
|
||||||
|
"colour") colour_picker ;;
|
||||||
|
*) save_screenshot ;;
|
||||||
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user