update_0.1
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
_self=$(basename "$0")
|
||||
pgrep -f "$_self" | grep -v $$ | xargs kill -9 2>/dev/null
|
||||
declare -A layouts
|
||||
prev_win_id=""
|
||||
while read -r event; do
|
||||
if [[ "$event" == *'"change":"focus"'* ]]; then
|
||||
current_win_id=$(echo "$event" | grep -oP '"id":\K[0-9]+' | head -n 1)
|
||||
if [ -n "$current_win_id" ]; then
|
||||
if [ -n "$prev_win_id" ] && [ "$prev_win_id" != "$current_win_id" ]; then
|
||||
layouts[$prev_win_id]=$(xkb-switch -p)
|
||||
fi
|
||||
saved_layout=${layouts[$current_win_id]}
|
||||
if [ -n "$saved_layout" ]; then
|
||||
xkb-switch -s "$saved_layout"
|
||||
else
|
||||
layouts[$current_win_id]=$(xkb-switch -p)
|
||||
fi
|
||||
prev_win_id=$current_win_id
|
||||
fi
|
||||
fi
|
||||
done < <(stdbuf -oL i3-msg -t subscribe -m '[ "window" ]')
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
geometry=$(slop -f "%g" -c 0,0.68,1,0.4 -b 1 -l)
|
||||
[ -z "$geometry" ] && exit 1
|
||||
temp_file="/tmp/i3-sc-area.png"
|
||||
maim -g "$geometry" "$temp_file"
|
||||
echo "file://$temp_file" | xclip -selection clipboard -t text/uri-list
|
||||
notify-send "Screenshot" "Captured area: $geometry" -i camera-photo -u low
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
selection=$(cat)
|
||||
[[ -z "$selection" ]] && exit 0
|
||||
|
||||
pkill -u $USER -x xclip
|
||||
|
||||
if [[ "$selection" == file://* && "$selection" == *.png ]]; then
|
||||
echo -n "$selection" | xclip -selection clipboard -t text/uri-list
|
||||
fi
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
eval $(xdotool getmouselocation --shell)
|
||||
data=$(i3-msg -t get_outputs | jq -r ".[] | select(.active == true and $X >= .rect.x and $X < (.rect.x + .rect.width) and $Y >= .rect.y and $Y < (.rect.y + .rect.height)) | \"\(.name)\t\(.rect.width)x\(.rect.height)+\(.rect.x)+\(.rect.y)\"")
|
||||
name=$(echo "$data" | cut -f1)
|
||||
geometry=$(echo "$data" | cut -f2)
|
||||
temp_file="/tmp/i3-sc-full.png"
|
||||
maim -g "$geometry" "$temp_file"
|
||||
echo "file://$temp_file" | xclip -selection clipboard -t text/uri-list
|
||||
notify-send "Screenshot" "Captured display: $name" -i camera-photo
|
||||
rm "$temp_file"
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
window_id=$(xdotool getactivewindow)
|
||||
window_name=$(xprop -id "$window_id" WM_CLASS | cut -d '"' -f 4)
|
||||
temp_file="/tmp/i3-sc-window.png"
|
||||
maim -i "$window_id" "$temp_file"
|
||||
echo "file://$temp_file" | xclip -selection clipboard -t text/uri-list
|
||||
notify-send "Screenshot" "Captured window: $window_name" -u low
|
||||
Reference in New Issue
Block a user