diff --git a/group_vars/all.yml b/group_vars/all.yml new file mode 100644 index 0000000..a0d2313 --- /dev/null +++ b/group_vars/all.yml @@ -0,0 +1,3 @@ +isNotebook: true +isDesktop: false +isVm: false \ No newline at end of file diff --git a/host_vars/kronos b/host_vars/kronos deleted file mode 100644 index 6b6f080..0000000 --- a/host_vars/kronos +++ /dev/null @@ -1,45 +0,0 @@ -monitors: - - desc: "LG Electronics LG ULTRAGEAR 311NTZN8J917" - output: "DP-1" - resolution: "2560x1440@120" - position: "1440x1440" - background: - file: "bg1.png" - mode: "fill" - - - desc: "LG Electronics LG ULTRAGEAR 311NTVS8J911" - output: "DP-2" - resolution: "2560x1440@120" - position: "1440x0" - background: - file: "bg0.png" - mode: "fill" - - - desc: "Acer Technologies KG271U TATEE0048524" - output: "HDMI-A-4" - resolution: "2560x1440@120" - position: "0x320" - transform: 3 - background: - file: "bgv0.png" - mode: "fill" - -workspaces: - - id: 1 - monitor: "LG Electronics LG ULTRAGEAR 311NTZN8J917" - default: true - - id: 2 - monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911" - default: true - - id: 3 - monitor: "Acer Technologies KG271U TATEE0048524" - default: true - layoutopt_orientation: "top" - on_created_empty: "flatpak run com.discordapp.Discord & keepassxc" - - id: 9 - monitor: "LG Electronics LG ULTRAGEAR 311NTVS8J911" - -autostart: - - command: "spotify --enable-features=UseOzonePlatform --ozone-platform=wayland" - workspace: 9 - silent: true \ No newline at end of file diff --git a/host_vars/zeus b/host_vars/zeus deleted file mode 100644 index 348e08a..0000000 --- a/host_vars/zeus +++ /dev/null @@ -1,26 +0,0 @@ -mobile_platform: true - -monitors: - - desc: "BOE 0x07C9" - output: "eDP-1" - resolution: "1920x1080@60" - background: - file: "bg0.png" - mode: "fill" - -workspaces: - - id: 1 - monitor: "BOE 0x07C9" - default: true - - id: 8 - monitor: "BOE 0x07C9" - - id: 9 - monitor: "BOE 0x07C9" - -autostart: - - command: "keepassxc" - workspace: 8 - silent: true - - command: "spotify --enable-features=UseOzonePlatform --ozone-platform=wayland" - workspace: 9 - silent: true \ No newline at end of file diff --git a/inventory/devices.yml b/inventory/devices.yml deleted file mode 100644 index 2926f3e..0000000 --- a/inventory/devices.yml +++ /dev/null @@ -1,4 +0,0 @@ -ungrouped: - hosts: - kronos: - zeus: \ No newline at end of file diff --git a/main.yml b/main.yml index 91fac47..7986567 100644 --- a/main.yml +++ b/main.yml @@ -1,12 +1,8 @@ - hosts: localhost roles: - common - - desktop-environment # Hyprland, App Launcher etc. - #- firefox - #- nextcloud - #- keepassxc - #- spotify - #- vlc - #- vs-code - #- qemu-kvm - #- discord + - desktop-environment # Sway, App Launcher etc. + - essential-tools # Thunar File Manager, Firefox, KeePassXC, Nextcloud Desktop + #- media-tools # Spotify, VLC + #- dev-tools # Visual Studio Code, Node.js + #- vm-tools # QEMU / KVM, libvirt, virt-manager \ No newline at end of file diff --git a/prerequisites.sh b/prerequisites.sh index 914ea93..f9d8c3c 100755 --- a/prerequisites.sh +++ b/prerequisites.sh @@ -2,9 +2,9 @@ UBUNTU_CODENAME=jammy sudo apt update -sudo apt install -y wget gpg +sudo apt install wget gpg wget -O- "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" | sudo gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main" | sudo tee /etc/apt/sources.list.d/ansible.list sudo apt update -sudo apt install -y ansible \ No newline at end of file +sudo apt install ansible \ No newline at end of file diff --git a/roles/desktop-environment/files/.config/background/bg0.png b/roles/desktop-environment/files/.config/background/bg0.png deleted file mode 100644 index d407675..0000000 Binary files a/roles/desktop-environment/files/.config/background/bg0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/bg1.png b/roles/desktop-environment/files/.config/background/bg1.png deleted file mode 100644 index 263e236..0000000 Binary files a/roles/desktop-environment/files/.config/background/bg1.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/bgv0.png b/roles/desktop-environment/files/.config/background/bgv0.png deleted file mode 100644 index 2b6a553..0000000 Binary files a/roles/desktop-environment/files/.config/background/bgv0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lock-bg0.png b/roles/desktop-environment/files/.config/background/lock-bg0.png deleted file mode 100644 index b1977da..0000000 Binary files a/roles/desktop-environment/files/.config/background/lock-bg0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lock-bg1.png b/roles/desktop-environment/files/.config/background/lock-bg1.png deleted file mode 100644 index ffaba68..0000000 Binary files a/roles/desktop-environment/files/.config/background/lock-bg1.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/background/lock-bgv0.png b/roles/desktop-environment/files/.config/background/lock-bgv0.png deleted file mode 100644 index e241fab..0000000 Binary files a/roles/desktop-environment/files/.config/background/lock-bgv0.png and /dev/null differ diff --git a/roles/desktop-environment/files/.config/environment.d/sway.conf b/roles/desktop-environment/files/.config/environment.d/sway.conf new file mode 100644 index 0000000..935b4d4 --- /dev/null +++ b/roles/desktop-environment/files/.config/environment.d/sway.conf @@ -0,0 +1,2 @@ +XDG_CURRENT_DESKTOP="sway" +XDG_SESSION_TYPE="wayland" \ No newline at end of file diff --git a/roles/desktop-environment/files/.config/sway/background.png b/roles/desktop-environment/files/.config/sway/background.png new file mode 100644 index 0000000..3d0c67e Binary files /dev/null and b/roles/desktop-environment/files/.config/sway/background.png differ diff --git a/roles/desktop-environment/files/.config/sway/lockscreen.jpg b/roles/desktop-environment/files/.config/sway/lockscreen.jpg new file mode 100644 index 0000000..99a4b70 Binary files /dev/null and b/roles/desktop-environment/files/.config/sway/lockscreen.jpg differ diff --git a/roles/desktop-environment/meta/main.yml b/roles/desktop-environment/meta/main.yml new file mode 100644 index 0000000..1afe99d --- /dev/null +++ b/roles/desktop-environment/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: + - role: common \ No newline at end of file diff --git a/roles/desktop-environment/tasks/config.yml b/roles/desktop-environment/tasks/config.yml deleted file mode 100644 index 370c233..0000000 --- a/roles/desktop-environment/tasks/config.yml +++ /dev/null @@ -1,61 +0,0 @@ -- name: Create group for sudoers config - become: yes - group: - name: admins - state: present - -- name: Add user to group for sudoers config - become: yes - user: - append: true - name: "{{ ansible_user_id }}" - groups: - - admins - -- name: Create sudoers config - become: yes - community.general.sudoers: - name: desktop-environment - group: admins - nopassword: true - commands: - - "/usr/bin/systemctl poweroff" - - "/usr/bin/systemctl reboot" - - "/usr/bin/systemctl suspend" - -- name: Copy static config files - copy: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - loop: - - src: "{{ role_path }}/files/.config" - dest: "{{ ansible_env.HOME }}/" - -- name: Ensure presence of required directories - file: - path: "{{ item }}" - recurse: yes - state: directory - loop: - - "{{ ansible_env.HOME }}/.config/hypr" - - "{{ ansible_env.HOME }}/.config/waybar" - - "{{ ansible_env.HOME }}/.local/bin" - -- name: Render config files - ansible.builtin.template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - loop: - - src: "bash_profile.j2" - dest: "{{ ansible_env.HOME }}/.bash_profile" - - src: ".config/hypr/hyprland.conf.j2" - dest: "{{ ansible_env.HOME }}/.config/hypr/hyprland.conf" - - src: ".config/waybar/config.j2" - dest: "{{ ansible_env.HOME }}/.config/waybar/config" - - src: ".local/bin/hyprhelpr.j2" - dest: "{{ ansible_env.HOME }}/.local/bin/hyprhelpr" - -- name: Make "~/.local/bin/hyprhelpr" executable - ansible.builtin.file: - dest: "{{ ansible_env.HOME }}/.local/bin/hyprhelpr" - mode: "ug+x" \ No newline at end of file diff --git a/roles/desktop-environment/tasks/flatpak.yml b/roles/desktop-environment/tasks/flatpak.yml deleted file mode 100644 index 474d9e1..0000000 --- a/roles/desktop-environment/tasks/flatpak.yml +++ /dev/null @@ -1,22 +0,0 @@ -- name: Install flatpak - become: yes - apt: - state: latest - install_recommends: false - name: - - flatpak - -- name: Add flathub remote to flatpak - community.general.flatpak_remote: - name: flathub - state: present - flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo - method: user - -- name: Install flatpaks - community.general.flatpak: - name: "{{ item }}" - state: present - method: user - loop: - - org.wezfurlong.wezterm \ No newline at end of file diff --git a/roles/desktop-environment/tasks/hyprland.yml b/roles/desktop-environment/tasks/hyprland.yml deleted file mode 100644 index dc093d6..0000000 --- a/roles/desktop-environment/tasks/hyprland.yml +++ /dev/null @@ -1,158 +0,0 @@ -- name: Install build dependencies (1/2) - become: yes - apt: - state: build-dep - name: - - wlroots - -- name: Install build dependencies (2/2) - become: yes - apt: - state: latest - install_recommends: false - name: - # General - - build-essential - - cmake - - meson - # hyprland-scanner - - libpugixml-dev - # hyprcursor - - libzip-dev - - librsvg2-dev - - libxcb-util-dev - # Hyprland - - libpango1.0-dev - - libtomlplusplus-dev - - uuid-dev - # xdg-desktop-portal-hyprland - #- qtbase5-dev - - qt6-base-dev - - libspa-0.2-dev - - libpipewire-0.3-dev - -- name: Create source folders - become: yes - file: - path: "/usr/local/src/{{ item }}" - state: directory - owner: "{{ ansible_user_id }}" - group: "{{ ansible_user_id }}" - loop: - - "hyprwayland-scanner" - - "Hyprland" - - "hyprlang" - - "hyprcursor" - - "xdg-desktop-portal-hyprland" - -- name: Checkout hyprwayland-scanner repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprwayland-scanner.git' - dest: /usr/local/src/hyprwayland-scanner - version: v0.3.4 - force: true - recursive: true - -- name: Checkout Hyprland repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/Hyprland.git' - dest: /usr/local/src/Hyprland - version: v0.40.0 - force: true - recursive: true - -- name: Checkout hyprlang repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprlang.git' - dest: /usr/local/src/hyprlang - version: v0.5.1 - force: true - recursive: true - -- name: Checkout hyprcursor repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/hyprcursor.git' - dest: /usr/local/src/hyprcursor - version: v0.1.8 - force: true - recursive: true - -- name: Checkout xdg-desktop-portal-hyprland repo - ansible.builtin.git: - repo: 'https://github.com/hyprwm/xdg-desktop-portal-hyprland.git' - dest: /usr/local/src/xdg-desktop-portal-hyprland - version: master - force: true - recursive: true - -- name: Build hyprwayland-scanner - ansible.builtin.command: - cmd: "{{ item }}" - chdir: /usr/local/src/hyprwayland-scanner - loop: - - "cmake -DCMAKE_INSTALL_PREFIX=/usr -B build" - - "cmake --build build" - -- name: Install hyprwayland-scanner - become: yes - ansible.builtin.command: - cmd: "cmake --install build" - chdir: /usr/local/src/hyprwayland-scanner - -- name: Build hyprlang - ansible.builtin.command: - cmd: "{{ item }}" - chdir: /usr/local/src/hyprlang - loop: - - "cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B build" - - "cmake --build build --config Release --target hyprlang" - -- name: Install hyprlang - become: yes - ansible.builtin.command: - cmd: "cmake --install build" - chdir: /usr/local/src/hyprlang - -- name: Build hyprcursor - ansible.builtin.command: - cmd: "{{ item }}" - chdir: /usr/local/src/hyprcursor - loop: - - "cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build" - - "cmake --build build --config Release --target all" - -- name: Install hyprcursor - become: yes - ansible.builtin.command: - cmd: "cmake --install build" - chdir: /usr/local/src/hyprcursor - -- name: Build Hyprland - community.general.make: - chdir: /usr/local/src/Hyprland - target: all - -- name: Install Hyprland - become: true - community.general.make: - chdir: /usr/local/src/Hyprland - target: install - -- name: Build xdg-desktop-portal-hyprland - ansible.builtin.command: - cmd: "{{ item }}" - chdir: /usr/local/src/xdg-desktop-portal-hyprland - loop: - - "cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DCMAKE_INSTALL_PREFIX=/usr -B build" - - "cmake --build build" - -- name: Install xdg-desktop-portal-hyprland - become: yes - ansible.builtin.command: - cmd: "cmake --install build" - chdir: /usr/local/src/xdg-desktop-portal-hyprland - -- name: Reload systemd - ansible.builtin.systemd_service: - daemon_reload: true - scope: user diff --git a/roles/desktop-environment/tasks/main.yml b/roles/desktop-environment/tasks/main.yml index 99e828b..e9f2800 100644 --- a/roles/desktop-environment/tasks/main.yml +++ b/roles/desktop-environment/tasks/main.yml @@ -1,11 +1,93 @@ -- name: Include installation of Hyprland - import_tasks: hyprland.yml +- name: Install packages for desktop environment + become: yes + apt: + state: latest + install_recommends: false + name: + - sway + - xwayland + - swaylock + - waybar + - xdg-desktop-portal-wlr + - slurp + - xfce4-appfinder + - rtkit + - pipewire + - pipewire-pulse + - wireplumber + - alsa-utils + - brightnessctl + - flatpak + - adwaita-icon-theme + - fonts-firacode + - fonts-font-awesome + - fonts-noto-color-emoji -- name: Include installation of utilities - import_tasks: utils.yml +- name: Add flathub remote to flatpak + community.general.flatpak_remote: + name: flathub + state: present + flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo + method: user -- name: Include flatpak setup - import_tasks: flatpak.yml +- name: Install flatpaks + community.general.flatpak: + name: "{{ item }}" + state: present + method: user + loop: + - org.wezfurlong.wezterm -- name: Include configuration steps - import_tasks: config.yml \ No newline at end of file +- name: Create group for sudoers config + become: yes + group: + name: admins + state: present + +- name: Add user to group for sudoers config + become: yes + user: + append: true + name: "{{ ansible_user_id }}" + groups: + - admins + +- name: Create sudoers config + become: yes + community.general.sudoers: + name: desktop-environment + group: admins + nopassword: true + commands: + - "/usr/bin/systemctl poweroff" + - "/usr/bin/systemctl reboot" + - "/usr/bin/systemctl suspend" + +- name: Copy static config files + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + loop: + - src: "{{ role_path }}/files/.config" + dest: "{{ ansible_env.HOME }}/" + +- name: Ensure presence of required directories + file: + path: "{{ item }}" + recurse: yes + state: directory + loop: + - "{{ ansible_env.HOME }}/.config/sway" + - "{{ ansible_env.HOME }}/.config/waybar" + +- name: Render config files + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + loop: + - src: "bash_profile.j2" + dest: "{{ ansible_env.HOME }}/.bash_profile" + - src: "sway-config.j2" + dest: "{{ ansible_env.HOME }}/.config/sway/config" + - src: "waybar-config.j2" + dest: "{{ ansible_env.HOME }}/.config/waybar/config" \ No newline at end of file diff --git a/roles/desktop-environment/tasks/utils.yml b/roles/desktop-environment/tasks/utils.yml deleted file mode 100644 index 45c7dbd..0000000 --- a/roles/desktop-environment/tasks/utils.yml +++ /dev/null @@ -1,27 +0,0 @@ -- name: Install utilities - become: yes - apt: - state: latest - install_recommends: false - name: - - swaylock - - swaybg - - swayidle - - waybar - - wofi - - xdg-desktop-portal-wlr - - xdg-desktop-portal-gtk - - xfce4-appfinder - - rtkit - - pipewire - - pipewire-pulse - - wireplumber - - qpwgraph - - alsa-utils - - brightnessctl - - gnome-keyring - - adwaita-icon-theme - - fonts-firacode - - fonts-font-awesome - - fonts-noto-color-emoji - - thunar \ No newline at end of file diff --git a/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 b/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 deleted file mode 100644 index 44cefc5..0000000 --- a/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 +++ /dev/null @@ -1,183 +0,0 @@ -# Monitor configuration (see https://wiki.hyprland.org/Configuring/Monitors/) -{% for monitor in hostvars[ansible_hostname]['monitors'] %} -monitor=desc:{{ monitor['desc'] }}, {{ monitor['resolution'] }}, {{ monitor['position'] | default('auto') }}, 1 -{% endfor %} - -# Programs to use -$terminal = flatpak run --nosocket=wayland org.wezfurlong.wezterm -$menu = xfce4-appfinder --disable-server - -# Default env vars -env = XCURSOR_SIZE,24 -env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that - -# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ -input { - kb_layout = de - kb_variant = nodeadkeys - numlock_by_default = 1 - - follow_mouse = 2 - - touchpad { - natural_scroll = 1 - } - - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. -} - -general { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - - gaps_in = 5 - gaps_out = 10 - border_size = 2 - col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg - col.inactive_border = rgba(595959aa) - - layout = master - - # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on - allow_tearing = false -} - -decoration { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - - rounding = 10 - - blur { - enabled = true - size = 3 - passes = 1 - - vibrancy = 0.1696 - } - - drop_shadow = true - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) -} - -# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more -animations { - enabled = true - - bezier = myBezier, 0.05, 0.9, 0.1, 1.05 - - animation = windows, 1, 7, myBezier - animation = windowsOut, 1, 7, default, popin 80% - animation = border, 1, 10, default - animation = borderangle, 1, 8, default - animation = fade, 1, 7, default - animation = workspaces, 1, 6, default -} - -master { - # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - new_is_master = true - orientation = right -} - -gestures { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - workspace_swipe = false -} - -misc { - # See https://wiki.hyprland.org/Configuring/Variables/ for more - force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers -} - -# Example windowrule v2 -# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -windowrulev2 = suppressevent maximize, class:.* -windowrulev2 = idleinhibit fullscreen, class:.* -windowrulev2 = float,title:^(Application Finder)$ -windowrulev2 = size 500 500,title:^(Application Finder)$ - -# Workspace rules -{% for workspace in hostvars[ansible_hostname]['workspaces'] %} -workspace = {{ workspace['id'] }}{% if 'monitor' in workspace %}, monitor:desc:{{ workspace['monitor'] }}{% endif %}{% if 'default' in workspace %}, default:{{ workspace['default'] | lower }}{% endif %}{% if 'layoutopt_orientation' in workspace %}, layoutopt:orientation:{{ workspace['layoutopt_orientation'] }}{% endif %}{% if 'on_created_empty' in workspace %}, on-created-empty:{{ workspace['on_created_empty'] }}{% endif %} - -{% endfor %} - -# Execute apps at launch -exec-once = systemctl --user import-environment DISPLAY WAYLAND_DISPLAY && hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK -exec-once = waybar & ~/.local/bin/hyprhelpr background & ~/.local/bin/hyprhelpr idle -{% if 'nextcloud' in role_names %} -exec-once = nextcloud --background -{% endif %} -{% for autostart in hostvars[ansible_hostname]['autostart'] %} -exec-once = {% if 'workspace' in autostart %}[workspace {{ autostart['workspace'] }} {%- if (autostart['silent'] | default('false')) | bool %} silent{% endif %}] {% endif %}{{ autostart['command'] }} -{% endfor %} - -# See https://wiki.hyprland.org/Configuring/Keywords/ for more -$mainMod = SUPER - -# Key binds, see https://wiki.hyprland.org/Configuring/Binds/ for more -bind = $mainMod, Return, exec, $terminal -bind = $mainMod, D, exec, $menu -bind = $mainMod SHIFT, Q, killactive, -bind = $mainMod SHIFT, E, exit, -bind = $mainMod, F, fullscreen, 0 -bind = $mainMod, V, togglefloating, -bind = $mainMod, L, exec, ~/.local/bin/hyprhelpr lock -bind = $mainMod, P, exec, ~/.local/bin/hyprhelpr powermenu - -# Move focus with mainMod + arrow keys -bind = $mainMod, left, movefocus, l -bind = $mainMod, right, movefocus, r -bind = $mainMod, up, movefocus, u -bind = $mainMod, down, movefocus, d - -# Move window with mainMod + SHIFT + arrow keys -bind = $mainMod SHIFT, left, movewindow, l -bind = $mainMod SHIFT, right, movewindow, r -bind = $mainMod SHIFT, up, movewindow, u -bind = $mainMod SHIFT, down, movewindow, d - -# Switch workspaces with mainMod + [0-9] -bind = $mainMod, 1, workspace, 1 -bind = $mainMod, 2, workspace, 2 -bind = $mainMod, 3, workspace, 3 -bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -bind = $mainMod, 6, workspace, 6 -bind = $mainMod, 7, workspace, 7 -bind = $mainMod, 8, workspace, 8 -bind = $mainMod, 9, workspace, 9 -bind = $mainMod, 0, workspace, 10 - -# Move active window to a workspace with mainMod + SHIFT + [0-9] -bind = $mainMod SHIFT, 1, movetoworkspace, 1 -bind = $mainMod SHIFT, 2, movetoworkspace, 2 -bind = $mainMod SHIFT, 3, movetoworkspace, 3 -bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -bind = $mainMod SHIFT, 6, movetoworkspace, 6 -bind = $mainMod SHIFT, 7, movetoworkspace, 7 -bind = $mainMod SHIFT, 8, movetoworkspace, 8 -bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, 10 - -# Move/resize windows with mainMod + LMB/RMB and dragging -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow - -{% if hostvars[ansible_hostname]['mobile_platform'] | bool %} -# Backlight control -bind = , XF86MonBrightnessUp, exec, brightnessctl -d intel_backlight set +5% -bind = , XF86MonBrightnessDown, exec, brightnessctl -d intel_backlight set 5%- - -# Volume control -bind = , XF86AudioRaiseVolume, exec, amixer -c 0 -q set Master 2dB+ unmute -bind = , XF86AudioLowerVolume, exec, amixer -c 0 -q set Master 2db- unmute -bind = , XF86AudioMute, exec, amixer -q set Master toggle - -# Touchpad control -bind = , XF86TouchpadOn, exec, synclient Touchpadoff=0 -bind = , XF86TouchpadOff, exec, synclient Touchpadoff=1 -{% endif %} \ No newline at end of file diff --git a/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 b/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 deleted file mode 100644 index 1753113..0000000 --- a/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -set -eu - -background() { - swaybg \ -{% for monitor in hostvars[ansible_hostname]['monitors'] %} - -o "{{ monitor['desc'] }}" -i ~/.config/background/{{ monitor['background']['file'] }} -m {{ monitor['background']['mode'] }} {%- if not loop.last %} \{% endif %} - -{% endfor %} -} - -idle() { - swayidle -w \ - timeout 180 '~/.local/bin/hyprhelpr lock' \ - timeout 240 'hyprctl dispatch dpms off' \ - resume 'hyprctl dispatch dpms on' -} - -lock() { - if pgrep -x "swaylock" >/dev/null - then - echo "A instance of swaylock is already running." - exit 1 - else - swaylock -f -e -s fill --indicator-radius 150 \ -{% for monitor in hostvars[ansible_hostname]['monitors'] %} - -i {{ monitor['output'] }}:~/.config/background/lock-{{ monitor['background']['file'] }} {%- if not loop.last %} \{% endif %} - -{% endfor %} - fi -} - -shutdown() { - sudo systemctl poweroff -} - -reboot() { - sudo systemctl reboot -} - -powermenu() { - PM_ACTION=$(printf "Shutdown\nReboot\nLock\nLogoff" | wofi --show=dmenu -i --width 200 --height 150) - if [ -n "$PM_ACTION" ]; then - case $PM_ACTION in - Shutdown) - shutdown - ;; - Reboot) - reboot - ;; - Lock) - lock - ;; - Logoff) - hyprctl dispatch exit - ;; - esac - fi -} - -ACTION=$1 -case $ACTION in - background) - background - ;; - idle) - idle - ;; - lock) - lock - ;; - shutdown) - shutdown - ;; - reboot) - reboot - ;; - powermenu) - powermenu - ;; - help | -h | --help) - echo "Usage: hyprhelpr [parameters]" - echo "Available actions:" - echo " background Start swaybg with the configured backgrounds." - echo " idle Start swayidle with the configured actions." - echo " lock Lock the current session using swaylock." - echo " shutdown Shut down the system." - echo " reboot Reboot the system." - echo " powermenu Show wofi in dmenu mode with different power options" - echo " help Show this help text." - ;; - *) - echo "Invalid action \"$ACTION\"."' Use "hyprhelpr help" to get help.' - exit 1 -esac diff --git a/roles/desktop-environment/templates/bash_profile.j2 b/roles/desktop-environment/templates/bash_profile.j2 index 144e1f3..9ddfa4f 100644 --- a/roles/desktop-environment/templates/bash_profile.j2 +++ b/roles/desktop-environment/templates/bash_profile.j2 @@ -13,10 +13,8 @@ fi # Fix gpg for git commit signing export GPG_TTY=$(tty) -# Autostart Hyprland at login -if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then -{% if (hostvars[ansible_hostname]['virtual_machine'] | default('false')) | bool %} - export WLR_NO_HARDWARE_CURSORS=1 +# Autostart sway at login +{% if isVm | bool %} +export WLR_NO_HARDWARE_CURSORS=1 {% endif %} - exec Hyprland -fi \ No newline at end of file +if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec sway; fi \ No newline at end of file diff --git a/roles/desktop-environment/templates/sway-config.j2 b/roles/desktop-environment/templates/sway-config.j2 new file mode 100644 index 0000000..80f30f8 --- /dev/null +++ b/roles/desktop-environment/templates/sway-config.j2 @@ -0,0 +1,248 @@ +input "type:keyboard" { + xkb_layout de + xkb_variant nodeadkeys + repeat_delay 200 + repeat_rate 40 +} + +input "type:touchpad" { + tap enabled + natural_scroll enabled +} + +set $mod Mod4 + +default_border pixel 2 +default_floating_border pixel 2 + +hide_edge_borders both + +bindsym $mod+u border none +bindsym $mod+y border pixel 1 +bindsym $mod+n border normal + +font xft:Fira Code 11 + +floating_modifier $mod + +bindsym $mod+Return exec flatpak run org.wezfurlong.wezterm + +# Window kill command +bindsym $mod+Shift+q kill + +# start program launcher +bindsym $mod+d exec --no-startup-id xfce4-appfinder --disable-server +for_window [title="Application Finder"] floating enable +for_window [title="Application Finder"] resize set 500 500 + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+semicolon focus right + +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+semicolon move right + +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# workspace back and forth (with/without active container) +workspace_auto_back_and_forth yes +bindsym $mod+b workspace back_and_forth +bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth + +# split orientation +bindsym $mod+h split h;exec notify-send 'tile horizontally' +bindsym $mod+v split v;exec notify-send 'tile vertically' +bindsym $mod+q split toggle + +# toggle fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# toggle sticky +bindsym $mod+Shift+s sticky toggle + +# focus the parent container +bindsym $mod+a focus parent + +# move the currently focused window to the scratchpad +bindsym $mod+Shift+minus move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym $mod+minus scratchpad show + +# navigate workspaces next / previous +bindsym $mod+Ctrl+Right workspace next +bindsym $mod+Ctrl+Left workspace prev + +# workspaces +set $ws1 1 +set $ws2 2 +set $ws3 3 +set $ws4 4 +set $ws5 5 +set $ws6 6 +set $ws7 7 +set $ws8 8 + +# switch to workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 + +# Move focused container to workspace +bindsym $mod+Ctrl+1 move container to workspace $ws1 +bindsym $mod+Ctrl+2 move container to workspace $ws2 +bindsym $mod+Ctrl+3 move container to workspace $ws3 +bindsym $mod+Ctrl+4 move container to workspace $ws4 +bindsym $mod+Ctrl+5 move container to workspace $ws5 +bindsym $mod+Ctrl+6 move container to workspace $ws6 +bindsym $mod+Ctrl+7 move container to workspace $ws7 +bindsym $mod+Ctrl+8 move container to workspace $ws8 + +# Move to workspace with focused container +bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 +bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 +bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 +bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 + +# Open specific applications in floating mode +for_window [window_role="About"] floating enable +for_window [title="alsamixer"] floating enable border pixel 1 +for_window [title="File Transfer*"] floating enable +for_window [class="eog"] floating enable +for_window [class="Galculator"] floating enable border pixel 1 +for_window [class="GParted"] floating enable border normal +for_window [class="(?i)gnome-calculator"] floating enable +for_window [class="Pavucontrol"] floating enable +for_window [class="qt5ct"] floating enable sticky enable border normal +for_window [class="Qtconfig-qt4"] floating enable sticky enable border normal +for_window [title="QEMU"] floating enable +for_window [class="Thus"] floating enable border normal +for_window [class="Timeset-gui"] floating enable border normal + +# switch to workspace with urgent window automatically +for_window [urgent=latest] focus + +# reload the configuration file +bindsym $mod+Shift+c reload + +# restart sway inplace (preserves layout/session) +bindsym $mod+Shift+r restart + +# exit sway +bindsym $mod+Shift+e exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'" + +# Set shut down, restart and locking features +set $mode_system (l)ock, (e)xit, (r)eboot, (Shift+s)hutdown +bindsym $mod+0 mode "$mode_system" +mode "$mode_system" { + bindsym l exec --no-startup-id swaylock -f -s fill -i ~/.config/sway/lockscreen.jpg, mode "default" + bindsym e exec --no-startup-id swaymsg exit, mode "default" + bindsym r exec --no-startup-id sudo systemctl reboot, mode "default" + bindsym Shift+s exec --no-startup-id sudo systemctl poweroff, mode "default" + + # exit system mode: "Enter" or "Escape" + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Resize window (you can also use the mouse for that) +bindsym $mod+r mode "resize" +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 5 px or 5 ppt + bindsym k resize grow height 5 px or 5 ppt + bindsym l resize shrink height 5 px or 5 ppt + bindsym semicolon resize grow width 5 px or 5 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # exit resize mode: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +# Set background +output * bg ~/.config/sway/background.png fill + +# Use waybar +exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK +exec hash dbus-update-activation-environment 2>/dev/null && \ + dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK +exec waybar + +# Autostart applications +{% if nextcloud is defined and nextcloud | bool %} +exec --no-startup-id nextcloud --background +{% endif %} + +# Theme colors +client.focused #c6c6c6 #1f1f1f #c6c6c6 #8abeb7 #8abeb7 +client.focused_inactive #c6c6c6 #1f1f1f #c6c6c6 #8abeb7 #8abeb7 +client.unfocused #c6c6c6 #1f1f1f #c6c6c6 #8abeb7 #8abeb7 +client.urgent #c6c6c6 #1f1f1f #c6c6c6 #8abeb7 #8abeb7 +client.placeholder #c6c6c6 #1f1f1f #c6c6c6 #8abeb7 #8abeb7 + +client.background #1f1f1f + +{% if isNotebook | bool %} +# backlight control +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl -d intel_backlight set +5% +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl -d intel_backlight set 5%- + +# set volume control +bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -c 0 -q set Master 2dB+ unmute +bindsym XF86AudioLowerVolume exec --no-startup-id amixer -c 0 -q set Master 2db- unmute +bindsym XF86AudioMute exec --no-startup-id amixer -q set Master toggle + +# touchpad on and off controller on laptops with Fn keys +bindsym XF86TouchpadOn exec --no-startup-id synclient Touchpadoff=0 +bindsym XF86TouchpadOff exec --no-startup-id synclient Touchpadoff=1 +{% endif %} + +focus_follows_mouse no + +# User defined keys +#bindsym Print exec flameshot gui # TODO +#bindsym Shift+Print exec flameshot gui #TODO diff --git a/roles/desktop-environment/templates/.config/waybar/config.j2 b/roles/desktop-environment/templates/waybar-config.j2 similarity index 64% rename from roles/desktop-environment/templates/.config/waybar/config.j2 rename to roles/desktop-environment/templates/waybar-config.j2 index 8d2b71a..30ee64a 100644 --- a/roles/desktop-environment/templates/.config/waybar/config.j2 +++ b/roles/desktop-environment/templates/waybar-config.j2 @@ -1,8 +1,10 @@ { - "modules-left": ["hyprland/workspaces"], + "modules-left": ["sway/workspaces", "sway/mode"], "modules-center": ["clock"], - "modules-right": ["cpu", "memory", "network", "pulseaudio", {% if (hostvars[ansible_hostname]['mobile_platform'] | default('false')) | bool %}"battery", {% endif %}"custom/power"], - "hyprland/workspaces": {}, + "modules-right": ["cpu", "memory", "network", "pulseaudio", {% if isNotebook | bool %}"battery", {% endif %}"custom/power"], + "sway/workspaces": { + "disable-scroll": true + }, "clock": { "format": " {:%H:%M %d.%m.}", "timezone": "Europe/Berlin" @@ -27,12 +29,16 @@ "format-icons": ["", "", ""], "reverse-scrolling": true, "on-click": "swaymsg exec amixer -q set Master toggle" - {% if (hostvars[ansible_hostname]['mobile_platform'] | default('false')) | bool %} }, + {% if isNotebook | bool %} "battery": { "format": "{icon} {capacity}%", "format-charging": " {capacity}%", "format-icons": ["", "", "", "", ""] + }, {% endif %} + "custom/power":{ + "format":"  ", + "on-click":"swaynag -t warning -m 'Power Menu Options' -b 'Logout' 'swaymsg exit' -b 'Lock' 'swaymsg exec swaylock -f' -b 'Suspend' 'swaymsg exec sudo systemctl suspend && swaylock -f' -b 'Reboot' 'swaymsg exec sudo systemctl reboot' -b 'Shutdown' 'swaymsg exec sudo systemctl poweroff'" } } diff --git a/roles/vs-code/tasks/main.yml b/roles/dev-tools/tasks/main.yml similarity index 100% rename from roles/vs-code/tasks/main.yml rename to roles/dev-tools/tasks/main.yml diff --git a/roles/discord/tasks/main.yml b/roles/discord/tasks/main.yml deleted file mode 100644 index 3aa94db..0000000 --- a/roles/discord/tasks/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Install Discord - community.general.flatpak: - name: "com.discordapp.Discord" - state: present - method: user diff --git a/roles/essential-tools/files/99pin-unstable b/roles/essential-tools/files/99pin-unstable new file mode 100644 index 0000000..62a3a4a --- /dev/null +++ b/roles/essential-tools/files/99pin-unstable @@ -0,0 +1,7 @@ +Package: * +Pin: release a=testing +Pin-Priority: 900 + +Package: * +Pin: release a=unstable +Pin-Priority: 10 \ No newline at end of file diff --git a/roles/essential-tools/meta/main.yml b/roles/essential-tools/meta/main.yml new file mode 100644 index 0000000..4dc5ce6 --- /dev/null +++ b/roles/essential-tools/meta/main.yml @@ -0,0 +1,4 @@ +dependencies: + - role: desktop-environment + vars: + nextcloud: true \ No newline at end of file diff --git a/roles/essential-tools/tasks/main.yml b/roles/essential-tools/tasks/main.yml new file mode 100644 index 0000000..6d81320 --- /dev/null +++ b/roles/essential-tools/tasks/main.yml @@ -0,0 +1,24 @@ +- name: Add debian unstable repo + become: yes + apt_repository: + repo: deb http://deb.debian.org/debian unstable main non-free-firmware non-free contrib + state: present + filename: debian-unstable + +- name: Create apt preferences file for unstable repo + become: yes + copy: + src: "{{ role_path }}/files/99pin-unstable" + dest: "/etc/apt/preferences.d/" + +- name: Install essential tools + become: yes + apt: + state: latest + install_recommends: false + update_cache: true + name: + - thunar + - firefox + - keepassxc + - nextcloud-desktop \ No newline at end of file diff --git a/roles/firefox/tasks/main.yml b/roles/firefox/tasks/main.yml deleted file mode 100644 index 96f0fca..0000000 --- a/roles/firefox/tasks/main.yml +++ /dev/null @@ -1,20 +0,0 @@ -- name: Add Mozilla repository - become: yes - deb822_repository: - name: mozilla - types: deb - uris: https://packages.mozilla.org/apt - suites: mozilla - components: main - signed_by: https://packages.mozilla.org/apt/repo-signing-key.gpg - state: present - enabled: yes - -- name: Install packages - become: yes - apt: - state: latest - update_cache: true - install_recommends: false - name: - - firefox \ No newline at end of file diff --git a/roles/keepassxc/tasks/main.yml b/roles/keepassxc/tasks/main.yml deleted file mode 100644 index f72660b..0000000 --- a/roles/keepassxc/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: Install packages - become: yes - apt: - state: latest - install_recommends: false - name: - - keepassxc-full diff --git a/roles/spotify/files/spotify.desktop b/roles/media-tools/files/spotify.desktop similarity index 72% rename from roles/spotify/files/spotify.desktop rename to roles/media-tools/files/spotify.desktop index f9ef700..bc895ba 100644 --- a/roles/spotify/files/spotify.desktop +++ b/roles/media-tools/files/spotify.desktop @@ -4,7 +4,7 @@ Name=Spotify GenericName=Music Player Icon=spotify-client TryExec=spotify -Exec=spotify --enable-features=UseOzonePlatform --ozone-platform=wayland --uri=%U +Exec=spotify --uri=%U Terminal=false MimeType=x-scheme-handler/spotify; Categories=Audio;Music;Player;AudioVideo; diff --git a/roles/spotify/tasks/main.yml b/roles/media-tools/tasks/main.yml similarity index 85% rename from roles/spotify/tasks/main.yml rename to roles/media-tools/tasks/main.yml index b944acb..c497e4e 100644 --- a/roles/spotify/tasks/main.yml +++ b/roles/media-tools/tasks/main.yml @@ -6,7 +6,7 @@ uris: http://repository.spotify.com suites: stable components: non-free - signed_by: https://download.spotify.com/debian/pubkey_6224F9941A8AA6D1.gpg + signed_by: https://download.spotify.com/debian/pubkey_7A3A762FAFD4A51F.gpg state: present enabled: yes @@ -17,6 +17,8 @@ update_cache: true install_recommends: false name: + - vlc + - vlc-plugin-pipewire - spotify-client - name: Ensure that directory for desktop entries exists diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml deleted file mode 100644 index 789881c..0000000 --- a/roles/nextcloud/tasks/main.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: Install packages - become: yes - apt: - state: latest - install_recommends: false - name: - - nextcloud-desktop \ No newline at end of file diff --git a/roles/vlc/tasks/main.yml b/roles/vlc/tasks/main.yml deleted file mode 100644 index c38dab8..0000000 --- a/roles/vlc/tasks/main.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Install packages - become: yes - apt: - state: latest - update_cache: true - install_recommends: false - name: - - vlc - - vlc-plugin-pipewire \ No newline at end of file diff --git a/roles/qemu-kvm/tasks/main.yml b/roles/vm-tools/tasks/main.yml similarity index 91% rename from roles/qemu-kvm/tasks/main.yml rename to roles/vm-tools/tasks/main.yml index 7f0a118..3552c0f 100644 --- a/roles/qemu-kvm/tasks/main.yml +++ b/roles/vm-tools/tasks/main.yml @@ -1,4 +1,4 @@ -- name: Install packages +- name: Install packages for qemu-kvm become: yes apt: state: latest @@ -6,7 +6,6 @@ name: - qemu-kvm - qemu-system - - qemu-utils - libvirt-daemon - libvirt-daemon-system - ovmf