-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopyq_get
More file actions
executable file
·29 lines (24 loc) · 844 Bytes
/
copyq_get
File metadata and controls
executable file
·29 lines (24 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/bash
AVAILABLE_ARGS=("next", "previous")
DIRECTION=$1
if ! [[ ${AVAILABLE_ARGS[*]} =~ "$DIRECTION" ]]; then
echo "Wrong arg"
exit 1
fi
# we are setting up id of every notification to 1
# if notification with id 1 alreay exist - new norification will replace it
# if not - new notification will appear
NOTIF_ID=1
copyq $DIRECTION
TYPE="$(xclip -selection clipboard -t TARGETS -o)"
# Проверяем тип данных в буфере обмена
if [[ $TYPE == *"image/png"* ]]; then
# Если тип данных - изображение
TEMP_FILE=$(mktemp --suffix=.png)
xclip -t image/png -o > "$TEMP_FILE"
notify-send -t 1000 -r $NOTIF_ID -i $TEMP_FILE -h int:clip_height:1000 pic clip
# feh --bg-scale $TEMP_FILE
else
TEXT="$(xclip -sel clipboard -o)"
notify-send -t 1000 -r $NOTIF_ID "$TEXT"
fi