feat(system): comprehensive branding, styling, and system feature update

- Relocate themes to assets/themes/ and update all references.
- Implement custom SDDM theme and Plymouth theme enhancements.
- Add themed templates for Alacritty, Hyprland, Waybar, and other apps.
- Introduce Makima key remapper module and configuration.
- Add Voxtype and Walker configurations.
- Implement systemd power management and timeout optimizations.
- Add Nautilus-python extensions for LocalSend.
- Update branding assets and ASCII art integration.
This commit is contained in:
Bernardo Magri
2026-04-05 10:52:41 +01:00
parent 9d5049aed5
commit 514b305713
465 changed files with 3770 additions and 578 deletions

View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Returns the battery full capacity in Wh (rounded to whole number).
# Used by nnomarchy-battery-status for displaying battery capacity.
battery_info=$(upower -i $(upower -e | grep BAT))
echo "$battery_info" | awk '/energy-full:/ {
printf "%d", $2
exit
}'

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Designed to be run by systemd timer every 30 seconds and alerts if battery is low
BATTERY_THRESHOLD=10
NOTIFICATION_FLAG="/run/user/$UID/nnomarchy_battery_notified"
BATTERY_LEVEL=$(nnomarchy-battery-remaining)
BATTERY_STATE=$(upower -i $(upower -e | grep 'BAT') | grep -E "state" | awk '{print $2}')
send_notification() {
notify-send -u critical "󱐋 Time to recharge!" "Battery is down to ${1}%" -i battery-caution -t 30000
nnomarchy-hook battery-low "$1"
}
if [[ -n $BATTERY_LEVEL && $BATTERY_LEVEL =~ ^[0-9]+$ ]]; then
if [[ $BATTERY_STATE == "discharging" ]] && (( BATTERY_LEVEL <= BATTERY_THRESHOLD )); then
if [[ ! -f $NOTIFICATION_FLAG ]]; then
send_notification $BATTERY_LEVEL
touch $NOTIFICATION_FLAG
fi
else
rm -f $NOTIFICATION_FLAG
fi
fi

View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Returns true if a battery is present on the system.
# Used by the battery monitor and other battery-related checks.
for bat in /sys/class/power_supply/BAT*; do
[[ -r $bat/present ]] &&
[[ $(cat $bat/present) == "1" ]] &&
[[ $(cat $bat/type) == "Battery" ]] &&
exit 0
done
exit 1

View File

@@ -0,0 +1,9 @@
#!/bin/bash
# Returns the battery percentage remaining as an integer.
# Used by the battery monitor and the Ctrl + Shift + Super + B hotkey.
upower -i $(upower -e | grep BAT) | awk '/percentage/ {
print int($2)
exit
}'

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Returns the battery time remaining (to empty or full) in a compact format.
battery_info=$(upower -i $(upower -e | grep BAT))
echo "$battery_info" | awk '/time to (empty|full)/ {
value = $4
unit = $5
if (unit == "minutes") {
hours = int(value / 60)
minutes = int(value % 60)
} else {
hours = int(value)
minutes = int((value - hours) * 60)
}
if (hours > 0 && minutes > 0) {
printf "%dh %dm", hours, minutes
} else if (hours > 0) {
printf "%dh", hours
} else {
printf "%dm", minutes
}
exit
}'

