diff --git a/.config/sway/config b/.config/sway/config index e70f6b3..6757b4f 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -1,533 +1,12 @@ -# ============================================================================= -# ~/.config/sway/config — Configuration Sway (Wayland) -# ============================================================================= -# Sway est un gestionnaire de fenêtres en tuiles pour Wayland, compatible -# avec la syntaxe de configuration de i3. -# -# Documentation officielle : https://man.archlinux.org/man/sway.5 -# Pour recharger la configuration sans redémarrer : Super + Maj + C -# Pour quitter Sway : Super + Maj + E -# ============================================================================= +# sway main config file ~/.config/sway/config +# include system config files +include /etc/sway/config.d/* -# ============================================================================= -# 1. TOUCHE MODIFICATEUR (Super / Meta) -# ============================================================================= -# $mod est la touche principale utilisée pour tous les raccourcis. -# Mod4 = touche Super (touche Windows / Commande) -# Mod1 = touche Alt (alternative si Super est indisponible) +# include user config files +include $HOME/.config/sway/config.d/* -set $mod Mod4 - - -# ============================================================================= -# 2. CLAVIER — DISPOSITION AZERTY FRANÇAISE -# ============================================================================= -# Configurez ici votre clavier. Tous les paramètres sont optionnels. -# -# Options courantes pour `xkb_options` : -# caps:escape → Caps Lock fonctionne comme Échap -# caps:ctrl_modifier → Caps Lock fonctionne comme Ctrl -# compose:ralt → Alt droit = touche Compose (accents) -# grp:alt_shift_toggle → Alt+Maj pour changer de disposition -# -# Délai et répétition (repeat_delay / repeat_rate) : -# repeat_delay : temps en ms avant que la répétition commence (défaut : 600) -# repeat_rate : frappes par seconde en répétition (défaut : 25) - -input "type:keyboard" { - xkb_layout fr - xkb_variant azerty - xkb_options caps:escape - repeat_delay 300 - repeat_rate 40 -} - -# --- Claviers spécifiques (optionnel) --- -# Si vous avez plusieurs claviers et voulez des réglages différents, -# trouvez l'identifiant avec : swaymsg -t get_inputs -# Exemple : -# input "1:1:AT_Translated_Set_2_keyboard" { -# xkb_layout fr -# } - - -# ============================================================================= -# 3. SOURIS ET PAVÉ TACTILE -# ============================================================================= -# Trouvez les identifiants de vos périphériques avec : swaymsg -t get_inputs - -input "type:touchpad" { - # Activer/désactiver le clic en tapant sur le pavé - tap enabled - # Désactiver le pavé tactile pendant la frappe - dwt enabled - # Défilement naturel (comme sur macOS) : disabled | enabled - natural_scroll disabled - # Accélération du pointeur : valeur entre -1.0 (lent) et 1.0 (rapide) - pointer_accel 0.2 - # Mode d'accélération : adaptive | flat - accel_profile adaptive -} - -input "type:pointer" { - # Désactiver l'accélération pour une souris (utile en jeu) - # accel_profile flat - pointer_accel 0.0 -} - - -# ============================================================================= -# 4. MONITEURS / ÉCRANS -# ============================================================================= -# Configurez vos moniteurs ici. -# Listez les sorties disponibles avec : swaymsg -t get_outputs -# -# Syntaxe : output -# -# Résolutions courantes : 1920x1080, 2560x1440, 3840x2160 -# Fréquences courantes : 60Hz, 75Hz, 144Hz, 165Hz -# Position (multi-écran): pos 0 0 (principal), pos 1920 0 (à droite), etc. -# Rotation : transform normal | 90 | 180 | 270 -# Mise à l'échelle HiDPI: scale 1.5 (pour les écrans 4K par exemple) - -# Écran principal (adaptez le nom à votre matériel) -output * bg #1e1e2e solid_color - -# Exemples de configurations d'écrans (décommentez et adaptez) : -# -# output HDMI-A-1 { -# resolution 1920x1080 -# refresh 60 -# pos 0 0 -# transform normal -# scale 1 -# } -# -# output DP-1 { -# resolution 2560x1440 -# refresh 144 -# pos 1920 0 -# } -# -# Désactiver un écran : -# output eDP-1 disable - - -# ============================================================================= -# 5. POLICE D'AFFICHAGE -# ============================================================================= -# Police utilisée pour les titres de fenêtres et la barre swaybar. -# Formats : pango: -# Exemples : pango:monospace 10 | pango:Noto Sans 11 | pango:JetBrains Mono 10 - -font pango:monospace 10 - - -# ============================================================================= -# 6. APPARENCE DES FENÊTRES -# ============================================================================= - -# Épaisseur de la bordure des fenêtres (en pixels). 0 = sans bordure. -default_border pixel 2 - -# Taille des espaces entre les fenêtres en tuiles (gaps) -# inner = espace entre les fenêtres -# outer = espace entre les fenêtres et le bord de l'écran -gaps inner 6 -gaps outer 4 - -# Masquer les bordures quand une seule fenêtre est visible -# none | smart | smart_no_gaps -smart_borders smart_no_gaps - -# Couleurs des bordures -# Format : client.<état> -# -# États : -# focused → fenêtre active -# unfocused → fenêtre inactive -# focused_inactive → fenêtre inactive d'un conteneur actif -# urgent → fenêtre avec une alerte - -set $bleu #89b4fa -set $surface #313244 -set $fond #1e1e2e -set $texte #cdd6f4 -set $urgence #f38ba8 - -client.focused $bleu $surface $texte $bleu $bleu -client.unfocused $fond $fond $texte $fond $fond -client.focused_inactive $surface $surface $texte $surface $surface -client.urgent $urgence $urgence $texte $urgence $urgence - - -# ============================================================================= -# 7. APPLICATIONS PAR DÉFAUT -# ============================================================================= -# Définissez ici vos applications favorites. -# Ces variables sont utilisées dans les raccourcis clavier ci-dessous. -# -# Terminal : foot (léger, natif Wayland) | alacritty | kitty | wezterm -# Navigateur : firefox | chromium | brave-browser | librewolf -# Explorateur : thunar | nautilus | nemo | dolphin -# Éditeur : code | gedit | mousepad | kate -# Lanceur : wofi --show drun | rofi -show drun (via XWayland) -# Messagerie : telegram-desktop | signal-desktop | discord -# Mail : thunderbird | evolution -# Musique : spotify | rhythmbox | lollypop - -set $terminal foot -set $browser firefox -set $displaymgr nwg-displays -set $files nemo -set $editor idea -set $launcher wofi --show drun --allow-markup --insensitive -set $screenshot grim -g "$(slurp)" - | wl-copy -set $screenclip grim ~/Images/capture-$(date +%Y%m%d-%H%M%S).png - - -# ============================================================================= -# 8. RACCOURCIS CLAVIER — APPLICATIONS DIRECTES -# ============================================================================= -# Principe : une touche = une application. Pas de cycling, pas de Alt+Tab. -# Chaque raccourci lance l'application ou y retourne si elle est déjà ouverte. -# -# Syntaxe : bindsym $mod+ exec -# -# Sur AZERTY, les touches disponibles facilement avec Super : -# Lettres : a z e r t y u i o p q s d f g h j k l m w x c v b n -# Chiffres : 1 2 3 4 5 6 7 8 9 0 (pour les espaces de travail) -# Autres : Return (Entrée), space (Espace), Tab, F1-F12 -# -# Astuce : utilisez `xev` ou `wev` pour identifier le nom d'une touche - -# --- Lanceur et terminal --- -bindsym $mod+Return exec $terminal -bindsym $mod+space exec $launcher - -# --- Applications courantes (modifiez selon vos besoins) --- -bindsym $mod+b exec $browser -bindsym $mod+e exec $files -bindsym $mod+c exec $editor -bindsym $mod+p exec $displaymgr - -# --- Capture d'écran --- -# Super + Impr → capture d'une zone sélectionnée (copie dans le presse-papier) -# Super + Maj + Impr → capture de tout l'écran (sauvegarde dans ~/Images) -bindsym $mod+Print exec $screenshot -bindsym $mod+Shift+Print exec $screenclip - -# --- Applications supplémentaires (décommentez et adaptez) --- -# bindsym $mod+m exec thunderbird -# bindsym $mod+s exec spotify -# bindsym $mod+t exec telegram-desktop -# bindsym $mod+n exec $terminal -e nvim -# bindsym $mod+p exec pavucontrol - - -# ============================================================================= -# 9. RACCOURCIS CLAVIER — GESTION DES FENÊTRES -# ============================================================================= - -# --- Fermer la fenêtre active --- -bindsym $mod+q kill - -# --- Recharger la configuration sans redémarrer --- -bindsym $mod+Shift+c reload - -# --- Quitter Sway (déconnexion) --- -bindsym $mod+Shift+e exec swaynag \ - -t warning \ - -m 'Voulez-vous vraiment quitter Sway ?' \ - -b 'Oui, quitter' 'swaymsg exit' - -# --- Déplacer le focus entre les fenêtres --- -# Avec les flèches directionnelles -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# Avec les touches hjkl (style Vim) — optionnel -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# --- Déplacer les fenêtres --- -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# --- Changer le mode de découpe (split) --- -# Horizontal : les nouvelles fenêtres s'ouvrent à droite -bindsym $mod+Shift+h split h -# Vertical : les nouvelles fenêtres s'ouvrent en bas -bindsym $mod+Shift+v split v -# Alterner automatiquement selon la dimension du conteneur -bindsym $mod+Shift+t split toggle - -# --- Changer la disposition du conteneur actif --- -# stacking : fenêtres empilées avec onglets en haut -# tabbed : fenêtres en onglets -# toggle split : alterner horizontal/vertical -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+z layout toggle split - -# --- Fenêtre en plein écran --- -bindsym $mod+f fullscreen toggle - -# --- Mode flottant --- -# Basculer la fenêtre active entre tuile et flottante -bindsym $mod+Shift+f floating toggle -# Garder le focus sur les fenêtres tuiles même quand une flottante est présente -focus_follows_mouse no -# Passer le focus sur tuiles / flottantes -bindsym $mod+Shift+space focus mode_toggle - -# Déplacer une fenêtre flottante avec Super + clic gauche -# Redimensionner une fenêtre flottante avec Super + clic droit -floating_modifier $mod normal - - -# ============================================================================= -# 10. ESPACES DE TRAVAIL (BUREAUX VIRTUELS) -# ============================================================================= -# Les espaces de travail permettent d'organiser vos fenêtres par thème. -# Exemple d'organisation : -# 1 → Terminal 2 → Navigateur 3 → Éditeur -# 4 → Messagerie 5 → Musique 6 → Fichiers - -# Noms des espaces de travail (modifiez selon vos préférences) -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# --- Aller à un espace de travail --- -# Note AZERTY : les chiffres sont accessibles directement (pas besoin de Maj) -bindsym $mod+ampersand workspace $ws1 -bindsym $mod+eacute workspace $ws2 -bindsym $mod+quotedbl workspace $ws3 -bindsym $mod+apostrophe workspace $ws4 -bindsym $mod+parenleft workspace $ws5 -bindsym $mod+minus workspace $ws6 -bindsym $mod+egrave workspace $ws7 -bindsym $mod+underscore workspace $ws8 -bindsym $mod+ccedilla workspace $ws9 -bindsym $mod+agrave workspace $ws10 - -# Variante avec les touches numériques directes (si les touches ci-dessus -# ne fonctionnent pas selon votre configuration) : -# bindsym $mod+1 workspace $ws1 -# ... -# bindsym $mod+0 workspace $ws10 - -# --- Déplacer la fenêtre active vers un espace de travail --- -bindsym $mod+Shift+ampersand move container to workspace $ws1 -bindsym $mod+Shift+eacute move container to workspace $ws2 -bindsym $mod+Shift+quotedbl move container to workspace $ws3 -bindsym $mod+Shift+apostrophe move container to workspace $ws4 -bindsym $mod+Shift+parenleft move container to workspace $ws5 -bindsym $mod+Shift+minus move container to workspace $ws6 -bindsym $mod+Shift+egrave move container to workspace $ws7 -bindsym $mod+Shift+underscore move container to workspace $ws8 -bindsym $mod+Shift+ccedilla move container to workspace $ws9 -bindsym $mod+Shift+agrave move container to workspace $ws10 - -# --- Navigation entre espaces de travail --- -# Aller à l'espace de travail précédent/suivant -bindsym $mod+Tab workspace next -bindsym $mod+Shift+Tab workspace prev - -# Revenir à l'espace de travail précédemment actif -bindsym $mod+BackSpace workspace back_and_forth - -# --- Affecter des applications à des espaces de travail --- -# Trouvez le nom de classe avec : swaymsg -t get_tree | grep app_id -# Pour les apps XWayland, cherchez "class" au lieu de "app_id" -# -# assign [app_id="firefox"] $ws2 -# assign [app_id="org.gnome.Nautilus"] $ws6 -# assign [class="code-oss"] $ws3 -# assign [app_id="thunderbird"] $ws4 -# assign [app_id="spotify"] $ws5 - - -# ============================================================================= -# 11. MODE REDIMENSIONNEMENT -# ============================================================================= -# Appuyez sur Super+R pour entrer en mode redimensionnement. -# Utilisez les flèches pour redimensionner, Échap ou Entrée pour sortir. - -mode "resize" { - bindsym Left resize shrink width 40px - bindsym Down resize grow height 40px - bindsym Up resize shrink height 40px - bindsym Right resize grow width 40px - - # Sorties du mode redimensionnement - bindsym Return mode "default" - bindsym Escape mode "default" - bindsym $mod+r mode "default" -} - -bindsym $mod+r mode "resize" - - -# ============================================================================= -# 12. TOUCHES MULTIMÉDIA ET SYSTÈME -# ============================================================================= - -# --- Volume (PulseAudio / PipeWire) --- -bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% -bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% -bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle -bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle - -# --- Luminosité (nécessite brightnessctl) --- -bindsym XF86MonBrightnessUp exec brightnessctl set +10% -bindsym XF86MonBrightnessDown exec brightnessctl set 10%- - -# --- Contrôle multimédia (nécessite playerctl) --- -bindsym XF86AudioPlay exec playerctl play-pause -bindsym XF86AudioNext exec playerctl next -bindsym XF86AudioPrev exec playerctl previous -bindsym XF86AudioStop exec playerctl stop - - -# ============================================================================= -# 13. VERROUILLAGE ET MISE EN VEILLE -# ============================================================================= - -# Verrouiller l'écran manuellement -bindsym Mod1+l exec swaylock --color 1e1e2e --inside-color 313244 \ - --ring-color 89b4fa --key-hl-color cdd6f4 --line-color 00000000 \ - --separator-color 00000000 --fade-in 0.2 - -# Mise en veille automatique avec swayidle : -# - après 5 min sans activité → verrouillage -# - après 10 min → extinction de l'écran -# - au retour → rallumage de l'écran -exec swayidle -w \ - timeout 300 'swaylock --color 1e1e2e' \ - timeout 600 'swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on"' \ - before-sleep 'swaylock --color 1e1e2e' - - -# ============================================================================= -# 14. RÈGLES DE FENÊTRES (COMPORTEMENTS SPÉCIFIQUES) -# ============================================================================= -# Vous pouvez forcer certaines fenêtres à être flottantes, à s'ouvrir -# sur un espace de travail particulier, ou à ne pas avoir de bordure. -# -# Trouvez app_id avec : swaymsg -t get_tree | grep app_id -# Trouvez class avec : swaymsg -t get_tree | grep '"class"' -# (class = apps XWayland comme certaines apps Electron) -# -# Paramètres disponibles : -# floating enable/disable -# border normal | pixel | none -# move to workspace -# inhibit_idle focus | visible | open | none - -# Fenêtres flottantes par défaut (boîtes de dialogue, utilitaires) -for_window [window_role="dialog"] floating enable -for_window [window_role="bubble"] floating enable -for_window [window_role="pop-up"] floating enable -for_window [window_type="dialog"] floating enable -for_window [window_type="menu"] floating enable -for_window [app_id="pavucontrol"] floating enable, resize set 700 450 -for_window [app_id="nm-connection-editor"] floating enable - -# Exemples supplémentaires (décommentez selon vos besoins) : -# for_window [app_id="firefox" title="Téléchargements"] floating enable -# for_window [app_id="mpv"] floating enable, border none -# for_window [class="Steam" title="Friends List"] floating enable - - -# ============================================================================= -# 15. BARRE D'ÉTAT -# ============================================================================= -# Deux options : -# A) swaybar (intégré, simple, recommandé pour débuter) -# B) waybar (externe, très personnalisable — voir ~/.config/waybar/) -# -# Pour utiliser waybar, commentez le bloc "bar { ... }" ci-dessous -# et décommentez la ligne "exec waybar". - -# --- Option A : swaybar intégré --- -# bar { -# # Position : top | bottom -# position top -# -# # Commande de statut (status_command) -# # swaybar-status : basique | i3status : plus d'infos | i3blocks : scripts -# status_command while date +'%a %d %b %H:%M:%S'; do sleep 1; done -# -# colors { -# # Fond et texte de la barre -# background #1e1e2e -# statusline #cdd6f4 -# separator #45475a -# -# # Couleurs des espaces de travail -# # format : -# focused_workspace #89b4fa #313244 #cdd6f4 -# active_workspace #313244 #313244 #cdd6f4 -# inactive_workspace #1e1e2e #1e1e2e #585b70 -# urgent_workspace #f38ba8 #f38ba8 #1e1e2e -# } -# } - -# --- Option B : waybar (décommentez pour activer) --- -exec_always pkill waybar; waybar - - -# ============================================================================= -# 16. DÉMARRAGE AUTOMATIQUE DES APPLICATIONS -# ============================================================================= -# `exec` : lancé une seule fois au démarrage de Sway -# `exec_always` : lancé aussi à chaque rechargement de la configuration - -exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway -exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP - -# config écrans -exec_always pkill kanshi; kanshi -# sync cloud boulot -exec nextcloud -# Notifications -exec mako - -# Gestionnaire d'authentification (nécessaire pour certaines apps graphiques) -exec /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 -exec gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 - -# Gestionnaire de réseau (barre système) -exec nm-applet --indicator - -# Presse-papier persistant (optionnel — nécessite wl-paste) -exec wl-paste --watch cliphist store - -# Démarrer des apps au lancement (décommentez selon vos besoins) : -exec firefox -exec mattermost-desktop - - -# ============================================================================= -# FIN DE LA CONFIGURATION -# ============================================================================= -# Pour tester les changements : Super + Maj + C (recharge la config) -# Manuel complet : man 5 sway -# Dépôt officiel : https://github.com/swaywm/sway +# no x11 +#xwayland disable +# preload x11 +xwayland force diff --git a/.config/sway/config.d/00-vars.conf b/.config/sway/config.d/00-vars.conf new file mode 100644 index 0000000..6750119 --- /dev/null +++ b/.config/sway/config.d/00-vars.conf @@ -0,0 +1,43 @@ +# sway # variables +# used on all other sway config files + +# modifiers: Alt & Super +set $mod Mod1 +set $mad Mod4 + +# direction vim like +set $left h +set $down j +set $up k +set $right l + +# custom workspace names +set $ws1 "1:" +set $ws2 "2:" +set $ws3 "3:" +set $ws4 "4:" +set $ws5 "5:" +set $ws6 "6:" +set $ws7 "7:" +set $ws8 "8:" +set $ws9 "9:" +set $ws10 "10:" +set $ws11 "11:" +set $ws12 "12:" + +# default apps +set $term "footclient" +set $browser "export MOZ_ENABLE_WAYLAND=1 && firefox" +set $mailer "export MOZ_ENABLE_WAYLAND=1 && thunderbird" +set $p2p "transmission-gtk" +set $player "$term --title=player --app-id=player mocp" +set $mixer "$term -W 80x25 --title=mixer --app-id=mixer alsamixer" +set $infosbox "xterm -g 110x30 -e 'neowofetch;$SHELL'" +set $infosystem "foot -W 140x40 --title Infos-System btop" + +# menu by rofi +set $menup "popmenu 0" +set $menud "rofi -modi 'run,drun,ssh' -show run -sidebar-mode" + +# nice locker +set $locker "nakedquit lock" diff --git a/.config/sway/config.d/01-outputs.conf b/.config/sway/config.d/01-outputs.conf new file mode 100644 index 0000000..53ed3bf --- /dev/null +++ b/.config/sway/config.d/01-outputs.conf @@ -0,0 +1,7 @@ +# sway # outputs + +### Output configuration +# You can get the names of your outputs by running: swaymsg -t get_outputs +# Example configuration: +# output HDMI-A-1 resolution 1920x1080 position 1920,0 +# output LVDS-1 resolution 1280x800 position 0,0 diff --git a/.config/sway/config.d/02-inputs.conf b/.config/sway/config.d/02-inputs.conf new file mode 100644 index 0000000..6a8a97f --- /dev/null +++ b/.config/sway/config.d/02-inputs.conf @@ -0,0 +1,27 @@ +# sway # inputs + +### Input configuration +# Example configuration: +# input "2:14:SynPS/2_Synaptics_TouchPad" { +# dwt enabled +# tap enabled +# natural_scroll enabled +# middle_emulation enabled +# } +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +# evdev is an Xorg input driver for Linux's generic event devices, +# including most mice, keyboards, tablets and touchscreens. +input * xkb_rules evdev + +#input "type:keyboard" { +# xkb_layout gb +# xkb_options altwin:menu_win +#} + +# trying auto-detection +exec_always { + 'swaymsg input type:keyboard xkb_layout "$(localectl status | grep "X11 Layout" | sed -e "s/^.*X11 Layout://")"' + 'swaymsg input type:keyboard xkb_variant "$(localectl status | grep "X11 Variant" | sed -e "s/^.*X11 Variant://")"' +} diff --git a/.config/sway/config.d/03-statusbar.conf b/.config/sway/config.d/03-statusbar.conf new file mode 100644 index 0000000..cdb6f5d --- /dev/null +++ b/.config/sway/config.d/03-statusbar.conf @@ -0,0 +1,40 @@ +# sway # statusbar + +# bar with waybar with desktop icons, glyphs and infos +bar { + mode dock + hidden_state hide + swaybar_command waybar +} + +# bar with swaybar with options: [1]command, [2]infobar or [3]i3status +#bar { +# position bottom +# font Hack 9 +# height 22 +# separator_symbol | +# status_padding 0 +# strip_workspace_name yes +# mode dock +# hidden_state hide +# swaybar_command swaybar +# #[1]#status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done +# #[2]#status_command while $HOME/.config/sway/scripts/infosbar; do sleep 2; done +# #[3]#status_command i3status +# colors { +# statusline #d8dee9ff +# background #2e3440d9 +# focused_statusline #d8dee9ff +# focused_background #2e3440d9 +# separator #d8dee9ff +# #bar colors border bground texte +# focused_workspace #5e81acff #5e81acff #d8dee9ff +# active_workspace #5e81acff #5e81acff #d8dee9ff +# inactive_workspace #2e3440d9 #2e3440d9 #d8dee9d9 +# urgent_workspace #bf616aff #bf616aff #d8dee9ff +# } +#} + +# show/hide bar +bindsym $mad+b exec "swaymsg bar mode hide bar-0" +bindsym $mad+Shift+b exec "swaymsg bar mode dock bar-0" diff --git a/.config/sway/config.d/04-autostart.conf b/.config/sway/config.d/04-autostart.conf new file mode 100644 index 0000000..8dc3a2d --- /dev/null +++ b/.config/sway/config.d/04-autostart.conf @@ -0,0 +1,23 @@ +# sway # autostart apps + +# system & user autostart +exec --no-startup-id "dex -e sway -a -s /etc/xdg/autostart/:~/.config/autostart/" +# authentification +exec --no-startup-id "/usr/libexec/polkit-mate-authentication-agent-1" + +# exec on sway start +exec --no-startup-id "xrdb -load ~/.Xresources" +exec --no-startup-id "foot --server" +exec --no-startup-id "sleep 20s; $HOME/.config/sway/scripts/screentemp toggle; pkill -RTMIN+5 waybar" + +# apps on start +exec "sleep 5 && $browser" +#exec "sleep 10 && $mailer" +#exec "sleep 15 && $p2p" + +# launch idle configuration : man swayidle ~ man swaylock +#exec swayidle -w \ +# timeout 300 'nakedquit lock' \ +# timeout 360 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ +# timeout 420 'acpi -b | grep Discharging && systemctl suspend' \ +# before-sleep 'nakedquit lock' diff --git a/.config/sway/config.d/05-scratchpad.conf b/.config/sway/config.d/05-scratchpad.conf new file mode 100644 index 0000000..6e8a384 --- /dev/null +++ b/.config/sway/config.d/05-scratchpad.conf @@ -0,0 +1,16 @@ +# sway # scratchpad + +# Sway has a "scratchpad", which is a bag of holding for windows. +# You can send windows there and get them back later. + +# launch a terminal and move it to scratch at launch +exec --no-startup-id "sleep 10 && $term -t scratch -a scratch -W 130x25" +for_window [app_id="scratch"] floating enable, move absolute position center +for_window [app_id="scratch"] move scratchpad + +# Move the currently focused window to the scratchpad +bindsym $mad+Shift+Return move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym $mad+Return scratchpad show diff --git a/.config/sway/config.d/06-theme.conf b/.config/sway/config.d/06-theme.conf new file mode 100644 index 0000000..34ce480 --- /dev/null +++ b/.config/sway/config.d/06-theme.conf @@ -0,0 +1,34 @@ +# sway # look + +font pango:Hack,forkawesome 9 +workspace_layout tabbed +default_border pixel 3 +default_floating_border pixel 2 +titlebar_border_thickness 1 +hide_edge_borders --i3 smart +smart_borders on +smart_gaps on +gaps inner 5 +focus_follows_mouse no +focus_on_window_activation smart + +# Colors +# class border bground text indicator child_border +client.focused #5E81AC #5E81AC #D8DEE9 #5E81AC #5E81AC +client.focused_inactive #4C566A #2E3440 #D8DEE9 #2E3440 #4C566A +client.unfocused #4C566A #2E3440 #88C0D0 #2E3440 #4C566A +client.urgent #4C566A #BF616A #D8DEE9 #BF616A #BF616A + +# gtk +exec_always $HOME/.config/sway/scripts/import-gsettings + +# hide cursor (ms) +seat * hide_cursor 5000 + +# opacity for inactive windows (0...1) +exec python3 $HOME/.config/sway/scripts/inactive-windows-transparency.py -o 0.95 + +# wallpaper +output * bg /usr/share/backgrounds/nakedeb-logo.jpg fill +exec_always --no-startup-id "$HOME/.config/sway/scripts/wallrdm" +#exec --no-startup-id "while $HOME/.config/sway/scripts/wallrdm; do sleep 180; done" diff --git a/.config/sway/config.d/07-window-rules.conf b/.config/sway/config.d/07-window-rules.conf new file mode 100644 index 0000000..d4d9ab7 --- /dev/null +++ b/.config/sway/config.d/07-window-rules.conf @@ -0,0 +1,66 @@ +# sway # window rules + +# auto floating +for_window [class="XTerm|XCalc|Xmessage|Lxappearance|Sxiv|Nsxiv|Tk"] floating enable, move absolute position center +for_window [app_id="org.keepassxc.KeePassXC|org.gnome.Calculator|engrampa|file-roller|lxappearance|mpv|swayimg*|mixer|pavucontrol"] floating enable, move absolute position center +for_window [title="Infos-System|Infos System"] floating enable, move absolute position center +for_window [window_role="pop-up|bubble|task_dialog|Preferences|About"] floating enable, move absolute position center +for_window [window_type="dialog"] floating enable, move absolute position center + +# no idle on movies +for_window [app_id="mpv"] inhibit_idle focus +for_window [title="VLC"] inhibit_idle focus + +# no transparency for Gimp tools +for_window [class="Gimp"] mark --add no3d + +# special icons on title for special apps +# inspired by https://github.com/iguanajuice/sway-font-awesome +for_window [app_id="foot|footclient"] title_format " %title" +for_window [app_id="file-roller"] title_format " %title" +for_window [app_id="eog|eom|feh|ristretto|xviewer|imv|gthumb|org.inkscape.Inkscape"] title_format " %title" +for_window [app_id="epiphany|org.qutebrowser.qutebrowser|firefox|Firefox-esr"] title_format " %title" +for_window [app_id="thunderbird-*"] title_format " %title" +for_window [app_id="mpv"] title_format " %title" +for_window [app_id="irc"] title_format " %title" +for_window [app_id="libreoffice*"] title_format " %title" +for_window [app_id="gedit|geany|kate|mousepad|xed"] title_format " %title" +for_window [app_id="filezilla"] title_format " %title" +for_window [app_id="transmission-gtk"] title_format " %title" +for_window [app_id="player"] title_format " %title" +for_window [app_id="btop"] title_format " %title" +for_window [title="filer"] title_format " %title" +for_window [class="Unison"] title_format " %title" +for_window [class="Pcmanfm"] title_format " %title" +for_window [class="Sxiv|Nsxiv|Gimp"] title_format " %title" + +# assign clients to specific workspace +# ws1 mail +assign [app_id="thunderbird*"] $ws1 +# ws2 web +assign [app_id="firefox-esr"] $ws2 +assign [class="Firefox-esr|Dillo"] $ws2 +# ws3 irc +assign [app_id="irc|xmpp"] $ws3 +# ws4 edit +assign [app_id="geany|libreoffice*"] $ws4 +# ws5 media +assign [app_id="fr.handbrake.ghb"] $ws5 +assign [class="avidemux3_*|Pitivi|openshot|Flowblade"] $ws5 +# ws6 gfx +assign [app_id="gimp|org.gnome.gThumb|org.inkscape.Inkscape"] $ws6 +# ws7 vbox +assign [class="VirtualBox Manager|VirtualBox Machine|Qemu-system-x86_64"] $ws7 +assign [app_id="qemu"] $ws7 +# ws8 bkp +assign [app_id="filezilla"] $ws8 +assign [app_id="unison*"] $ws8 +# ws9 p2p +assign [app_id="transmission*"] $ws9 +# ws10 top +assign [app_id="btop"] $ws10 +assign [class="Psensor"] $ws10 +# ws11 deb +# ws12 zik +assign [app_id="player"] $ws12 + diff --git a/.config/sway/config.d/08-launchers.conf b/.config/sway/config.d/08-launchers.conf new file mode 100644 index 0000000..cb78777 --- /dev/null +++ b/.config/sway/config.d/08-launchers.conf @@ -0,0 +1,62 @@ +# sway # launchers + +# menus: exec & apps +bindsym $mod+d exec $menud +bindsym $mod+p exec $menup + +# terminal +bindsym $mod+Return exec $term + +# help center +bindsym $mad+F1 exec "nakedhelp" + +# infos system +bindsym $mad+m exec "$term --title=btop --app-id=btop btop" +bindsym $mad+i exec "$infosbox" +bindsym $mad+Shift+i exec "$infosystem" + +# lockscreen +bindsym $mad+l exec "$locker" + +# wall: set or random +bindsym $mod+Ctrl+w exec --no-startup-id "nakedwalls" +bindsym $mad+Ctrl+w exec --no-startup-id "$HOME/.config/sway/scripts/wallrdm" + +# screenshot +bindsym Print exec "grim $HOME/screenshot-$(date +%Y%m%d-%H%M%S).png" + +# apps launchers keybinds +bindsym $mad+r exec "$term --title=filer --app-id=filer lf" +bindsym $mad+Shift+r exec "pcmanfm --no-desktop" +bindsym $mad+e exec "$term --title=vim --app-id=vim vim" +bindsym $mad+Shift+e exec "geany" +bindsym $mad+x exec "foot --title=irc --app-id=irc weechat-curses" +bindsym $mad+Shift+x exec "$mailer" +bindsym $mad+w exec "$browser" +bindsym $mad+Shift+w exec "$browser" + +# audio bindings +bindsym $mad+v exec "$mixer" +bindsym XF86AudioRaiseVolume exec --no-startup-id "amixer -q sset Master 1%+ unmute" +bindsym XF86AudioLowerVolume exec --no-startup-id "amixer -q sset Master 1%- unmute" +bindsym XF86AudioMute exec --no-startup-id "amixer set Master toggle" +bindsym XF86AudioMicMute exec --no-startup-id "amixer set Capture toggle" + +# brightness bindings +bindsym XF86MonBrightnessUp exec --no-startup-id "brightnessctl s 5%+" +bindsym XF86MonBrightnessDown exec --no-startup-id "brightnessctl s 5%-" + +# mocp bindings +bindsym $mad+z exec "$player" +bindsym XF86AudioPrev exec --no-startup-id "mocp --previous" +bindsym XF86AudioPlay exec --no-startup-id "mocp --toggle-pause" +bindsym XF86AudioNext exec --no-startup-id "mocp --next" + +# start search +bindsym $mad+f exec "nakedlocate" + +# cleaner +bindsym $mad+Backspace exec "dotcleaner" + +# screentemp toggle +bindsym $mad+Shift+s exec "$HOME/.config/sway/scripts/screentemp toggle; pkill -RTMIN+5 waybar" diff --git a/.config/sway/config.d/09-controls.conf b/.config/sway/config.d/09-controls.conf new file mode 100644 index 0000000..5df2502 --- /dev/null +++ b/.config/sway/config.d/09-controls.conf @@ -0,0 +1,94 @@ +# sway # controls + +# Basics: + # Kill focused window + bindsym $mod+Shift+q kill + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + floating_modifier $mod normal + # Edit configuration files + bindsym $mod+Shift+c exec "$term lf -command cd $HOME/.config/sway/" + # Reload the configuration file + bindsym $mod+Shift+r reload + +# Moving around: + # Move your focus around vim like + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # Or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # Move the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # Ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right + # window switcher Alt+Tab + bindsym $mod+Tab exec "$HOME/.config/sway/scripts/window-switcher" + +# Workspaces: for french keyboard, see ~/.config/sway/fr + # switch to workspace + bindsym $mad+ampersand workspace $ws1 + bindsym $mad+eacute workspace $ws2 + bindsym $mad+quotedbl workspace $ws3 + bindsym $mad+apostrophe workspace $ws4 + bindsym $mad+parenleft workspace $ws5 + bindsym $mad+minus workspace $ws6 + bindsym $mad+egrave workspace $ws7 + bindsym $mad+underscore workspace $ws8 + bindsym $mad+ccedilla workspace $ws9 + bindsym $mad+agrave workspace $ws10 + bindsym $mad+parenright workspace $ws11 + bindsym $mad+equal workspace $ws12 + + # move focused container to workspace + bindsym $mad+Shift+ampersand move container to workspace $ws1 + bindsym $mad+Shift+eacute move container to workspace $ws2 + bindsym $mad+Shift+quotedbl move container to workspace $ws3 + bindsym $mad+Shift+apostrophe move container to workspace $ws4 + bindsym $mad+Shift+parenleft move container to workspace $ws5 + bindsym $mad+Shift+minus move container to workspace $ws6 + bindsym $mad+Shift+egrave move container to workspace $ws7 + bindsym $mad+Shift+underscore move container to workspace $ws8 + bindsym $mad+Shift+ccedilla move container to workspace $ws9 + bindsym $mad+Shift+agrave move container to workspace $ws10 + bindsym $mad+Shift+parenright move container to workspace $ws11 + bindsym $mad+Shift+equal move container to workspace $ws12 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. + # change workspaces + bindsym $mod+Ctrl+Right workspace next + bindsym Mod4+Right workspace next + bindsym $mod+Ctrl+Left workspace prev + bindsym Mod4+Left workspace prev +# +# Layout stuff: + # You can "split" the current object of your focus + bindsym $mod+b splith + bindsym $mod+v splitv + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+t layout tabbed + bindsym $mod+e layout toggle split + # Make the current focus fullscreen + bindsym $mod+f fullscreen + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + # Move focus to the parent container + bindsym $mod+a focus parent + +# 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" diff --git a/.config/sway/config.d/10-modes.conf b/.config/sway/config.d/10-modes.conf new file mode 100644 index 0000000..0095639 --- /dev/null +++ b/.config/sway/config.d/10-modes.conf @@ -0,0 +1,42 @@ +# sway # modes + +# Resizing containers: +set $mode_resize "Resize(←↑↓→) Gaps(+/-)" +mode --pango_markup $mode_resize { + # resize windows vimlike + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + # with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + # resize window Gaps with +/- + bindsym minus gaps inner current minus 5px + bindsym plus gaps inner current plus 5px + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +# launch resize mode (Alt+r) +bindsym $mod+r mode $mode_resize + +# Audio menu +set $mode_audio "Audio(↑/↓/m) Micro(+/-/n)" +mode --pango_markup $mode_audio { + # volume control + bindsym Up exec --no-startup-id "amixer -q sset Master 1%+ unmute" + bindsym Down exec --no-startup-id "amixer -q sset Master 1%- unmute" + bindsym m exec --no-startup-id "amixer set Master toggle" + # micro control + bindsym minus exec --no-startup-id "amixer -q sset Capture 1%- cap" + bindsym plus exec --no-startup-id "amixer -q sset Capture 1%+ cap" + bindsym n exec --no-startup-id "amixer set Capture toggle" + # Return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +# launch audio mode (Super+s) +bindsym $mad+s mode $mode_audio diff --git a/.config/sway/fr/fr-apple-kbd.conf b/.config/sway/fr/fr-apple-kbd.conf new file mode 100644 index 0000000..a35448a --- /dev/null +++ b/.config/sway/fr/fr-apple-kbd.conf @@ -0,0 +1,30 @@ +# french keyboard ~ workspace section +# usage : replace keybind in ~/.config/sway/config.d/09-controls.conf +# + # switch to workspace + bindsym $mod+ampersand workspace $ws1 + bindsym $mod+eacute workspace $ws2 + bindsym $mod+quotedbl workspace $ws3 + bindsym $mod+apostrophe workspace $ws4 + bindsym $mod+parenleft workspace $ws5 + bindsym $mod+section workspace $ws6 + bindsym $mod+egrave workspace $ws7 + bindsym $mod+exclam workspace $ws8 + bindsym $mod+ccedilla workspace $ws9 + bindsym $mod+agrave workspace $ws10 + bindsym $mod+parenright workspace $ws11 + bindsym $mod+minus workspace $ws12 + + # move focused container to workspace + bindsym $mod+Shift+ampersand move container to workspace $ws1 + bindsym $mod+Shift+eacute move container to workspace $ws2 + bindsym $mod+Shift+quotedbl move container to workspace $ws3 + bindsym $mod+Shift+apostrophe move container to workspace $ws4 + bindsym $mod+Shift+parenleft move container to workspace $ws5 + bindsym $mod+Shift+section move container to workspace $ws6 + bindsym $mod+Shift+egrave move container to workspace $ws7 + bindsym $mod+Shift+exclam move container to workspace $ws8 + bindsym $mod+Shift+ccedilla move container to workspace $ws9 + bindsym $mod+Shift+agrave move container to workspace $ws10 + bindsym $mod+Shift+parenright move container to workspace $ws11 + bindsym $mod+Shift+minus move container to workspace $ws12 diff --git a/.config/sway/fr/fr-bepo-kbd.conf b/.config/sway/fr/fr-bepo-kbd.conf new file mode 100644 index 0000000..e124d29 --- /dev/null +++ b/.config/sway/fr/fr-bepo-kbd.conf @@ -0,0 +1,30 @@ +# french keyboard ~ workspace section +# usage : replace keybind in ~/.config/sway/config.d/09-controls.conf +# + # switch to workspace + bindsym $mod+quotedbl workspace $ws1 + bindsym $mod+guillemotleft workspace $ws2 + bindsym $mod+guillemotright workspace $ws3 + bindsym $mod+parenleft workspace $ws4 + bindsym $mod+parenright workspace $ws5 + bindsym $mod+at workspace $ws6 + bindsym $mod+plus workspace $ws7 + bindsym $mod+minus workspace $ws8 + bindsym $mod+slash workspace $ws9 + bindsym $mod+asterisk workspace $ws10 + bindsym $mod+equal workspace $ws11 + bindsym $mod+percent workspace $ws12 + + # move focused container to workspace + bindsym $mod+Shift+quotedbl move container to workspace $ws1 + bindsym $mod+Shift+guillemotleft move container to workspace $ws2 + bindsym $mod+Shift+guillemotright move container to workspace $ws3 + bindsym $mod+Shift+parenleft move container to workspace $ws4 + bindsym $mod+Shift+parenright move container to workspace $ws5 + bindsym $mod+Shift+at move container to workspace $ws6 + bindsym $mod+Shift+plus move container to workspace $ws7 + bindsym $mod+Shift+minus move container to workspace $ws8 + bindsym $mod+Shift+slash move container to workspace $ws9 + bindsym $mod+Shift+asterisk move container to workspace $ws10 + bindsym $mod+Shift+equal move container to workspace $ws11 + bindsym $mod+Shift+percent move container to workspace $ws12 diff --git a/.config/sway/fr/fr-kbd.conf b/.config/sway/fr/fr-kbd.conf new file mode 100644 index 0000000..d7164c4 --- /dev/null +++ b/.config/sway/fr/fr-kbd.conf @@ -0,0 +1,30 @@ +# french keyboard ~ workspace section +# usage : replace keybind in ~/.config/sway/config.d/09-controls.conf +# + # switch to workspace + bindsym $mod+ampersand workspace $ws1 + bindsym $mod+eacute workspace $ws2 + bindsym $mod+quotedbl workspace $ws3 + bindsym $mod+apostrophe workspace $ws4 + bindsym $mod+parenleft workspace $ws5 + bindsym $mod+minus workspace $ws6 + bindsym $mod+egrave workspace $ws7 + bindsym $mod+underscore workspace $ws8 + bindsym $mod+ccedilla workspace $ws9 + bindsym $mod+agrave workspace $ws10 + bindsym $mod+parenright workspace $ws11 + bindsym $mod+equal workspace $ws12 + + # move focused container to workspace + bindsym $mod+Shift+ampersand move container to workspace $ws1 + bindsym $mod+Shift+eacute move container to workspace $ws2 + bindsym $mod+Shift+quotedbl move container to workspace $ws3 + bindsym $mod+Shift+apostrophe move container to workspace $ws4 + bindsym $mod+Shift+parenleft move container to workspace $ws5 + bindsym $mod+Shift+minus move container to workspace $ws6 + bindsym $mod+Shift+egrave move container to workspace $ws7 + bindsym $mod+Shift+underscore move container to workspace $ws8 + bindsym $mod+Shift+ccedilla move container to workspace $ws9 + bindsym $mod+Shift+agrave move container to workspace $ws10 + bindsym $mod+Shift+parenright move container to workspace $ws11 + bindsym $mod+Shift+equal move container to workspace $ws12 diff --git a/.config/sway/scripts/import-gsettings b/.config/sway/scripts/import-gsettings new file mode 100755 index 0000000..f75d628 --- /dev/null +++ b/.config/sway/scripts/import-gsettings @@ -0,0 +1,27 @@ +#!/bin/sh +# get gtk settings from gtk-3.0 for swaywm +# usage: +# exec_always $HOME/.config/sway/scripts/import-gsettings + +gnome_schema="org.gnome.desktop.interface" + +config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" +if [ ! -f "$config" ]; then + # fallback theme + gtk_theme="Nordic" + icon_theme="Zafiro-Nord-Dark" + cursor_theme="Nordzy-dark-cursor" + font_name="Hack 9" +else + gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')" + icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')" + cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')" + font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')" +fi + +gsettings set "$gnome_schema" gtk-theme "$gtk_theme" +gsettings set "$gnome_schema" icon-theme "$icon_theme" +gsettings set "$gnome_schema" cursor-theme "$cursor_theme" +gsettings set "$gnome_schema" font-name "$font_name" + +exit 0 diff --git a/.config/sway/scripts/inactive-windows-transparency.py b/.config/sway/scripts/inactive-windows-transparency.py new file mode 100755 index 0000000..0c37574 --- /dev/null +++ b/.config/sway/scripts/inactive-windows-transparency.py @@ -0,0 +1,91 @@ +#!/usr/bin/python3 + +# This script requires i3ipc-python package (install it from a system package manager +# or pip). +# It makes inactive windows transparent. Use `transparency_val` variable to control +# transparency strength in range of 0…1 or use the command line argument -o. + +import argparse +import signal +import sys +from functools import partial + +import i3ipc + + +def on_window(args, ipc, event): + global focused_set + + # To get the workspace for a container, we need to have received its + # parents, so fetch the whole tree + tree = ipc.get_tree() + + focused = tree.find_focused() + if focused is None: + return + + focused_workspace = focused.workspace() + + focused.command("opacity " + args.focused) + focused_set.add(focused.id) + + to_remove = set() + for window_id in focused_set: + if window_id == focused.id: + continue + window = tree.find_by_id(window_id) + if window is None: + to_remove.add(window_id) + elif args.global_focus or window.workspace() == focused_workspace: + window.command("opacity " + args.opacity) + to_remove.add(window_id) + + focused_set -= to_remove + +def remove_opacity(ipc, focused_opacity): + for workspace in ipc.get_tree().workspaces(): + for w in workspace: + w.command("opacity " + focused_opacity) + ipc.main_quit() + sys.exit(0) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="This script allows you to set the transparency of unfocused windows in sway." + ) + parser.add_argument( + "--opacity", + "-o", + type=str, + default="0.80", + help="set inactive opacity value in range 0...1", + ) + parser.add_argument( + "--focused", + "-f", + type=str, + default="1.0", + help="set focused opacity value in range 0...1", + ) + parser.add_argument( + "--global-focus", + "-g", + action="store_true", + help="only have one opaque window across all workspaces", + ) + args = parser.parse_args() + + ipc = i3ipc.Connection() + focused_set = set() + + for window in ipc.get_tree(): + if window.focused: + focused_set.add(window.id) + window.command("opacity " + args.focused) + else: + window.command("opacity " + args.opacity) + for sig in [signal.SIGINT, signal.SIGTERM]: + signal.signal(sig, lambda signal, frame: remove_opacity(ipc, args.focused)) + ipc.on("window", partial(on_window, args)) + ipc.main() diff --git a/.config/sway/scripts/infosbar b/.config/sway/scripts/infosbar new file mode 100755 index 0000000..96a6836 --- /dev/null +++ b/.config/sway/scripts/infosbar @@ -0,0 +1,158 @@ +#!/bin/bash +# minimal infos for swaybar + +# active window +wfoc=`swaymsg -t get_tree | jq ".. | select(.type?) | select(.focused==true).name"` +wfocnb=`echo ${#wfoc}` +if [ "$wfocnb" -gt 60 ]; then + wfocus=`echo "${wfoc:0:59}...\""` +else + wfocus="$wfoc" +fi + +# apt updates +updates="$(($(apt list --upgradable 2>/dev/null | wc -l) - 1))" +if [[ ${updates} -gt 0 ]]; then + wapt=" [ ${updates}] " +else + wapt=" " +fi + +# cpu - source: i3block +PREV_TOTAL=0 +PREV_IDLE=0 +cpuFile="/tmp/.cpu" +if [[ -f "${cpuFile}" ]]; then + fileCont=$(cat "${cpuFile}") + PREV_TOTAL=$(echo "${fileCont}" | head -n 1) + PREV_IDLE=$(echo "${fileCont}" | tail -n 1) +fi +CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics. +unset CPU[0] # Discard the "cpu" prefix. +IDLE=${CPU[4]} # Get the idle CPU time. +# Calculate the total CPU time. +TOTAL=0 +for VALUE in "${CPU[@]:0:4}"; do + let "TOTAL=$TOTAL+$VALUE" +done +if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then + # Calculate the CPU usage since we last checked. + let "DIFF_IDLE=$IDLE-$PREV_IDLE" + let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL" + let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10" + wcpu="$(echo "${DIFF_USAGE}%")" +else + wcpu="?" +fi +# Remember the total and idle CPU times for the next check. +echo "${TOTAL}" > "${cpuFile}" +echo "${IDLE}" >> "${cpuFile}" + +# ram +mem_total=`free -m | grep "Mem" | awk '{print $2}'` +mem_used=`free -m | grep "Mem" | awk '{print $3}'` +mem_perc="$(($mem_used*100/$mem_total))" +# disk +hd_used=`df | grep "sda1" | awk '{print $3}'` +hd_total=`df | grep "sda1" | awk '{print $2}'` +hd_perc="$(($hd_used*100/$hd_total))" + +# network +if [ "$(cat /sys/class/net/enp0s25/operstate)" = "up" ] || [ "$(cat /sys/class/net/wls1/operstate)" = "up" ]; then + myip="$(wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g')" + else + myip="" +fi +if [ "$(cat /sys/class/net/enp0s25/operstate)" = "up" ]; then + wnet=" $myip" +elif + [ "$(cat /sys/class/net/wls1/operstate)" = "up" ]; then + wnet=" $myip" +else + wnet="" +fi + +# temp +wtemp=$(sensors | grep CPU | awk '{print $2}' | cut -d'+' -f2) + +# battery +urgent=15 +batt_info=$(acpi -b | grep "Battery ${BATTERY}") +batt_state=$(echo "$batt_info" | grep -wo "Full\|Charging\|Discharging") +batt_time=$(echo "$batt_info" | awk '{print $5}' | cut -c1-5) +batt_perc=$(echo "$batt_info" | grep -o '[0-9]\+%' | tr -d '%') +case $batt_state in + FULL) wbatt="" ;; + Charging) wbatt=" $batt_perc%" ;; + Discharging) + if [ "$batt_perc" -gt 80 ]; then + wbatt=" $batt_perc%" + elif [ "$batt_perc" -gt 50 ]; then + wbatt=" $batt_perc%" + elif [ "$batt_perc" -gt "$urgent" ]; then + wbatt=" $batt_perc%" + else + wbatt=" $batt_time" + fi + ;; + *) wbatt=" $batt_perc%" ;; +esac + +# brightness +level=`cat "/sys/class/backlight/acpi_video0/brightness"` +max=`cat "/sys/class/backlight/acpi_video0/max_brightness"` +wbright="$(( $level * 100 / $max ))" +if [ "$wbright" -gt 70 ]; then + wbrighti="" +elif [ "$wbright" -gt 50 ]; then + wbrighti="" +elif [ "$wbright" -gt 30 ]; then + wbrighti="" +else + wbrighti="" +fi + +# audio +mastervol=$(amixer get Master | tail -n 1) +status=$(echo "${mastervol}" | grep -wo "on") +volume=$(echo "${mastervol}" | awk -F ' ' '{print $5}' | tr -d '[]%') +if [ "$status" == "on" ]; then + if [ $volume -gt 60 ]; then + wvol=" $volume%" + elif [ $volume -gt 30 ]; then + wvol=" $volume%" + else + wvol=" $volume%" + fi +else + wvol="" +fi + +# capture +captvol=$(amixer get Capture | tail -n 1) +captstat=$(echo "${captvol}" | grep -wo "on") +captlev=$(echo "${captvol}" | awk -F ' ' '{print $5}' | tr -d '[]%') +if [ "$captstat" == "on" ]; then + wcap=" $captlev%" +else + wcap="" +fi + +# trash +if [ ! -e $HOME/.local/share/Trash/files ]; then + wtrash="" +else + trashcount="$(ls -U -1 "$HOME/.local/share/Trash/files" | wc -l)" + #wtrash="[ $trashcount] " + if [[ ${trashcount} > 0 ]]; then + wtrash=" [ $trashcount] " + else + wtrash=" " + fi +fi + +# date-time +sw_date=`date +'%Y-%m-%d'` +sw_time=`date +'%I:%M%p'` + +echo "[$wfocus]$wapt[ $wcpu] [ $mem_perc%] [ $hd_perc%] [$wnet] [ $wtemp] [$wbatt] [$wbrighti $wbright%] [$wvol] [$wcap]$wtrash[ $sw_date  $sw_time]" diff --git a/.config/sway/scripts/screentemp b/.config/sway/scripts/screentemp new file mode 100755 index 0000000..bed986a --- /dev/null +++ b/.config/sway/scripts/screentemp @@ -0,0 +1,47 @@ +#!/bin/bash + +# gps - get yours https://arpinux.org/public/arpinux-docs-pdf/gps.pdf +lat="43.21" +long="2.14" +# screen temp 6500~2800 +cmax="6300" +cmin="3200" + +# check and/or toggle screentemp +userlocale=$(echo $LANG | cut -b-2) +case $userlocale in + fr) messageon="coloration d'écran activée" + messageoff="coloration d'écran désactivée" + ;; + *) messageon="screen temp enabled" + messageoff="screen temp disabled" + ;; +esac + +case "$1" in + toggle) + if ! pgrep -x wlsunset > /dev/null 2>&1; then + wlsunset -l $lat -L $long -g 0.8 -T $cmax -t $cmin & + notify-send "$messageon" + else + pkill wlsunset + notify-send "$messageoff" + fi + ;; + check) + if ! pgrep -x wlsunset > /dev/null 2>&1; then + echo '{"text": "", "class": "off", "tooltip": "'$messageoff'"}' + else + echo '{"text": "", "class": "on", "tooltip": "'$messageon'"}' + fi + ;; + *) + if ! pgrep -x wlsunset > /dev/null 2>&1; then + notify-send "$messageoff" + else + notify-send "$messageon" + fi + ;; +esac + +exit 0 diff --git a/.config/sway/scripts/wallrdm b/.config/sway/scripts/wallrdm new file mode 100755 index 0000000..770a884 --- /dev/null +++ b/.config/sway/scripts/wallrdm @@ -0,0 +1,29 @@ +#!/bin/bash +# sources: https://framagit.org/3hg/isotop/-/blob/master/src/files/usr/local/share/isotop/bin/rdmwall +# by prx +#----------------------- +#Set as wallpaper a random picture located in any DIRS path + +if [ -d "$1" ]; then + DIRS="$1" +else + DIRS="/usr/share/backgrounds + $HOME/pics/walls" +fi + +getrdmwall() { +for D in $DIRS; do + find $D -maxdepth 1 \ + -type f \ + -iname "*.jpg" -o \ + -iname "*.png" +done | sort -R | head -n 1 +} + +img="" +while [ ! -f "${img}" ]; do + img="$(getrdmwall)" +done + +swaymsg output "*" bg "$img" fill & +exit 0 diff --git a/.config/sway/scripts/window-switcher b/.config/sway/scripts/window-switcher new file mode 100755 index 0000000..c222ec9 --- /dev/null +++ b/.config/sway/scripts/window-switcher @@ -0,0 +1,9 @@ +#!/bin/bash +# window switcher for sway by rofi + +swaymsg -t get_tree | + jq -r '.nodes[].nodes[] | if .nodes then [recurse(.nodes[])] else [] end + .floating_nodes | .[] | select(.nodes==[]) | ((.id | tostring) + " " + .name)' | + rofi -dmenu -p "window switcher" | { + read -r id name + swaymsg "[con_id=$id]" focus +} diff --git a/.config/swaylock/cloudy_moon.jpg b/.config/swaylock/cloudy_moon.jpg new file mode 100644 index 0000000..cfce927 Binary files /dev/null and b/.config/swaylock/cloudy_moon.jpg differ diff --git a/.config/swaylock/config b/.config/swaylock/config new file mode 100644 index 0000000..246076b --- /dev/null +++ b/.config/swaylock/config @@ -0,0 +1,35 @@ +ignore-empty-password +daemonize +#indicator-idle-visible +image=~/.config/swaylock/cloudy_moon.jpg +scaling=fill +font=Hack +font-size=18 +color=2e3440ff +indicator-radius=100 +indicator-thickness=50 +bs-hl-color=d08770ff +caps-lock-bs-hl-color=d08770ff +key-hl-color=a3be8cd9 +caps-lock-key-hl-color=a3be8cd9 +inside-color=d8dee9cc +inside-caps-lock-color=d8dee9cc +inside-ver-color=81a1c1cc +inside-clear-color=ebcb8bcc +inside-wrong-color=bf616aff +line-color=eceff480 +line-caps-lock-color=eceff480 +line-clear-color=eceff400 +line-caps-lock-color=2e344080 +line-ver-color=2e344000 +line-wrong-color=bf616a00 +ring-color=d8dee980 +ring-ver-color=81a1c1cc +ring-clear-color=d8dee900 +ring-wrong-color=bf616a00 +separator-color=d8dee900 +text-color=2e3440ff +text-clear-color=2e3440ff +text-caps-lock-color=2e3440ff +text-ver-color=2e3440ff +text-wrong-color=eceff4ff diff --git a/.config/waybar/config b/.config/waybar/config new file mode 100644 index 0000000..34745c0 --- /dev/null +++ b/.config/waybar/config @@ -0,0 +1,296 @@ +{ + // + // Design + // + "ipc": true, + "layer": "top", + "position": "bottom", + //"height": 22, + //"width": 1280, + "margin": "0 0 0 0", + "spacing": 2, + "fixed-center": true, + // + // Modules order + // + "modules-left": [ + "custom/popmenu", + "custom/ssh", + "custom/filezilla", + "custom/lftp", + "sway/mode", + "keyboard-state", + "keyboard-state#numlock", + "sway/scratchpad", + //"idle_inhibitor", + "sway/window" + ], + "modules-center": [ + "sway/workspaces", + "custom/update" + ], + "modules-right": [ + "cpu", + "temperature", + "memory", + "disk", + //"disk#disk2", + "network", + "pulseaudio", + "backlight", + "battery", + "custom/wlsunset", + "custom/infosbox", + "custom/infosystem", + "custom/trash", + "clock", + "tray", + "custom/exit" + ], + // + // Modules configuration (alphabetic order) + // + "backlight": { + // "device": "acpi_video1", + "format": "{icon}", + "format-alt": "{icon} {percent}%", + "format-icons": ["", "", "", ""] + }, + "battery": { + "states": { + "good": 80, + "warning": 20, + "critical": 10 + }, + "format": "{icon}", + "format-charging": "", + "format-plugged": "", + "format-alt": "{icon} {capacity}% {time}", + // "format-good": "", // An empty format will hide the module + "format-full": "", + "format-icons": ["", "", "", "", ""] + }, + "clock": { + "timezone": "Europe/Paris", + "format": "{:%I:%M}", + "format-alt": "{:%Y-%m-%d}", + "tooltip-format": "{calendar}", + "calendar": { + "mode" : "month", + "mode-mon-col" : 3, + "weeks-pos" : "none", + "on-scroll" : 0, + "format": { + "months": "{}", + "days": "{}", + "weekdays": "{}", + "today": "{}" + } + }, + "actions": { + "on-click-right": "mode" + } + }, + "cpu": { + "states": { + "critical": 90, + "warning": 80 + }, + "interval": 1, + "format": " {usage}%", + //"format-alt": " {icon0}{icon1} {usage:>2}%", + //"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"], + "on-click-right": "foot btop" + }, + "custom/exit": { + "format": "", + "tooltip": false, + "on-click": "nakedquit" + }, + "custom/infosbox": { + "format": "", + "tooltip": false, + //"on-click": "$HOME/bin/infosbox" + "on-click": "xterm -g 110x28 -e 'neowofetch;$SHELL'" + }, + "custom/infosystem": { + "format": "", + "tooltip": false, + "on-click": "pgrep -x btop && pkill btop || foot -W 140x40 --title Infos-System btop" + }, + "custom/filezilla": { + "format": "{}", + "exec": "echo ''", + "exec-if": "pgrep -x filezilla", + "interval": 30 + }, + "custom/lftp": { + "format": "{}", + "exec": "echo ''", + "exec-if": "pgrep -x lftp", + "interval": 30 + }, + "custom/popmenu": { + "format": "", + "tooltip": false, + "on-click": "popmenu" + }, + "custom/ssh": { + "format": "{}", + "exec": "echo ''", + "exec-if": "pgrep -x ssh", + "interval": 5 + }, + "custom/trash": { + "format": "{}", + "exec": "[ $(trash-list|wc -l) -gt 0 ] && echo \" $(trash-list|wc -l)\" || echo \"\"", + "interval": 10, + "tooltip": false, + "on-click": "dotcleaner" + }, + "custom/update": { + "format": "{}", + "tooltip": false, + "exec": "nakedupdate -p", + "exec-on-event": true, + "on-click": "nakedupdate -m", + "interval": 600 + }, + "custom/wlsunset": { + "exec": "$HOME/.config/sway/scripts/screentemp check", + "return-type": "json", + "exec-on-event": "true", + "interval": "once", + "on-click": "$HOME/.config/sway/scripts/screentemp toggle; pkill -RTMIN+5 waybar", + "signal": 5 + }, + "disk": { + "format": " {percentage_used}%", + "format-alt": " {free} free", + "tooltip-format": " disk usage\nused: {used}\nfree: {free}\nfull: {total}", + "states": { + "warning": 65, + "critical": 90 + }, + "interval": 60 + }, + "disk#disk2": { + "path": "/media/arp/nakedback/", + "format": " {percentage_used}%", + "format-alt": " {free} free", + "tooltip-format": " nakedback usage\nused: {used}\nfree: {free}\nfull: {total}", + "states": { + "warning": 65, + "critical": 90 + }, + "interval": 60 + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "tooltip-format-activated": "idle disabled", + "tooltip-format-deactivated": "idle enabled" + }, + "keyboard-state": { + "numlock": false, + "capslock": true, + "format": "{icon}", + "format-icons": { + "locked": "C", + "unlocked": "" + } + }, + "keyboard-state#numlock": { + "numlock": true, + "capslock": false, + "format": "{icon}", + "format-icons": { + "locked": "N", + "unlocked": "" + } + }, + "memory": { + "format": " {}%", + "format-alt": " {used} used - {avail} free", + "tooltip-format": " mem usage\nused: {used}\nfree: {avail}\nswap: {swapPercentage}%", + "interval": 15, + "states": { + "warning": 65, + "critical": 80 + }, + "on-click-right": "foot btop" + }, + "network": { + // "interface": "wlp2*", // (Optional) To force the use of this interface + "format": "{ifname}", + "format-wifi": " {signalStrength}%", + "format-ethernet": " ", + "format-linked": " noip", + "format-disconnected": " nonet", + "tooltip-format": "{ifname}  {essid}\n {bandwidthUpOctets}\n {bandwidthDownOctets}", + "format-alt": "{ifname}: {ipaddr}", + "on-click-right": "connman-gtk" + }, + "pulseaudio": { + // "scroll-step": 1, // %, can be a float + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": " {volume}%", + "format-source-muted": "", + "tooltip": false, + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "foot --app-id=mixer -W 80x25 alsamixer", + "on-click-right": "pavucontrol" + }, + "sway/mode": { + "format": "{}", + "tooltip": false + }, + "sway/scratchpad": { + "format": "{icon} {count}", + "show-empty": false, + "format-icons": ["", ""], + "tooltip": true, + "tooltip-format": "{app}: {title}" + }, + "sway/window": { + "format": " {}", + "max-length": 50, + "on-click-right": "swaymsg move to scratchpad $1" + }, + "sway/workspaces": { + "disable-scroll": true, + "all-outputs": true, + "format": "{name}" + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 85, + "format-critical": "{icon} {temperatureC}°C", + "format": "{icon}", + "format-alt": "{temperatureC}°C", + "tooltip": true, + "format-icons": ["", "", "", "", ""] + }, + "tray": { + "icon-size": 16, + "show-passive-items": true, + "spacing": 5 + } +} + +// vim: ft=jsonc diff --git a/.config/waybar/style.css b/.config/waybar/style.css new file mode 100644 index 0000000..4ecb404 --- /dev/null +++ b/.config/waybar/style.css @@ -0,0 +1,93 @@ +* { font-family: forkawesome, Hack; font-size: 11px; } +window#waybar { + background-color: #2e3440; + color: #d8dee9; + transition-property: background-color; + transition-duration: .5s; + opacity: 0.85; + border: none; +} +window#waybar.hidden { opacity: 0.2; } +button:hover { background: inherit; } +#workspaces button { padding: 0 5px; background-color: transparent; color: #88c0d0; } +#workspaces button:hover { background-color: #4c566a; color: #d8dee9; } +#workspaces button.focused { background-color: #4c566a; color: #eceff4; } +#workspaces button.urgent { background-color: #bf616a; color: #d8dee9; } +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#custom-popmenu, +#custom-ssh, +#custom-filezilla, +#custom-lftp, +#custom-trash, +#custom-update, +#custom-infosbox, +#custom-infosystem, +#custom-wlsunset, +#tray, +#mode, +#idle_inhibitor, +#scratchpad { padding: 0 5px; background-color: #2e3440; } + +#window, #workspaces { margin: 0 2px; } +#mode { background-color: #d08770; color: #2e3440; } +#custom-popmenu { color: #eceff4; } +#custom-ssh, #custom-filezilla, #custom-lftp { background-color: #bf616a; } +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { margin-left: 0; } +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { margin-right: 0; } +#custom-update { background-color: #bf616a; padding-right: 2px; } +#battery.charging, #battery.plugged, #battery.full { color: #a3be8c; } +@keyframes blink { + to { background-color: #eceff4; color: #2e3440; } +} +#battery.good:not(.charging) { color: #a3be8c; } +#battery.warning:not(.charging) { + color: #bf616a; + background-color: #4c566a; +} +#battery.critical:not(.charging) { + background-color: #bf616a; + color: #d8dee9; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} +label:focus { background-color: #2e3440; } +#cpu { color: #88c0d0; padding-right: 0; } +#cpu.warning { color: #d08770; } +#cpu.critical { color: #bf616a; } +#memory { color: #a3be8c; } +#memory.warning { color: #d08770; } +#memory.critical { color: #bf616a; } +#disk { color: #ebcb8b; } +#disk.warning { color: #d08770; } +#disk.critical { color: #bf616a; } +#backlight { color: #d8dee9; } +#network { color: #81a1c1; } +#network.disconnected { color: #bf616a; } +#pulseaudio { color: #d8dee9; } +#pulseaudio.muted { color: #bf616a; } +#temperature { color: #88c0d0; } +#temperature.critical { color: #bf616a; } +#custom-wlsunset.on { color: #d08770; } +#custom-wlsunset.off { color: #d8dee9; } +#custom-infosbox { color: #88c0d0; } +#custom-infosystem { color: #b48ead; } +#tray { background-color: #4c566a; } +#tray > .passive { -gtk-icon-effect: dim; } +#tray > .needs-attention { -gtk-icon-effect: highlight; background-color: #eb4d4b; } +#idle_inhibitor.activated { background-color: #88c0d0; color: #2e3440; } +#keyboard-state { padding: 0; margin: 0; } +#keyboard-state > label.locked { background-color: #bf616a; padding: 0 5px; } +#scratchpad.empty { background-color: transparent; } diff --git a/scripts/install-nakedsway.sh b/scripts/install-nakedsway.sh new file mode 100755 index 0000000..76f3cfd --- /dev/null +++ b/scripts/install-nakedsway.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -e + +KEYRING="/usr/local/share/keyrings/nakedeb-keyring.gpg" +LIST="/etc/apt/sources.list.d/nakedeb.list" +REPO_URL="https://nakedeb.arpinux.org/repo/debian" + +echo "==> Ajout du keyring nakeDeb" + +sudo mkdir -p /usr/local/share/keyrings + +if [ ! -f "$KEYRING" ]; then + curl -fsSL https://nakedeb.arpinux.org/repo/nakedeb.gpg.key \ + | gpg --dearmor \ + | sudo tee "$KEYRING" > /dev/null + echo "✔ Clé ajoutée" +else + echo "✔ Clé déjà présente" +fi + +echo "==> Détection de la version Debian" +CODENAME=trixie + +echo "==> Ajout du repo" +echo "deb [signed-by=$KEYRING] $REPO_URL $CODENAME main" | sudo tee "$LIST" > /dev/null + +echo "==> Mise à jour APT" +sudo apt update + +echo "==> Installation de nakedsway" +sudo apt install -y nakedsway + +echo "==> Copie config (si absente)" +if [ ! -d "$HOME/.config/sway" ]; then + mkdir -p ~/.config/sway ~/.config/swaylock ~/.config/waybar ~/.config/foot + cp -u -R /etc/skel/.config/sway/* ~/.config/sway/ + cp -u -R /etc/skel/.config/swaylock/* ~/.config/swaylock/ + cp -u -R /etc/skel/.config/waybar/* ~/.config/waybar/ + cp -u -R /etc/skel/.config/foot/* ~/.config/foot/ + echo "✔ Config copiée" +else + echo "✔ Config déjà existante (skip)" +fi + +echo "==> Installation terminée" +echo "Lance avec: sway" diff --git a/scripts/install-sway.sh b/scripts/install-sway.sh deleted file mode 100755 index c43174d..0000000 --- a/scripts/install-sway.sh +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/env bash -# ============================================================================= -# install-sway.sh — Installation de Sway (Wayland) sur Debian 13 -# ============================================================================= -# Usage : -# chmod +x install-sway.sh -# ./install-sway.sh -# -# Ce script installe : -# - sway : gestionnaire de fenêtres en tuiles (Wayland) -# - swaybar : barre de statut (inclus avec sway) -# - swaybg : fond d'écran Wayland -# - swaylock : verrouillage d'écran Wayland -# - swayidle : gestion de la mise en veille -# - waybar : barre de statut avancée (alternative à swaybar) -# - wofi : lanceur d'applications Wayland (remplace rofi/dmenu) -# - foot : terminal léger natif Wayland -# - mako : notifications Wayland -# - wl-clipboard : copier/coller en ligne de commande sous Wayland -# - grim + slurp : capture d'écran Wayland -# - brightnessctl : contrôle de la luminosité -# - playerctl : contrôle multimédia (play/pause/next) -# - kanshi : gestion dynamique des moniteurs (optionnel) -# - polkit-gnome : agent d'authentification graphique -# ============================================================================= - -set -euo pipefail - -# --- Couleurs pour l'affichage --- -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color - -log() { echo -e "${GREEN}[✓]${NC} $*"; } -info() { echo -e "${BLUE}[i]${NC} $*"; } -warn() { echo -e "${YELLOW}[!]${NC} $*"; } -err() { echo -e "${RED}[✗]${NC} $*" >&2; exit 1; } - -# --- Vérification des droits --- -if [[ "$EUID" -eq 0 ]]; then - err "Ne pas lancer ce script en root. Utilisez un utilisateur normal (sudo sera demandé si nécessaire)." -fi - -info "Démarrage de l'installation de Sway sur Debian 13..." -echo "" - -# --- Mise à jour des paquets --- -info "Mise à jour de la liste des paquets..." -sudo apt-get update -qq -log "Liste des paquets mise à jour." - -# --- Installation des paquets principaux --- -info "Installation de Sway et des outils Wayland..." -sudo apt-get install -y \ - sway \ - swaybg \ - swaylock \ - swayidle \ - waybar \ - wofi \ - foot \ - mako-notifier \ - wl-clipboard \ - grim \ - slurp \ - brightnessctl \ - playerctl \ - kanshi \ - policykit-1-gnome \ - xdg-user-dirs \ - xdg-desktop-portal-wlr \ - fonts-font-awesome \ - fonts-noto \ - pulseaudio \ - pavucontrol \ - nwg-displays \ - xdg-desktop-portal-wlr \ - network-manager-gnome - -log "Paquets installés avec succès." - -# --- Création des répertoires de configuration --- -info "Création des répertoires de configuration..." -mkdir -p "$HOME/.config/sway" -mkdir -p "$HOME/.config/waybar" -mkdir -p "$HOME/.config/foot" -mkdir -p "$HOME/.config/mako" -mkdir -p "$HOME/.config/wofi" -mkdir -p "$HOME/.config/kanshi" -log "Répertoires créés." - -# --- Copie du fichier de configuration Sway --- -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -SWAY_CONFIG_SRC="$SCRIPT_DIR/sway-config" -SWAY_CONFIG_DEST="$HOME/.config/sway/config" - -if [[ -f "$SWAY_CONFIG_SRC" ]]; then - if [[ -f "$SWAY_CONFIG_DEST" ]]; then - warn "Un fichier de configuration Sway existe déjà. Sauvegarde dans config.bak" - cp "$SWAY_CONFIG_DEST" "$SWAY_CONFIG_DEST.bak" - fi - cp "$SWAY_CONFIG_SRC" "$SWAY_CONFIG_DEST" - log "Configuration Sway copiée vers $SWAY_CONFIG_DEST" -else - warn "Fichier 'sway-config' introuvable à côté du script. Placez-le dans : $SCRIPT_DIR/" - warn "La configuration par défaut de Sway sera utilisée au premier lancement." -fi - -# --- Configuration minimale de foot (terminal) --- -info "Génération d'une configuration de base pour foot..." -cat > "$HOME/.config/foot/foot.ini" << 'EOF' -# Configuration du terminal Foot -# Documentation : https://codeberg.org/dnkl/foot/src/branch/master/doc/foot.ini.5.scd - -[main] -# Police et taille (modifiez selon vos préférences) -font=monospace:size=11 - -[colors] -# Thème sombre simple -background=1e1e2e -foreground=cdd6f4 -EOF -log "Configuration foot créée." - -# --- Configuration minimale de mako (notifications) --- -info "Génération d'une configuration de base pour mako..." -cat > "$HOME/.config/mako/config" << 'EOF' -# Configuration des notifications Mako -# Documentation : man mako - -# Position des notifications -anchor=top-right -margin=10 - -# Apparence -background-color=#1e1e2edd -text-color=#cdd6f4 -border-color=#89b4fadd -border-radius=8 -border-size=2 - -# Durée d'affichage (en millisecondes) -default-timeout=5000 - -# Police -font=sans 10 -EOF -log "Configuration mako créée." - -# --- Configuration de wofi (lanceur d'apps) --- -info "Génération d'une configuration de base pour wofi..." -cat > "$HOME/.config/wofi/style.css" << 'EOF' -/* Style de Wofi - lanceur d'applications */ -window { - background-color: #1e1e2e; - border: 2px solid #89b4fa; - border-radius: 10px; -} -#input { - background-color: #313244; - color: #cdd6f4; - border: none; - border-radius: 6px; - padding: 8px; - margin: 6px; -} -#outer-box { padding: 6px; } -#entry { padding: 6px; border-radius: 6px; } -#entry:selected { background-color: #45475a; } -#text { color: #cdd6f4; } -EOF -log "Style wofi créé." - -# --- Ajout de l'utilisateur aux groupes nécessaires --- -info "Ajout de l'utilisateur aux groupes video et input (pour luminosité et entrées)..." -sudo usermod -aG video,input "$USER" 2>/dev/null || warn "Impossible d'ajouter aux groupes (peut-être déjà membre)." -log "Groupes configurés." - -# --- Création d'une entrée de session Wayland (si nécessaire) --- -SESSION_FILE="/usr/share/wayland-sessions/sway.desktop" -if [[ ! -f "$SESSION_FILE" ]]; then - info "Création de l'entrée de session Sway pour le gestionnaire de connexion..." - sudo bash -c "cat > $SESSION_FILE" << 'EOF' -[Desktop Entry] -Name=Sway -Comment=Sway - Compositeur Wayland en tuiles (i3-compatible) -Exec=sway -Type=Application -EOF - log "Entrée de session créée." -else - log "Entrée de session Sway déjà présente." -fi - -# --- Récapitulatif --- -echo "" -echo -e "${GREEN}════════════════════════════════════════════════════════${NC}" -echo -e "${GREEN} Installation terminée !${NC}" -echo -e "${GREEN}════════════════════════════════════════════════════════${NC}" -echo "" -echo -e " Prochaine étape :" -echo -e " 1. Assurez-vous que le fichier ${YELLOW}sway-config${NC} est copié dans :" -echo -e " ${BLUE}~/.config/sway/config${NC}" -echo -e " 2. ${YELLOW}Déconnectez-vous${NC} de votre session actuelle." -echo -e " 3. Choisissez ${BLUE}Sway${NC} comme session dans votre gestionnaire de connexion." -echo -e " (ou lancez ${BLUE}sway${NC} depuis un TTY)" -echo "" -echo -e " Raccourcis essentiels (voir le fichier de config pour tout) :" -echo -e " ${BLUE}Super + Entrée${NC} → Terminal (foot)" -echo -e " ${BLUE}Super + Espace${NC} → Lanceur d'apps (wofi)" -echo -e " ${BLUE}Super + Q${NC} → Fermer la fenêtre active" -echo -e " ${BLUE}Super + [1-9]${NC} → Aller à l'espace de travail numéroté" -echo "" -warn "Reconnectez-vous pour que les changements de groupes (video/input) prennent effet." -echo "" diff --git a/scripts/uninstall-nakedsway.sh b/scripts/uninstall-nakedsway.sh new file mode 100755 index 0000000..7bfb618 --- /dev/null +++ b/scripts/uninstall-nakedsway.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -e + +KEYRING="/usr/local/share/keyrings/nakedeb-keyring.gpg" +LIST="/etc/apt/sources.list.d/nakedeb.list" + +echo "==> Suppression de nakedsway" +sudo apt remove --purge -y nakedsway + +echo "==> Suppression des dépendances inutiles" +sudo apt autoremove -y + +echo "==> Suppression du repo nakeDeb" +if [ -f "$LIST" ]; then + sudo rm "$LIST" + echo "✔ Repo supprimé" +else + echo "✔ Repo déjà absent" +fi + +echo "==> Suppression du keyring" +if [ -f "$KEYRING" ]; then + sudo rm "$KEYRING" + echo "✔ Clé supprimée" +else + echo "✔ Clé déjà absente" +fi + +echo "==> Mise à jour APT" +sudo apt update + +echo "==> (Optionnel) Suppression config utilisateur" +read -p "Supprimer ~/.config (ATTENTION) ? [y/N] " confirm + +if [[ "$confirm" == "y" || "$confirm" == "Y" ]]; then + rm -rf "$HOME/.config/sway" + echo "✔ Config sway supprimée" +else + echo "✔ Config conservée" +fi + +echo "==> Désinstallation terminée"