Compare commits
2 Commits
b9f53bd348
...
83f591c4e4
| Author | SHA1 | Date |
|---|---|---|
|
|
83f591c4e4 | |
|
|
964ecce7e4 |
|
|
@ -1,7 +1,7 @@
|
||||||
# sway # launchers
|
# sway # launchers
|
||||||
|
|
||||||
# menus: exec & apps
|
# menus: exec & apps
|
||||||
bindsym $mod+d exec $menud
|
#bindsym $mod+d exec $menud
|
||||||
#bindsym $mod+p exec $menup
|
#bindsym $mod+p exec $menup
|
||||||
|
|
||||||
# terminal
|
# terminal
|
||||||
|
|
|
||||||
|
|
@ -112,4 +112,4 @@
|
||||||
|
|
||||||
# Exit sway (logs you out of your Wayland session)
|
# 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 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"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,232 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
|
@ -56,3 +56,5 @@ echo "faire un source .bashrc"
|
||||||
# sudo apt update
|
# sudo apt update
|
||||||
# sudo apt install bruno
|
# sudo apt install bruno
|
||||||
|
|
||||||
|
echo "Pour sway : sway-bindings liste les raccourcis"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue