switch x/xmonad for wayland/river
This commit is contained in:
parent
3ffb35cc2e
commit
dac9f903c9
8 changed files with 81 additions and 131 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ -t 1 ]; then
|
||||
if [ -t 1 -a "$1" != '-g' ]; then
|
||||
pick() {
|
||||
sk
|
||||
}
|
||||
|
@ -10,16 +10,32 @@ if [ -t 1 ]; then
|
|||
echo "$@"
|
||||
}
|
||||
else
|
||||
window="$(xdotool getwindowfocus)"
|
||||
pick() {
|
||||
dmenu -i -l 10
|
||||
if pgrep wayland >/dev/null; then
|
||||
skmenu
|
||||
else
|
||||
dmenu -i -l 10
|
||||
fi
|
||||
}
|
||||
inject() {
|
||||
xdotool type --clearmodifiers --window "$window" "$*"
|
||||
xdotool windowfocus "$window"
|
||||
if pgrep wayland >/dev/null; then
|
||||
wtype -s 500 "$*"
|
||||
else
|
||||
window="$(xdotool getwindowfocus)"
|
||||
xdotool type --clearmodifiers --window "$window" "$*"
|
||||
xdotool windowfocus "$window"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
if wl-paste -h >/dev/null; then
|
||||
primary() { wl-paste --primary; }
|
||||
clip() { wl-paste; }
|
||||
else
|
||||
primary() { xclip -o; }
|
||||
clip() { xclip -o -sel c; }
|
||||
fi
|
||||
|
||||
choice="$(pick <<HERE
|
||||
email address
|
||||
pass
|
||||
|
@ -53,10 +69,10 @@ case "$choice" in
|
|||
inject "$(lpass show --password "$choice" | head -1)"
|
||||
;;
|
||||
'clipboard')
|
||||
inject "$(xclip -o -sel c)"
|
||||
inject "$(clip)"
|
||||
;;
|
||||
'selection')
|
||||
inject "$(xclip -o)"
|
||||
inject "$(primary)"
|
||||
;;
|
||||
'run')
|
||||
choice="$(dmenu_path | pick)"
|
||||
|
@ -74,7 +90,7 @@ case "$choice" in
|
|||
d="$(mktemp -d)"
|
||||
trap "rm -r '$d'" EXIT KILL
|
||||
cd "$d"
|
||||
curl -LOJ "$(xclip -o)"
|
||||
curl -LOJ "$(primary)"
|
||||
rifle -fF *
|
||||
;;
|
||||
'clipmenu')
|
||||
|
@ -89,13 +105,13 @@ case "$choice" in
|
|||
inject "${choice##* }"
|
||||
;;
|
||||
'spotify-title')
|
||||
inject "$(curl -L "$(xclip -o)" | sed -n 's@.*<title>\(.*\) - song \(and lyrics \)\?by \(.*\) | Spotify</title>.*@\1 - \3@p')"
|
||||
inject "$(curl -L "$(clip)" | sed -n 's@.*<title>\(.*\) - song \(and lyrics \)\?by \(.*\) | Spotify</title>.*@\1 _van_ \3@p')"
|
||||
;;
|
||||
'youtube-dl')
|
||||
d="$(mktemp -d)"
|
||||
trap "rm -r '$d'" EXIT KILL
|
||||
cd "$d"
|
||||
yt-dlp "$(xclip -o)"
|
||||
yt-dlp "$(primary)"
|
||||
if mplayer -v >/dev/null; then
|
||||
exec st mplayer *
|
||||
else
|
||||
|
@ -106,7 +122,7 @@ case "$choice" in
|
|||
d="$(mktemp -d)"
|
||||
trap "rm -r '$d'" EXIT KILL
|
||||
cd "$d"
|
||||
yt-dlp -x "$(xclip -o)"
|
||||
yt-dlp -x "$(primary)"
|
||||
exec st mpv --no-video *
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
xset dpms 0 0 300
|
||||
|
||||
dp1="$(xrandr | grep '^DP1 connected')"
|
||||
dp1_1="$(xrandr | grep '^DP1-1 connected')"
|
||||
dp1_2="$(xrandr | grep '^DP1-2 connected')"
|
||||
dp1_3="$(xrandr | grep '^DP1-3 connected')"
|
||||
|
||||
if [ -n "$dp1" -a -z "$dp1_1" -a -z "$dp1_2" -a -z "$dp1_3" ]; then
|
||||
xrandr --output DP1 --auto --primary --above eDP1
|
||||
elif [ -z "$dp1" -a -n "$dp1_1" -a -z "$dp1_2" -a -z "$dp1_3" ]; then
|
||||
xrandr --output DP1-1 --auto --primary --above eDP1
|
||||
elif [ -z "$dp1" -a -n "$dp1_1" -a -n "$dp1_2" -a -z "$dp1_3" ]; then
|
||||
xrandr --output DP1-1 --auto --left-of eDP1 \
|
||||
--output DP1-2 --auto --right-of eDP1
|
||||
elif [ -z "$dp1" -a -z "$dp1_1" -a -z "$dp1_2" -a -n "$dp1_3" ]; then
|
||||
xrandr --output DP1-3 --auto --primary --above eDP1
|
||||
fi
|
2
local/bin/skmenu
Executable file
2
local/bin/skmenu
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
foot --title skmenu sh -c "sk -e < /proc/$$/fd/0 > /proc/$$/fd/1"
|
Loading…
Add table
Add a link
Reference in a new issue