Outils pour utilisateurs

Outils du site


doc:bullseye:misc

Misc

Upgrade/fix

sudo dpkg --configure -a
sudo apt update
sudo apt install -yf
sudo apt upgrade -y --autoremove

Auto-upgrade

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -f noninteractive unattended-upgrades
sudo sed -i 's|^//\(      "origin=Debian,codename=${distro_codename}-updates";\)|  \1|' "/etc/apt/apt.conf.d/50unattended-upgrades"
sudo sed -i 's|^//\(      "origin=Debian,codename=${distro_codename}-proposed-updates";\)|  \1|' "/etc/apt/apt.conf.d/50unattended-upgrades"

Read DVD

sudo apt install -y libdvd-pkg
sudo UBUNTU_FRONTEND='noninteractive' dpkg-reconfigure libdvd-pkg

Backport kernel

echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free " | tee -a /etc/apt/sources.list
sudo apt update
sudo apt install linux-image-amd64 -t bullseye-backports

SID kernel (and only that)

echo "deb http://deb.debian.org/debian sid main contrib non-free" | sudo tee -a /etc/apt/sources.list
echo "Package: *
Pin: release a=unstable
Pin-Priority: 499" | sudo tee "/etc/apt/preferences.d/00low_sid"
sudo apt update
sudo apt install linux-image-amd64 -t sid

lightdm : autologine 1st user

lightdm="/etc/lightdm/lightdm.conf"
if grep -Eq "^#?autologin-user=" "$lightdm"
then
	sudo sed -ri "s/#?(autologin-user=).*/\1$(id -un 1000)/" "$lightdm"
else
	echo "autologin-user=$user" | sudo tee -a "$lightdm"
fi

Slighty faster boot (grub=1s + skip wait-network)

sudo sed -ri 's|^(GRUB_TIMEOUT=).*|\11|' "/etc/default/grub"
sudo systemctl disable 'NetworkManager-wait-online.service'

Pretty useless but nice

mkdir -p "$HOME/.config/vlc"
grep -q "qt-privacy-ask=0" "$HOME/.config/vlc/vlcrc" || echo "qt-privacy-ask=0" >> "$HOME/.config/vlc/vlcrc"

#NetworkManager : configurer les DNS de la FFDN sur votre réseau actif
i="$(nmcli -t c s --active | cut -d: -f1)"
if ! echo $i | grep -q "FFDN$"
then
	i2="${i}+FFDN"
	nmcli c c "$i" "$i2"
	nmcli c m "$i2" ipv4.dns "80.67.169.12, 80.67.169.40, 80.67.188.188"
	nmcli c m "$i2" ipv6.dns "2001:910:800::12, 2001:910:800::40, 2001:913::8"
	nmcli c m "$i2" ipv4.ignore-auto-dns "true"
	nmcli c m "$i2" ipv6.ignore-auto-dns "true"
	nmcli c up "$i2"
fi

#trucs qui m'enervent en .desktop :1

desktop(){
	if test ! -f "/usr/share/applications/$2"
	then sudo rm -f "/usr/local/share/applications/$2" && echo "Avertissement : pas d'entrée $2" && return 0
	fi
	if test -f "/usr/local/share/applications/$2"
	then src="/usr/local/share/applications/$2"
	else src="/usr/share/applications/$2"
	fi
	tmp=$(mktemp)
	case "$1" in
		"hide") sudo sed -r "s|(\[Desktop Entry\])|\1\nHidden=true|" "$src" > "$tmp";;
		"uncat") sudo sed -r "s|([;=])$3;|\1|g" "$src" > $tmp;;
		"recat") sudo sed -r "s|([;=])$3;|\1$4;|g" "$src" > $tmp;;
		*) echo "Erreur : Pas d'argument valide fourni"; return 1 ;;
	esac
	sudo mv "$tmp" "/usr/local/share/applications/$2"
}

#libreoffice : passer msg d'accueil + astuce du jour + nouvelle version
conf="$HOME/.config/libreoffice/4/user/registrymodifications.xcu"
#header
if test ! -f "$conf"
then
	mkdir -p "$(dirname $conf)"
	echo '<?xml version="1.0" encoding="UTF-8"?>
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</oor:items>
' "$conf"
fi
sed -i '$d' "$conf"
echo '<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="ShowTipOfTheDay" oor:op="fuse"><value>false</value></prop></item>
<item oor:path="/org.openoffice.Setup/Product"><prop oor:name="ooSetupLastVersion" oor:op="fuse"><value>7.0</value></prop></item>
' >> "$conf"
echo '</oor:items>' >> "$conf"

