Compare commits

...
5 Commits
14 changed files with 163 additions and 57 deletions

No files matched your search

+2 -2
View File
@@ -63,7 +63,7 @@ On a fresh Arch install, logged in as your own user with sudo and a network
connection: connection:
```bash ```bash
curl -fsSL https://git.sirblob.co/SirBlob/blomarchy/raw/branch/main/bootstrap.sh | bash curl -fsSL https://git.sirblob.co/SirBlob/dotfiles/raw/branch/main/bootstrap.sh | bash
``` ```
`bootstrap.sh` installs `git`, clones this repository to `~/dotfiles` (or `bootstrap.sh` installs `git`, clones this repository to `~/dotfiles` (or
@@ -93,7 +93,7 @@ It runs these steps, in this order, and every one of them is idempotent:
| 4. Config | copies `hypr/`, the themed app configs, `blob/shell.json`, and the uwsm environment into `~/.config`, sets the default apps for images, video, PDFs, office files, text and archives, and writes `/etc/profile.d/blob.sh` so a login shell finds the `blob` command | | 4. Config | copies `hypr/`, the themed app configs, `blob/shell.json`, and the uwsm environment into `~/.config`, sets the default apps for images, video, PDFs, office files, text and archives, and writes `/etc/profile.d/blob.sh` so a login shell finds the `blob` command |
| 5. First theme | links `~/wallpapers` to the checkout, applies `flats` headless, picks a background, and links the btop and Neovim theme files, so the first login is not a blank desktop | | 5. First theme | links `~/wallpapers` to the checkout, applies `flats` headless, picks a background, and links the btop and Neovim theme files, so the first login is not a blank desktop |
| 6. User units | installs the session services into `~/.config/systemd/user` and enables them | | 6. User units | installs the session services into `~/.config/systemd/user` and enables them |
| 7. systemd drop-ins | writes the shutdown timeouts, oomd thresholds, plocate prune paths, and sleep hooks under `/etc`, and turns Wi-Fi power saving off in NetworkManager | | 7. systemd drop-ins | writes the shutdown timeouts, oomd thresholds, plocate prune paths, and sleep hooks under `/etc`, turns Wi-Fi power saving off in NetworkManager, and has it prefer 5GHz over 2.4GHz |
| 8. System services | enables NetworkManager, resolved, bluetooth, cups, avahi, docker, power-profiles-daemon, and oomd, masks `NetworkManager-wait-online`, sets the boot splash to `branding/blob_boot.png`, and sets GRUB up with every other installed OS in its menu | | 8. System services | enables NetworkManager, resolved, bluetooth, cups, avahi, docker, power-profiles-daemon, and oomd, masks `NetworkManager-wait-online`, sets the boot splash to `branding/blob_boot.png`, and sets GRUB up with every other installed OS in its menu |
| 9. Login screen | installs the session entry, the SDDM config and the Blob login theme, enables `sddm.service`, and sets the default target to `graphical.target` | | 9. Login screen | installs the session entry, the SDDM config and the Blob login theme, enables `sddm.service`, and sets the default target to `graphical.target` |
| 10. Reload | reloads systemd, restarts the running user services, and in a running session re-renders the theme, reloads Hyprland, and restarts the Blob shell | | 10. Reload | reloads systemd, restarts the running user services, and in a running session re-renders the theme, reloads Hyprland, and restarts the Blob shell |
+4 -21
View File
@@ -40,32 +40,15 @@ provider_from_arg() {
esac esac
} }
# The path etc/sudoers.d/blob-network-dns names. The privileged half always runs from script_path=$(readlink -f "${BASH_SOURCE[0]}")
# there rather than from whichever copy was invoked, so the rule matches even
# where $BLOB_PATH points at a checkout.
PACKAGED_PATH=/usr/bin/blob-network-dns
# True when sudo would run this exact command without stopping for a password.
# `sudo -l` on its own reports whether a command is permitted, which the blanket
# %wheel rule answers yes to for everything; the long listing prints the matched
# entry's tags, so !authenticate is the grant in etc/sudoers.d/blob-network-dns and
# nothing else. Listing runs nothing and, under -n, prompts for nothing, so a
# machine whose blob-settings predates that file falls through to polkit
# instead of dying on a password prompt it has no terminal to show.
sudo_grants_passwordless() {
sudo -n -l -l "$PACKAGED_PATH" "$@" 2>/dev/null | grep -q '!authenticate'
}
require_root() { require_root() {
if (( EUID == 0 )); then if (( EUID == 0 )); then
return return
elif [[ -t 0 ]] || sudo_grants_passwordless "$@"; then elif [[ -t 0 ]]; then
# A terminal can carry sudo's own password prompt. Without one, sudo is exec sudo "$script_path" "$@"
# right only where the grant reaches; polkit can at least put a prompt on
# screen, and offer to authenticate as someone else.
exec sudo "$PACKAGED_PATH" "$@"
else else
exec pkexec "$PACKAGED_PATH" "$@" exec pkexec "$script_path" "$@"
fi fi
} }
+1 -1
View File
@@ -2,7 +2,7 @@
set -e set -e
repo_url="${BLOB_REPO_URL:-https://git.sirblob.co/SirBlob/blomarchy.git}" repo_url="${BLOB_REPO_URL:-https://git.sirblob.co/SirBlob/dotfiles.git}"
repo_branch="${BLOB_REPO_BRANCH:-main}" repo_branch="${BLOB_REPO_BRANCH:-main}"
checkout_dir="${BLOB_CHECKOUT_DIR:-$HOME/dotfiles}" checkout_dir="${BLOB_CHECKOUT_DIR:-$HOME/dotfiles}"
+12 -24
View File
@@ -1,25 +1,13 @@
@@ @@ @@ ( ) (
@@ @@ @@ ) ( ) )
@@ @@ @@ ( ) ( (
@@ @@ @@
@@ @@ @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
@@ @@ ██ ██▄▄▄▄▄
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ██ ██ ██
@@ @@@@@@ ██ ██ ██
@@ @@ @@ ██ ██▀▀▀▀▀
@@ @@ @@ ██ ██
@@ @@ @@ ▀█▄▄▄▄▄▄▄▄▄▄▄█▀
@@ @@ @@ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
@@ @@@@@@@ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
@@ @@
@@ @@
@@ @@
@@ @@
@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@ @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+1
View File
@@ -0,0 +1 @@
MAKEFLAGS="-j$(nproc)"
@@ -0,0 +1,108 @@
#!/bin/bash
interface=$1
action=$2
connection_uuid=${CONNECTION_UUID:-}
minimum_signal=40
signal_margin=20
retry_seconds=600
settle_seconds=5
state_dir=/run/blob-wifi-band
field_separator=$'\x1f'
nm_get() {
LC_ALL=C nmcli -g "$@" 2>/dev/null
}
frequency_band() {
local mhz=${1%%[!0-9]*}
[[ -n $mhz ]] || return 1
if ((mhz >= 2400 && mhz < 2500)); then
echo "2.4"
elif ((mhz >= 4900 && mhz < 7125)); then
echo "5"
else
return 1
fi
}
should_run() {
[[ $action == up && -n $interface && -n $connection_uuid ]] || return 1
[[ $(nm_get GENERAL.TYPE device show "$interface") == wifi ]] || return 1
[[ -z $(nm_get 802-11-wireless.band connection show "$connection_uuid") ]] || return 1
[[ -z $(nm_get 802-11-wireless.bssid connection show "$connection_uuid") ]] || return 1
}
attempted_recently() {
local marker="$state_dir/$connection_uuid"
[[ -e $marker ]] || return 1
(($(date +%s) - $(stat -c %Y "$marker") < retry_seconds))
}
mark_attempt() {
mkdir -p "$state_dir"
touch "$state_dir/$connection_uuid"
}
list_access_points() {
nm_get IN-USE,FREQ,SIGNAL,BSSID,SSID device wifi list ifname "$interface" --rescan no |
sed "s/\\\\:/$field_separator/g"
}
find_better_access_point() {
local in_use frequency signal bssid ssid
local current_ssid="" current_signal=0 current_band=""
local best_bssid="" best_signal=0
local access_points
access_points=$(list_access_points)
while IFS=: read -r in_use frequency signal bssid ssid; do
[[ $in_use == "*" ]] || continue
current_ssid=${ssid//$field_separator/:}
current_signal=$signal
current_band=$(frequency_band "$frequency")
done <<<"$access_points"
[[ $current_band == "2.4" && -n $current_ssid ]] || return 1
while IFS=: read -r in_use frequency signal bssid ssid; do
[[ ${ssid//$field_separator/:} == "$current_ssid" ]] || continue
[[ $(frequency_band "$frequency") == "5" ]] || continue
((signal > best_signal)) || continue
best_signal=$signal
best_bssid=${bssid//$field_separator/:}
done <<<"$access_points"
[[ -n $best_bssid ]] || return 1
((best_signal >= minimum_signal)) || return 1
((best_signal + signal_margin >= current_signal)) || return 1
echo "$best_bssid"
}
switch_to_faster_band() {
local target_bssid
nmcli device wifi rescan ifname "$interface" &>/dev/null
sleep "$settle_seconds"
[[ $(nm_get GENERAL.CONNECTION device show "$interface") == "$(nm_get connection.id connection show "$connection_uuid")" ]] || return 0
target_bssid=$(find_better_access_point) || return 0
mark_attempt
nmcli connection up uuid "$connection_uuid" ifname "$interface" ap "$target_bssid" &>/dev/null
}
should_run || exit 0
attempted_recently && exit 0
if [[ -z ${BLOB_WIFI_BAND_DETACHED:-} ]]; then
BLOB_WIFI_BAND_DETACHED=1 setsid -f "$0" "$@" &>/dev/null
exit 0
fi
switch_to_faster_band
+6 -2
View File
@@ -112,7 +112,11 @@ with `--check`.
oomd pressure thresholds, the plocate prune paths, and the sleep hooks. oomd pressure thresholds, the plocate prune paths, and the sleep hooks.
`/etc/NetworkManager/conf.d/10-blob-wifi-powersave.conf` turns Wi-Fi power `/etc/NetworkManager/conf.d/10-blob-wifi-powersave.conf` turns Wi-Fi power
saving off, and NetworkManager is reloaded when it changes. saving off, and NetworkManager is reloaded when it changes.
8. **System services** are enabled: NetworkManager, resolved, bluetooth, cups, `/etc/NetworkManager/dispatcher.d/90-blob-wifi-prefer-5ghz` moves a Wi-Fi
connection that comes up on 2.4GHz to the same network on 5GHz or 6GHz when
that band has a usable signal. It skips profiles that have a band or BSSID
pinned with `blob network band`.
8. **System services** are enabled: NetworkManager and its dispatcher, resolved, bluetooth, cups,
avahi, docker, power-profiles-daemon, and oomd. avahi, docker, power-profiles-daemon, and oomd.
`NetworkManager-wait-online.service` is masked so a slow DHCP lease cannot `NetworkManager-wait-online.service` is masked so a slow DHCP lease cannot
hold up the login screen, and `plymouth-start.service` and hold up the login screen, and `plymouth-start.service` and
@@ -218,7 +222,7 @@ things, the first three only when the tool is installed:
| `powerprofilesctl` function | runs it on `/usr/bin/python3`, since a mise Python ahead on `PATH` has no `gi` module | | `powerprofilesctl` function | runs it on `/usr/bin/python3`, since a mise Python ahead on `PATH` has no `gi` module |
`--cmd cd` replaces `cd` rather than adding a `z` command, so `--cmd cd` replaces `cd` rather than adding a `z` command, so
`cd blomarchy` jumps to the last matching directory you have visited from `cd dotfiles` jumps to the last matching directory you have visited from
anywhere, while `cd ./relative/path`, `cd -` and `cd` with no argument keep anywhere, while `cd ./relative/path`, `cd -` and `cd` with no argument keep
behaving exactly as the builtin does. `cdi` picks from the matches behaving exactly as the builtin does. `cdi` picks from the matches
interactively through `fzf`, and `zoxide query -ls` prints the database. interactively through `fzf`, and `zoxide query -ls` prints the database.
+1
View File
@@ -80,6 +80,7 @@ install_bar_widgets
remove_omarchy_font remove_omarchy_font
refresh_font_cache refresh_font_cache
install_shell_profile install_shell_profile
install_makepkg_config
install_bash_integration install_bash_integration
install_user_units install_user_units
install_systemd_dropins install_systemd_dropins
+6 -1
View File
@@ -7,7 +7,7 @@
# having run first. # having run first.
link_blob_path() { link_blob_path() {
local current="" local current=""
[[ -L $blob_path ]] && current="$(readlink -f "$blob_path")" [[ -L $blob_path ]] && current="$(readlink -f "$blob_path" || true)"
if [[ $current == "$repo_dir" ]]; then if [[ $current == "$repo_dir" ]]; then
say "ok BLOB_PATH -> $repo_dir" say "ok BLOB_PATH -> $repo_dir"
@@ -125,6 +125,11 @@ install_shell_profile() {
install_root_file "$repo_dir/session/profile.sh" /etc/profile.d/blob.sh "profile.d/blob.sh" install_root_file "$repo_dir/session/profile.sh" /etc/profile.d/blob.sh "profile.d/blob.sh"
} }
install_makepkg_config() {
install_root_file "$repo_dir/default/makepkg/blob-parallel.conf" \
/etc/makepkg.conf.d/blob-parallel.conf "makepkg.conf.d/blob-parallel.conf"
}
install_zen_config() { install_zen_config() {
local profile local profile
profile="$(find "$config_dir/zen" -maxdepth 1 -type d -name '*.Default (release)*' 2>/dev/null | head -1)" profile="$(find "$config_dir/zen" -maxdepth 1 -type d -name '*.Default (release)*' 2>/dev/null | head -1)"
+4
View File
@@ -1,5 +1,6 @@
system_services=( system_services=(
NetworkManager.service NetworkManager.service
NetworkManager-dispatcher.service
systemd-resolved.service systemd-resolved.service
bluetooth.service bluetooth.service
cups.service cups.service
@@ -122,6 +123,9 @@ install_network_config() {
install_root_file "$repo_dir/default/networkmanager/conf.d/10-blob-wifi-powersave.conf" \ install_root_file "$repo_dir/default/networkmanager/conf.d/10-blob-wifi-powersave.conf" \
/etc/NetworkManager/conf.d/10-blob-wifi-powersave.conf \ /etc/NetworkManager/conf.d/10-blob-wifi-powersave.conf \
"NetworkManager/conf.d/10-blob-wifi-powersave.conf" "NetworkManager/conf.d/10-blob-wifi-powersave.conf"
install_root_file "$repo_dir/default/networkmanager/dispatcher.d/90-blob-wifi-prefer-5ghz" \
/etc/NetworkManager/dispatcher.d/90-blob-wifi-prefer-5ghz \
"NetworkManager/dispatcher.d/90-blob-wifi-prefer-5ghz" 0755
[[ $check == true ]] && return 0 [[ $check == true ]] && return 0
(( changes > changes_before )) || return 0 (( changes > changes_before )) || return 0
+1 -1
View File
@@ -9,7 +9,7 @@ link_wallpapers() {
local source="$repo_dir/wallpapers" local source="$repo_dir/wallpapers"
local current="" local current=""
[[ -L $wallpaper_dir ]] && current="$(readlink -f "$wallpaper_dir")" [[ -L $wallpaper_dir ]] && current="$(readlink -f "$wallpaper_dir" || true)"
if [[ $current == "$source" ]]; then if [[ $current == "$source" ]]; then
say "ok wallpapers" say "ok wallpapers"
+7
View File
@@ -14,3 +14,10 @@ case ":$PATH:" in
*) PATH="${PATH:+$PATH:}$HOME/.local/bin" ;; *) PATH="${PATH:+$PATH:}$HOME/.local/bin" ;;
esac esac
export PATH export PATH
cpu_cores=$(nproc 2>/dev/null || echo 1)
: "${MAKEFLAGS:=-j$cpu_cores}"
: "${CMAKE_BUILD_PARALLEL_LEVEL:=$cpu_cores}"
: "${CARGO_BUILD_JOBS:=$cpu_cores}"
export MAKEFLAGS CMAKE_BUILD_PARALLEL_LEVEL CARGO_BUILD_JOBS
unset cpu_cores
+7 -2
View File
@@ -317,14 +317,18 @@ function canForgetNetwork(network) {
// must never be an argument (printf is a bash builtin, so no process spawns // must never be an argument (printf is a bash builtin, so no process spawns
// with it either). // with it either).
var enterpriseConnectScript = var enterpriseConnectScript =
"u=$(uuidgen); IFS= read -r pw; server_check=();" + "u=$(uuidgen); IFS= read -r pw; server_check=(); old_profiles=();" +
" [ -n \"$5\" ] && server_check=(802-1x.system-ca-certs yes 802-1x.domain-suffix-match \"$5\");" + " [ -n \"$5\" ] && server_check=(802-1x.system-ca-certs yes 802-1x.domain-suffix-match \"$5\");" +
" while IFS=: read -r id type; do" +
" [ \"$type\" = 802-11-wireless ] && [ \"$(nmcli -e no -g 802-11-wireless.ssid connection show uuid \"$id\")\" = \"$1\" ] && old_profiles+=(\"$id\");" +
" done < <(nmcli -g UUID,TYPE connection show);" +
" nmcli connection add type wifi con-name \"$1\" ssid \"$1\" connection.uuid \"$u\"" + " nmcli connection add type wifi con-name \"$1\" ssid \"$1\" connection.uuid \"$u\"" +
" connection.autoconnect no" + " connection.autoconnect no" +
" wifi-sec.key-mgmt wpa-eap 802-1x.eap \"$3\" 802-1x.phase2-auth \"$4\"" + " wifi-sec.key-mgmt wpa-eap 802-1x.eap \"$3\" 802-1x.phase2-auth \"$4\"" +
" 802-1x.identity \"$2\" 802-1x.auth-timeout 8 \"${server_check[@]}\" >/dev/null" + " 802-1x.identity \"$2\" 802-1x.auth-timeout 8 \"${server_check[@]}\" >/dev/null" +
" && printf 'set 802-1x.password %s\\nsave\\nquit\\n' \"$pw\" | nmcli connection edit uuid \"$u\" >/dev/null" + " && printf 'set 802-1x.password %s\\nsave\\nquit\\n' \"$pw\" | nmcli connection edit uuid \"$u\" >/dev/null" +
" && nmcli connection up uuid \"$u\"" + " && nmcli connection up uuid \"$u\"" +
" && { for id in \"${old_profiles[@]}\"; do nmcli connection delete uuid \"$id\" >/dev/null 2>&1; done; true; }" +
" && { nmcli connection modify uuid \"$u\" connection.autoconnect yes; true; }" + " && { nmcli connection modify uuid \"$u\" connection.autoconnect yes; true; }" +
" || { nmcli connection delete uuid \"$u\" >/dev/null 2>&1; false; }" " || { nmcli connection delete uuid \"$u\" >/dev/null 2>&1; false; }"
@@ -361,9 +365,10 @@ function networkFailureReason(reason, needsCredentials, reasons, isEnterprise) {
// same profile a first failed attempt leaves behind as "known"), so the user // same profile a first failed attempt leaves behind as "known"), so the user
// needs a chance to re-enter it -- connectWithPsk overwrites the stored PSK on // needs a chance to re-enter it -- connectWithPsk overwrites the stored PSK on
// submit. // submit.
function shouldRepromptPassphrase(reason, needsCredentials, reasons) { function shouldRepromptPassphrase(reason, needsCredentials, reasons, isEnterprise) {
var r = reasons || {} var r = reasons || {}
if (!needsCredentials) return false if (!needsCredentials) return false
if (isEnterprise) return reason !== r.WifiNetworkLost
return reason === r.NoSecrets || reason === r.WifiAuthTimeout return reason === r.NoSecrets || reason === r.WifiAuthTimeout
} }
+3 -3
View File
@@ -773,8 +773,8 @@ Panel {
return Model.networkFailureReason(reason, needsCredentials, connectionFailReasons, isEnterprise) return Model.networkFailureReason(reason, needsCredentials, connectionFailReasons, isEnterprise)
} }
function shouldRepromptPassphrase(reason, needsCredentials) { function shouldRepromptPassphrase(reason, needsCredentials, isEnterprise) {
return Model.shouldRepromptPassphrase(reason, needsCredentials, connectionFailReasons) return Model.shouldRepromptPassphrase(reason, needsCredentials, connectionFailReasons, isEnterprise)
} }
function checkActionCompletion(network) { function checkActionCompletion(network) {
@@ -1672,7 +1672,7 @@ Panel {
var panel = root var panel = root
var ssid = row.net.ssid || "" var ssid = row.net.ssid || ""
var ours = panel.actionKind === "connect" && panel.actionSsid === ssid var ours = panel.actionKind === "connect" && panel.actionSsid === ssid
var reprompt = ours && panel.shouldRepromptPassphrase(reason, row.requiresCredentials) var reprompt = ours && panel.shouldRepromptPassphrase(reason, row.requiresCredentials, row.isEnterprise)
panel.failNetworkAction(panel.networkForSsid(ssid), reason) panel.failNetworkAction(panel.networkForSsid(ssid), reason)
if (reprompt) panel.openPasswordPrompt(ssid) if (reprompt) panel.openPasswordPrompt(ssid)
} }