#!/bin/bash set -e # 1) Obtener client_path client_path=$( gdbus call --system \ --dest org.freedesktop.GeoClue2 \ --object-path /org/freedesktop/GeoClue2/Manager \ --method org.freedesktop.GeoClue2.Manager.GetClient | cut -d "'" -f2 ) echo "Cliente asignado a: $client_path" # 2) Asignar DesktopId y precisión gdbus call --system \ --dest org.freedesktop.GeoClue2 \ --object-path "$client_path" \ --method org.freedesktop.DBus.Properties.Set \ org.freedesktop.GeoClue2.Client DesktopId "<'location-tester.desktop'>" gdbus call --system \ --dest org.freedesktop.GeoClue2 \ --object-path "$client_path" \ --method org.freedesktop.DBus.Properties.Set \ org.freedesktop.GeoClue2.Client RequestedAccuracyLevel "<3>" # 3) Iniciar el cliente gdbus call --system \ --dest org.freedesktop.GeoClue2 \ --object-path "$client_path" \ --method org.freedesktop.GeoClue2.Client.Start # 4) Espera ubicación sleep 2 # 5) Obtener ruta de Location location_path=$( gdbus call --system \ --dest org.freedesktop.GeoClue2 \ --object-path "$client_path" \ --method org.freedesktop.DBus.Properties.Get \ org.freedesktop.GeoClue2.Client Location | grep -o '/org/freedesktop/GeoClue2/Location/[0-9]*' ) echo "Location path: $location_path" # 6) Mostrar propiedades (Latitude, Longitude, etc.) gdbus introspect --system \ --dest org.freedesktop.GeoClue2 \ --object-path "$location_path"