mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 23:49:56 +00:00
Reorganize desktop roles: extract common bootstrap and host-specific layers
- Add profile_desktop_common with shared desktop bootstrap (emptty, PAM, dotfiles, templates, GPG, Maildir, Flatpak, st, external tools) - Add profile_desktop_host with host-specific tasks (NVIDIA/PRIME on nymph) - Reduce profile_desktop_i3 to i3/X11-only tasks - Create profile_desktop_hyprland for Hyprland Wayland session - Add dual-session support (i3 + Hyprland) on nymph with session choice - Create shared Hyprland/Waybar dotfiles under dotfiles/desktop/ - Fix Waybar: bottom position, no persistent workspaces, sort by number - Rename host_dotfiles to host_i3_dotfiles for clarity - Make emptty restart manual by default to avoid session drops
This commit is contained in:
23
dotfiles/desktop/.local/bin/lock-session
Normal file
23
dotfiles/desktop/.local/bin/lock-session
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
case "${XDG_CURRENT_DESKTOP:-}" in
|
||||
*Hyprland*|*hyprland*)
|
||||
exec hyprlock
|
||||
;;
|
||||
*i3*|*I3*)
|
||||
exec "$HOME/.config/i3/scripts/lockscreen"
|
||||
;;
|
||||
esac
|
||||
|
||||
if command -v hyprlock >/dev/null 2>&1; then
|
||||
exec hyprlock
|
||||
fi
|
||||
|
||||
if [ -x "$HOME/.config/i3/scripts/lockscreen" ]; then
|
||||
exec "$HOME/.config/i3/scripts/lockscreen"
|
||||
fi
|
||||
|
||||
printf '%s\n' 'No supported lock command found.' >&2
|
||||
exit 1
|
||||
42
dotfiles/desktop/.local/bin/powermenu
Normal file
42
dotfiles/desktop/.local/bin/powermenu
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
choice="$(printf 'Shutdown\nReboot\nLogout\nLock\nSuspend' \
|
||||
| rofi -dmenu \
|
||||
-i \
|
||||
-p 'Power' \
|
||||
-theme ~/.config/rofi/config.rasi \
|
||||
-theme-str 'window { width: 20%; location: center; anchor: center; } listview { columns: 1; spacing: 6px; }')"
|
||||
|
||||
[ -n "$choice" ] || exit 0
|
||||
|
||||
case "$choice" in
|
||||
Lock)
|
||||
"$HOME/.local/bin/lock-session"
|
||||
;;
|
||||
Logout)
|
||||
case "${XDG_CURRENT_DESKTOP:-}" in
|
||||
*Hyprland*|*hyprland*)
|
||||
hyprctl dispatch exit
|
||||
;;
|
||||
*i3*|*I3*)
|
||||
i3-msg exit
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' 'Unsupported desktop session for logout.' >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Suspend)
|
||||
"$HOME/.local/bin/lock-session" || true
|
||||
loginctl suspend
|
||||
;;
|
||||
Reboot)
|
||||
loginctl reboot
|
||||
;;
|
||||
Shutdown)
|
||||
loginctl poweroff
|
||||
;;
|
||||
esac
|
||||
33
dotfiles/desktop/.local/bin/screenshot-wayland
Normal file
33
dotfiles/desktop/.local/bin/screenshot-wayland
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
mode=${1:-full}
|
||||
target_dir="$HOME/Pictures/Screenshots"
|
||||
target_file="$target_dir/$(date +%Y-%m-%d-%H%M%S).png"
|
||||
|
||||
mkdir -p "$target_dir"
|
||||
|
||||
case "$mode" in
|
||||
full)
|
||||
grim "$target_file"
|
||||
;;
|
||||
region)
|
||||
grim -g "$(slurp)" "$target_file"
|
||||
;;
|
||||
output)
|
||||
grim -g "$(slurp -o)" "$target_file"
|
||||
;;
|
||||
*)
|
||||
printf 'Usage: %s [full|region|output]\n' "$0" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if command -v wl-copy >/dev/null 2>&1; then
|
||||
wl-copy < "$target_file"
|
||||
fi
|
||||
|
||||
if command -v notify-send >/dev/null 2>&1; then
|
||||
notify-send "Screenshot saved" "$target_file"
|
||||
fi
|
||||
38
dotfiles/desktop/.local/bin/setup-gtk-theme
Normal file
38
dotfiles/desktop/.local/bin/setup-gtk-theme
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/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" <<EOF
|
||||
[Settings]
|
||||
gtk-theme-name=$THEME
|
||||
gtk-icon-theme-name=$ICONS
|
||||
gtk-cursor-theme-name=$CURSOR
|
||||
gtk-font-name=$FONT_UI
|
||||
gtk-application-prefer-dark-theme=1
|
||||
gtk-xft-antialias=1
|
||||
gtk-xft-hinting=1
|
||||
gtk-xft-hintstyle=hintslight
|
||||
gtk-xft-rgba=rgb
|
||||
EOF
|
||||
|
||||
cat > "$HOME/.config/gtk-4.0/settings.ini" <<EOF
|
||||
[Settings]
|
||||
gtk-theme-name=$THEME
|
||||
gtk-icon-theme-name=$ICONS
|
||||
gtk-cursor-theme-name=$CURSOR
|
||||
gtk-font-name=$FONT_UI
|
||||
gtk-application-prefer-dark-theme=1
|
||||
EOF
|
||||
|
||||
if command -v gsettings >/dev/null 2>&1; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "$THEME" >/dev/null 2>&1 || true
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$ICONS" >/dev/null 2>&1 || true
|
||||
gsettings set org.gnome.desktop.interface cursor-theme "$CURSOR" >/dev/null 2>&1 || true
|
||||
gsettings set org.gnome.desktop.interface color-scheme prefer-dark >/dev/null 2>&1 || true
|
||||
fi
|
||||
22
dotfiles/desktop/.local/bin/start-hyprland-session
Normal file
22
dotfiles/desktop/.local/bin/start-hyprland-session
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ $# -gt 0 ] || set -- Hyprland
|
||||
|
||||
[ -r /etc/profile ] && . /etc/profile
|
||||
[ -r "$HOME/.profile" ] && . "$HOME/.profile"
|
||||
|
||||
set -e
|
||||
|
||||
session_name=${1##*/}
|
||||
|
||||
export XDG_CURRENT_DESKTOP="$session_name"
|
||||
export XDG_SESSION_DESKTOP="$session_name"
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
|
||||
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 "$@"
|
||||
Reference in New Issue
Block a user