New backup 2024-04-29 15:58:34

This commit is contained in:
Penelope Gwen 2024-04-29 15:58:34 -06:00
parent eb6a1b3352
commit 19bc1126ff
11 changed files with 193 additions and 0 deletions

20
de/home/.local/bin/sp-clipboard Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
cb_count=$(copyq count)
cb_count=10
wofilist=""
for i in $(seq $cb_count);do
cb_line="$( copyq read $((${i}-1)) | tr '\n' ' ' )"
echo "${cb_line}"
if [[ "${cb_line}" == "" ]];then
cb_line=$( copyq read ? "$((${i}-1))" | head -n 1 )
fi
wofilist="${wofilist}${setnl}${i}. ${cb_line}"
setnl="\n"
done
selected=$( echo -e "${wofilist}" | wofi -i --dmenu -k /dev/null | cut -d. -f1)
copyq select "$(( ${selected}-1)) "

View file

@ -0,0 +1,8 @@
#!/bin/bash
source "${HOME}/.local/lib/sp-functions"
options=$( ls "${conf_dir}/global-shortcuts/" )
op=$( echo -e "${options}" | wofi -i --dmenu | awk '{print}' )
"${conf_dir}/global-shortcuts/${op}"

17
de/home/.local/bin/sp-launcher Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash
source "${HOME}/.local/lib/sp-functions"
source "${conf_dir}/config"
case $1 in
file_manager )
launch_exec=${filemanager_cmd}
launch_arg=$( jq -r .[].home_directory "${conf_dir}/profiles/$( get_profile_id )/vars.json" )
;;
browser )
launch_exec=${browser_cmd}
launch_arg=$( jq -r .[].browser_profile "${conf_dir}/profiles/$( get_profile_id )/vars.json" )
;;
esac
bash -c "${launch_exec} ${launch_arg}"

16
de/home/.local/bin/sp-lock Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
source "${HOME}/.local/lib/sp-functions"
outputs=( $(swaymsg -t get_outputs | jq -r '.[] | {name} | "\(.name)"') )
for o in ${outputs[@]};do
workspace=$(swaymsg -t get_workspaces | jq -r '.[] | select(.output) | {name} | "\(.name)"')
wpno=$(cat "${cache_dir}/displays/${o}")
wp_imgpath="$HOME/.config/sway/assets/wallpaper/${o}/${wpno}.jpg"
sl_imgpath="${cache_dir}/lock/${o}.jpg"
convert -scale 10% -blur 0x3 -resize 500% "${wp_imgpath}" "${sl_imgpath}"
sl_args="${sl_args}--image ${o}:${sl_imgpath} "
done
swaylock ${sl_args}

18
de/home/.local/bin/sp-powermenu Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
op=$( echo -e "⏻ Poweroff\n Reboot\n Suspend\n🔒 Lock\n Logout" | wofi -i --dmenu -a --width 250 --height 420 | awk '{print tolower($2)}' )
case $op in
poweroff)
;&
reboot)
;&
suspend)
systemctl $op
;;
lock)
swaylock
;;
logout)
swaymsg exit
;;
esac

