-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths
More file actions
executable file
·124 lines (109 loc) · 2.95 KB
/
s
File metadata and controls
executable file
·124 lines (109 loc) · 2.95 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
upload(){
curl -sH 'Authorization: Client-ID 67328d13363251e' \
-F 'image=@-' https://api.imgur.com/3/image \
| sed 's|.*"link":"\([^"]*\)".*|\1|;s|\\\/|\/|g'
}
scrot_backend() {
if [ -n "$WAYLAND_DISPLAY" ]; then
grim -g "$(slurp)" - "$@"
elif [ -n "$DISPLAY" ]; then
maim -su "$@"
fi
}
copy_image() {
if [ -n "$WAYLAND_DISPLAY" ]; then wl-copy
elif [ -n "$DISPLAY" ]; then xclip -i -sel clip -t image/png
fi
}
copy_text() {
if [ -n "$WAYLAND_DISPLAY" ]; then wl-copy
elif [ -n "$DISPLAY" ]; then xclip -i -sel clip
fi
}
scrot_upload() { scrot_backend "$@" | upload | copy_text; }
scrot_save() { fname="$1"; shift; scrot_backend "$@" > "$fname"; }
scrot() { scrot_backend "$@" | copy_image; }
# Screen record
screc() {
if [ -z "$1" ]; then
out=/tmp/demo.mp4
else
out="$1"
fi
slop -f "%wx%h +%x,%y" | {
read -r size ofs
echo "$size"
ffmpeg -y \
-f x11grab \
-framerate 25 \
-video_size "$size" \
-i :0.0"$ofs" \
"$out"
}
}
case "$1" in
imgur) upload ;;
scrot)
shift
if [ "$1" = "-u" ]
then shift; scrot_upload "$@"
elif [ "$1" = "-o" ]
then shift; scrot_save "$@"
else
if [ "$1" = "--" ]; then
shift
fi
scrot "$@"
fi
;;
screc)
shift
screc "$@"
;;
ixio)
shift
curl -F 'f:1=<-' ix.io | copy_text
;;
audio-init)
shift
xdgtmux() {
tmux -f "$XDG_CONFIG_HOME/tmux/tmux.conf" "$@"
}
xdgtmux new -ds audio \
sh -c ~/.local/etc/root/service/jamyx/run \; \
split-window sh -c "pavucontrol & pulseaudio -D && \
pactl load-module module-jack-sink && \
pactl load-module module-jack-source && \
~/.local/src/dev/Jamyxui2/jamyxui" \; \
new-window -t:+ sh -c alsmixer \; \
split-window -h sh -c mopidy \; \
attach
;;
ping)
shift
ping -c 1 google.com | sed -n 2p | cut -d= -f4 | cut -d' ' -f1 || echo 0
;;
wayfire)
shift
(
export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=Wayfire
. "$XDG_CONFIG_HOME/shell/rc"
dbus-launch wayfire 2>&1 >"$XDG_RUNTIME_DIR/wayfire.$(date +%F).log"
)
;;
switch-sink)
shift
current="$(pactl info | grep Default\ Sink | cut -d' ' -f3)"
sinks="$(pactl list sinks short | grep -vi hdmi | cut -f2)"
for sink in $sinks; do
if ! [ "$sink" = "$current" ]; then
pactl set-default-sink "$sink"
break
fi
done
;;
*)
echo "Invalid command: $1" >&2
esac