Manage favorites menu

This commit is contained in:
Kris Lamoureux 2021-12-06 00:57:07 -05:00
parent 0a716d469c
commit 203e6f58dd
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
5 changed files with 66 additions and 0 deletions

View File

@ -3,3 +3,8 @@ development: true
users: users:
- name: vagrant - name: vagrant
favorites:
- firefox-esr.desktop
- terminator.desktop
- org.remmina.Remmina.desktop

View File

@ -0,0 +1,24 @@
# Follows homelab package list:
# https://github.com/krislamo/moxie/blob/master/roles/base/defaults/main.yml
moxie_packages:
- cryptsetup
- curl
- dnsutils
- hashdeep
- htop
- jq
- kpartx
- ncdu
- rsync
- screen
- strace
- tree
- vim
- wget
packages:
- "{{ moxie_packages }}"
- firefox-esr
- meld
- remmina
- terminator

View File

@ -8,6 +8,7 @@
apt: apt:
name: fasttrack-archive-keyring name: fasttrack-archive-keyring
state: present state: present
update_cache: true
- name: Enable fasttrack - name: Enable fasttrack
copy: copy:

View File

@ -20,3 +20,21 @@
lookandfeeltool -a $(lookandfeeltool --list | grep dark) lookandfeeltool -a $(lookandfeeltool --list | grep dark)
fi fi
loop: "{{ users }}" loop: "{{ users }}"
- name: Install packages
apt:
name: "{{ item }}"
loop: "{{ packages }}"
- name: Install sqlite3
apt:
name: sqlite3
state: present
- name: Change favorites menu
template:
src: favorites.sh.j2
dest: "/home/{{ item.name }}/.config/autostart-scripts/favorites.sh"
mode: a+x
loop: "{{ users }}"
tags: debug

View File

@ -0,0 +1,18 @@
#!/bin/bash
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