Automated, naturally.
The basic commands to use are these:
kactivities-cli --create-activity NAME
kactivities-cli --list-activities
kactivities-cli --remove-activity UUID
You can set up kwin rules like this:
#!/usr/bin/bash
activity_name=$2
if kactivities-cli --list-activities |grep -q -w "$activity_name" ;
then
ACTIVITY_UUID="$(kactivities-cli --list-activities |awk -v aname=$2 '$0 ~ aname{ print $2 }' )"
RULE_UUID="$(uuidgen)"
count=$(kreadconfig6 --file kwinrulesrc --group General --key count)
echo $count
RULE_LIST=$(kreadconfig6 --file kwinrulesrc --group General --key rules 2>/dev/null )
NEW_RULES="$RULE_LIST,$RULE_UUID"
kwriteconfig6 --file kwinrulesrc --group General --key count $count
kwriteconfig6 --file kwinrulesrc --group General --key rules "$NEW_RULES"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key Description "Force $1 windows to Activity $2"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key title "[$1]"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key titlematch "2"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key wmclass "$1"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key wmclassmatch "2"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key activity "$ACTIVITY_UUID"
kwriteconfig6 --file kwinrulesrc --group $RULE_UUID --key activityrule "2"
qdbus org.kde.KWin /KWin reconfigure
else
echo "No such activity"
exit
fi
That looks evil, but it’s straightforward.
It matches windows by title - like [personal], and the titlematch 2
is for a substring. If you wanted to match exactly, you would use 1.
The activityrule options are:
2 - Force (Window can only appear in specified activity)
3 - Apply initially (window appears in one activity but you can move
elsewhere)
I use Force - every new window matching the rule is forced to a
specified activity, which allows me to group windows from qubes within
the same domain on to the same activity.
If you have various desktops, you can also push windows to specific
desktop/activity combinations.
I use a different Qubes wallpaper for each activity as a strong guide to
the domain color.
Red wild strawberry
Orange salmon
Yellow sun
Green grass
Gray paper
Blue dawn
Purple plum
I use helper scripts linked to keyboard shortcuts to switch to specific
Activities when opening windows, to check the name/color of the window
that has focus, and so on.
These use the same template I’ve posted before:
#!/usr/bin/bash
ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" )
if [[ "$QUBE" == "_QUBES_VMNAME: not found." ]]; then
DOM0
else
DO SOMETHING
fi
Of course, once you have the templates, it’s straightforward to set this
up, and once you have it as you like, you can salt the whole or part of set up.
I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.