#df les fichiers pdf n'ont rien à faire dans les applis
desktop hide "lcdd.desktop"
desktop hide "df-manuel.desktop"
desktop uncat "df-manuel.desktop" "Utility"
#Entrées Peu utilisées (ou y a pas trop d'intêret à lancer tel quel)
desktop hide "libreoffice-startcenter.desktop"
desktop hide "xfce4-appfinder.desktop"
#Entrées inutiles
desktop hide "software-properties-drivers.desktop"
#Doublons et mal placé
desktop uncat "libreoffice-draw.desktop" "Graphics"
desktop uncat "users.desktop" "Settings"
desktop uncat "system-config-printer.desktop"
desktop uncat "lightdm-gtk-greeter-settings.desktop" "Utility"
desktop uncat "pavucontrol.desktop" "AudioVideo"
desktop uncat "xfce4-sensors.desktop" "Utility"
desktop uncat "xfce4-taskmanager.desktop" "Utility"
desktop uncat "thunar-bulk-rename.desktop" "System"
desktop uncat "system-config-printer.desktop" "Settings"
desktop uncat "xfburn.desktop" "Utility"
desktop uncat "thunar.desktop" "System"
#Mal placé
desktop recat "org.gnome.DejaDup.desktop" "Utility" "System"
desktop recat "software-properties-gnome.desktop" "Settings" "System"
desktop recat "synaptic.desktop" "Settings" "System"
desktop recat "xfce4-dict.desktop" "Office" "Utility"
desktop recat "org.gnome.DiskUtility.desktop" "Utility" "System"
desktop recat "pavucontrol.desktop" "Audio" "Settings"
desktop recat "hplip.desktop" "Settings" "System"
desktop recat "software-properties-gtk.desktop" "Settings" "System"
desktop recat "mousepad.desktop" "Utility" "Office"

## Whiskermenu : ne devrait pas passer changer de cat en survol (trop de precision pour personnes âgées)
reconf(){
	find "$HOME/.config/xfce4/panel/" -name "whiskermenu-*.rc" | while read f
	do
		sed -ri "s|^($1=).*|\1$2|" "$f" && grep -q "^$1" "$f" || echo "$1=$2" >> "$f"
	done
}

## nm : cacher les notifs de co/deco généralement inutiles
dconf write "/org/gnome/nm-applet/disable-disconnected-notifications" "true"
dconf write "/org/gnome/nm-applet/disable-connected-notifications" "true"

#theme
xfconf-query -c "xsettings" -p "/Net/IconThemeName" -n -t "string" -s "gnome"

#xfce4-session : ne pas sauvegarder la session défaut
xfconf-query -c "xfce4-session" -p "/general/SaveOnExit" -n -t "bool" -s "false"

#xfwm4 : la focalisation SUIT LA SOURIS ;
xfconf-query -c "xfwm4" -p "/general/click_to_focus" -n -t "bool" -s "true"
## xfwm4 : Enlever la fonction enrouler les fenêtres avec la molette (pourrait se déclencher par accident)
xfconf-query -c "xfwm4" -p "/general/mousewheel_rollup" -n -t "bool" -s "false"
xfconf-query -c "xfwm4" -p "/general/button_layout" -n -t "string" -s "0|HMC"
#xfwm4 : considérer supprimer la composition pour les vieux clous : mais perso la transparence des fenêtres inactives : buerk
xfconf-query -c "xfwm4" -p "/general/use_compositing" -n -t "bool" -s "true"
xfconf-query -c "xfwm4" -p "/general/inactive_opacity" -n -t "int" -s "100"
# xfwm4 ne pas cycle les fenêtres alt+tab sur les bueaux sur lesquels on est pas
xfconf-query -c "xfwm4" -p "/general/cycle_workspaces" -n -t "bool" -s "false"
# xfwm4 : les vieux et jeunes touchent à leur molette par accident et switchen d'espace de travail...
xfconf-query -c "xfwm4" -p "/general/scroll_workspaces" -n -t "bool" -s "false"
# xfwm4 : optimisation sur vieil ordi : ne pas rafraichir les fenêtres en redimensionnement
xfconf-query -c "xfwm4" -p "/general/box_resize" -n -t "bool" -s "true"

