26 lines
1.0 KiB
Django/Jinja
26 lines
1.0 KiB
Django/Jinja
#!/bin/bash
|
|
|
|
FAVORITES="{% for item in favorites %}{{ item }}{{ ',' if not loop.last else '' }}{% endfor %}"
|
|
if [ -f ~/.config/kactivitymanagerd-statsrc ]; then
|
|
if ! grep -q "$FAVORITES" ~/.config/kactivitymanagerd-statsrc; then
|
|
sed -i "/^ordering/s/=.*/=$FAVORITES/" ~/.config/kactivitymanagerd-statsrc
|
|
fi
|
|
fi
|
|
|
|
sqlite3 ~/.local/share/kactivitymanagerd/resources/database <<-EOF
|
|
CREATE TEMPORARY TABLE FavoritesList (usedActivity TEXT, initiatingAgent TEXT, targettedResource TEXT);
|
|
INSERT INTO FavoritesList (usedActivity, initiatingAgent, targettedResource)
|
|
VALUES
|
|
{% for item in favorites %}
|
|
(":global", "org.kde.plasma.favorites.applications", "{{ item }}"){{ "," if not loop.last else ";" }}
|
|
{% endfor %}
|
|
|
|
INSERT INTO ResourceLink (usedActivity, initiatingAgent, targettedResource)
|
|
SELECT f.usedActivity, f.initiatingAgent, f.targettedResource
|
|
FROM FavoritesList AS f
|
|
WHERE f.targettedResource NOT IN (SELECT targettedResource FROM ResourceLink);
|
|
|
|
DELETE FROM ResourceLink
|
|
WHERE targettedResource NOT IN (SELECT targettedResource FROM FavoritesList);
|
|
EOF
|