45
de/home/.local/bin/sp-profiles Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
source "$HOME/.local/lib/sp-functions"
get_profile_list
case $1 in
next|prev)
current_profile=$(cat "${cache_dir}/active_profile")
echo ${current_profile}
;;&
next)
new_profile=$(( ${current_profile}+1 ))
[[ "$new_profile" -eq "${p_count}" ]] && new_profile=0
;;&
prev)
new_profile=$(( ${current_profile}-1 ))
[[ "$new_profile" -eq "-1" ]] && new_profile=3
;;&
prev|next)
op=$(printf "%01d\n" ${new_profile})
;;
*)
for (( p="0"; p<${p_count}; p++ ));do
[[ $p -eq $(( ${p_count} - 1 )) ]] && nl="" || nl="\n"
wofilist="${wofilist}${p_icons[$p]} ${p_names[$p]}${nl}"
done
[[ -z $1 ]] && op=$( echo -e "${wofilist}" | wofi -i --dmenu --width 250 --height 320 -k /dev/null | awk '{print $2}' ) || op="${1}"
op=$(echo ${p_names[@]/$op//} | cut -d/ -f1 | wc -w | tr -d ' ')
;;
esac
[[ "$op" -gt "$(( $p_count - 1 ))" ]] && exit
[[ $op -eq "0" ]] && p_num="" || p_num="$op"
p_icon="${p_icons[$op]}"
for i in {1..10};do
[[ "$i" -eq "10" ]] && k="0" || k=$i
swaymsg 'bindsym $mod+'"$k"' workspace number "'"${p_num}${i}:${p_icon}"'"'
swaymsg 'bindsym $mod+Shift+'"$k"' move container to workspace number "'"${p_num}${i}:${p_icon}"'"'
done
moveto="${p_num}1:${p_icon}"
swaymsg 'workspace number "'"${p_num}"'"1:"'"${p_icon}"'"'
echo "${op}" > "${cache_dir}/active_profile"

7
de/home/.local/bin/sp-rename Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
source "${HOME}/.local/lib/sp-functions"
new_wsname="$( get_workspace_prefix )$(wofi -i --dmenu --height 1 --search $( get_workspace_name ))"
swaymsg 'rename workspace "'"$( get_workspace_fullname )"'" to "'"${new_wsname}"'"'

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
source "${HOME}/.local/lib/sp-functions"
op=$( echo -e "Output\nWindow\nRegion" | wofi -i --dmenu --width 250 --height 260 | awk '{print tolower($1)}' )
echo "$op"
sleep 0.5
mkdir -p "${cache_dir}/screenshots/"
sway-screenshot -m $op --output-folder "${cache_dir}/screenshots/"
mv "${cache_dir}/screenshots/"* "$HOME/Pictures/Screen Capture"

10
de/home/.local/bin/sp-shortcuts Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
source "${HOME}/.local/lib/sp-functions"
current_profile=$( get_profile_id )
profile_scripts=$( ls "${conf_dir}/profiles/${current_profile}/shortcuts/" )
op=$( echo -e "${profile_scripts}" | wofi -w 2 -i --dmenu | awk '{print}' )
"${conf_dir}/profiles/${current_profile}/shortcuts/${op}"

30
de/home/.local/bin/sp-wallpaper Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
source "${HOME}/.local/lib/sp-functions"
getwpno() {
wpno=$(printf "%02d\n" $(($(echo "$1" | awk '{print $1}' | grep -o "^[1-9]*")-1)) | cut -c 1 | sed 's/[^0-9]*//g')
echo "${wpno}" | tee "${cache_dir}/displays/${2}"
}
setbg() {
for d in ${outputs[@]};do
d_wpno=$(cat "${cache_dir}/displays/${d}")
swaymsg output "${d}" bg "$HOME/.config/sway/assets/wallpaper/${d}/${d_wpno}.jpg" fill
done
}
output=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | {name} | "\(.name)"')
outputs=( $(swaymsg -t get_outputs | jq -r '.[] | {name} | "\(.name)"') )
workspace=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | {name} | "\(.name)"')
getwpno "${workspace}" "${output}"
setbg "${output}" "${wpno}"
swaymsg -r -t subscribe -m '["workspace"]' | jq -rc --unbuffered 'select(.change == "focus") | .current | "\(.name) \(.output)"' | while read name output;do
wsno=$(($(echo "$name" | awk '{print $1}' | grep -o "^[1-9]*")-1))
wpno_last=$(cat "${cache_dir}/displays/${output}")
getwpno "${name}" "${output}"
if [[ "${wpno}" -ne "${wpno_last}" ]];then
setbg "${output}" "${wpno}"
fi
done

View file

@ -12,3 +12,13 @@
.config/alacritty
.local/bin/randomrat
.local/lib/sp-functions
.local/bin/sp-clipboard
.local/bin/sp-global-shortcuts
.local/bin/sp-launcher
.local/bin/sp-lock
.local/bin/sp-powermenu
.local/bin/sp-profiles
.local/bin/sp-rename
.local/bin/sp-screenshot
.local/bin/sp-shortcuts
.local/bin/sp-wallpaper