Skip to content

Commit 76d09b2

Browse files
authored
Merge pull request #5192 from basecamp/rc
Omarchy 3.5.0
2 parents b4cb5e2 + f18dfdd commit 76d09b2

159 files changed

Lines changed: 1088 additions & 177 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/omarchy-battery-monitor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ BATTERY_STATE=$(upower -i $(upower -e | grep 'BAT') | grep -E "state" | awk '{pr
99

1010
send_notification() {
1111
notify-send -u critical "󱐋 Time to recharge!" "Battery is down to ${1}%" -i battery-caution -t 30000
12+
omarchy-hook battery-low "$1"
1213
}
1314

1415
if [[ -n $BATTERY_LEVEL && $BATTERY_LEVEL =~ ^[0-9]+$ ]]; then

bin/omarchy-battery-remaining-time

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
battery_info=$(upower -i $(upower -e | grep BAT))
66

77
echo "$battery_info" | awk '/time to (empty|full)/ {
8-
hours = int($4)
9-
minutes = int(($4 - hours) * 60)
10-
if (minutes > 0) {
11-
printf "%dh %dm", hours, minutes
8+
value = $4
9+
unit = $5
10+
if (unit ~ /^minute/) {
11+
printf "%dm", int(value)
1212
} else {
13-
printf "%dh", hours
13+
hours = int(value)
14+
minutes = int((value - hours) * 60)
15+
if (minutes > 0) {
16+
printf "%dh %dm", hours, minutes
17+
} else {
18+
printf "%dh", hours
19+
}
1420
}
1521
exit
1622
}'

bin/omarchy-brightness-keyboard

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ fi
2323
max_brightness="$(brightnessctl -d "$device" max)"
2424
current_brightness="$(brightnessctl -d "$device" get)"
2525

26-
# Calculate step as one unit (keyboards typically have discrete levels like 0-3).
26+
# Calculate step as 10% of max brightness. Keyboards with many levels (e.g. 512)
27+
# need larger steps; keyboards with few levels (e.g. 3) fall back to step=1.
28+
step=$(( max_brightness / 10 ))
29+
(( step < 1 )) && step=1
30+
2731
if [[ $direction == "cycle" ]]; then
28-
new_brightness=$(( (current_brightness + 1) % (max_brightness + 1) ))
32+
new_brightness=$(( current_brightness + step ))
33+
(( new_brightness > max_brightness )) && new_brightness=0
2934
elif [[ $direction == "up" ]]; then
30-
new_brightness=$((current_brightness + 1))
35+
new_brightness=$(( current_brightness + step ))
3136
(( new_brightness > max_brightness )) && new_brightness=$max_brightness
3237
else
33-
new_brightness=$((current_brightness - 1))
38+
new_brightness=$(( current_brightness - step ))
3439
(( new_brightness < 0 )) && new_brightness=0
3540
fi
3641

bin/omarchy-cmd-screenrecord

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ start_webcam_overlay() {
6363
done
6464

6565
ffplay -f v4l2 $video_size_arg -framerate 30 "$WEBCAM_DEVICE" \
66-
-vf "scale=${target_width}:-1" \
66+
-vf "crop=iw/2:ih,scale=${target_width}:-1" \
6767
-window_title "WebcamOverlay" \
6868
-noborder \
6969
-fflags nobuffer -flags low_delay \

bin/omarchy-cmd-screenshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}"
99

1010
if [[ ! -d $OUTPUT_DIR ]]; then
11-
notify-send "Screenshot directory does not exist: $OUTPUT_DIR" -u critical -t 3000
12-
exit 1
11+
mkdir -p "$OUTPUT_DIR"
12+
notify-send "Created screenshot directory: $OUTPUT_DIR" -u normal -t 2000
1313
fi
1414

1515
pkill slurp && exit 0

bin/omarchy-font-set

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if [[ -n $font_name ]]; then
3333
omarchy-restart-swayosd
3434

3535
if pgrep -x ghostty; then
36-
notify-send " You must restart Ghostty to see font change"
36+
notify-send -u low " You must restart Ghostty to see font change"
3737
fi
3838

3939
omarchy-hook font-set "$font_name"

bin/omarchy-haptic-touchpad

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env python3
2+
3+
"""Haptic feedback daemon for Synaptics touchpads with Manual Trigger.
4+
5+
Monitors touchpad button press events and sends haptic pulses via HID
6+
feature reports. Required because the kernel's HID haptic subsystem only
7+
supports Auto Trigger with waveform enumeration, not the simpler Manual
8+
Trigger protocol used by these Synaptics touchpads.
9+
"""
10+
11+
import fcntl, glob, os, struct, sys
12+
13+
VENDOR = "06CB"
14+
PRODUCT = "D01A"
15+
REPORT_ID = 0x37
16+
INTENSITY = 40 # 0-100
17+
18+
# input_event: struct timeval (16 bytes on 64-bit) + type(H) + code(H) + value(i)
19+
EVENT_FORMAT = "llHHi"
20+
EVENT_SIZE = struct.calcsize(EVENT_FORMAT)
21+
EV_KEY = 0x01
22+
BTN_LEFT = 272
23+
BTN_RIGHT = 273
24+
BTN_MIDDLE = 274
25+
26+
# ioctl: HIDIOCSFEATURE(len) = _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
27+
def HIDIOCSFEATURE(length):
28+
return 0xC0000000 | (length << 16) | (ord("H") << 8) | 0x06
29+
30+
31+
def find_hidraw():
32+
for path in sorted(glob.glob("/sys/class/hidraw/hidraw*")):
33+
uevent = os.path.join(path, "device", "uevent")
34+
try:
35+
with open(uevent) as f:
36+
content = f.read().upper()
37+
if f"0000{VENDOR}" in content and f"0000{PRODUCT}" in content:
38+
return os.path.join("/dev", os.path.basename(path))
39+
except OSError:
40+
continue
41+
return None
42+
43+
44+
def find_touchpad_event():
45+
for path in sorted(glob.glob("/sys/class/input/event*/device/name")):
46+
try:
47+
with open(path) as f:
48+
name = f.read().strip().upper()
49+
if VENDOR in name and PRODUCT in name and "TOUCHPAD" in name:
50+
event = path.split("/")[-3]
51+
return os.path.join("/dev/input", event)
52+
except OSError:
53+
continue
54+
return None
55+
56+
57+
def main():
58+
hidraw = find_hidraw()
59+
if not hidraw:
60+
print("No Synaptics haptic touchpad hidraw device found", file=sys.stderr)
61+
sys.exit(1)
62+
63+
event = find_touchpad_event()
64+
if not event:
65+
print("No Synaptics haptic touchpad input device found", file=sys.stderr)
66+
sys.exit(1)
67+
68+
print(f"Haptic touchpad: hidraw={hidraw} input={event} intensity={INTENSITY}", flush=True)
69+
70+
haptic_report = struct.pack("BB", REPORT_ID, INTENSITY)
71+
ioctl_req = HIDIOCSFEATURE(len(haptic_report))
72+
73+
hidraw_fd = os.open(hidraw, os.O_RDWR)
74+
event_fd = os.open(event, os.O_RDONLY)
75+
76+
try:
77+
while True:
78+
data = os.read(event_fd, EVENT_SIZE)
79+
if len(data) < EVENT_SIZE:
80+
continue
81+
_, _, ev_type, code, value = struct.unpack(EVENT_FORMAT, data)
82+
if ev_type == EV_KEY and code in (BTN_LEFT, BTN_RIGHT, BTN_MIDDLE) and value == 1:
83+
try:
84+
fcntl.ioctl(hidraw_fd, ioctl_req, haptic_report)
85+
except OSError:
86+
pass
87+
except KeyboardInterrupt:
88+
pass
89+
finally:
90+
os.close(event_fd)
91+
os.close(hidraw_fd)
92+
93+
94+
if __name__ == "__main__":
95+
main()

bin/omarchy-hibernation-setup

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ if [[ ! -f $RESUME_DROP_IN ]]; then
7373
echo "Adding resume kernel parameters"
7474
sudo swapon -p 0 "$SWAP_FILE" 2>/dev/null
7575
RESUME_DEVICE=$(findmnt -no SOURCE -T "$SWAP_FILE" | sed 's/\[.*\]//')
76-
RESUME_OFFSET=$(btrfs inspect-internal map-swapfile -r "$SWAP_FILE")
76+
RESUME_OFFSET=$(sudo btrfs inspect-internal map-swapfile -r "$SWAP_FILE")
7777
sudo mkdir -p /etc/limine-entry-tool.d
7878
echo "KERNEL_CMDLINE[default]+=\" resume=$RESUME_DEVICE resume_offset=$RESUME_OFFSET\"" | sudo tee "$RESUME_DROP_IN" >/dev/null
79+
sudo tee -a /etc/default/limine < "$RESUME_DROP_IN" >/dev/null
7980
fi
8081

8182
# Use ACPI alarm for RTC wakeup on s2idle systems (needed for suspend-then-hibernate)
@@ -85,6 +86,7 @@ if grep -q "\[s2idle\]" /sys/power/mem_sleep 2>/dev/null; then
8586
echo "Enabling ACPI RTC alarm for s2idle suspend"
8687
sudo mkdir -p /etc/limine-entry-tool.d
8788
echo 'KERNEL_CMDLINE[default]+=" rtc_cmos.use_acpi_alarm=1"' | sudo tee "$LIMINE_DROP_IN" >/dev/null
89+
sudo tee -a /etc/default/limine < "$LIMINE_DROP_IN" >/dev/null
8890
fi
8991
fi
9092

bin/omarchy-hw-framework16

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Detect whether the computer is a Framework Laptop 16.
44

55
[[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "Framework" ]] &&
6-
grep -q "Laptop 16" /sys/class/dmi/id/product_name 2>/dev/null
6+
omarchy-hw-match "Laptop 16"

bin/omarchy-hw-intel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
# Detect whether the computer has an Intel CPU.
4+
5+
[[ $(grep -m1 "vendor_id" /proc/cpuinfo 2>/dev/null | cut -d: -f2 | tr -d ' ') == "GenuineIntel" ]]

0 commit comments

Comments
 (0)