New backup 2024-04-29 15:57:51
This commit is contained in:
parent
af48c09ddf
commit
eb6a1b3352
2 changed files with 58 additions and 0 deletions
57
de/home/.local/lib/sp-functions
Executable file
57
de/home/.local/lib/sp-functions
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
|
||||
conf_dir="$HOME/.config/sway-profiles"
|
||||
cache_dir="$HOME/.cache/sway-profiles"
|
||||
|
||||
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 ) ]}"
|
||||
}
|
||||
|
||||
#get_profile_list
|
||||
|
||||
#get_workspace_id
|
||||
get_workspace_name
|
||||
get_workspace_prefix
|
||||
#get_profile_id
|
||||
#get_profile_name
|
||||
#get_profile_icon
|
|
@ -11,3 +11,4 @@
|
|||
.config/wofi
|
||||
.config/alacritty
|
||||
.local/bin/randomrat
|
||||
.local/lib/sp-functions
|
||||
|
|
Loading…
Add table
Reference in a new issue