#xfdesktop : moins de menus pour nostalgiques d'openbox...
xfconf-query -c "xfce4-desktop" -p "/desktop-menu/show" -n -t "bool" -s "false"
xfconf-query -c "xfce4-desktop" -p "/windowlist-menu/show" -n -t "bool" -s "false"

#cacher l'option "hibernate", "hibernate hybrid" et "switch user" : rarement employés
#trouvé en fouillant https://github.com/xfce-mirror/xfce4-session/blob/master/xfce4-session/xfsm-logout-dialog.c
xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'false'
xfconf-query -c xfce4-session -np '/shutdown/ShowSwitchUser' -t 'bool' -s 'false'
xfconf-query -c xfce4-session -np '/shutdown/ShowHybridSleep' -t 'bool' -s 'false'

#thunar : vue par défaut en liste, la seule vue que je trouve utile perso
xfconf-query -c "thunar" -p "/default-view" -n -t "string" -s "ThunarDetailsView"
#thunar : je désactiverai "periphérique : système de fichier" ; personne n'a besoin d'un accès rapide vers "/"
xfconf-query -c "thunar" -p "/hidden-bookmarks" -n -t "string" -t "string" -t "string" -s "network:///" -s "computer:///" -s "file:///"

# Mousepad : ouvrir dans une nouvelle fenêtre, rares sont les gens à l'aise avec les onglets (moi le premier)
dconf write "/org/xfce/mousepad/preferences/window/opening-mode" "'window'"
# Mousepad : barre d'outil pour les débutants + gros icones + passage de ligne (scroller c'est dur) + numéro de ligne (pacher) + parenthèses
dconf write "/org/xfce/mousepad/preferences/window/statusbar-visible" "true"
dconf write "/org/xfce/mousepad/preferences/window/toolbar-icon-size" "'large-toolbar'"
dconf write "/org/xfce/mousepad/preferences/view/match-braces" "true"
dconf write "/org/xfce/mousepad/preferences/view/show-line-numbers" "true"
# Mousepad : ne saute pas à la ligne par défaut ?
dconf write "/org/xfce/mousepad/preferences/view/word-wrap" "true"

# Gnome-software : passer le "allons faire nos courses". Sérieusement ?
dconf write "/org/gnome/software/first-run" "false"

#lightlocker : ne pas bloquer après screensaver
dconf write "/apps/light-locker/lock-after-screensaver" "uint32 0"

DF

#Supprimer libreoffice base et math
sudo apt purge libreoffice-base libreoffice-math --autoremove -y

#Supprimer ~/Public, launcher
rmdir "$HOME/Public"
#sed -i "s|.*$HOME/Public||" "$HOME/.config/gtk-3.0/bookmarks"
mkdir -p "$HOME/.config/gtk-3.0/"
echo "file://$HOME/Documents
file://$HOME/Images
file://$HOME/Musique
file://$HOME/T%C3%A9l%C3%A9chargements
file://$HOME/Vid%C3%A9os
" > "$HOME/.config/gtk-3.0/bookmarks"
rm -f "$HOME/Bureau/handymenu.desktop"

#renommer les cahier et le manuel pour + explicite
sed -ri "s|(^Name=).*|\1Manuel Debian (avancé)|" "$HOME/.config/xfce4/panel/launcher-1/16251597592.desktop"
sed -ri "s|(^Name=).*|\1Manuel Debian (découverte)|" "$HOME/.config/xfce4/panel/launcher-1/16251597361.desktop"

Apps dépannage

sudo apt install mlocate -y
sudo updatedb
sudo apt install nethogs numlockx ffmpeg aptitude iotop gddrescue testdisk dconf-cli numlockx smart-notifier aptitude -y

Apps préférées

#deluge mieux que transmission
sudo apt install deluge -y && sudo apt purge transmission-gtk --autoremove -y

