# FWS — configuration i3 par défaut (session X11, COMPATIBLE VR).
# SteamVR fonctionne en X11 : c'est le bureau à choisir pour un casque VR
# (HTC Vive, Valve Index…). Lance « fws-vr-setup » (Super+Shift+V, ou menu)
# pour installer les drivers/runtimes selon ton casque.
# Le clavier X11 est configuré système via /etc/X11/xorg.conf.d/00-keyboard.conf
# (écrit par l'installateur selon ton choix Anaconda) : rien à régler ici.

set $mod Mod4
set $term kitty
set $filemanager dolphin
set $menu rofi -show drun -show-icons
set $browser firefox

# Couleurs — nuances de bleu (Catppuccin Mocha, comme SDDM/waybar FWS)
set $base     #1e1e2e
set $surface0 #313244
set $text     #cdd6f4
set $blue     #89b4fa
set $sapphire #74c7ec
set $red      #f38ba8

# classe                bordure   fond      texte  indicateur child_border
client.focused          $blue     $blue     $base  $sapphire  $blue
client.focused_inactive $surface0 $surface0 $text  $surface0  $surface0
client.unfocused        $surface0 $surface0 $text  $surface0  $surface0
client.urgent           $red      $red      $base  $red       $red
client.background       $base

font pango:Noto Sans 10
default_border pixel 2
gaps inner 4
gaps outer 4

##################
## APPLICATIONS ##
##################
bindsym $mod+Return        exec $term
bindsym $mod+Shift+Return  exec kitty --class floating-term
bindsym $mod+r             exec $menu
bindsym $mod+e             exec $filemanager
bindsym $mod+b             exec $browser
# VR : installation des drivers/runtimes casque (HTC Vive, Index, Quest…)
bindsym $mod+Shift+v       exec kitty -e fws-vr-setup
# Panneau des raccourcis clavier (aussi via le bouton ⌌ de la barre)
bindsym $mod+k             exec fws-keys
# Menu d'alimentation (verrouiller/déconnexion/redémarrer/éteindre)
bindsym $mod+x             exec fws-powermenu

##############
## FENETRES ##
##############
bindsym $mod+q         kill
bindsym $mod+v         floating toggle
bindsym $mod+f         fullscreen toggle
bindsym $mod+j         split toggle
bindsym $mod+l         exec i3lock -c 1e1e2e
# Quitter i3 → retour à SDDM
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Quitter i3 et revenir à SDDM ?' -B 'Oui, quitter' 'i3-msg exit'"
bindsym $mod+Shift+c reload

# Focus (flèches)
bindsym $mod+Left  focus left
bindsym $mod+Right focus right
bindsym $mod+Up    focus up
bindsym $mod+Down  focus down
# Déplacer la fenêtre
bindsym $mod+Shift+Left  move left
bindsym $mod+Shift+Right move right
bindsym $mod+Shift+Up    move up
bindsym $mod+Shift+Down  move down
# Redimensionner (Ctrl + flèches)
bindsym $mod+Ctrl+Left  resize shrink width  30 px
bindsym $mod+Ctrl+Right resize grow   width  30 px
bindsym $mod+Ctrl+Up    resize shrink height 30 px
bindsym $mod+Ctrl+Down  resize grow   height 30 px

################
## WORKSPACES ##
################
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Multi-écrans
bindsym $mod+Ctrl+1 move container to output left
bindsym $mod+Ctrl+2 move container to output right
# Molette = changer de workspace
bindsym $mod+button4 workspace prev
bindsym $mod+button5 workspace next
# Scratchpad
bindsym $mod+s       scratchpad show
bindsym $mod+Shift+s move scratchpad

##############
## CAPTURES ##
##############
bindsym Print            exec --no-startup-id "maim | xclip -selection clipboard -t image/png"
bindsym $mod+Print       exec --no-startup-id "maim -s | xclip -selection clipboard -t image/png"
bindsym $mod+Shift+Print exec --no-startup-id "mkdir -p ~/Images && maim -s ~/Images/capture_$(date +%Y-%m-%d_%H-%M-%S).png"

################
## MULTIMEDIA ##
################
bindsym XF86AudioRaiseVolume  exec --no-startup-id wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindsym XF86AudioLowerVolume  exec --no-startup-id wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindsym XF86AudioMute         exec --no-startup-id wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindsym XF86AudioPlay         exec --no-startup-id playerctl play-pause
bindsym XF86AudioNext         exec --no-startup-id playerctl next
bindsym XF86AudioPrev         exec --no-startup-id playerctl previous
bindsym XF86MonBrightnessUp   exec --no-startup-id brightnessctl set +5%
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-

#####################
## REGLES FENETRES ##
#####################
for_window [class="floating-term"] floating enable, resize set 900 550
for_window [class="(?i)fws-hello"] floating enable
for_window [class="(?i)fws-about"] floating enable
for_window [class="(?i)pavucontrol"] floating enable, resize set 700 500
for_window [class="(?i)blueman-manager"] floating enable
for_window [title="Picture-in-Picture"] floating enable

###########
## BARRE ##
###########
# Polybar (config ~/.config/polybar/config.ini) : clone visuel de la waybar
# Hyprland FWS — pilules, icônes, horloge+date au centre, bouton Raccourcis.
# exec_always + pkill : la barre survit proprement aux reload ($mod+Shift+c).
exec_always --no-startup-id sh -c 'pkill -x polybar; sleep 0.3; exec polybar -q fws'

###############
## AUTOSTART ##
###############
# picom : coins arrondis (parité visuelle avec Hyprland) — config FWS légère.
# PAS en machine virtuelle : le compositing sur GPU virtuel (vmwgfx/llvmpipe)
# rate le repaint des fenêtres GTK → contenus noirs/artefacts. Les coins
# arrondis sont sacrifiés en VM ; sur matériel réel picom se lance normalement.
exec --no-startup-id sh -c 'systemd-detect-virt --quiet || exec picom --config ~/.config/picom.conf'
exec --no-startup-id dunst
exec --no-startup-id nm-applet
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id sh -c '[ -n "$(ls -A /sys/class/bluetooth 2>/dev/null)" ] && exec blueman-applet'
# Fenêtre de bienvenue (1er démarrage seulement — se retire ensuite).
exec --no-startup-id fws-hello --autostart
