ready for 2021.11.16
This commit is contained in:
56
tromjaro/xfce/desktop-overlay/etc/skel/.local/bin/fix-tweaked-desktop-files
Executable file
56
tromjaro/xfce/desktop-overlay/etc/skel/.local/bin/fix-tweaked-desktop-files
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
data="$HOME"/.local/share/applications/tweaked-desktop-files
|
||||
detectfiles() {
|
||||
for file in "$HOME"/.local/share/applications/*.desktop; do
|
||||
[ -d "$file" ] || grep -xq "$file" "$data" && continue
|
||||
name=$(basename "$file") || continue
|
||||
[ -f /usr/share/applications/"$name" ] ||
|
||||
ls /var/lib/flatpak/app/*/current/active/files/share/applications/"$name" >/dev/null 2>&1 ||
|
||||
[ -f /var/lib/snapd/desktop/applications/"$name" ] &&
|
||||
echo "$file" >> "$data"
|
||||
done
|
||||
}
|
||||
|
||||
fixfiles() {
|
||||
lastmod=$(stat -c "%Y" "$data")
|
||||
tmp="$(mktemp -u)"
|
||||
[ -f "$data" ] && cp "$data" "$tmp" && copied='true'
|
||||
[ "$copied" = 'true' ] && while IFS= read -r file; do
|
||||
[ -f "$file" ] || { sed -i "/^$file$/d" "$tmp" ; continue; }
|
||||
name=$(basename "$file") || continue
|
||||
[ -f /usr/share/applications/"$name" ] ||
|
||||
ls /var/lib/flatpak/app/*/current/active/files/share/applications/"$name" >/dev/null 2>&1 ||
|
||||
[ -f /var/lib/snapd/desktop/applications/"$name" ] ||
|
||||
mv "$file" "$file.bak"
|
||||
done < "$data"
|
||||
|
||||
[ "$copied" = 'true' ] && [ "$(stat -c '%Y' "$data")" = "$lastmod" ] && mv "$tmp" "$data"
|
||||
|
||||
for bakfile in "$HOME"/.local/share/applications/*.desktop.bak; do
|
||||
origfile="${bakfile/%.bak}"
|
||||
[ -f "$origfile" ] && continue
|
||||
name=$(basename "$origfile") || continue
|
||||
[ -f /usr/share/applications/"$name" ] ||
|
||||
ls /var/lib/flatpak/app/*/current/active/files/share/applications/"$name" >/dev/null 2>&1 ||
|
||||
[ -f /var/lib/snapd/desktop/applications/"$name" ] &&
|
||||
mv "$bakfile" "$origfile"
|
||||
done
|
||||
}
|
||||
|
||||
pidof -q -o %PPID -x fix-tweaked-desktop-files && exit
|
||||
|
||||
while :; do
|
||||
local_new=$(ls -ad "$HOME"/.local/share/applications/*.desktop 2>/dev/null)
|
||||
pacman_new=$(ls -ad /usr/share/applications/*.desktop 2>/dev/null)
|
||||
flatpak_new=$(ls -ad /var/lib/flatpak/app/*/current/active/files/share/applications/*.desktop 2>/dev/null)
|
||||
snap_new=$(ls -ad /var/lib/snapd/desktop/applications/*.desktop 2>/dev/null)
|
||||
[ "$local_new" != "$local_old" ] && detectfiles
|
||||
[ "$pacman_new" != "$pacman_old" ] ||
|
||||
[ "$flatpak_new" != "$flatpak_old" ] ||
|
||||
[ "$snap_new" != "$snap_old" ] && fixfiles
|
||||
local_old=$local_new
|
||||
pacman_old=$pacman_new
|
||||
flatpak_old=$flatpak_new
|
||||
snap_old=$snap_new
|
||||
sleep 5
|
||||
done
|
@@ -1,19 +1,11 @@
|
||||
#! /bin/bash
|
||||
|
||||
# add them ti .local/bin
|
||||
# then add a simple launcher
|
||||
# with their names and select
|
||||
# to use the terminal
|
||||
|
||||
FILE1=/usr/lib/vala-panel/appmenu-registrar
|
||||
FILE2=/usr/lib/vala-panel/appmenu-registrar.OFF
|
||||
if [ -f "$FILE1" ]; then
|
||||
## Disable Global Menu
|
||||
sudo mv "$FILE1" "$FILE2" || exit
|
||||
sudo -A mv "$FILE1" "$FILE2" || exit
|
||||
xfconf-query -c xfce4-panel -p /plugins/plugin-3/plugins/plugin-3/compact-mode -n -t bool -s true
|
||||
killall appmenu-registrar
|
||||
rofi -e 'Disabling the top menu
|
||||
Please wait...' &
|
||||
killall appmenu-registrar
|
||||
## Reset panels and windows
|
||||
xfce4-panel -r &
|
||||
xfwm4 --replace &
|
||||
@@ -22,10 +14,8 @@ Please wait...' &
|
||||
|
||||
elif [ -f "$FILE2" ]; then
|
||||
## Enable Global Menu
|
||||
sudo mv "$FILE2" "$FILE1" || exit
|
||||
sudo -A mv "$FILE2" "$FILE1" || exit
|
||||
xfconf-query -c xfce4-panel -p /plugins/plugin-3/plugins/plugin-3/compact-mode -n -t bool -s false
|
||||
rofi -e 'Enabling the top menu
|
||||
Please wait...' &
|
||||
## Reset panels and windows
|
||||
xfce4-panel -r &
|
||||
xfwm4 --replace &
|
||||
|
Reference in New Issue
Block a user