51 lines
1.3 KiB
Bash
Executable file
51 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
|
|
conf_dir="$HOME/.config/sway-profiles"
|
|
cache_dir="$HOME/.cache/sway-profiles"
|
|
|
|
mkdir -p "${cache_dir}/"{displays,lock,screenshots}
|
|
|
|
get_workspace_id(){
|
|
workspace_id=$( printf "%02d\n" $( swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true)|.name' | sed 's/:.*//' ) )
|
|
echo "${workspace_id}"
|
|
}
|
|
|
|
get_workspace_fullname(){
|
|
workspace_fullname=$( swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true)|.name' )
|
|
echo "${workspace_fullname}"
|
|
}
|
|
|
|
get_workspace_prefix(){
|
|
workspace_prefix="$( grep -o '[0-9]*:[^a-zA-Z1-9]' <<< $( swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true)|.name' ) )"
|
|
echo "${workspace_prefix}"
|
|
}
|
|
|
|
get_workspace_name(){
|
|
workspace_name=$( echo "$( get_workspace_fullname )" | sed 's/'"$( get_workspace_prefix )"'//' )
|
|
echo "${workspace_name}"
|
|
}
|
|
|
|
get_profile_id(){
|
|
current_workspace=$( printf "%02d\n" $(( $( swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true)|.name' | sed 's/:.*//' ) - 1 )) )
|
|
echo "${current_workspace:0:1}"
|
|
}
|
|
|
|
get_profile_name(){
|
|
echo "test"
|
|
}
|
|
|
|
get_profile_list(){
|
|
p_icons=()
|
|
p_names=()
|
|
while read p;do
|
|
p_icons+=($( awk '{print $1}'<<<"${p}" ))
|
|
p_names+=($( awk '{print $2}'<<<"${p}" ))
|
|
done<"${conf_dir}/profile_list"
|
|
p_count="${#p_names[@]}"
|
|
}
|
|
|
|
get_profile_icon(){
|
|
get_profile_list
|
|
echo "${p_icons[ $( get_profile_id ) ]}"
|
|
}
|