tweaks for hyprland and emacs

This commit is contained in:
Chris Cochrun 2023-05-05 13:10:09 -05:00
parent 6001fa7e21
commit 73da080847
6 changed files with 29 additions and 11 deletions

View file

@ -2,9 +2,9 @@
if [ $(hostname) = "syl" ]; then
if [ $XDG_SESSION_TYPE = "x11" ]; then
style="laptop-search"
style="laptop"
else
style="laptop-search-wayland"
style="laptop-rbw-wayland"
fi
else
style="desktop-search"
@ -13,7 +13,12 @@ fi
timestamp=$(date +%F-%T)
picture=$(maim --hidecursor --select /tmp/$timestamp.png)
if [ $XDG_SESSION_TYPE = "x11" ]; then
picture=$(maim --hidecursor --select /tmp/$timestamp.png)
else
region=$(slurp)
picture=$(grim -g "$region" /tmp/$timestamp.png)
fi
declare -a options=(
"clipboard"
@ -21,14 +26,19 @@ declare -a options=(
"cancel"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -theme /home/chris/.config/rofi/launchers-git/$style.rasi -dmenu -p 'Clip or Save')
choice=$(printf '%s\n' "${options[@]}" | rofi -sync -i -theme /home/chris/.config/rofi/launchers-git/$style.rasi -dmenu -p 'Clip or Save')
if [[ "$choice" == "cancel" ]]; then
rm /tmp/$timestamp.png
echo "Canceled." && exit 1
elif [ "$choice" == "clipboard" ]; then
xclip -selection clipboard -target image/png -i /tmp/$timestamp.png
if [ $XDG_SESSION_TYPE = "x11" ]; then
xclip -selection clipboard -target image/png -i /tmp/$timestamp.png
else
wl-copy /tmp/$timestamp.png
fi
rm /tmp/$timestamp.png
echo 'saved to clipboard'

View file

@ -2,11 +2,14 @@
window=$(wlrctl window list | rofi -i -sync -dmenu -p " " -theme ~/.config/rofi/launchers-git/laptop-rbw-wayland.rasi)
echo $window
win=$(echo $window | awk '{print $1}' | sed 's/://')
if [ $win == "" ]
echo $win
if [ ! -z "$win" ]
then
exit 0
wlrctl window focus $win
fi
wlrctl window focus $win