first commit
This commit is contained in:
commit
e2e03d0832
3 changed files with 43 additions and 0 deletions
1
README.md
Normal file
1
README.md
Normal file
|
@ -0,0 +1 @@
|
|||
# hyprmsn
|
17
scripts/clients.sh
Executable file
17
scripts/clients.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#! /bin/bash
|
||||
missioncontroldir=$HOME/.config/hyprmsn
|
||||
|
||||
OLDIFS="$IFS"
|
||||
IFS=$'\n' # bash specific
|
||||
chosen=$(for line in $(hyprctl clients | grep "title: " | sed 's/title: //g' | tr -d '\t')
|
||||
do
|
||||
special_line=$line
|
||||
special_line=$(echo $special_line | sed 's/\[\([^]]*\)\]/\\[\1\\]/g') #add \ to []
|
||||
special_line=$(echo $special_line | sed 's/'\''\.\*\\^//g') #add \ to special characters
|
||||
icon=$(ls "$missioncontroldir/windows" | grep -F $special_line)
|
||||
echo -en "$line\x00icon\x1f$missioncontroldir/windows/$icon\n"
|
||||
done | rofi -dmenu )
|
||||
IFS="$OLDIFS"
|
||||
|
||||
window_id=$(hyprctl clients | rg 'Window ([A-Fa-f0-9]+)' | grep -F "$chosen" | sed -E 's/Window (.*)->.*/\1/g')
|
||||
hyprctl dispatch focuswindow address:0x$window_id > /dev/null
|
25
scripts/daemon.sh
Executable file
25
scripts/daemon.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#! /bin/bash
|
||||
|
||||
missioncontroldir=$HOME/.config/hyprmsn
|
||||
mkdir $missioncontroldir/windows 2> /dev/null
|
||||
window=$(hyprctl activewindow -j | jq --raw-output .title)
|
||||
rm -rf $missioncontroldir/windows/* 2> /dev/null
|
||||
|
||||
while true; do
|
||||
new_window=$(hyprctl activewindow -j | jq --raw-output .title)
|
||||
new_window=$(echo $new_window | sed 's/\[\([^]]*\)\]/\\[\1\\]/g') #add \ to []
|
||||
new_window=$(echo $new_window | sed 's/'\''\.\*\\^//g') #add \ to special characters
|
||||
|
||||
if [[ "$window" == "$new_window" ]]; then
|
||||
continue
|
||||
fi
|
||||
window=$new_window
|
||||
|
||||
|
||||
at_size=$(hyprctl clients | sed -n "/$window/,/^\$/p" | grep -Ew 'at|size' | tr -d '[a-z]|:|\t| ')
|
||||
at=$(echo $at_size | tr ' ' '\n' | head -1 | tail -1)
|
||||
size=$(echo $at_size | tr ' ' '\n' | head -2 | tail -1 | tr ',' 'x')
|
||||
|
||||
sleep 0.4
|
||||
grim -g "$at $size" -t jpeg -q 50 "$missioncontroldir/windows/$window.jpeg"
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue