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 #!/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 cp_chown custom/laptop-tlp.conf /etc/tlp.conf root:root 644
systemctl restart tlp systemctl restart tlp
file_has_line "/etc/profile" "export FEAT_BRIGHTNESS=brightnessctl"
# apps
install libreoffice-still

View File

@ -6,7 +6,7 @@ PACKAGES=(
# system # system
linux base linux-firmware lvm2 sudo polkit # base 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 openssh man-db restic htop # admin utils
# cli programs # cli programs
@ -14,7 +14,7 @@ PACKAGES=(
dash shellcheck # shell scripting dash shellcheck # shell scripting
hugo miniserve neomutt translate-shell # www hugo miniserve neomutt translate-shell # www
gnupg pass pass-otp # crypt gnupg pass pass-otp # crypt
jq qalc # data processing jq libqalculate # data processing
git zip # others git zip # others
# desktop env # desktop env
@ -33,6 +33,9 @@ PACKAGES=(
) )
install() {
pacman -S --needed --noconfirm "$@"
}
file_has_line() { file_has_line() {
grep -qxF "$2" "$1" || echo "$2" >> "$1" grep -qxF "$2" "$1" || echo "$2" >> "$1"
} }
@ -45,11 +48,14 @@ cp_chown() {
[ "$(id -u)" != "0" ] && echo "ERROR: root required" >&2 && exit 1 [ "$(id -u)" != "0" ] && echo "ERROR: root required" >&2 && exit 1
pacman -Syu pacman -Syu
pacman -S --needed "${PACKAGES[@]}" install "${PACKAGES[@]}"
file_has_line "/etc/profile" "umask 002" 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' {} \; 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 while read -r entity; do
# group <name> <id> # group <name> <id>
# user <name> <id> [<secondary groups>...] # user <name> <id> [<secondary groups>...]

View File

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

View File

@ -119,6 +119,9 @@ bindsym --to-code $mod+Space exec run.sh
############################################## ##############################################
################# daemons #################### ################# 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 foot -s
exec mako exec mako
############################################## ##############################################