diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..7b3f1c8 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +inventory = ansible/inventory/hosts.yml +roles_path = ansible/roles +host_key_checking = False +retry_files_enabled = False diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg deleted file mode 100644 index 9af03de..0000000 --- a/ansible/ansible.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[defaults] -inventory = inventory/hosts.yml -roles_path = roles -host_key_checking = False -retry_files_enabled = False diff --git a/ansible/inventory/group_vars/all.yml b/ansible/inventory/group_vars/all.yml index ee917e2..e631ed9 100644 --- a/ansible/inventory/group_vars/all.yml +++ b/ansible/inventory/group_vars/all.yml @@ -1 +1,15 @@ -# common variables +--- +ansible_python_interpreter: /usr/bin/python3 +username: fscotto +user_group: fscotto +user_home: "/home/{{ username }}" +user_shell: /bin/bash + +common_packages: + - bash-completion + - git + - wget + - unzip + - zip + - vim + - fzf diff --git a/ansible/inventory/group_vars/desktop.yml b/ansible/inventory/group_vars/desktop.yml index b6a14de..46243e0 100644 --- a/ansible/inventory/group_vars/desktop.yml +++ b/ansible/inventory/group_vars/desktop.yml @@ -1 +1,30 @@ -# desktop profile variables +--- +profile_packages: + - i3 + - i3blocks + - i3blocks-blocklets + - i3status + - i3lock-color + - dunst + - rofi + - alacritty + - Thunar + - thunar-volman + - udiskie + - xfce-polkit + - xfce4-power-manager + - xfce4-clipman-plugin + - xfce4-screenshooter + - volumeicon + - brightnessctl + - feh + - scrot + - xclip + - network-manager-applet + - chromium + - mpv + - libreoffice + - lm_sensors + - fastfetch + - liberation-fonts-ttf + - terminus-font diff --git a/ansible/inventory/group_vars/void.yml b/ansible/inventory/group_vars/void.yml index c004f14..2dc6da8 100644 --- a/ansible/inventory/group_vars/void.yml +++ b/ansible/inventory/group_vars/void.yml @@ -1 +1,27 @@ -# variables for Void Linux hosts +--- +void_packages_base: + - base-system + - xtools + - vpm + - vsv + - xorg-minimal + - xorg-fonts + - elogind + - NetworkManager + - xdg-desktop-portal + - xdg-desktop-portal-gtk + - flatpak + - gvfs + - pipewire + - pavucontrol + - gnome-keyring + - seahorse + - socklog + - socklog-void + +enabled_services: + - dbus + - elogind + - NetworkManager + - socklog-unix + - nanoklogd diff --git a/ansible/inventory/host_vars/ikaros.yml b/ansible/inventory/host_vars/ikaros.yml index 6cee1ba..caa13f1 100644 --- a/ansible/inventory/host_vars/ikaros.yml +++ b/ansible/inventory/host_vars/ikaros.yml @@ -1 +1,11 @@ -# ikaros specific variables +--- +hostname: ikaros + +host_packages: + - void-repo-nonfree + - nvidia + - mesa-dri + - mesa-vaapi + - mesa-vdpau + +host_enabled_services: [] diff --git a/ansible/inventory/host_vars/nymph.yml b/ansible/inventory/host_vars/nymph.yml index 5419ed3..c00e89a 100644 --- a/ansible/inventory/host_vars/nymph.yml +++ b/ansible/inventory/host_vars/nymph.yml @@ -1 +1,11 @@ -# nymph specific variables +--- +hostname: nymph + +host_packages: + - tlp + - tlp-rdw + - blueman + - bluez + +host_enabled_services: + - tlp diff --git a/ansible/inventory/hosts.yml b/ansible/inventory/hosts.yml index 292e22b..7c841df 100644 --- a/ansible/inventory/hosts.yml +++ b/ansible/inventory/hosts.yml @@ -4,21 +4,12 @@ all: hosts: ikaros: nymph: + ansible_connection: local - ubuntu: - hosts: - deadalus: - prometheus: - - desktop: - hosts: - ikaros: - nymph: - - workstation: + ubuntu_workstation: hosts: deadalus: - server: + ubuntu_server: hosts: prometheus: diff --git a/ansible/roles/packages_void/tasks/main.yml b/ansible/roles/packages_void/tasks/main.yml index 00316d2..d2f61ee 100644 --- a/ansible/roles/packages_void/tasks/main.yml +++ b/ansible/roles/packages_void/tasks/main.yml @@ -1 +1,12 @@ -# install packages with xbps +--- +- name: Install packages on Void Linux + community.general.xbps: + name: >- + {{ + (common_packages | default([])) + + (void_packages_base | default([])) + + (profile_packages | default([])) + + (host_packages | default([])) + }} + state: present + update_cache: true diff --git a/ansible/roles/profile_desktop_i3/tasks/main.yml b/ansible/roles/profile_desktop_i3/tasks/main.yml index 8fe7fd7..1f65714 100644 --- a/ansible/roles/profile_desktop_i3/tasks/main.yml +++ b/ansible/roles/profile_desktop_i3/tasks/main.yml @@ -1 +1,77 @@ -# desktop profile tasks +--- +- name: Ensure config directories exist + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + loop: + - "{{ user_home }}/.config" + - "{{ user_home }}/.config/i3" + - "{{ user_home }}/.config/i3blocks" + - "{{ user_home }}/.config/dunst" + - "{{ user_home }}/.config/alacritty" + - "{{ user_home }}/.config/Thunar" + +- name: Enable gnome-keyring PAM auth hook + ansible.builtin.lineinfile: + path: /etc/pam.d/login + insertafter: '^auth\s+include\s+system-local-login$' + line: 'auth optional pam_gnome_keyring.so' + state: present + +- name: Enable gnome-keyring PAM session hook + ansible.builtin.lineinfile: + path: /etc/pam.d/login + insertafter: '^session\s+include\s+system-local-login$' + line: 'session optional pam_gnome_keyring.so auto_start' + state: present + +- name: Copy i3 config + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/desktop/.config/i3/" + dest: "{{ user_home }}/.config/i3/" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: preserve + +- name: Copy i3blocks config + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/desktop/.config/i3blocks/" + dest: "{{ user_home }}/.config/i3blocks/" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: preserve + +- name: Copy dunst config + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/desktop/.config/dunst/" + dest: "{{ user_home }}/.config/dunst/" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: preserve + +- name: Copy alacritty config + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/desktop/.config/alacritty/" + dest: "{{ user_home }}/.config/alacritty/" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: preserve + +- name: Copy Thunar config + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/desktop/.config/Thunar/" + dest: "{{ user_home }}/.config/Thunar/" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: preserve + +- name: Copy .xinitrc + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/desktop/.xinitrc" + dest: "{{ user_home }}/.xinitrc" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" diff --git a/ansible/roles/services_runit/tasks/main.yml b/ansible/roles/services_runit/tasks/main.yml index bf2a909..07b7270 100644 --- a/ansible/roles/services_runit/tasks/main.yml +++ b/ansible/roles/services_runit/tasks/main.yml @@ -1 +1,14 @@ -# enable runit services +--- +- name: Enable base runit services + ansible.builtin.file: + src: "/etc/sv/{{ item }}" + dest: "/var/service/{{ item }}" + state: link + loop: "{{ enabled_services | default([]) }}" + +- name: Enable host runit services + ansible.builtin.file: + src: "/etc/sv/{{ item }}" + dest: "/var/service/{{ item }}" + state: link + loop: "{{ host_enabled_services | default([]) }}" diff --git a/ansible/site.yml b/ansible/site.yml index 60be5cb..bbaecd2 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -1,31 +1,8 @@ --- -- name: Converge all machines - hosts: all +- hosts: void become: true roles: - - base - - - role: packages_void - when: "'void' in group_names" - - - role: packages_ubuntu - when: "'ubuntu' in group_names" - - - role: services_runit - when: "'void' in group_names" - - - role: services_systemd - when: "'ubuntu' in group_names" - - - role: profile_desktop_i3 - when: "'desktop' in group_names" - - - role: profile_workstation_gnome - when: "'workstation' in group_names" - - - role: profile_server - when: "'server' in group_names" - - - role: dotfiles - become: false + - packages_void + - services_runit + - profile_desktop_i3 diff --git a/dotfiles/desktop/.config/Thunar/accels.scm b/dotfiles/desktop/.config/Thunar/accels.scm new file mode 100644 index 0000000..27ba193 --- /dev/null +++ b/dotfiles/desktop/.config/Thunar/accels.scm @@ -0,0 +1,125 @@ +; thunar GtkAccelMap rc-file -*- scheme -*- +; this file is an automated accelerator map dump +; +; (gtk_accel_path "/ThunarStandardView/sort-by-type" "") +; (gtk_accel_path "/ThunarStatusBar/toggle-last-modified" "") +; (gtk_accel_path "/Thunarwindow/menu" "") +; (gtk_accel_path "/ThunarActionManager/cut" "x") +; (gtk_accel_path "/ThunarStandardView/sort-by-size" "") +; (gtk_accel_path "/ThunarWindow/file-menu" "") +; (gtk_accel_path "/ThunarWindow/close-tab" "w") +; (gtk_accel_path "/ThunarWindow/switch-previous-tab-alt" "ISO_Left_Tab") +; (gtk_accel_path "/ThunarStatusBar/toggle-size" "") +; (gtk_accel_path "/ThunarWindow/new-window" "n") +; (gtk_accel_path "/ThunarWindow/clear-directory-specific-settings" "") +; (gtk_accel_path "/ThunarWindow/close-window" "q") +; (gtk_accel_path "/ThunarWindow/open-parent" "Up") +; (gtk_accel_path "/ThunarWindow/view-side-pane-menu" "") +; (gtk_accel_path "/ThunarStatusBar/toggle-size-in-bytes" "") +; (gtk_accel_path "/ThunarWindow/switch-previous-tab" "Page_Up") +; (gtk_accel_path "/ThunarActionManager/open" "o") +; (gtk_accel_path "/ThunarStandardView/sort-ascending" "") +; (gtk_accel_path "/ThunarWindow/toggle-split-view" "F3") +; (gtk_accel_path "/ThunarActionManager/copy-2" "Insert") +; (gtk_accel_path "/ThunarActionManager/trash-delete" "Delete") +; (gtk_accel_path "/ThunarWindow/open-recent" "") +; (gtk_accel_path "/ThunarWindow/view-configure-toolbar" "") +; (gtk_accel_path "/ThunarStandardView/forward" "Right") +; (gtk_accel_path "/ThunarActionManager/restore" "") +; (gtk_accel_path "/ThunarWindow/open-location-alt" "d") +; (gtk_accel_path "/ThunarWindow/zoom-out-alt" "KP_Subtract") +; (gtk_accel_path "/ThunarStandardView/select-by-pattern" "s") +; (gtk_accel_path "/ThunarWindow/open-file-menu" "F10") +; (gtk_accel_path "/ThunarWindow/contents" "F1") +; (gtk_accel_path "/ThunarWindow/show-highlight" "") +; (gtk_accel_path "/ThunarStandardView/sort-descending" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-name" "") +; (gtk_accel_path "/ThunarStandardView/select-all-files" "a") +; (gtk_accel_path "/ThunarActionManager/execute" "") +; (gtk_accel_path "/ThunarStandardView/properties" "Return") +; (gtk_accel_path "/ThunarActionManager/cut-2" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-dtime" "") +; (gtk_accel_path "/ThunarWindow/switch-next-tab" "Page_Down") +; (gtk_accel_path "/ThunarWindow/open-templates" "") +; (gtk_accel_path "/ThunarActionManager/paste-2" "Insert") +; (gtk_accel_path "/ThunarStatusBar/toggle-filetype" "") +; (gtk_accel_path "/ThunarWindow/close-all-windows" "w") +; (gtk_accel_path "/ThunarStandardView/create-document" "") +; (gtk_accel_path "/ThunarWindow/detach-tab" "") +; (gtk_accel_path "/ThunarWindow/cancel-search" "Escape") +; (gtk_accel_path "/ThunarWindow/zoom-in-alt2" "equal") +; (gtk_accel_path "/ThunarStatusBar/toggle-hidden-count" "") +; (gtk_accel_path "/ThunarShortcutsPane/sendto-shortcuts" "d") +; (gtk_accel_path "/ThunarActionManager/undo" "z") +; (gtk_accel_path "/ThunarStandardView/toggle-sort-order" "") +; (gtk_accel_path "/ThunarWindow/view-location-selector-entry" "") +; (gtk_accel_path "/ThunarActionManager/paste" "v") +; (gtk_accel_path "/ThunarWindow/zoom-in-alt1" "KP_Add") +; (gtk_accel_path "/ThunarWindow/view-menubar" "m") +; (gtk_accel_path "/ThunarStandardView/back" "Left") +; (gtk_accel_path "/ThunarWindow/open-desktop" "") +; (gtk_accel_path "/ThunarWindow/view-as-detailed-list" "2") +; (gtk_accel_path "/ThunarActionManager/restore-show" "") +; (gtk_accel_path "/ThunarWindow/sendto-menu" "") +; (gtk_accel_path "/ThunarStatusBar/toggle-display-name" "") +; (gtk_accel_path "/ThunarWindow/go-menu" "") +; (gtk_accel_path "/ThunarWindow/zoom-out" "minus") +; (gtk_accel_path "/ThunarWindow/remove-from-recent" "") +; (gtk_accel_path "/ThunarActionManager/open-with-other" "") +; (gtk_accel_path "/ThunarStandardView/invert-selection" "i") +; (gtk_accel_path "/ThunarWindow/view-side-pane-shortcuts" "b") +; (gtk_accel_path "/ThunarWindow/reload-alt-2" "Reload") +; (gtk_accel_path "/ThunarWindow/view-location-selector-menu" "") +; (gtk_accel_path "/ThunarWindow/reload" "r") +; (gtk_accel_path "/ThunarWindow/edit-menu" "") +; (gtk_accel_path "/ThunarActionManager/copy" "c") +; (gtk_accel_path "/ThunarWindow/bookmarks-menu" "") +; (gtk_accel_path "/ThunarStandardView/forward-alt" "Forward") +; (gtk_accel_path "/ThunarActionManager/move-to-trash" "") +; (gtk_accel_path "/ThunarWindow/reload-alt-1" "F5") +; (gtk_accel_path "/ThunarActionManager/delete-3" "KP_Delete") +; (gtk_accel_path "/ThunarStandardView/unselect-all-files" "Escape") +; (gtk_accel_path "/ThunarWindow/contents/help-menu" "") +; (gtk_accel_path "/ThunarStandardView/arrange-items-menu" "") +; (gtk_accel_path "/ThunarStandardView/sort-by-mtime" "") +; (gtk_accel_path "/ThunarWindow/open-computer" "") +; (gtk_accel_path "/ThunarWindow/toggle-image-preview" "") +; (gtk_accel_path "/ThunarWindow/toggle-side-pane" "F9") +; (gtk_accel_path "/ThunarWindow/view-as-icons" "1") +; (gtk_accel_path "/ThunarActionManager/delete-2" "Delete") +; (gtk_accel_path "/ThunarWindow/zoom-in" "plus") +; (gtk_accel_path "/ThunarStandardView/rename" "F2") +; (gtk_accel_path "/ThunarWindow/open-location" "l") +; (gtk_accel_path "/ThunarWindow/view-as-compact-list" "3") +; (gtk_accel_path "/ThunarWindow/view-menu" "") +; (gtk_accel_path "/ThunarWindow/search" "f") +; (gtk_accel_path "/ThunarWindow/new-tab" "t") +; (gtk_accel_path "/ThunarWindow/zoom-reset" "0") +; (gtk_accel_path "/ThunarStandardView/back-alt2" "Back") +; (gtk_accel_path "/ThunarActionManager/open-in-new-tab" "p") +; (gtk_accel_path "/ThunarWindow/view-location-selector-buttons" "") +; (gtk_accel_path "/ThunarActionManager/redo" "z") +; (gtk_accel_path "/ThunarWindow/open-trash" "") +; (gtk_accel_path "/ThunarActionManager/open-in-new-window" "o") +; (gtk_accel_path "/ThunarWindow/view-statusbar" "") +; (gtk_accel_path "/ThunarActionManager/open-location" "") +; (gtk_accel_path "/ThunarStandardView/duplicate" "") +; (gtk_accel_path "/ThunarActionManager/trash-delete-2" "KP_Delete") +; (gtk_accel_path "/ThunarStandardView/back-alt1" "BackSpace") +; (gtk_accel_path "/ThunarStandardView/create-folder" "n") +; (gtk_accel_path "/ThunarWindow/open-home" "Home") +; (gtk_accel_path "/ThunarWindow/switch-focused-split-view-pane" "") +; (gtk_accel_path "/ThunarWindow/show-hidden" "h") +; (gtk_accel_path "/ThunarStandardView/set-default-app" "") +; (gtk_accel_path "/ThunarWindow/empty-trash" "") +; (gtk_accel_path "/ThunarWindow/preferences" "") +; (gtk_accel_path "/ThunarActionManager/delete" "") +; (gtk_accel_path "/ThunarWindow/open-network" "") +; (gtk_accel_path "/ThunarWindow/view-side-pane-tree" "e") +; (gtk_accel_path "/ThunarWindow/open-file-system" "") +; (gtk_accel_path "/ThunarWindow/search-alt" "Search") +; (gtk_accel_path "/ThunarWindow/switch-next-tab-alt" "Tab") +; (gtk_accel_path "/ThunarActionManager/sendto-desktop" "") +; (gtk_accel_path "/ThunarStandardView/make-link" "") +; (gtk_accel_path "/ThunarWindow/zoom-reset-alt" "KP_0") +; (gtk_accel_path "/ThunarWindow/about" "") diff --git a/dotfiles/desktop/.config/Thunar/uca.xml b/dotfiles/desktop/.config/Thunar/uca.xml new file mode 100644 index 0000000..f5e40cb --- /dev/null +++ b/dotfiles/desktop/.config/Thunar/uca.xml @@ -0,0 +1,15 @@ + + + + utilities-terminal + Open Terminal Here + + 1773500783260441-1 + exo-open --working-directory %f --launch TerminalEmulator + Example for a custom action + + * + + + + diff --git a/dotfiles/desktop/.config/alacritty/alacritty.toml b/dotfiles/desktop/.config/alacritty/alacritty.toml new file mode 100644 index 0000000..745977c --- /dev/null +++ b/dotfiles/desktop/.config/alacritty/alacritty.toml @@ -0,0 +1,44 @@ +[window] +padding = { x = 8, y = 8 } +opacity = 1.0 + +[font] +normal = { family = "Liberation Mono", style = "Regular" } +size = 10 + +[scrolling] +history = 10000 +multiplier = 3 + +[cursor] +style = { shape = "Beam", blinking = "Off" } + +[colors.primary] +background = "#000000" +foreground = "#c8c8c8" + +[colors.normal] +black = "#1f1f28" +red = "#c7162b" +green = "#4caf50" +yellow = "#e95420" +blue = "#4a90d9" +magenta = "#7e57c2" +cyan = "#6daeea" +white = "#eeeeee" + +[colors.bright] +black = "#3a3a46" +red = "#ff5c5c" +green = "#7ad97a" +yellow = "#ff8f40" +blue = "#6daeea" +magenta = "#9575cd" +cyan = "#8bd6ff" +white = "#ffffff" + +[keyboard] +bindings = [ + { key = "V", mods = "Control|Shift", action = "Paste" }, + { key = "C", mods = "Control|Shift", action = "Copy" } +] \ No newline at end of file diff --git a/dotfiles/desktop/.config/dunst/dunstrc b/dotfiles/desktop/.config/dunst/dunstrc new file mode 100644 index 0000000..9cfda01 --- /dev/null +++ b/dotfiles/desktop/.config/dunst/dunstrc @@ -0,0 +1,54 @@ +[global] +monitor = 0 +follow = mouse +gap_size = 10 + +width = 360 +height = 120 +origin = top-right +offset = 20x40 + +font = Liberation Sans 10 +line_height = 2 + +padding = 12 +horizontal_padding = 12 +text_icon_padding = 8 + +separator_height = 2 +frame_width = 2 +corner_radius = 8 + +transparency = 0 + +background = "#1f1f28" +foreground = "#eeeeee" +frame_color = "#4a90d9" +separator_color = frame + +timeout = 5 + +markup = full +format = "%s\n%b" + +icon_position = left +min_icon_size = 24 +max_icon_size = 32 + +[urgency_low] +background = "#1f1f28" +foreground = "#bcbcbc" +frame_color = "#3a3a46" +timeout = 3 + +[urgency_normal] +background = "#1f1f28" +foreground = "#eeeeee" +frame_color = "#4a90d9" +timeout = 5 + +[urgency_critical] +background = "#1f1f28" +foreground = "#ffffff" +frame_color = "#c7162b" +timeout = 0 \ No newline at end of file diff --git a/dotfiles/desktop/.config/i3/config b/dotfiles/desktop/.config/i3/config new file mode 100644 index 0000000..34d7c4c --- /dev/null +++ b/dotfiles/desktop/.config/i3/config @@ -0,0 +1,218 @@ +# i3 config for nymph + +set $mod Mod4 +set $refresh_i3status killall -SIGUSR1 i3status + +font pango:Liberation Mono 10 + +# Start XDG autostart entries (.desktop), useful on Void for pipewire/wireplumber/etc. +exec --no-startup-id dex --autostart --environment i3 +exec --no-startup-id gnome-keyring-daemon --start --components=secrets +exec_always --no-startup-id feh --bg-fill ~/.config/i3/wallpapers/gargantua2.png +exec_always --no-startup-id ~/.config/i3/scripts/setup-gtk-theme.sh +exec --no-startup-id /usr/libexec/xdg-desktop-portal + +# Audio +exec --no-startup-id pipewire +exec --no-startup-id pipewire-pulse +exec --no-startup-id wireplumber + +# Tray services +exec --no-startup-id dunst +exec --no-startup-id xfce-polkit +exec --no-startup-id nm-applet +exec --no-startup-id blueman-applet +exec --no-startup-id udiskie --tray --automount +exec --no-startup-id volumeicon +exec --no-startup-id xfce4-power-manager +exec --no-startup-id xfce4-clipman + +# Lock before suspend +exec --no-startup-id xss-lock --transfer-sleep-lock -- ~/.config/i3/scripts/lockscreen + +# General behavior +focus_follows_mouse no +mouse_warping none +floating_modifier $mod +tiling_drag modifier titlebar + +# Borders +default_border pixel 2 +default_floating_border pixel 2 +new_window pixel 2 +new_float pixel 2 +hide_edge_borders none + +# vim-like directions +set $left h +set $down j +set $up k +set $right l + +# Terminal +bindsym $mod+Return exec --no-startup-id /usr/bin/alacritty + +# Emergency terminal fallback +bindsym $mod+Shift+Return exec --no-startup-id xterm + +# Launcher +#bindsym $mod+d exec --no-startup-id "rofi -modi drun,run -show drun" +bindsym $mod+d exec --no-startup-id "rofi -show drun -theme ~/.config/rofi/config.rasi" + +# Audio panel control +bindsym $mod+Shift+v exec --no-startup-id pavucontrol + +# File manager +bindsym $mod+Shift+f exec thunar + +# Manual lock screen +bindsym $mod+Shift+x exec ~/.config/i3/scripts/lockscreen + +# Kill focused window +bindsym $mod+Shift+q kill + +# Screenshot +bindsym Print exec xfce4-screenshooter +bindsym Shift+Print exec xfce4-screenshooter -r +bindsym Alt+Print exec xfce4-screenshooter -w + +# Focus +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right + +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Move windows +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right 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 + +# Split +bindsym $mod+b split h +bindsym $mod+v split v + +# Layouts +bindsym $mod+f fullscreen toggle +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# Floating / focus mode +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle +bindsym $mod+a focus parent + +# Scratchpad +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +# Volume (PipeWire / PulseAudio compatibility) +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle + +# Brightness +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +10% && pkill -RTMIN+5 i3blocks +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 10%- && pkill -RTMIN+5 i3blocks + +# Media keys +bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause +bindsym XF86AudioNext exec --no-startup-id playerctl next +bindsym XF86AudioPrev exec --no-startup-id playerctl previous + +# 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" +set $ws9 "9" +set $ws10 "10" + +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# Reload / restart / exit +bindsym $mod+Shift+c reload +bindsym $mod+Shift+r restart +bindsym $mod+Shift+BackSpace exec --no-startup-id i3-msg exit +bindsym $mod+Shift+Escape exec --no-startup-id ~/.config/i3/scripts/powermenu.sh + +# Resize mode +mode "resize" { + 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 + + 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 + + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# i3bar + i3status +bar { + status_command i3blocks + position bottom + tray_output primary + font pango:Liberation Mono 10 + + colors { + background #1f1f28 + statusline #d0d0d0 + separator #3a3a46 + + focused_workspace #4a90d9 #4a90d9 #ffffff + active_workspace #3a3a46 #2b2b36 #d0d0d0 + inactive_workspace #1f1f28 #1f1f28 #9a9a9a + urgent_workspace #c7162b #c7162b #ffffff + } +} + +client.focused #4a90d9 #4a90d9 #ffffff #4a90d9 #4a90d9 +client.focused_inactive #3a3a46 #2b2b36 #eeeeee #3a3a46 #3a3a46 +client.unfocused #2b2b36 #1f1f28 #bcbcbc #2b2b36 #2b2b36 +client.urgent #c7162b #c7162b #ffffff #c7162b #c7162b +client.placeholder #1f1f28 #1f1f28 #bcbcbc #1f1f28 #1f1f28 +client.background #1f1f28 diff --git a/dotfiles/desktop/.config/i3/scripts/i3status-wrapper.sh b/dotfiles/desktop/.config/i3/scripts/i3status-wrapper.sh new file mode 100755 index 0000000..35542b0 --- /dev/null +++ b/dotfiles/desktop/.config/i3/scripts/i3status-wrapper.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +battery_json() { + local total_now=0 + local total_full=0 + local overall_status="" + local now full status bat capacity icon color + + shopt -s nullglob + + for bat in /sys/class/power_supply/BAT*; do + [[ -d "$bat" ]] || continue + + if [[ -r "$bat/energy_now" && -r "$bat/energy_full" ]]; then + now=$(<"$bat/energy_now") + full=$(<"$bat/energy_full") + elif [[ -r "$bat/charge_now" && -r "$bat/charge_full" ]]; then + now=$(<"$bat/charge_now") + full=$(<"$bat/charge_full") + else + continue + fi + + status=$(<"$bat/status") + + (( total_now += now )) + (( total_full += full )) + + case "$status" in + Charging) + overall_status="Charging" + ;; + Discharging) + [[ "$overall_status" != "Charging" ]] && overall_status="Discharging" + ;; + Full) + [[ -z "$overall_status" ]] && overall_status="Full" + ;; + *) + [[ -z "$overall_status" ]] && overall_status="$status" + ;; + esac + done + + (( total_full > 0 )) || return 1 + + capacity=$(( 100 * total_now / total_full )) + + case "$overall_status" in + Charging) icon="⚡" ;; + Discharging) icon="🔋" ;; + Full) icon="✔" ;; + *) icon="?" ;; + esac + + if (( capacity <= 15 )); then + color="#ff5555" + elif (( capacity <= 30 )); then + color="#f1fa8c" + else + color="#ffffff" + fi + + printf '{"full_text":"%s %s%%","name":"battery","color":"%s"}' \ + "$icon" "$capacity" "$color" +} + +i3status | while IFS= read -r line; do + case "$line" in + '{"version":'* | '[') + printf '%s\n' "$line" + ;; + ,*) + batt="$(battery_json)" + if [[ -n "$batt" ]]; then + line="${line#,}" + printf ',[%s,%s\n' "$batt" "${line#\[}" + else + printf '%s\n' "$line" + fi + ;; + \[*) + batt="$(battery_json)" + if [[ -n "$batt" ]]; then + printf '[%s,%s\n' "$batt" "${line#\[}" + else + printf '%s\n' "$line" + fi + ;; + *) + printf '%s\n' "$line" + ;; + esac +done diff --git a/dotfiles/desktop/.config/i3/scripts/lockscreen b/dotfiles/desktop/.config/i3/scripts/lockscreen new file mode 100755 index 0000000..076f578 --- /dev/null +++ b/dotfiles/desktop/.config/i3/scripts/lockscreen @@ -0,0 +1,33 @@ +#!/bin/sh + +img=/tmp/lockscreen.png + +# screenshot +scrot "$img" + +# blur +convert "$img" -blur 0x8 "$img" + +# lock +i3lock \ +--image "$img" \ +--clock \ +--indicator \ +--radius 100 \ +--ring-width 8 \ +--color=000000ff \ +--ring-color=2f4058ff \ +--inside-color=1f1f28ff \ +--line-color=00000000 \ +--separator-color=3a3a46ff \ +--keyhl-color=6daeeaff \ +--bshl-color=c7162bff \ +--ringver-color=4a90d9ff \ +--insidever-color=1f1f28ff \ +--ringwrong-color=c7162bff \ +--insidewrong-color=1f1f28ff \ +--time-color=d0d0d0ff \ +--date-color=9a9a9aff \ +--layout-color=d0d0d0ff \ +--verif-color=d0d0d0ff \ +--wrong-color=d0d0d0ff diff --git a/dotfiles/desktop/.config/i3/scripts/powermenu.sh b/dotfiles/desktop/.config/i3/scripts/powermenu.sh new file mode 100755 index 0000000..1c45f9c --- /dev/null +++ b/dotfiles/desktop/.config/i3/scripts/powermenu.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +choice="$(printf "⏻ Shutdown\n Reboot\n Logout\n Lock\n⏾ Suspend" \ +| rofi -dmenu \ +-i \ +-p "Power" \ +-theme ~/.config/rofi/config.rasi \ +-theme-str 'window { width: 20%; location: center; anchor: center; } listview { columns: 1; spacing: 6px; }')" + +[ -z "$choice" ] && exit 0 + +case "$choice" in + *Lock) + ~/.config/i3/scripts/lockscreen + ;; + *Logout) + i3-msg exit + ;; + *Suspend) + ~/.config/i3/scripts/lockscreen + loginctl suspend + ;; + *Reboot) + loginctl reboot + ;; + *Shutdown) + loginctl poweroff + ;; +esac diff --git a/dotfiles/desktop/.config/i3/scripts/setup-gtk-theme.sh b/dotfiles/desktop/.config/i3/scripts/setup-gtk-theme.sh new file mode 100755 index 0000000..0d02825 --- /dev/null +++ b/dotfiles/desktop/.config/i3/scripts/setup-gtk-theme.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +THEME="Yaru-blue-dark" +ICONS="Yaru-blue-dark" +CURSOR="Yaru" + +FONT_UI="Liberation Sans 10" + +mkdir -p "$HOME/.config/gtk-3.0" +mkdir -p "$HOME/.config/gtk-4.0" + +cat > "$HOME/.config/gtk-3.0/settings.ini" < "$HOME/.config/gtk-4.0/settings.ini" </dev/null) + + total_now=$((total_now + now)) + total_full=$((total_full + full)) + + case "$st" in + Charging) status="⚡" ;; + Discharging) [ -z "$status" ] && status="🔋" ;; + Full) [ -z "$status" ] && status="✔" ;; + esac +done + +[ "$total_full" -gt 0 ] || exit 0 + +pct=$((100 * total_now / total_full)) +[ -n "$status" ] || status="BAT" + +text="$status $pct%" + +if [ "$pct" -le 15 ]; then + color="#ff5555" +elif [ "$pct" -le 30 ]; then + color="#f1fa8c" +else + color="#9ece6a" +fi + +printf '%s\n%s\n%s\n' "$text" "$text" "$color" diff --git a/dotfiles/desktop/.config/i3blocks/scripts/keyindicator b/dotfiles/desktop/.config/i3blocks/scripts/keyindicator new file mode 100755 index 0000000..6aa0bac --- /dev/null +++ b/dotfiles/desktop/.config/i3blocks/scripts/keyindicator @@ -0,0 +1,17 @@ +#!/bin/sh + +state="$(xset q 2>/dev/null)" + +caps="$(printf '%s\n' "$state" | grep 'Caps Lock:' | awk '{print $4}')" +num="$(printf '%s\n' "$state" | grep 'Num Lock:' | awk '{print $8}')" + +out="" + +[ "$caps" = "on" ] && out="${out} CAPS" +[ "$num" = "on" ] && out="${out} NUM" + +[ -n "$out" ] || exit 0 + +echo "$out" +echo "$out" +echo "#9a9a9a" \ No newline at end of file diff --git a/dotfiles/desktop/.config/i3blocks/scripts/memory b/dotfiles/desktop/.config/i3blocks/scripts/memory new file mode 100755 index 0000000..8c30cb5 --- /dev/null +++ b/dotfiles/desktop/.config/i3blocks/scripts/memory @@ -0,0 +1,19 @@ +#!/bin/sh + +mem=$(free | awk '/^Mem:/ {print $3/$2 * 100.0}') +mem=${mem%.*} + +if [ "$mem" -ge 90 ]; then + color="#c7162b" +elif [ "$mem" -ge 70 ]; then + color="#e95420" +else + color="#d0d0d0" +fi + +used=$(free -h | awk '/^Mem:/ {print $3}') +total=$(free -h | awk '/^Mem:/ {print $2}') + +echo "RAM $used/$total" +echo "RAM $used/$total" +echo "$color" diff --git a/dotfiles/desktop/.config/i3blocks/scripts/temperature b/dotfiles/desktop/.config/i3blocks/scripts/temperature new file mode 100755 index 0000000..3008f0c --- /dev/null +++ b/dotfiles/desktop/.config/i3blocks/scripts/temperature @@ -0,0 +1,18 @@ +#!/bin/sh + +t=$(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null) +[ -n "$t" ] || exit 0 + +temp=$((t / 1000)) + +if [ "$temp" -ge 85 ]; then + color="#c7162b" +elif [ "$temp" -ge 70 ]; then + color="#e95420" +else + color="#d0d0d0" +fi + +echo "CPU ${temp}°C" +echo "CPU ${temp}°C" +echo "$color" diff --git a/dotfiles/desktop/.config/i3blocks/scripts/volume b/dotfiles/desktop/.config/i3blocks/scripts/volume new file mode 100755 index 0000000..4c6a58b --- /dev/null +++ b/dotfiles/desktop/.config/i3blocks/scripts/volume @@ -0,0 +1,16 @@ +#!/bin/sh + +mute=$(pactl get-sink-mute @DEFAULT_SINK@ 2>/dev/null | awk '{print $2}') +vol=$(pactl get-sink-volume @DEFAULT_SINK@ 2>/dev/null | awk '/Volume:/ {print $5; exit}') + +[ -n "$vol" ] || exit 0 + +if [ "$mute" = "yes" ]; then + text="VOL mute" + color="#7aa2f7" +else + text="VOL $vol" + color="#c0caf5" +fi + +printf '%s\n%s\n%s\n' "$text" "$text" "$color" diff --git a/dotfiles/desktop/.config/i3blocks/scripts/wifi b/dotfiles/desktop/.config/i3blocks/scripts/wifi new file mode 100755 index 0000000..d1cc4c1 --- /dev/null +++ b/dotfiles/desktop/.config/i3blocks/scripts/wifi @@ -0,0 +1,9 @@ +#!/bin/sh + +ssid=$(nmcli -t -f active,ssid dev wifi | awk -F: '$1=="yes"{print $2}') + +[ -n "$ssid" ] || exit 0 + +echo "WIFI $ssid" +echo "WIFI $ssid" +echo "#4a90d9" diff --git a/dotfiles/desktop/.gitkeep b/dotfiles/desktop/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/dotfiles/desktop/.xinitrc b/dotfiles/desktop/.xinitrc new file mode 100755 index 0000000..d0880bf --- /dev/null +++ b/dotfiles/desktop/.xinitrc @@ -0,0 +1,9 @@ +#!/bin/sh + +# dbus session +export XDG_CURRENT_DESKTOP=i3 +exec dbus-run-session sh -c " + eval \$(ssh-agent -s) + gpgconf --launch gpg-agent + exec i3 +"