Procházet zdrojové kódy

dev: automated commit - 2025-06-24 19:45:47

Mariano Z. před 7 měsíci
rodič
revize
a9a990ffed

+ 1 - 1
kitty/.config/kitty/kitty.conf

@@ -30,7 +30,7 @@ window_padding_width 0
 window_margin_width 2
 hide_window_decorations no
 
-background_opacity 0.90
+background_opacity 0.989
 background_blur 1
 
 # advance

+ 7 - 4
sway/.config/sway/config

@@ -1,3 +1,5 @@
+include /etc/sway/config.d/*
+
 # Sway Window Manager Configuration
 # ================================
 
@@ -93,6 +95,11 @@ bindsym {
     $mod+Shift+e exec --no-startup-id wlogout
 }
 
+bindgesture swipe:right focus right
+bindgesture swipe:left focus left
+bindgesture swipe:up workspace next
+bindgesture swipe:down workspace prev
+
 # Application Launchers
 bindsym {
     $mod+Return   exec $term
@@ -299,10 +306,6 @@ exec {
     ~/.bin/randwall
     ~/.bin/waybar.sh
 
-    # Environment and system integration
-    dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY SWAYSOCK XDG_SESSION_DESKTOP=sway
-    systemctl --user import-environment
-
     # System services - lxsession includes polkit
     lxsession
 

+ 8 - 0
waybar/.config/waybar/config.jsonc

@@ -73,6 +73,7 @@
       "custom/playerlabel"
     ],
     "modules-right": [
+      "custom/microphone",
       "custom/randwall",
       "pulseaudio",
       "custom/vpn",
@@ -91,6 +92,13 @@
       "interval": 1,
       "exec": "/home/forbi/.local/bin/vpn",
       "on-click": "/home/forbi/.local/bin/vpn toggle"
+    },
+    "custom/microphone": {
+      "format": "{}",
+      "return-type": "json",
+      "exec": "~/.config/waybar/scripts/mic-status.sh --monitor",
+      "restart-interval": 1,
+      "on-click": "pavucontrol -t 4"
     }
   }
 ]

+ 93 - 0
waybar/.config/waybar/scripts/mic-status.sh

@@ -0,0 +1,93 @@
+#!/bin/bash
+SOURCE="alsa_input.pci-0000_c1_00.6.analog-stereo"
+HEADSET_PORT="analog-input-headset-mic"
+INTERNAL_PORT="analog-input-internal-mic"
+WAYBAR_SIGNAL_FILE="/tmp/waybar-mic-update"
+
+# Función para log con timestamp
+log() {
+	echo "[$(date '+%H:%M:%S')] $1"
+}
+
+# Función para notificar a waybar
+notify_waybar() {
+	local port="$1"
+	local status_file="$HOME/.cache/mic-status"
+
+	case "$port" in
+	"$HEADSET_PORT")
+		echo '{"text":"🎧","tooltip":"Headset microphone","class":"headset"}' >"$status_file"
+		;;
+	"$INTERNAL_PORT")
+		echo '{"text":"💻","tooltip":"Internal microphone","class":"internal"}' >"$status_file"
+		;;
+	*)
+		echo '{"text":"🎤","tooltip":"Unknown: '"$port"'","class":"unknown"}' >"$status_file"
+		;;
+	esac
+
+	# Señal a waybar para actualizar (si está usando el método de archivo)
+	touch "$WAYBAR_SIGNAL_FILE"
+}
+
+# Función para cambiar puerto con verificación
+switch_port() {
+	local port="$1"
+	local name="$2"
+
+	if pactl set-source-port "$SOURCE" "$port" 2>/dev/null; then
+		log "✓ Switched to $name"
+		notify_waybar "$port"
+	else
+		log "✗ Failed to switch to $name"
+	fi
+}
+
+# Verificar que pactl existe
+if ! command -v pactl &>/dev/null; then
+	log "✗ pactl not found. Install pulseaudio-utils"
+	exit 1
+fi
+
+log "Starting microphone auto-switcher..."
+log "Monitoring: $SOURCE"
+
+# Procesar estado inicial
+source_info=$(pactl list sources | grep -A1000 "$SOURCE" 2>/dev/null)
+if [ -z "$source_info" ]; then
+	log "✗ Source not found: $SOURCE"
+	exit 1
+fi
+
+# Estado inicial para waybar
+active_port=$(echo "$source_info" | grep "Active Port" | awk '{print $3}')
+notify_waybar "$active_port"
+
+# Loop principal
+pactl subscribe 2>/dev/null | while read -r line; do
+	if echo "$line" | grep -q "Event 'change' on source"; then
+		# Obtener info actual
+		source_info=$(pactl list sources | grep -A1000 "$SOURCE" 2>/dev/null)
+		[ -z "$source_info" ] && continue
+
+		active_port=$(echo "$source_info" | grep "Active Port" | awk '{print $3}')
+		headset_status=$(echo "$source_info" | grep "$HEADSET_PORT")
+
+		log "Event detected - Active: $active_port"
+
+		# Lógica de switching simplificada
+		if echo "$headset_status" | grep -q "availability unknown"; then
+			# Headset conectado
+			if [[ "$active_port" != "$HEADSET_PORT" ]]; then
+				switch_port "$HEADSET_PORT" "headset mic"
+			fi
+		elif echo "$headset_status" | grep -q "not available"; then
+			# Headset desconectado
+			if [[ "$active_port" != "$INTERNAL_PORT" ]]; then
+				switch_port "$INTERNAL_PORT" "internal mic"
+			fi
+		fi
+	fi
+done
+
+log "✗ pactl subscribe ended unexpectedly"

+ 20 - 6
waybar/.config/waybar/style.css

@@ -9,7 +9,7 @@
 
 /* Window Styles */
 window#waybar {
-    background: rgba(0, 0, 0, 0.7);
+    background: rgba(0, 0, 0, 0.8);
     border-bottom: 1px solid #282828;
     border-radius: 10px;
     color: #f4d9e1;
@@ -21,15 +21,12 @@ tooltip {
 }
 
 /* Workspace Styles */
-#workspaces {
-    padding: 0 0 0 5px;
-}
 
 #workspaces button {
     color: #fff;
     border-radius: 10px;
-    padding: 3px;
-    margin: 0 4px;
+    padding: 0px;
+    margin: 4px 4px;
 }
 
 #workspaces button.urgent {
@@ -151,3 +148,20 @@ tooltip {
         opacity: 1;
     }
 }
+
+#custom-microphone {
+    padding: 0 10px;
+    margin: 0 5px;
+}
+
+#custom-microphone.headset {
+    color: #a6e3a1;
+}
+
+#custom-microphone.internal {
+    color: #f9e2af;
+}
+
+#custom-microphone.unknown {
+    color: #f38ba8;
+}