|:.:.:.:.:.:.:.:.:/.:.:.:.:.:./.:.:.:.:.:.:.:.:.:.:.:.:.:./|   '. :.:.:.:.:.:.:.:.:.:.l.ヽ:.:.:.:.l:.:.:.:.:.:.:.:.:.:∧\:.:.:.',
          |:.:.:.:.:.:.:./.:.:.:.:.:./.:.:.:.:.:.:.:.:.:.:.:.: , ′   l :.:.:.:.:.:.:.:.:.:| ∨.:.:.l:.:.:.:.:.:.:.:.:.:.∧ \:.'.
          |:.:.:.:.:.:/.:.:.:.:.: /.:.:.:.:.:.:.:.:. ヽ/ /    |:.:.:.:.:.:.:./:.:.|   y'.:.:|:.:.:.:.|:.:.:.:.:.:.∧   ヘ.
          |:.:.:.:./.:.:.:.//.:.:.:.:.:.:.:.:.:.:/ \,′   !:.:.:.:.:.:/|:.:./,/ '.:.:| :.:.:.|:.:.:.:.:.:.:.:.|
          |:.:.:/.:.:./.:./.:.:.:.:.:.:.:.:./   /` ‐-‐'|:.:.:./ |ァ'´    |:.:| :.:.:.|:.:.:.:.:.:.:.:.|
          |:.:.i.:.:./.:.:.: '.:.:.:.:.:.:.:/   ,/       |:.:.:/   ′    }.:.| :.:.:.|:.:.:.| :.:.:.:|
          |:.:.|:./.: rヘ|:.:.:.:.:.:/:.| 三三三三三  |:./   三三三 ハ|:.:.:.:.|:.:.:.| :.:.:.:|
          |:.:.l〃.:{  |:.:.:.:./.:.:.|             l.'         .i.:.:.i.:.:.:∧ :.:|ヽ :.:|
          |:.:./.:.:.:.\|:.:.:/.:.:.:.:|                '       |:.:.||:.:/  :.:.| '.:.:l
          |:./.:.:.:.:.:.:. !:./.:.:.:.:.:.'、            ,.ー--、    }.:.:|レ′ ∨  V
          |/.:.:.:.:.:.:.:.:V '´  ̄`ヽ.、            ´`¨¨{. |_.  '.:.:.:.|
         /.:.:.:.:.:.:.:./         ヘ `    . __. -r1 |:.:.:.:.:.:.:.:.|
         :.:.:.:.:.:.:, '         '. \    | _.   -┴ー──┴┐
         :.:.:.:.:./           |  \  r' |   -──────i'
    

< KONAKONA.MOE >

KDE Spectacle + Zipline Upload Script

Last Mod.: 2024-06-12 | Created On: 2024-06-11


This is a garbage script that I made for KDE Spectacle to be able to send screenshots to my Zipline server, it kinda sucks because Wayland is utter garbage and so is spectacle, it hangs for some reason, but yeah here it is if you want.

Make sure to install:

Script

Make sure to copy something this to your $PATH, like specifially something “lower level” like /usr/local/bin or something, I tried putting it on my ~/.local/bin and KDE would refuse to execute even though I had put the entire path. Then add the scripts to your “Shortcuts” on Settings.

 1#!/bin/sh
 2
 3# configuration
 4folder="/home/user/Screenshots"
 5token="yourtoken"
 6url="https://yourdomain/api/upload"
 7
 8# useful variables
 9datetime="$(date +%Y%m%d_%H%M%S)"
10year=$(date +%Y)
11
12# creates the year subfolder if not exist
13[ -d $folder/$year ] || mkdir -p $folder/$year
14
15activewindow() {
16    filename="$folder/$year/${datetime}_$(kdotool getactivewindow getwindowclassname).png"
17    spectacle --background --pointer --activewindow --output $filename
18}
19
20region() {
21    filename="$folder/$year/${datetime}_region.png"
22    spectacle --background --pointer --region --output $filename
23}
24
25activemonitor() {
26    filename="$folder/$year/${datetime}_monitor-$(kdotool getmouselocation --shell | grep 'SCREEN' | awk -F= '{print $2}').png"
27    spectacle --background --pointer --current --output $filename
28}
29
30workspace() {
31    filename="$folder/$year/${datetime}_workspace.png"
32    spectacle --background --pointer --fullscreen --output $filename
33}
34
35upload() {
36    [ -f "$filename" ] && curl -H "authorization: $token" $url -F file=@$filename -H "Content-Type: multipart/form-data" -H "Format: random" -H "Image-Compression-Percent: 99" -H "Embed: true" -H "Original-Name: true" | jq -r '.files[0]' | tr -d '\n' | wl-copy
37}
38
39case $1 in
40    activewindow)
41        activewindow
42        upload
43    ;;
44    region)
45        region
46        upload
47    ;;
48    activemonitor)
49        activemonitor
50        upload
51    ;;
52    workspace)
53        workspace
54        upload
55    ;;
56    *)
57        echo "You're using this wrong and I am too lazy to write documentation."
58        exit 1
59    ;;
60esac

Prev:
Hugo Favicon Shortcode
Next:
Maim Screenshot Script + Zipline (Fuck Wayland …