#mirage ftw
sudo apt install -y mirage
#casse xfce4-goodies
sudo apt-mark manual hddtemp libqrencode4 libxnvctrl0 xfce4-battery-plugin xfce4-clipman xfce4-clipman-plugin xfce4-cpufreq-plugin xfce4-cpugraph-plugin xfce4-datetime-plugin xfce4-dict xfce4-diskperf-plugin xfce4-fsguard-plugin xfce4-genmon-plugin xfce4-mailwatch-plugin xfce4-netload-plugin xfce4-places-plugin xfce4-screenshooter xfce4-sensors-plugin xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-timer-plugin xfce4-verve-plugin xfce4-wavelan-plugin xfce4-weather-plugin xfce4-whiskermenu-plugin xfce4-xkb-plugin
sudo apt purge -y ristretto

#lxtask ftw
sudo apt install -y lxtask
sudo apt purge -y xfce4-taskmanager

grep -q "<Shift>C" "/usr/lib/python3/dist-packages/mirage/__init__.py" || echo '467a468,470
>             ("app.resize-image", "<Shift>R"),
>             ("app.crop-image", "<Shift>C"),
>             ("app.saturation", "<Shift>S"),' | sudo patch "/usr/lib/python3/dist-packages/mirage/__init__.py"

## avoir une bordure de fenêtre normale => gtk3-nocsd ? libxfce4ui-nocsd serait mieux (évite double menus)
#keepassxc bonne habitude
sudo apt install gtk3-nocsd keepassxc -y

FF & Thunderbird

#installing addons
sudo apt install -y unzip

#from https://askubuntu.com/questions/73474/how-to-install-firefox-addon-from-command-line-in-scripts
#updated here https://stackoverflow.com/questions/37728865/install-webextensions-on-firefox-from-the-command-line
iAddon() {
	xpi=$(curl "$1" | grep -o "https://[a-z./0-9_+-]*.xpi") || exit 1
	temp=$(mktemp)
	wget "$xpi" --output-document="$temp"
	id=$(unzip -p "$temp" "manifest.json" | grep '"id": "' | sed -r 's|.*"(.*)".*|\1|')
	find "$HOME/.mozilla/firefox/" -name "extensions" -type d | while read f
	do
		if ! test -f "$f/$id.xpi"
		then
			ln "$temp" "$f/$id.xpi"
		fi
	done
	rm "$temp"
}

#I don't care about cookies
iAddon "https://addons.mozilla.org/en-US/firefox/addon/i-dont-care-about-cookies/"
#RSS preview
iAddon "https://addons.mozilla.org/en-US/firefox/addon/rsspreview/"
#ublock origin
sudo apt install -y webext-ublock-origin-firefox
#iAddon "https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/"
#https everywhere 
sudo apt install -y webext-https-everywhere
#iAddon "https://addons.mozilla.org/en-US/firefox/addon/https-everywhere/"

#Bookmarks
sudo apt install -y sqlite3
addBookmark(){
	fk=$(echo "INSERT INTO moz_places (url, title) VALUES('$1', '$2'); select last_insert_rowid();" | sqlite3 "$f")
	guid=$(uuidgen | cut -d"-" -f5)
	echo "INSERT INTO moz_bookmarks (type, fk, parent, position, title, guid) VALUES(1,$fk,3,0,'$2','$guid');" | sqlite3 "$f"
}
delBookmark(){
	echo "DELETE FROM moz_bookmarks WHERE title='$1';" | sqlite3 "$f"
}

find "$HOME/.mozilla/firefox/" -name "places.sqlite" -type f | while read f
do
	delBookmark "Debian"
	delBookmark "Débuter avec Firefox"
	addBookmark "https://www.agendadulibre.org/pages/filter" "Agenda du Libre"
done

reconf(){
	find "$HOME/.thunderbird/" -name "prefs.js" | while read f
	do
		if ! grep -q "$1" "$f"
		then
			echo "user_pref(\"$1\", $2);" >> "$f"
		else
			sed -i 's|^user_pref("'$1'",.*);|user_pref("'$1'", '$2');|' "$f"
		fi
	done
}

