Skip to content

Commit 0dd44e9

Browse files
Improve AppIndicator and D-Bus validation in desktop setup
Adds a debug script for AppIndicator environment, enhances D-Bus session detection and validation in setup and post-CI scripts, and improves AppIndicator service checks. These changes provide better diagnostics and reliability for virtual desktop environments using MATE/XFCE.
1 parent 5399878 commit 0dd44e9

File tree

4 files changed

+145
-4
lines changed

4 files changed

+145
-4
lines changed

actions/setup_virtual_desktop/action.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,18 @@ runs:
133133
echo "::group::Test AppIndicator"
134134
# Test ayatana-appindicator (only on MATE/XFCE which have indicator support)
135135
if [[ "$ENVIRONMENT" == "mate" ]] || [[ "$ENVIRONMENT" == "xfce" ]]; then
136-
python3 "${GITHUB_ACTION_PATH}/test_appindicator.py" &
137-
APPIND_PID=$!
138-
${SCREENSHOT_PATH} --output-path=05-appindicator.png --delay=1000
139-
kill $APPIND_PID 2>/dev/null || true
136+
echo "::group::AppIndicator Debug Info"
137+
bash "${GITHUB_ACTION_PATH}/debug_indicators.sh"
138+
echo "::endgroup::"
139+
140+
echo "Testing AppIndicator support..."
141+
if python3 "${GITHUB_ACTION_PATH}/test_appindicator.py"; then
142+
echo "AppIndicator test completed successfully"
143+
${SCREENSHOT_PATH} --output-path=05-appindicator.png --delay=500
144+
else
145+
echo "::error::AppIndicator test failed"
146+
exit 1
147+
fi
140148
else
141149
echo "Skipping AppIndicator test (not supported on ${ENVIRONMENT})"
142150
fi
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# Debug script to check AppIndicator environment
3+
4+
echo "=== AppIndicator Debug Information ==="
5+
echo ""
6+
7+
echo "1. Checking if indicator service is running:"
8+
ps aux | grep -E "(ayatana-indicator|indicator-application)" | grep -v grep || echo " No indicator service found"
9+
echo ""
10+
11+
echo "2. Checking D-Bus session:"
12+
echo " DBUS_SESSION_BUS_ADDRESS: ${DBUS_SESSION_BUS_ADDRESS:-NOT SET}"
13+
echo ""
14+
15+
echo "3. Checking if indicator service is on D-Bus:"
16+
dbus-send --session --dest=org.freedesktop.DBus --print-reply /org/freedesktop/DBus \
17+
org.freedesktop.DBus.ListNames 2>/dev/null | grep -i indicator || echo " No indicator service registered on D-Bus"
18+
echo ""
19+
20+
echo "4. Checking GObject Introspection typelibs:"
21+
if [ -f "/usr/lib/x86_64-linux-gnu/girepository-1.0/AyatanaAppIndicator3-0.1.typelib" ]; then
22+
echo " ✓ AyatanaAppIndicator3-0.1.typelib found"
23+
else
24+
echo " ✗ AyatanaAppIndicator3-0.1.typelib NOT found"
25+
fi
26+
echo ""
27+
28+
echo "5. Checking panel processes:"
29+
ps aux | grep -E "(mate-panel|xfce4-panel)" | grep -v grep || echo " No panel found"
30+
echo ""
31+
32+
echo "6. Checking DISPLAY:"
33+
echo " DISPLAY: ${DISPLAY:-NOT SET}"
34+
echo ""
35+
36+
echo "7. Testing simple indicator registration:"
37+
python3 -c "
38+
import gi
39+
gi.require_version('AyatanaAppIndicator3', '0.1')
40+
from gi.repository import AyatanaAppIndicator3 as AppIndicator
41+
print(' ✓ Python can import AyatanaAppIndicator3')
42+
indicator = AppIndicator.Indicator.new('test', 'mail-message-new', AppIndicator.IndicatorCategory.APPLICATION_STATUS)
43+
print(' ✓ Created indicator object')
44+
indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE)
45+
print(' ✓ Set indicator status to ACTIVE')
46+
" 2>&1 || echo " ✗ Failed to create indicator"
47+
48+
echo ""
49+
echo "=== End Debug Information ==="

actions/setup_virtual_desktop/post-ci.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ fi
1212

1313
echo "✓ DISPLAY is set to: $DISPLAY"
1414

