File indexing completed on 2024-12-15 05:03:51
0001 #! /bin/bash 0002 # 0003 # next-activity.sh 0004 # SPDX-FileCopyrightText: 2016 Ivan Čukić <ivan.cukic(at)kde.org> 0005 # 0006 # SPDX-License-Identifier: MIT 0007 # 0008 0009 current_activity=($(qdbus org.kde.ActivityManager /ActivityManager/Activities CurrentActivity)) 0010 activities=($(qdbus org.kde.ActivityManager /ActivityManager/Activities ListActivities)) 0011 found="0" 0012 0013 previous_activity="" 0014 0015 for ((i=0; i < ${#activities[@]}; ++i)); do 0016 if [ "$current_activity" = "${activities[$i]}" ]; then 0017 if [ "$previous_activity" != "" ]; then 0018 echo "Switching to $previous_activity" 0019 qdbus org.kde.ActivityManager /ActivityManager/Activities SetCurrentActivity $previous_activity 0020 exit 0021 else 0022 echo "Switching to ${activities[-1]}" 0023 qdbus org.kde.ActivityManager /ActivityManager/Activities SetCurrentActivity ${activities[-1]} 0024 exit 0025 fi 0026 else 0027 previous_activity="${activities[$i]}" 0028 fi 0029 done 0030