Skip to content

Commit 6cf453a

Browse files
author
Derek
committed
fix: add ai/ to gitignore and fix D-Bus session for ui-mode
- Add ai/ to .gitignore for public repo mode (gitignored, not submodule) - Fix GNOME winlike/maclike tasks to pass DBUS_SESSION_BUS_ADDRESS when running ui-mode script (resolves GitHub issue #1)
1 parent 634f698 commit 6cf453a

4 files changed

Lines changed: 71 additions & 17 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ installers/
5454
local-config/
5555

5656
# AI assistant work files - never commit (local only, public repo)
57+
ai/
5758
STATE.md
5859
CLAUDE.md
5960
TODO.md

TODO.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
# TODO - DFE Developer Environment
22

3-
## Immediate Tasks
4-
5-
### GNOME RDP CPU Usage - Pending Verification
3+
## Completed This Session
64

7-
**Status:** Fix applied, pending VM restart
5+
- [x] Fix `ai/` directory management for public repos
6+
- Keep `.git/` intact for manual updates via `git -C ai pull`
7+
- `/load` uses Glob (no bash approval) to check if `ai/` exists
8+
- Updated: `.gitignore`, `.claude/commands/load.md`
9+
- Also fixed in `/projects/ai`: `attach-public.sh`, `README.md`
810

9-
VM 1000 was configured with `vga: virtio` (2D only) instead of `vga: virtio-gl` (VirGL 3D). Fix applied via `qm set 1000 -vga virtio-gl,memory=256`.
10-
11-
**Next action:** Restart VM 1000 to verify VirGL is active and CPU usage drops.
11+
## Immediate Tasks
1212

13-
**H.264 GPU Encoding Note:** VirGL will help desktop rendering, but H.264 RDP encoding will remain CPU-based until QEMU merges VA-API H.264 patches.
13+
### GitHub Issue #1: UI mode fails with D-Bus error when GNOME running
1414

15-
### VSCode Wayland Fullscreen Bug - Monitor Upstream
15+
**Status:** Fix implemented, pending test
1616

17-
**Status:** Documented, upstream bug, cannot fix locally
17+
**Root cause:** `ansible.builtin.command` with `become_user` doesn't inherit the user's D-Bus session environment. The `ui-mode` script uses `dconf` which requires `DBUS_SESSION_BUS_ADDRESS`.
1818

19-
**Full Documentation:** [docs/VSCODE-WAYLAND.md](docs/VSCODE-WAYLAND.md)
19+
**Fix:** Get `DBUS_SESSION_BUS_ADDRESS` from gnome-shell's /proc environment and pass it to the command.
2020

21-
**Future Work:**
21+
**Files modified:**
2222

23-
- [ ] Monitor GNOME 49/50 for Mutter fixes
24-
- [ ] Test upcoming Electron versions
25-
- [ ] Investigate gnome-shell extensions that may help
26-
- [ ] File consolidated bug on GNOME GitLab if not tracked
23+
- `ansible/roles/dfe_developer/tasks/gnome_winlike.yml`
24+
- `ansible/roles/dfe_developer/tasks/gnome_maclike.yml`
2725

2826
## Platform Support
2927

ansible/roles/dfe_developer/tasks/gnome_maclike.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,52 @@
2020
# APPLY MACLIKE MODE VIA UI-MODE UTILITY
2121
# ============================================================================
2222

23+
- name: Check if GNOME Shell is running
24+
ansible.builtin.shell: pgrep -x gnome-shell
25+
register: gnome_shell_running
26+
changed_when: false
27+
failed_when: false
28+
become: true
29+
become_user: "{{ dfe_actual_user }}"
30+
31+
- name: Get DBUS_SESSION_BUS_ADDRESS from running GNOME session
32+
ansible.builtin.shell: |
33+
gnome_pid=$(pgrep -u {{ dfe_actual_user }} -x gnome-shell | head -1)
34+
if [ -n "$gnome_pid" ]; then
35+
grep -z DBUS_SESSION_BUS_ADDRESS /proc/$gnome_pid/environ 2>/dev/null | tr '\0' '\n'
36+
fi
37+
register: dbus_addr_result
38+
changed_when: false
39+
failed_when: false
40+
when: gnome_shell_running.rc == 0
41+
2342
- name: Apply macOS-like UI mode
2443
ansible.builtin.command:
2544
cmd: /usr/local/sbin/ui-mode maclike
2645
become: true
2746
become_user: "{{ dfe_actual_user }}"
47+
environment:
48+
DBUS_SESSION_BUS_ADDRESS: "{{ dbus_addr_result.stdout | regex_replace('^DBUS_SESSION_BUS_ADDRESS=', '') }}"
2849
changed_when: true
50+
when:
51+
- gnome_shell_running.rc == 0
52+
- dbus_addr_result.stdout | default('') | length > 0
53+
54+
- name: Save UI mode preference for first login (when GNOME not running)
55+
ansible.builtin.file:
56+
path: "{{ dfe_user_home }}/.config/dfe"
57+
state: directory
58+
owner: "{{ dfe_actual_user }}"
59+
mode: '0755'
60+
when: gnome_shell_running.rc != 0
61+
62+
- name: Write UI mode preference file for first login
63+
ansible.builtin.copy:
64+
dest: "{{ dfe_user_home }}/.config/dfe/ui-mode"
65+
content: "maclike"
66+
owner: "{{ dfe_actual_user }}"
67+
mode: '0644'
68+
when: gnome_shell_running.rc != 0
2969

3070
# ============================================================================
3171
# WALLPAPER DEPLOYMENT (system-wide, safe from apt/dnf updates)

ansible/roles/dfe_developer/tasks/gnome_winlike.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,28 @@
2626
become: true
2727
become_user: "{{ dfe_actual_user }}"
2828

29+
- name: Get DBUS_SESSION_BUS_ADDRESS from running GNOME session
30+
ansible.builtin.shell: |
31+
gnome_pid=$(pgrep -u {{ dfe_actual_user }} -x gnome-shell | head -1)
32+
if [ -n "$gnome_pid" ]; then
33+
grep -z DBUS_SESSION_BUS_ADDRESS /proc/$gnome_pid/environ 2>/dev/null | tr '\0' '\n'
34+
fi
35+
register: dbus_addr_result
36+
changed_when: false
37+
failed_when: false
38+
when: gnome_shell_running.rc == 0
39+
2940
- name: Apply Windows-like UI mode
3041
ansible.builtin.command:
3142
cmd: /usr/local/sbin/ui-mode winlike
3243
become: true
3344
become_user: "{{ dfe_actual_user }}"
45+
environment:
46+
DBUS_SESSION_BUS_ADDRESS: "{{ dbus_addr_result.stdout | regex_replace('^DBUS_SESSION_BUS_ADDRESS=', '') }}"
3447
changed_when: true
35-
when: gnome_shell_running.rc == 0
48+
when:
49+
- gnome_shell_running.rc == 0
50+
- dbus_addr_result.stdout | default('') | length > 0
3651

3752
- name: Save UI mode preference for first login (when GNOME not running)
3853
ansible.builtin.file:

0 commit comments

Comments
 (0)