diff --git a/ansible/inventory/group_vars/desktop.yml b/ansible/inventory/group_vars/desktop.yml index 6adf601..28596b4 100644 --- a/ansible/inventory/group_vars/desktop.yml +++ b/ansible/inventory/group_vars/desktop.yml @@ -3,6 +3,7 @@ desktop_manage_icloud_keyring: false desktop_protonmail_bridge_cert_path: ~/.var/app/ch.protonmail.protonmail-bridge/config/protonmail/bridge-v3/cert.pem profile_packages: + - emptty - i3 - i3blocks - i3blocks-blocklets diff --git a/ansible/inventory/group_vars/void.yml b/ansible/inventory/group_vars/void.yml index 8855cbd..340d4ec 100644 --- a/ansible/inventory/group_vars/void.yml +++ b/ansible/inventory/group_vars/void.yml @@ -28,6 +28,7 @@ void_packages_base: enabled_services: - dbus - elogind + - emptty - NetworkManager - ufw - bluetoothd diff --git a/ansible/roles/profile_desktop_i3/files/i3.desktop b/ansible/roles/profile_desktop_i3/files/i3.desktop new file mode 100644 index 0000000..345b18f --- /dev/null +++ b/ansible/roles/profile_desktop_i3/files/i3.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=i3 +Comment=improved dynamic tiling window manager +Exec=i3 +TryExec=i3 +Type=Application +DesktopNames=i3 +Keywords=tiling;wm;windowmanager;window;manager; diff --git a/ansible/roles/profile_desktop_i3/handlers/main.yml b/ansible/roles/profile_desktop_i3/handlers/main.yml new file mode 100644 index 0000000..c5e610b --- /dev/null +++ b/ansible/roles/profile_desktop_i3/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart emptty + ansible.builtin.command: sv restart emptty + changed_when: true + when: not ansible_check_mode diff --git a/ansible/roles/profile_desktop_i3/tasks/main.yml b/ansible/roles/profile_desktop_i3/tasks/main.yml index 65ec639..eaf9a57 100644 --- a/ansible/roles/profile_desktop_i3/tasks/main.yml +++ b/ansible/roles/profile_desktop_i3/tasks/main.yml @@ -96,6 +96,46 @@ line: "password optional pam_gnome_keyring.so use_authtok" state: present +- name: Ensure emptty log directory exists + tags: [packages, services, emptty] + ansible.builtin.file: + path: /var/log/emptty + state: directory + owner: root + group: root + mode: "0755" + +- name: Ensure emptty session directories exist + tags: [packages, services, emptty] + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: root + group: root + mode: "0755" + loop: + - /etc/emptty/xsessions + - /etc/emptty/wayland-sessions + +- name: Install allowed emptty X11 sessions + tags: [packages, services, emptty] + ansible.builtin.copy: + src: i3.desktop + dest: /etc/emptty/xsessions/i3.desktop + owner: root + group: root + mode: "0644" + +- name: Configure emptty + tags: [packages, services, emptty] + ansible.builtin.template: + src: emptty-conf.j2 + dest: /etc/emptty/conf + owner: root + group: root + mode: "0644" + notify: Restart emptty + - name: Copy desktop dotfiles tags: [dotfiles, dotfiles:desktop] ansible.builtin.copy: diff --git a/ansible/roles/profile_desktop_i3/templates/emptty-conf.j2 b/ansible/roles/profile_desktop_i3/templates/emptty-conf.j2 new file mode 100644 index 0000000..51709df --- /dev/null +++ b/ansible/roles/profile_desktop_i3/templates/emptty-conf.j2 @@ -0,0 +1,12 @@ +TTY_NUMBER=7 +SWITCH_TTY=true +DEFAULT_ENV=xorg +DBUS_LAUNCH=false +XINITRC_LAUNCH=true +XORG_SESSIONS_PATH=/etc/emptty/xsessions +WAYLAND_SESSIONS_PATH=/etc/emptty/wayland-sessions +VERTICAL_SELECTION=true +IDENTIFY_ENVS=true +SELECT_LAST_USER=global +LOGGING=rotate +SESSION_ERROR_LOGGING=disabled diff --git a/dotfiles/common/.bash_profile b/dotfiles/common/.bash_profile index 6223493..6f08613 100644 --- a/dotfiles/common/.bash_profile +++ b/dotfiles/common/.bash_profile @@ -4,7 +4,3 @@ # Get the aliases and functions [ -f $HOME/.bashrc ] && . $HOME/.bashrc - -if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then - exec startx -fi diff --git a/dotfiles/desktop/.xinitrc b/dotfiles/desktop/.xinitrc index 9765f18..f6248ce 100755 --- a/dotfiles/desktop/.xinitrc +++ b/dotfiles/desktop/.xinitrc @@ -1,11 +1,20 @@ #!/bin/sh -# dbus session -export XDG_CURRENT_DESKTOP=i3 -exec dbus-run-session sh -c " - umask 077 - printf '%s\n' \"\$DBUS_SESSION_BUS_ADDRESS\" > \"\$HOME/.dbus-session-bus-address\" - eval \$(ssh-agent -s) - gpgconf --launch gpg-agent - exec i3 -" +[ $# -gt 0 ] || set -- i3 + +[ -r /etc/profile ] && . /etc/profile +[ -r "$HOME/.profile" ] && . "$HOME/.profile" + +session_name=${1##*/} + +export XDG_CURRENT_DESKTOP="$session_name" +export XDG_SESSION_DESKTOP="$session_name" +export XDG_SESSION_TYPE=x11 + +exec dbus-run-session sh -eu -c ' + umask 077 + printf "%s\n" "$DBUS_SESSION_BUS_ADDRESS" > "$HOME/.dbus-session-bus-address" + eval "$(ssh-agent -s)" >/dev/null + gpgconf --launch gpg-agent + exec "$@" +' sh "$@"