51 lines
1.5 KiB
Bash
Executable file
51 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
profiles=( "Personal" "Development" "School" "Work")
|
|
icons=( "~" "" "" "" "a" )
|
|
|
|
#echo ${profiles[@]/School//} | cut -d/ -f1 | wc -w | tr -d ' '
|
|
profilem=$((${#profiles[@]}-1))
|
|
|
|
#echo ${#profiles[@]}
|
|
|
|
#exit
|
|
|
|
case $1 in
|
|
next|prev)
|
|
current_profile=$(cat "$(dirname $0)/data/active_profile")
|
|
echo ${current_profile}
|
|
;;&
|
|
next)
|
|
new_profile=$(( ${current_profile}+1 ))
|
|
[[ "$new_profile" -eq "${#profiles[@]}" ]] && 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<=${profilem}; p++ ));do
|
|
[[ $p -eq $profilem ]] && nl="" || nl="\n"
|
|
wofilist="${wofilist}${icons[$p]} ${profiles[$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 ${profiles[@]/$op//} | cut -d/ -f1 | wc -w | tr -d ' ')
|
|
;;
|
|
esac
|
|
|
|
[[ "$op" -gt "$profilem" ]] && exit
|
|
[[ $op -eq "0" ]] && p_num="" || p_num="$op"
|
|
p_icon="${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}" > "$(dirname $0)/data/active_profile"
|