#thunderbird : agenda et tâche sont en haut à gauche par défaut mais désactivés... Pas intuitif. Soit ils barrent soit on les active quoi ?
#thunderbird : notif "gnagna est un logiciel libre"
#thunderbird : onglet pub "vie privée"
#thunderbird : le spam détecté le mettre dans la spamboite automatiquement ? => NON PREVU, mais si ça l'était ce serait ça : user_pref("mail.server.server1.moveOnSpam", true);


#thunderbird : ne pas afficher la page de thunderbird en page de démarrage (ORLY)
reconf "mailnews.start_page.enabled" "false"
#thunderbird : afficher en "html simple" permet d'éviter le message flippant de "voulez vous faire confiance" et + simple
reconf "mailnews.display.html_as" 3
#thunderbird : correction fr
reconf "spellchecker.dictionary" '"fr"'
#thunderbird : toggle sur alt
reconf "ui.key.menuAccessKeyFocuses" "false"
#thunderbird : envoyer des report => nah
reconf "datareporting.healthreport.uploadEnabled" "false"
#thunderbird : mettre dans spam le courrier marquer spam...
reconf "mail.spam.manualMark" "true"



reconf(){
	find "$HOME/.mozilla/firefox/" -name "prefs.js" | while read f
	do
		if ! grep -q "$1" "$f"
		then
			echo "user_pref(\"$1\", $2);" >> "$f"
		else
			#dumbest workaround
			a=$(echo $2 | sed "s|\\\|\\\\\\\\\\\|g")
			sed -i 's|^user_pref("'$1'",.*);|user_pref("'$1'", '$a');|' "$f"
		fi
	done
}

#firefox : activer les extensions ajoutées via script
reconf "extensions.autoDisableScopes" "0"
#firefox : désactiver les brèves/+visité/+highlight
reconf "browser.newtabpage.activity-stream.feeds.snippets" "false"
reconf "browser.newtabpage.activity-stream.feeds.section.highlights" "false"
reconf "browser.newtabpage.activity-stream.feeds.topsites" "false"
#firefox : cacher le moteur de recherche ebay
reconf "browser.search.hiddenOneOffs" '"eBay"'
#firefox : Pocket à désactiver
reconf "extensions.pocket.enabled" "false"
#firefox : pouvoir cycler entre les onglets avec ctrl+tab/ctrl+maj+tab
reconf "browser.ctrlTab.recentlyUsedOrder" "false"
#firefox : ne pas avoir les menus qui clignotent dès qu'on utilise tab
reconf "ui.key.menuAccessKeyFocuses" "false"
#firefox : pas de pub, merci
reconf "browser.newtabpage.activity-stream.showSponsored" "false"
#firefox : correction fr
reconf "spellchecker.dictionary" '"fr"'

#firefox : je désactiverai aussi le bouton "profil" de ff & accès zarbos aux marque-page (ça définit tous les placements du coup)
reconf "browser.uiCustomization.state" '"{\"placements\":{\"widget-overflow-fixed-list\":[],\"nav-bar\":[\"back-button\",\"forward-button\",\"stop-reload-button\",\"urlbar-container\",\"downloads-button\",\"ublock0_raymondhill_net-browser-action\"],\"toolbar-menubar\":[\"menubar-items\"],\"TabsToolbar\":[\"tabbrowser-tabs\",\"new-tab-button\",\"alltabs-button\"],\"PersonalToolbar\":[\"personal-bookmarks\"]},\"seen\":[\"https-everywhere-eff_eff_org-browser-action\",\"ublock0_raymondhill_net-browser-action\",\"jid1-kkzogwgsw3ao4q_jetpack-browser-action\",\"developer-button\"],\"dirtyAreaCache\":[\"nav-bar\",\"widget-overflow-fixed-list\"],\"currentVersion\":16,\"newElementCount\":2}"'

###PAS dans prefs.js
#firefox : raccourci debian offi/ff offi inutile nah ? (ou alors faut m'expliquer ce qu'un débutant y trouve)
#firefox : la correction ortho est en anglais par défaut
#firefox : plugin rss + I don't care about cookies 

Latest youtube-dl & auto-upgrade

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
echo "#!/bin/sh
youtube-dl -U" | sudo tee -a "/etc/cron.daily/yt-dl"

Add thunar custom action

video to mp3 conversion

hueeem

doc/bullseye/misc.txt · Dernière modification: 2022/03/17 02:11 de Otyugh