Add Omarchy-style Hyprland desktop for straylight
Ports the classic dotfiles Omarchy setup to a no-home-manager NixOS
system module (configs/omarchy.nix), scoped to straylight only so the
other desktop hosts keep i3.
- Hyprland (programs.hyprland) becomes the default lightdm session; i3
stays enabled and selectable as a fallback.
- Omarchy config layout under ~/.config/{hypr,waybar,rofi,wlogout,
swayosd,alacritty} symlinked from the store; mutable theme/wallpaper
state in ~/.config/omarchy/current.
- omarchy-dots generates 8 themes (hyprland/hyprlock/waybar/rofi/
swayosd/wlogout/alacritty/mako colour files) from each theme's
palette, with wallpapers fetched from the Omarchy v3.8.4 tag.
- Helper scripts: omarchy-theme-set/bg-next/bg-set/apply, omarchy-menu
(rofi power/theme/background menus), waybar toggle, screenshot, lock.
- Shared desktop modules (desktop.nix / desktop-light.nix) untouched.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Screenshot helper: region | window | output. Saves under ~/Pictures/Screenshots
|
||||
# and copies to the clipboard.
|
||||
set -euo pipefail
|
||||
|
||||
mode="${1:-region}"
|
||||
dir="$HOME/Pictures/Screenshots"
|
||||
mkdir -p "$dir"
|
||||
file="$dir/$(date +%Y-%m-%d_%H-%M-%S).png"
|
||||
|
||||
case "$mode" in
|
||||
region)
|
||||
geom="$(slurp)" || exit 0
|
||||
grim -g "$geom" "$file"
|
||||
;;
|
||||
window)
|
||||
geom="$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')"
|
||||
grim -g "$geom" "$file"
|
||||
;;
|
||||
output)
|
||||
grim "$file"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: omarchy-capture-screenshot [region|window|output]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
wl-copy <"$file" 2>/dev/null || true
|
||||
command -v notify-send >/dev/null && notify-send -u low "Screenshot saved" "$file" || true
|
||||
exit 0
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
# rofi-based Omarchy menu. Replaces Omarchy v3's walker-driven omarchy-menu.
|
||||
# Usage: omarchy-menu [system|theme|background|capture|keybindings]
|
||||
set -euo pipefail
|
||||
|
||||
OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}"
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
PICK=(rofi -dmenu -i -p "" -theme-str 'window { width: 22%; } listview { lines: 8; }')
|
||||
|
||||
menu_main() {
|
||||
local choice
|
||||
choice="$(printf '%s\n' Apps Themes Backgrounds Capture System Keybindings | "${PICK[@]}")" || exit 0
|
||||
case "$choice" in
|
||||
Apps) rofi -show drun -show-icons ;;
|
||||
Themes) menu_theme ;;
|
||||
Backgrounds) omarchy-theme-bg-next ;;
|
||||
Capture) menu_capture ;;
|
||||
System) menu_system ;;
|
||||
Keybindings) menu_keybindings ;;
|
||||
esac
|
||||
}
|
||||
|
||||
menu_system() {
|
||||
local choice
|
||||
choice="$(printf '%s\n' Lock Logout Suspend Reboot Shutdown | "${PICK[@]}")" || exit 0
|
||||
case "$choice" in
|
||||
Lock) omarchy-system-lock ;;
|
||||
Logout) hyprctl dispatch exit ;;
|
||||
Suspend) systemctl suspend ;;
|
||||
Reboot) systemctl reboot ;;
|
||||
Shutdown) systemctl poweroff ;;
|
||||
esac
|
||||
}
|
||||
|
||||
menu_theme() {
|
||||
local choice
|
||||
choice="$(find "$OMARCHY_PATH/themes" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort | "${PICK[@]}")" || exit 0
|
||||
[ -n "$choice" ] && omarchy-theme-set "$choice"
|
||||
}
|
||||
|
||||
menu_capture() {
|
||||
local choice
|
||||
choice="$(printf '%s\n' Region Window Output | "${PICK[@]}")" || exit 0
|
||||
case "$choice" in
|
||||
Region) omarchy-capture-screenshot region ;;
|
||||
Window) omarchy-capture-screenshot window ;;
|
||||
Output) omarchy-capture-screenshot output ;;
|
||||
esac
|
||||
}
|
||||
|
||||
menu_keybindings() {
|
||||
alacritty -e less ~/.config/hypr/bindings.conf
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
system) menu_system ;;
|
||||
theme) menu_theme ;;
|
||||
background) omarchy-theme-bg-next ;;
|
||||
capture) menu_capture ;;
|
||||
keybindings) menu_keybindings ;;
|
||||
"" | *) menu_main ;;
|
||||
esac
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Reload waybar (re-reads config + style).
|
||||
pkill -SIGUSR2 waybar 2>/dev/null || true
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Lock the session with hyprlock, then blank the display.
|
||||
set -euo pipefail
|
||||
if ! pidof hyprlock >/dev/null; then
|
||||
( hyprlock; hyprctl dispatch dpms on ) &
|
||||
fi
|
||||
hyprctl switchxkblayout all 0 >/dev/null 2>&1 || true
|
||||
(
|
||||
sleep 3
|
||||
pidof hyprlock >/dev/null || exit 0
|
||||
hyprctl dispatch dpms off >/dev/null 2>&1 || true
|
||||
) &
|
||||
exit 0
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# Resolve ~/.config/omarchy/current/{theme,background} symlinks from the
|
||||
# persisted theme.name / background.name state files. Only manages symlinks;
|
||||
# restarting clients (swaybg/waybar/hyprland) is the caller's job.
|
||||
#
|
||||
# Safe to run as root (system activation) or as the user: honour $HOME.
|
||||
set -euo pipefail
|
||||
|
||||
OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}"
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
THEMES="$OMARCHY_PATH/themes"
|
||||
|
||||
mkdir -p "$CURRENT"
|
||||
|
||||
# --- theme ---
|
||||
name="$(cat "$CURRENT/theme.name" 2>/dev/null || true)"
|
||||
if [ -z "$name" ] || [ ! -d "$THEMES/$name" ]; then
|
||||
name="$(find "$THEMES" -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort | head -n1)"
|
||||
printf '%s\n' "$name" >"$CURRENT/theme.name"
|
||||
fi
|
||||
ln -sfn "$THEMES/$name" "$CURRENT/theme"
|
||||
|
||||
# --- background ---
|
||||
bg="$(cat "$CURRENT/background.name" 2>/dev/null || true)"
|
||||
if [ -z "$bg" ] || [ ! -e "$THEMES/$name/backgrounds/$bg" ]; then
|
||||
bg="$(find "$THEMES/$name/backgrounds" -maxdepth 1 -type f -printf '%f\n' 2>/dev/null | sort | head -n1)"
|
||||
printf '%s\n' "$bg" >"$CURRENT/background.name"
|
||||
fi
|
||||
if [ -n "$bg" ]; then
|
||||
ln -sfn "$THEMES/$name/backgrounds/$bg" "$CURRENT/background"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Cycle to the next background for the current theme.
|
||||
set -euo pipefail
|
||||
|
||||
OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}"
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
|
||||
name="$(cat "$CURRENT/theme.name" 2>/dev/null || true)"
|
||||
theme="$OMARCHY_PATH/themes/$name"
|
||||
[ -d "$theme/backgrounds" ] || { echo "No backgrounds for theme '$name'" >&2; exit 1; }
|
||||
|
||||
mapfile -t backgrounds < <(find "$theme/backgrounds" -maxdepth 1 -type f -printf '%f\n' | sort)
|
||||
total=${#backgrounds[@]}
|
||||
[ "$total" -gt 0 ] || { echo "No backgrounds found" >&2; exit 1; }
|
||||
|
||||
cur="$(cat "$CURRENT/background.name" 2>/dev/null || true)"
|
||||
idx=-1
|
||||
for i in "${!backgrounds[@]}"; do
|
||||
[ "${backgrounds[$i]}" = "$cur" ] && { idx=$i; break; }
|
||||
done
|
||||
next=$(( (idx + 1) % total ))
|
||||
printf '%s\n' "${backgrounds[$next]}" >"$CURRENT/background.name"
|
||||
|
||||
omarchy-theme-apply
|
||||
|
||||
pkill -x swaybg 2>/dev/null || true
|
||||
sleep 0.1
|
||||
setsid swaybg -i "$CURRENT/background" -m fill >/dev/null 2>&1 &
|
||||
exit 0
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Set the background for the current theme to a given image path.
|
||||
set -euo pipefail
|
||||
|
||||
OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}"
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
|
||||
[ -n "${1:-}" ] && [ -f "$1" ] || { echo "Usage: omarchy-theme-bg-set <path-to-image>" >&2; exit 1; }
|
||||
bg="$(realpath "$1")"
|
||||
name="$(cat "$CURRENT/theme.name" 2>/dev/null || true)"
|
||||
|
||||
if [ -n "$name" ] && [ "$(dirname "$bg")" = "$OMARCHY_PATH/themes/$name/backgrounds" ]; then
|
||||
basename "$bg" >"$CURRENT/background.name"
|
||||
ln -sfn "$bg" "$CURRENT/background"
|
||||
else
|
||||
rm -f "$CURRENT/background.name"
|
||||
ln -sfn "$bg" "$CURRENT/background"
|
||||
fi
|
||||
|
||||
pkill -x swaybg 2>/dev/null || true
|
||||
sleep 0.1
|
||||
setsid swaybg -i "$CURRENT/background" -m fill >/dev/null 2>&1 &
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Print the current theme name (pretty).
|
||||
set -euo pipefail
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
if [ -f "$CURRENT/theme.name" ]; then
|
||||
sed -E 's/(^|-)([a-z])/\1\u\2/g; s/-/ /g' "$CURRENT/theme.name"
|
||||
else
|
||||
echo "Unknown"
|
||||
fi
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Set the active Omarchy theme (name or "<theme>" from the menu).
|
||||
set -euo pipefail
|
||||
|
||||
OMARCHY_PATH="${OMARCHY_PATH:-$HOME/.local/share/omarchy}"
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
|
||||
if [ -z "${1:-}" ]; then
|
||||
echo "Usage: omarchy-theme-set <theme-name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Normalise: strip markup, lowercase, spaces -> dashes
|
||||
name="$(printf '%s' "$1" | sed -E 's/<[^>]+>//g' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')"
|
||||
|
||||
if [ ! -d "$OMARCHY_PATH/themes/$name" ]; then
|
||||
echo "Theme '$name' does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' "$name" >"$CURRENT/theme.name"
|
||||
# Start each theme on its first background
|
||||
find "$OMARCHY_PATH/themes/$name/backgrounds" -maxdepth 1 -type f -printf '%f\n' | sort | head -n1 \
|
||||
>"$CURRENT/background.name"
|
||||
|
||||
omarchy-theme-apply
|
||||
|
||||
# Restart clients so the new colours/wallpaper take effect
|
||||
pkill -x swaybg 2>/dev/null || true
|
||||
sleep 0.1
|
||||
setsid swaybg -i "$CURRENT/background" -m fill >/dev/null 2>&1 &
|
||||
pkill -SIGUSR2 waybar 2>/dev/null || true
|
||||
hyprctl reload >/dev/null 2>&1 || true
|
||||
|
||||
command -v notify-send >/dev/null && notify-send -u low "Theme: $name" || true
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Toggle the waybar on/off (marker file read by the session autostart).
|
||||
set -euo pipefail
|
||||
CURRENT="$HOME/.config/omarchy/current"
|
||||
mkdir -p "$CURRENT"
|
||||
if [ -e "$CURRENT/waybar-off" ]; then
|
||||
rm -f "$CURRENT/waybar-off"
|
||||
setsid waybar >/dev/null 2>&1 &
|
||||
else
|
||||
touch "$CURRENT/waybar-off"
|
||||
pkill -x waybar 2>/dev/null || true
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Exit 0 if waybar should be running (used by the Hyprland exec-once line).
|
||||
[ ! -e "$HOME/.config/omarchy/current/waybar-off" ]
|
||||
Reference in New Issue
Block a user