This commit is contained in:
Yuri Zamyatin 2025-01-06 08:29:28 +00:00
parent d3b1db73cb
commit b5906605a3
4 changed files with 54 additions and 17 deletions

View File

@ -1,5 +1,17 @@
#!/bin/bash
pacman -S --needed brightnessctl intel-media-driver intel-ucode mesa tlp libreoffice-still sof-firmware
# hardware
install intel-media-driver intel-ucode mesa sof-firmware
# brightness
install brightnessctl
file_has_line "/etc/profile" "export FEAT_BRIGHTNESS=brightnessctl"
# power
install tlp
systemctl enable tlp --now
cp_chown custom/laptop-tlp.conf /etc/tlp.conf root:root 644
systemctl restart tlp
file_has_line "/etc/profile" "export FEAT_BRIGHTNESS=brightnessctl"
# apps
install libreoffice-still

View File

@ -6,7 +6,7 @@ PACKAGES=(
# system
linux base linux-firmware lvm2 sudo polkit # base
pulseaudio networkmanager # system
pulseaudio pulseaudio-bluetooth bluez bluez-utils networkmanager # system
openssh man-db restic htop # admin utils
# cli programs
@ -14,7 +14,7 @@ PACKAGES=(
dash shellcheck # shell scripting
hugo miniserve neomutt translate-shell # www
gnupg pass pass-otp # crypt
jq qalc # data processing
jq libqalculate # data processing
git zip # others
# desktop env
@ -33,6 +33,9 @@ PACKAGES=(
)
install() {
pacman -S --needed --noconfirm "$@"
}
file_has_line() {
grep -qxF "$2" "$1" || echo "$2" >> "$1"
}
@ -45,11 +48,14 @@ cp_chown() {
[ "$(id -u)" != "0" ] && echo "ERROR: root required" >&2 && exit 1
pacman -Syu
pacman -S --needed "${PACKAGES[@]}"
install "${PACKAGES[@]}"
file_has_line "/etc/profile" "umask 002"
find /etc/pam.d -type f -exec sed -i -e 's/^session optional pam_umask.so$/session optional pam_umask.so usergroups/g' {} \;
sed -i 's/#AutoEnable=true/AutoEnable=false/' /etc/bluetooth/main.conf
systemctl enable bluetooth --now
while read -r entity; do
# group <name> <id>
# user <name> <id> [<secondary groups>...]

View File

@ -20,15 +20,17 @@ LIST+=(
"shell_tui" "vifm"
"shell_tui" "vim"
"tui" "htop"
"tui" "nmtui"
"float_tui" "nmtui"
"float_tui" "bluetoothctl"
"man" "man"
"term" "term"
# native
"screen_pick" "screenshot all"
"screen_pick" "screenshot output"
"screen_pick" "screenshot selection"
"pass" "pass"
"transl" "translate en-ru"
"transl" "translate ru-en"
"todo" "pass"
"tui" "calc"
"todo" "translate ru-en"
"todo" "translate en-ru"
"word_pick" "pick-word"
)
if [ "$FEAT_BRIGHTNESS" ]; then
@ -39,24 +41,27 @@ fi
LIST+=(
"direct" "sway reload"
"power" "logout"
"power-todo" "inhibit"
"todo" "inhibit"
"power" "suspend"
"power" "poweroff"
"power" "poweroff --check-inhibitors=no"
"power" "reboot"
)
# generic
sure() {
echo yes | bemenu --prompt "sure?"
}
# generic
exec_gui() {
exec "$@"
}
exec_tui() {
exec footclient -D ~/ "$@"
}
exec_float_tui() { # todo
exec footclient -D ~/ "$@"
}
exec_shell_tui() {
exec footclient -D ~/ "$SHELL" -c "$@"
}
@ -89,6 +94,15 @@ exec_man() {
fi
[ -n "$page" ] && exec footclient "$SHELL" -c "man '$page' || read -n1"
}
exec_screen_pick() {
shift 1
if [ "$1" = "output" ]; then
mon="$(swaymsg -t get_outputs | jq -r '. | map(select(.focused == true)) | .[0].name')"
grim -o "$mon" - | wl-copy -t image/png
elif [ "$1" = "selection" ]; then
grim -g "$(slurp)" - | wl-copy -t image/png
fi
}
exec_pass() {
echo 1
}
@ -96,19 +110,21 @@ exec_transl() {
echo 1
}
exec_word_pick() {
echo 1
shift 1
}
exec_brightness() {
shift
target="$1"
if [ -z "$target" ]; then
current="$(($(brightnessctl g)*100/$(brightnessctl m)))%"
list="$(echo ok; echo 1%; seq 5 5 100 | sed 's/$/%/')";
current="$(($(brightnessctl g)*100/$(brightnessctl m)))"
current_i="$((current/5))"
list="$(echo 1%; seq 5 5 100 | sed 's/$/%/')";
target="$(
echo "$list" | bemenu --prompt "$current ->"
echo "$list" | bemenu --index $current_i --prompt "$current% ->"
)";
fi
if [ -n "$target" ] && [ "$target" != "ok" ]; then
if [ -n "$target" ]; then
brightnessctl set "$target"
[ -z "$1" ] && exec_brightness brightness
fi

View File

@ -119,6 +119,9 @@ bindsym --to-code $mod+Space exec run.sh
##############################################
################# daemons ####################
exec swayidle -w \
timeout 280 'notify-send "Suspend in 20s" "Produce some acivity or run inhibit to cancel" -a "swayidle" -t 20000' \
timeout 300 'systemctl suspend'
exec foot -s
exec mako
##############################################