Compare commits

..

No commits in common. "83f591c4e411dd7e783b68bc3dd19f3bcc956fc4" and "b9f53bd348ebab8ac692728e78e00e46f907239d" have entirely different histories.

4 changed files with 2 additions and 236 deletions

View File

@ -1,7 +1,7 @@
# sway # launchers
# menus: exec & apps
#bindsym $mod+d exec $menud
bindsym $mod+d exec $menud
#bindsym $mod+p exec $menup
# terminal

View File

@ -112,4 +112,4 @@
# Exit sway (logs you out of your Wayland session)
#bindsym $mod+Shift+e exec swaynag --background 4c566a --border d8dee9 --border-bottom d8dee9 --button-background 81a1c1 --text d8dee9 --button-text 2e3440 --border-bottom-size 1 --button-border-size 1 -m 'You pressed the exit shortcut...' -B ' shutdown!' 'systemctl poweroff' -B ' lockscreen' 'swaylock' -B ' exit sway' 'swaymsg exit'
#bindsym $mod+Shift+e exec "nakedquit"
bindsym $mod+Shift+e exec "nakedquit"

View File

@ -1,232 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
CONFIG="$HOME/.config/sway/config"
# --------------------------------------------------------------------
# Configuration
# --------------------------------------------------------------------
# Chez toi $mad semble être ton modificateur principal.
# Adapte si nécessaire.
declare -A VARS=(
[mad]="Super"
[mod]="Super"
)
# --------------------------------------------------------------------
# Fonctions
# --------------------------------------------------------------------
pretty_key() {
local key="$1"
key="${key//\$mad/Super}"
key="${key//\$mod/Super}"
key="${key//+Shift/+Shift}"
key="${key//+Ctrl/+Ctrl}"
key="${key//+Alt/+Alt}"
echo "$key"
}
application_from_command() {
local cmd="$1"
case "$cmd" in
*'app-focus "firefox"'*)
echo "Firefox"
;;
*'app-focus "Mattermost.Desktop"'*)
echo "Mattermost"
;;
*'app-focus "jetbrains-idea"'*)
echo "IntelliJ IDEA"
;;
*'app-focus "jitsi-meet"'*)
echo "Jitsi Meet"
;;
*'app-focus "freetube"'*)
echo "FreeTube"
;;
*'app-focus "Spotify"'*)
echo "Spotify"
;;
*'app-focus "discord"'*)
echo "Discord"
;;
*'app-focus "foot"'*)
echo "Terminal"
;;
*'app-focus "bruno"'*)
echo "Bruno"
;;
*)
echo ""
;;
esac
}
describe_command() {
local cmd="$1"
case "$cmd" in
*'app-focus'*)
echo "Focus / suivant"
;;
*'panel-toggle launcher'*)
echo "Noctalia launcher"
;;
*'panel-toggle control-center'*)
echo "Noctalia control center"
;;
*'settings-toggle'*)
echo "Noctalia settings"
;;
*'workspace '*)
echo "$cmd"
;;
*'kill'*)
echo "Fermer fenêtre"
;;
*)
echo "$cmd"
;;
esac
}
# --------------------------------------------------------------------
# Recherche des fichiers
# --------------------------------------------------------------------
mapfile -t FILES < <(
{
echo "$CONFIG"
find "$HOME/.config/sway/config.d" -type f 2>/dev/null
echo "$HOME/.config/sway/noctalia"
} |
sort -u
)
# --------------------------------------------------------------------
# Extraction
# --------------------------------------------------------------------
declare -a BINDINGS=()
declare -A COUNT=()
for file in "${FILES[@]}"; do
[ -f "$file" ] || continue
while IFS= read -r line; do
# Supprime les commentaires
line="${line%%#*}"
# Ignore les lignes vides
[[ -z "${line//[[:space:]]/}" ]] && continue
# On ne s'intéresse qu'aux bindsym
[[ "$line" =~ ^[[:space:]]*bindsym[[:space:]]+ ]] || continue
# Retire "bindsym"
rest="${line#*bindsym }"
# Sépare les options éventuelles (--release, --locked...)
key="$rest"
key="${key%% exec *}"
key="${key%% workspace *}"
key="${key%% kill*}"
key="${key%% focus *}"
key="${key%% move *}"
command="${rest#"$key"}"
command="${command# }"
# Normalisation du raccourci
key="$(pretty_key "$key")"
# Application éventuelle
app="$(application_from_command "$command")"
if [ -n "$app" ]; then
action="$app"
else
action="$(describe_command "$command")"
fi
binding="$key"$'\t'"$action"$'\t'"$file"
BINDINGS+=("$binding")
((COUNT["$key"]++)) || true
done < "$file"
done
# --------------------------------------------------------------------
# Affichage
# --------------------------------------------------------------------
echo
echo "APPLICATIONS"
echo "============"
printf "%-25s %-22s %s\n" "RACCOURCI" "APPLICATION" "SOURCE"
printf "%-25s %-22s %s\n" "-------------------------" "----------------------" "------------------------------"
for binding in "${BINDINGS[@]}"; do
IFS=$'\t' read -r key action file <<< "$binding"
case "$action" in
Firefox|Mattermost|*"IntelliJ"*|*"Jitsi"*|FreeTube|Spotify|Discord|Terminal|Bruno)
printf "%-25s %-22s %s\n" "$key" "$action" "$file"
;;
esac
done
echo
echo "AUTRES RACCOURCIS"
echo "================="
printf "%-25s %-30s %s\n" "RACCOURCI" "ACTION" "SOURCE"
printf "%-25s %-30s %s\n" "-------------------------" "------------------------------" "------------------------------"
for binding in "${BINDINGS[@]}"; do
IFS=$'\t' read -r key action file <<< "$binding"
case "$action" in
Firefox|Mattermost|*"IntelliJ"*|*"Jitsi"*|FreeTube|Spotify|Discord|Terminal|Bruno)
continue
;;
esac
printf "%-25s %-30s %s\n" "$key" "$action" "$file"
done
echo
echo "CONFLITS"
echo "========"
found=0
for key in "${!COUNT[@]}"; do
if (( COUNT["$key"] > 1 )); then
echo
echo "⚠ $key (${COUNT[$key]} bindings)"
for binding in "${BINDINGS[@]}"; do
IFS=$'\t' read -r bkey action file <<< "$binding"
if [[ "$bkey" == "$key" ]]; then
printf " %-25s %s\n" "$action" "$file"
fi
done
found=1
fi
done
if (( found == 0 )); then
echo "Aucun conflit détecté."
fi

View File

@ -56,5 +56,3 @@ echo "faire un source .bashrc"
# sudo apt update
# sudo apt install bruno
echo "Pour sway : sway-bindings liste les raccourcis"