15+
# Check D-Bus session address is set
16+
echo ""
17+
echo "Checking D-Bus session..."
18+
if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then
19+
echo "✗ DBUS_SESSION_BUS_ADDRESS is not set"
20+
exit 1
21+
fi
22+
23+
echo "✓ DBUS_SESSION_BUS_ADDRESS is set to: $DBUS_SESSION_BUS_ADDRESS"
24+
25+
# Verify D-Bus is working
26+
if dbus-send --session --dest=org.freedesktop.DBus --print-reply /org/freedesktop/DBus \
27+
org.freedesktop.DBus.ListNames >/dev/null 2>&1; then
28+
echo "✓ D-Bus session is responding"
29+
else
30+
echo "✗ D-Bus session is not responding"
31+
exit 1
32+
fi
33+
1534
# Check if X server is responding
1635
if xdpyinfo > /dev/null 2>&1; then
1736
echo "✓ X server is responding"
@@ -77,5 +96,24 @@ if [[ "$PANEL_FOUND" = false ]]; then
7796
exit 1
7897
fi
7998

99+
# Check for AppIndicator service (MATE/XFCE only)
100+
echo ""
101+
echo "Checking for AppIndicator service..."
102+
if pgrep -f "ayatana-indicator-application-service" > /dev/null 2>&1; then
103+
echo "✓ AppIndicator service is running"
104+
105+
# Verify it's registered on D-Bus
106+
if dbus-send --session --dest=org.freedesktop.DBus --print-reply /org/freedesktop/DBus \
107+
org.freedesktop.DBus.ListNames 2>/dev/null | grep -q "com.canonical.indicator.application"; then
108+
echo "✓ AppIndicator service is registered on D-Bus"
109+
else
110+
echo "⚠ AppIndicator service running but not registered on D-Bus"
111+
fi
112+
elif pgrep -x "mate-session" > /dev/null 2>&1 || pgrep -x "xfce4-session" > /dev/null 2>&1; then
113+
echo "⚠ MATE/XFCE session detected but AppIndicator service not running"
114+
else
115+
echo "ℹ AppIndicator service not expected (not MATE/XFCE environment)"
116+
fi
117+
80118
echo ""
81119
echo "Virtual desktop validation successful!"

actions/setup_virtual_desktop/setup_desktop.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,52 @@ echo -e "${BLUE}Starting D-Bus session...${RESET}"
207207
if ! pgrep -x "dbus-daemon" > /dev/null; then
208208
eval "$(dbus-launch --sh-syntax)"
209209
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> "$GITHUB_ENV"
210+
echo -e "${GREEN}✓ D-Bus session started${RESET}"
211+
else
212+
echo -e "${YELLOW}⚠ D-Bus daemon already running${RESET}"
213+
fi
214+
215+
# Ensure DBUS_SESSION_BUS_ADDRESS is set and exported
216+
if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then
217+
echo -e "${YELLOW}⚠ DBUS_SESSION_BUS_ADDRESS not set, attempting to detect...${RESET}"
218+
219+
# Find the dbus-daemon process for the current user
220+
DBUS_PID=$(pgrep -u "$(id -u)" dbus-daemon | head -n 1)
221+
222+
if [[ -n "$DBUS_PID" ]]; then
223+
echo -e "${CYAN}Found dbus-daemon PID: ${DBUS_PID}${RESET}"
224+
225+
# Extract DBUS_SESSION_BUS_ADDRESS from the process environment
226+
# Disable pipefail temporarily for this command since grep may not find the variable
227+
set +e
228+
DBUS_ADDR=$(grep -z DBUS_SESSION_BUS_ADDRESS "/proc/$DBUS_PID/environ" 2>/dev/null | tr '\0' '\n' | cut -d= -f2-)
229+
GREP_EXIT=$?
230+
set -e
231+
232+
if [[ -n "$DBUS_ADDR" ]]; then
233+
echo -e "${GREEN}✓ Detected D-Bus session address${RESET}"
234+
export DBUS_SESSION_BUS_ADDRESS="$DBUS_ADDR"
235+
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_ADDR" >> "$GITHUB_ENV"
236+
else
237+
echo -e "${YELLOW}Debug: grep exit code: ${GREP_EXIT}${RESET}"
238+
echo -e "${YELLOW}Debug: Checking /proc/$DBUS_PID/environ exists...${RESET}"
239+
if [[ -f "/proc/$DBUS_PID/environ" ]]; then
240+
echo -e "${YELLOW}Debug: File exists, dumping environment variables:${RESET}"
241+
cat "/proc/$DBUS_PID/environ" | tr '\0' '\n' | grep -i dbus || true
242+
else
243+
echo -e "${RED}Error: /proc/$DBUS_PID/environ not found${RESET}" >&2
244+
fi
245+
echo -e "${RED}Error: Could not extract D-Bus address from process environment${RESET}" >&2
246+
exit 1
247+
fi
248+
else
249+
echo -e "${RED}Error: dbus-daemon process not found${RESET}" >&2
250+
exit 1
251+
fi
252+
else
253+
echo -e "${GREEN}✓ DBUS_SESSION_BUS_ADDRESS is set${RESET}"
254+
# Ensure it's in GITHUB_ENV even if already set in current shell
255+
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> "$GITHUB_ENV"
210256
fi
211257

212258
# Start AT-SPI bus to fix accessibility warnings

0 commit comments

Comments
 (0)