From eb6a1b33524303a3ef82b8ff1204355ec7543917 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Mon, 29 Apr 2024 15:57:51 -0600 Subject: [PATCH] New backup 2024-04-29 15:57:51 --- de/home/.local/lib/sp-functions | 57 +++++++++++++++++++++++++++++++++ de/include | 1 + 2 files changed, 58 insertions(+) create mode 100755 de/home/.local/lib/sp-functions diff --git a/de/home/.local/lib/sp-functions b/de/home/.local/lib/sp-functions new file mode 100755 index 0000000..5d60084 --- /dev/null +++ b/de/home/.local/lib/sp-functions @@ -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 diff --git a/de/include b/de/include index a014c7b..126f16c 100644 --- a/de/include +++ b/de/include @@ -11,3 +11,4 @@ .config/wofi .config/alacritty .local/bin/randomrat +.local/lib/sp-functions