Basic working package

This commit is contained in:
Nox Sluijtman 2023-01-19 14:52:54 +01:00
parent 3d7a0dc1db
commit 20d51b44f3
6 changed files with 123 additions and 4 deletions

28
APKBUILD Normal file
View file

@ -0,0 +1,28 @@
# Contributor: Marty Sluijtman <marty.wanderer@disroot.org>
# Maintainer: Marty Sluijtman <marty.wanderer@disroot.org>
pkgname=maim-utils
pkgver=1.0
pkgrel=1
pkgdesc="A few common screenshot options rolled into one script based on maim"
url="https://alpine.voidcruiser.nl"
arch="noarch"
license="GPL-3.0"
depends="libnotify maim xdotool"
makedepends="scdoc"
subpackages="$pkgname-doc
$pkgname-zsh-completion
"
source="https://alpine.voidcruiser.nl/src/$pkgname-$pkgver.tar.gz"
build() {
return 0
}
package() {
make install PREFIX=/usr DESTDIR="$pkgdir"
install -Dm 644 zsh.completion "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}
sha512sums="
e73d7e82ea183521862e3e6e1d8967aa832290d16407edbf574474077e317ab8013c4f0fc792de09479f040e880e12a6cfecc5aa391bdaff7dabac43fd4b870f maim-utils-1.0.tar.gz
"

1
LICENCE Normal file
View file

@ -0,0 +1 @@
fiets

36
Makefile Normal file
View file

@ -0,0 +1,36 @@
NAME = maim-utils
VERSION = 1.0
DIRNAME= $(NAME)-$(VERSION)
MANPAGE = $(NAME).1
MANPREFIX = $(PREFIX)/share/man
$(MANPAGE): $(MANPAGE).scd
scdoc < $< > $@
dist:
mkdir -p $(DIRNAME)
cp -R $(NAME) $(MANPAGE).scd Makefile LICENCE README.md zsh.completion $(DIRNAME)
tar -cf $(DIRNAME).tar $(DIRNAME)
gzip $(DIRNAME).tar
rm -rf $(DIRNAME)
clean:
rm $(MANPAGE) $(DIRNAME).tar.gz
install: $(MANPAGE)
install -dm 0755 $(DESTDIR)$(PREFIX)/bin
install -m 0755 $(NAME) $(DESTDIR)$(PREFIX)/bin
install -dm 0755 $(DESTDIR)$(MANPREFIX)/man1
install -m 0644 $(MANPAGE) $(DESTDIR)$(MANPREFIX)/man1
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(NAME)\
$(DESTDIR)$MANPREFIX)/man1/$(MANPAGE)
package: dist
rsync --progress $(DIRNAME).tar.gz voidDroplet:/var/www/alpine/src/
rm -f /var/cache/distfiles/$(NAME)*
abuild checksum
abuild -r
.PHONY: all install dist uninstall package clean

45
maim-utils Normal file → Executable file
View file

@ -1,10 +1,47 @@
#!/bin/sh
saveDir="${SCROTDIR:-$HOME/Pictures/screenshots}"
savedir="${SCROTDIR:-$HOME/Pictures/Screenshots}"
filename="$savedir/$(date -Iseconds)_maim.png"
# test whether the screenshot directory exists, if not, create it.
[ -d $savedir ] || mkdir -p $savedir
fullscreen(){
maim -ui root "$saveDir/$(date -Iseconds)_maim.png"
notify-send 'Maim utils' 'Shot entire screen'
maim -ui root "$filename"
notify-send 'Maim utils' "Shot entire screen and saved output to:\n\n$filename"
}
fullscreen
selection(){
maim -su "$filename"
notify-send 'Maim utils' "Shot selection and saved output to:\n\n$filename\n\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status."
}
focus(){
maim -ui "$(xdotool getactivewindow)" "$filename"
notify-send 'Maim utils' "Shot focussed window and saved output to:\n\n$filename"
}
clip_fullscreen(){
maim -ui root | xclip -sel clip -t image/png
notify-send 'Maim utils' "Shot entire screen and sent it to the clipboard."
}
clip_selection(){
maim -su | xclip -sel clip -t image/png
notify-send 'Maim utils' "Shot selection and sent it to the clipboard.\nBe aware that the selection process can be cancelled using any keypress and that this won't show up due to xclip eating the exit status."
}
clip_focus(){
maim -ui "$(xdotool getactivewindow)" | xclip -sel clip -t image/png
notify-send 'Maim utils' "Shot focussed window and sent it to the clipboard."
}
case $1 in
sel|selection) selection;;
sel-clip|clip-sel|clip-selection) clip_selection;;
full|fullscreen) fullscreen;;
full-clip|clip-full|clip-fullscreen) clip_fullscreen;;
focus) foucs;;
clip-focus|focus-clip) clip_focus;;
open|show|screenshots) xdg-open $savedir;;
esac

11
maim-utils.1.scd Normal file
View file

@ -0,0 +1,11 @@
maim-utils(1)
# NAME
maim-utils - A few common screenshot options rolled into one script based on maim
# SYNOPSIS
*maim-utils* _<fullscreen|focus|selection>_
*maim-utils* _<clip-fullscreen|clip-focus|clip-selection>_

6
zsh.completion Normal file
View file

@ -0,0 +1,6 @@
#compdef maim-utils _maim-utils
_arguments -C \
"1: :(focus fullscreen selection clip-selection clip-fullscreen clip-focus)" \
"*::args:->args"
_arguments : $arguments