View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Returns a formatted battery status string with percentage and power draw/charge.
# Used by the battery notification hotkey (Ctrl + Shift + Super + B).
battery_info=$(upower -i $(upower -e | grep BAT))
percentage=$(echo "$battery_info" | awk '/percentage/ {
print int($2)
exit
}')
power_rate=$(echo "$battery_info" | awk '/energy-rate/ {
rounded = sprintf("%.1f", $2)
sub(/\.0$/, "", rounded)
print rounded
exit
}')
state=$(echo "$battery_info" | awk '/state/ { print $2; exit }')
time_remaining=$(nnomarchy-battery-remaining-time)
capacity=$(nnomarchy-battery-capacity)
if [[ $state == "charging" ]]; then
echo "󰁹 Battery ${percentage}% · ${time_remaining} to full ·  ${power_rate}W / ${capacity}Wh"
else
echo "󰁹 Battery ${percentage}% · ${time_remaining} left ·  ${power_rate}W / ${capacity}Wh"
fi

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Adjust brightness on the most likely display device.
# Usage: nnomarchy-brightness-display <step>
step="${1:-+5%}"
# Start with the first possible output, then refine to the most likely given an order heuristic.
device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)"
for candidate in amdgpu_bl* intel_backlight acpi_video*; do
if [[ -e /sys/class/backlight/$candidate ]]; then
device="$candidate"
break
fi
done
# Set the actual brightness of the display device.
brightnessctl -d "$device" set "$step" >/dev/null
# Use SwayOSD to display the new brightness setting.
nnomarchy-swayosd-brightness "$(brightnessctl -d "$device" -m | cut -d',' -f4 | tr -d '%')"

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Adjust the brightness on Apple Studio Displays and Apple XDR Displays using asdcontrol.
if (( $# == 0 )); then
echo "Adjust Apple Display Brightness by passing +5000 or -5000 (or any range from 0-60000)"
else
device="$(sudo asdcontrol --detect /dev/usb/hiddev* | grep ^/dev/usb/hiddev | cut -d: -f1)"
sudo asdcontrol "$device" -- "$1" >/dev/null
value="$(sudo asdcontrol "$device" | awk -F= '/BRIGHTNESS=/{print $2+0}')"
nnomarchy-swayosd-brightness "$(( value * 100 / 60000 ))"
fi

View File

@@ -0,0 +1,42 @@
#!/bin/bash
# Adjust keyboard backlight brightness using available steps.
# Usage: nnomarchy-brightness-keyboard <up|down|cycle>
direction="${1:-up}"
# Find keyboard backlight device (look for *kbd_backlight* pattern in leds class).
device=""
for candidate in /sys/class/leds/*kbd_backlight*; do
if [[ -e $candidate ]]; then
device="$(basename "$candidate")"
break
fi
done
if [[ -z $device ]]; then
echo "No keyboard backlight device found" >&2
exit 1
fi
# Get current and max brightness to determine step size.
max_brightness="$(brightnessctl -d "$device" max)"
current_brightness="$(brightnessctl -d "$device" get)"
# Calculate step as one unit (keyboards typically have discrete levels like 0-3).
if [[ $direction == "cycle" ]]; then
new_brightness=$(( (current_brightness + 1) % (max_brightness + 1) ))
elif [[ $direction == "up" ]]; then
new_brightness=$((current_brightness + 1))
(( new_brightness > max_brightness )) && new_brightness=$max_brightness
else
new_brightness=$((current_brightness - 1))
(( new_brightness < 0 )) && new_brightness=0
fi
# Set the new brightness.
brightnessctl -d "$device" set "$new_brightness" >/dev/null
# Use SwayOSD to display the new brightness setting.
percent=$((new_brightness * 100 / max_brightness))
nnomarchy-swayosd-kbd-brightness "$percent"

View File

@@ -0,0 +1,95 @@
#!/usr/bin/env python3
"""Haptic feedback daemon for Synaptics touchpads with Manual Trigger.
Monitors touchpad button press events and sends haptic pulses via HID
feature reports. Required because the kernel's HID haptic subsystem only
supports Auto Trigger with waveform enumeration, not the simpler Manual
Trigger protocol used by these Synaptics touchpads.
"""
import fcntl, glob, os, struct, sys
VENDOR = "06CB"
PRODUCT = "D01A"
REPORT_ID = 0x37
INTENSITY = 40 # 0-100
# input_event: struct timeval (16 bytes on 64-bit) + type(H) + code(H) + value(i)
EVENT_FORMAT = "llHHi"
EVENT_SIZE = struct.calcsize(EVENT_FORMAT)
EV_KEY = 0x01
BTN_LEFT = 272
BTN_RIGHT = 273
BTN_MIDDLE = 274
# ioctl: HIDIOCSFEATURE(len) = _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
def HIDIOCSFEATURE(length):
return 0xC0000000 | (length << 16) | (ord("H") << 8) | 0x06
def find_hidraw():
for path in sorted(glob.glob("/sys/class/hidraw/hidraw*")):
uevent = os.path.join(path, "device", "uevent")
try:
with open(uevent) as f:
content = f.read().upper()
if f"0000{VENDOR}" in content and f"0000{PRODUCT}" in content:
return os.path.join("/dev", os.path.basename(path))
except OSError:
continue
return None
def find_touchpad_event():
for path in sorted(glob.glob("/sys/class/input/event*/device/name")):
try:
with open(path) as f:
name = f.read().strip().upper()
if VENDOR in name and PRODUCT in name and "TOUCHPAD" in name:
event = path.split("/")[-3]
return os.path.join("/dev/input", event)
except OSError:
continue
return None
def main():
hidraw = find_hidraw()
if not hidraw:
print("No Synaptics haptic touchpad hidraw device found", file=sys.stderr)
sys.exit(1)
event = find_touchpad_event()
if not event:
print("No Synaptics haptic touchpad input device found", file=sys.stderr)
sys.exit(1)
print(f"Haptic touchpad: hidraw={hidraw} input={event} intensity={INTENSITY}", flush=True)
haptic_report = struct.pack("BB", REPORT_ID, INTENSITY)
ioctl_req = HIDIOCSFEATURE(len(haptic_report))
hidraw_fd = os.open(hidraw, os.O_RDWR)
event_fd = os.open(event, os.O_RDONLY)
try:
while True:
data = os.read(event_fd, EVENT_SIZE)
if len(data) < EVENT_SIZE:
continue
_, _, ev_type, code, value = struct.unpack(EVENT_FORMAT, data)
if ev_type == EV_KEY and code in (BTN_LEFT, BTN_RIGHT, BTN_MIDDLE) and value == 1:
try:
fcntl.ioctl(hidraw_fd, ioctl_req, haptic_report)
except OSError:
pass
except KeyboardInterrupt:
pass
finally:
os.close(event_fd)
os.close(hidraw_fd)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Detect whether the computer is an Asus ROG machine.
[[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "ASUSTeK COMPUTER INC." ]] &&
grep -q "ROG" /sys/class/dmi/id/product_family 2>/dev/null

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Detect whether the computer is a Framework Laptop 16.
[[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "Framework" ]] &&
nnomarchy-hw-match "Laptop 16"

5
bin/hardware/nomarchy-hw-intel Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
# Detect whether the computer has an Intel CPU.
[[ $(grep -m1 "vendor_id" /proc/cpuinfo 2>/dev/null | cut -d: -f2 | tr -d ' ') == "GenuineIntel" ]]

View File

@@ -0,0 +1,5 @@
#!/bin/bash
# Detect whether the computer has an Intel Panther Lake GPU.
lspci | grep -iE 'vga|3d|display' | grep -qi 'panther lake'

6
bin/hardware/nomarchy-hw-match Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Match against the computer's DMI product name (case-insensitive).
# Usage: nnomarchy-hw-match "XPS"
grep -qi "$1" /sys/class/dmi/id/product_name 2>/dev/null

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Detect whether the computer is a Microsoft Surface device.
[[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "Microsoft Corporation" ]] &&
nnomarchy-hw-match "Surface"

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Detect whether Vulkan is available.
[[ -d /usr/share/vulkan/icd.d ]] &&
find /usr/share/vulkan/icd.d -maxdepth 1 -name "*.json" -print -quit | grep -q .

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# Returns a list of all the available power profiles on the system.
# Used by the Nnomarchy Menu under Setup > Power Profile.
powerprofilesctl list |
awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }' |
tac

View File

@@ -0,0 +1,5 @@
#!/bin/bash
# Restart makima - key remapping service for remapping Copilot key to Nnomarchy Menu
sudo systemctl restart makima

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# Reload the intel_quicki2c driver to fix a dead trackpad.
# The THC (Touch Host Controller) can fail to initialize interrupts
# during boot or after suspend, leaving the trackpad registered but
# not delivering events.
sudo modprobe -r intel_quicki2c && sudo modprobe intel_quicki2c

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Toggle dedicated vs integrated GPU mode via supergfxd (for hybrid gpu laptops, like Asus G14).
# Declarative enablement + Runtime mode switching for Nnomarchy NixOS.
STATE_FILE="/etc/nixos/state.json"
# Check if supergfxd is enabled in config
if [[ $(sudo jq -r '.features.hybridGPU // false' "$STATE_FILE") != "true" ]]; then
if gum confirm "Hybrid GPU support is not enabled. Enable it now? (Requires sys-update)"; then
sudo jq ".features.hybridGPU = true" "$STATE_FILE" > /tmp/state.json && sudo mv /tmp/state.json "$STATE_FILE"
echo "Hybrid GPU support enabled in configuration. Applying changes..."
sudo sys-update
echo "Please run this command again after the update."
exit 0
fi
exit 1
fi
if ! command -v supergfxctl &> /dev/null; then
echo "supergfxctl not found. Is the system updated?"
exit 1
fi
gpu_mode=$(supergfxctl -g)
echo "Current GPU mode: $gpu_mode"
case "$gpu_mode" in
"Integrated")
if gum confirm "Switch to Hybrid mode (enables dGPU) and reboot?"; then
supergfxctl -m Hybrid
echo "Switching to Hybrid mode..."
nnomarchy-system-reboot
fi
;;
"Hybrid")
if gum confirm "Switch to Integrated mode (disables dGPU) and reboot?"; then
supergfxctl -m Integrated
echo "Switching to Integrated mode..."
nnomarchy-system-reboot
fi
;;
*)
echo "Hybrid GPU in unknown mode: $gpu_mode. Try 'supergfxctl -m Hybrid' manually."
exit 1
;;
esac

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Toggles wifi power saving declaratively.
# Usage: nnomarchy-wifi-powersave <on|off>
STATE_FILE="/etc/nixos/state.json"
case "$1" in
on) value="true" ;;
off) value="false" ;;
*) echo "Usage: nnomarchy-wifi-powersave <on|off>"; exit 1 ;;
esac
sudo jq ".wifi.powersave = $value" "$STATE_FILE" > /tmp/state.json && sudo mv /tmp/state.json "$STATE_FILE"
echo "Wifi powersave set to $1. Applying changes..."
sudo sys-update