This project contains two Bash scripts to manage KDE activities and move windows between activities in the KDE Plasma environment.
manage_activities.sh
: This script is used to create, remove, and manage hotkeys for activities.mv_win_activity.sh
: This script moves the currently active window to a specified activity.
Both scripts require the following:
kactivities-cli
– to manage KDE Plasma activities.xdotool
– to identify the currently focused window.xprop
– to modify window properties.
You can install the required packages with:
sudo apt install kactivities-cli xdotool xprop
-
Copy both scripts to a directory of your choice.
-
Make the scripts executable by running:
chmod +x manage_activities.sh chmod +x mv_win_activity.sh
This script manages KDE activities and hotkeys.
./manage_activities.sh {create|remove|hotkeys|all}
create
: Creates the activities "1", "2", "3", "4", "5" if they do not already exist.remove
: Removes these activities if they exist.hotkeys
: Sets hotkeys (Alt+1
,Alt+2
, etc.) to switch between activities.all
: Creates the activities and sets the hotkeys.
Example:
./manage_activities.sh create
This script moves the currently active window to the specified activity.
./mv_win_activity.sh "Activity Name"
Example:
./mv_win_activity.sh "1"
If the window cannot be moved (e.g., it is plasmashell
, or the activity is not found), the script will output an error message.
You can set up keyboard shortcuts to quickly run mv_win_activity.sh
and move windows to specific activities:
-
Open System Settings.
-
Navigate to Shortcuts > Custom Shortcuts.
-
Right-click and select New -> Global Shortcut -> Command/URL.
-
Name the shortcut and set a key combination under the Trigger tab.
-
Under the Action tab, enter the path to the script followed by the activity name. For example:
bash /path/to/mv_win_activity.sh "1"
-
Click Apply.
Now, you can use your keyboard shortcuts to move windows to different activities.