From b190c24860f397a0ab742f4c972412ad37b4d294 Mon Sep 17 00:00:00 2001 From: Yuri Zamyatin Date: Wed, 1 Jan 2025 00:24:48 +0000 Subject: [PATCH] wip --- arch-root/install.sh | 9 +- arch-user/config/bemenu/config.sh | 19 +- arch-user/config/config.py | 7 + .../config/foot/{foot.ini => foot.ini.tmpl} | 8 +- arch-user/config/i3blocks/weather | 2 +- arch-user/config/sway/config.tmpl | 4 +- arch-user/config/theme.sh | 13 +- arch-user/install.sh | 11 +- arch-user/scripts/run.sh | 172 ++++++++++++------ 9 files changed, 172 insertions(+), 73 deletions(-) create mode 100644 arch-user/config/config.py rename arch-user/config/foot/{foot.ini => foot.ini.tmpl} (98%) diff --git a/arch-root/install.sh b/arch-root/install.sh index 4ba3ebb..6649b0d 100644 --- a/arch-root/install.sh +++ b/arch-root/install.sh @@ -4,7 +4,7 @@ set -e PACKAGES=( # system - linux base linux-firmware lvm2 sudo polkit greetd # basic + linux base linux-firmware lvm2 sudo polkit # basic openssh networkmanager man-db restic htop # admin utils # cli programs @@ -15,17 +15,18 @@ PACKAGES=( git zip # others # desktop env - sway swaybg xorg-xwayland # basic + greetd sway swaybg xorg-xwayland # basic foot bemenu-wayland i3blocks mako libnotify # terminals, ui wev wl-clipboard wtype slurp grim # interaction ttf-roboto ttf-roboto-mono # fonts # gui apps imv mpv gimp # media - firefox sqlitebrowser qt5-wayland + qutebrowser qt6-wayland # www + sqlitebrowser qt5-wayland # db # extensions - firefox-tridactyl vim-ale vim-fugitive + vim-ale vim-fugitive ) diff --git a/arch-user/config/bemenu/config.sh b/arch-user/config/bemenu/config.sh index 5428b1a..c39e86b 100644 --- a/arch-user/config/bemenu/config.sh +++ b/arch-user/config/bemenu/config.sh @@ -1,2 +1,19 @@ #!/bin/sh -export BEMENU_OPTS="--ignorecase --width-factor 0.5 --fn \"Roboto Mono 14\" --list 500 --border 1 --scrollbar autohide --bdr #9988ff --nb #0d1117d9 --ab #0d1117d9" +export BEMENU_OPTS="\ +--ignorecase \ +--width-factor 0.5 \ +--fn \"$THEME_FONT_MONO $THEME_SIZE_FONT_LARGE_PT\" \ +--list 500 \ +--border 1 \ +--scrollbar autohide \ +--bdr #$THEME_COLOR_FG_ACCENT$THEME_OPACITY_MID_HEX \ +--scf #$THEME_COLOR_FG_ACCENT$THEME_OPACITY_MID_HEX \ +--nb #$THEME_COLOR_BG$THEME_OPACITY_HIGH_HEX \ +--ab #$THEME_COLOR_BG$THEME_OPACITY_HIGH_HEX \ +--hb #$THEME_COLOR_BG$THEME_OPACITY_HIGH_HEX \ +--nf #$THEME_COLOR_FG \ +--af #$THEME_COLOR_FG \ +--hf #$THEME_COLOR_FG_ACCENT \ +--tf #$THEME_COLOR_FG_ACCENT \ +--ff #$THEME_COLOR_FG_ACCENT \ +" diff --git a/arch-user/config/config.py b/arch-user/config/config.py new file mode 100644 index 0000000..2b2cf13 --- /dev/null +++ b/arch-user/config/config.py @@ -0,0 +1,7 @@ +config.load_autoconfig(False) +config.set('tabs.tabs_are_windows', True) +config.set('tabs.show', 'never') +for mode in ['normal','insert','hint','passthrough','command','prompt','yesno','register']: + config.bind('', 'fake-key -g ', mode) + config.bind('', 'fake-key -g ', mode) + config.bind('', 'fake-key -g ', mode) diff --git a/arch-user/config/foot/foot.ini b/arch-user/config/foot/foot.ini.tmpl similarity index 98% rename from arch-user/config/foot/foot.ini rename to arch-user/config/foot/foot.ini.tmpl index 8dcbd5b..051cd66 100644 --- a/arch-user/config/foot/foot.ini +++ b/arch-user/config/foot/foot.ini.tmpl @@ -5,9 +5,9 @@ # login-shell=no # app-id=foot # globally set wayland app-id. Default values are "foot" and "footclient" for desktop and server mode -# title=foot +title=term # locked-title=no -font=Roboto Mono:size=12 +font=$THEME_FONT_MONO:size=$THEME_SIZE_FONT_BASE_PT # font-bold= # font-italic= # font-bold-italic= @@ -83,8 +83,8 @@ pad=8x4 # optionally append 'center' # long-press-delay=400 [colors] -alpha=0.85 -background=0d1117 +alpha=$THEME_OPACITY_HIGH +background=$THEME_COLOR_BG # foreground=ffffff # flash=7f7f00 # flash-alpha=0.5 diff --git a/arch-user/config/i3blocks/weather b/arch-user/config/i3blocks/weather index a06258f..e8de141 100755 --- a/arch-user/config/i3blocks/weather +++ b/arch-user/config/i3blocks/weather @@ -1,3 +1,3 @@ #!/bin/bash -curl "https://wttr.in/?format=%l;%t,%p" --silent | sed 's/^\(.\{3\}\)\(.*\);/☀\1:/' +curl "https://wttr.in/?format=%l;%t%20%p" --silent | sed 's/^\(.\{3\}\)\(.*\);/☀\1 /' echo diff --git a/arch-user/config/sway/config.tmpl b/arch-user/config/sway/config.tmpl index 3f40234..241d581 100644 --- a/arch-user/config/sway/config.tmpl +++ b/arch-user/config/sway/config.tmpl @@ -84,7 +84,7 @@ bindsym --to-code $mod+v exec wtype -P XF86Paste default_border pixel 1 smart_borders on title_align center -font pango:Roboto 10 +font pango:$THEME_FONT_REGULAR $THEME_SIZE_FONT_SMALL_PT output * bg #$THEME_COLOR_BG solid_color client.focused #$THEME_COLOR_BG_ACCENT_LIGHT #$THEME_COLOR_BG_ACCENT_LIGHT #$THEME_COLOR_FG #$THEME_COLOR_FG_ACCENT #$THEME_COLOR_BG_ACCENT_LIGHT client.focused_tab_title #$THEME_COLOR_BG_ACCENT_LIGHT$THEME_OPACITY_MID_HEX $THEME_COLOR_BG_ACCENT_LIGHT$THEME_OPACITY_MID_HEX #$THEME_COLOR_FG_DARK #$THEME_COLOR_FG_ACCENT #$THEME_COLOR_BG_ACCENT_LIGHT @@ -95,7 +95,7 @@ client.unfocused #$THEME_COLOR_BG_ACCENT_DARK #$THEME_COLOR_BG_ACCENT_DARK #$THE ################## bar ##################### bar { position top - font pango:Roboto Mono 12 + font pango:$THEME_FONT_REGULAR $THEME_SIZE_FONT_BASE_PT status_command i3blocks strip_workspace_numbers yes separator_symbol | diff --git a/arch-user/config/theme.sh b/arch-user/config/theme.sh index 481484e..d6de8c1 100644 --- a/arch-user/config/theme.sh +++ b/arch-user/config/theme.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/sh +# std export THEME_COLOR_FG=ffffff # main text export THEME_COLOR_FG_DARK=b8bcc1 # secondary text export THEME_COLOR_FG_ACCENT=9988ff # highlighted text, scrollbars (low-mid transp) @@ -8,7 +9,15 @@ export THEME_COLOR_BG_ACCENT_DARK=020030 # alt bg export THEME_OPACITY_LOW=0.2 export THEME_OPACITY_MID=0.55 export THEME_OPACITY_HIGH=0.85 - +export THEME_SIZE_FONT_BASE_PX=16 +export THEME_SiZE_FONT_SMALL_MULT=0.875 +export THEME_SIZE_FONT_LARGE_MULT=1.1125 +export THEME_FONT_REGULAR=Roboto +export THEME_FONT_MONO="Roboto Mono" +# calculated +export THEME_SIZE_FONT_BASE_PT=12 +export THEME_SIZE_FONT_SMALL_PT=10.5 +export THEME_SIZE_FONT_LARGE_PT=13.5 export THEME_OPACITY_LOW_HEX=33 export THEME_OPACITY_MID_HEX=8C export THEME_OPACITY_HIGH_HEX=D9 diff --git a/arch-user/install.sh b/arch-user/install.sh index 5683cd0..ab32f1d 100644 --- a/arch-user/install.sh +++ b/arch-user/install.sh @@ -18,23 +18,26 @@ cp_subst() { envsubst "$VARS" < "$1" > "$2" } -# simple -cp -rf config/foot ~/.config +# xdg simple cp -rf config/i3blocks ~/.config cp -rf config/git ~/.config cp -rf config/vim ~/.config cp -rf config/xkb ~/.config +cp -rf config/qutebrowser ~/.config # non-xdg cp -rf config/bash/bashrc ~/.bashrc # templated cp_subst config/sway/config.tmpl ~/.config/sway/config +cp_subst config/foot/foot.ini.tmpl ~/.config/foot/foot.ini # dynamic cp -rf config/profile ~/.profile -cat config/bemenu/config.sh >> ~/.profile -cat config/theme.sh >> ~/.profile +# shellcheck disable=SC2129 +echo -e "\n# GENERATED" >> ~/.profile +sed '/^#/d' config/theme.sh >> ~/.profile +sed '/^#/d' config/bemenu/config.sh >> ~/.profile ################################ swaymsg reload diff --git a/arch-user/scripts/run.sh b/arch-user/scripts/run.sh index 898f47e..b933ae0 100755 --- a/arch-user/scripts/run.sh +++ b/arch-user/scripts/run.sh @@ -1,65 +1,127 @@ -#!/bin/sh +#!/bin/bash +LIST=(); if [ "$USER" = "yrzam" ]; then - WEB="\ -web projects -web life\ -" + LIST+=( + "web" "web projects" + "web" "web life" + ) else - WEB=web + LIST+=( + "web" "web" + ) fi -LIST="\ -term -$WEB -vifm -vim -gimp -htop -man -sway reload -logout -poweroff -reboot\ -" - -out=$(bemenu --prompt "" << EOF -$LIST -EOF +LIST+=( + "gui" "gimp" + "gui" "sqlitebrowser" + "shell_tui" "vifm" + "shell_tui" "vim" + "tui" "htop" + "tui" "nmtui" + "man" "man" + "screenpick-todo" "screenshot all" + "screenpick-todo" "screenshot selection" + "pass" "pass" + "term" "term" + "brightness" "brightness" + "direct" "sway reload" + "power" "logout" + "power-todo" "inhibit" + "power" "suspend" + "power" "poweroff" + "power" "poweroff --check-inhibitors=no" + "power" "reboot" ) -conf() { +# generic +sure() { echo yes | bemenu --prompt "sure?" } -case "$out " in - " ");; - "web "*) - profile="${out##* }" - if [ "$profile" != "web" ]; then - exec firefox -P "$profile" - else - exec firefox - fi;; - "man ") - page="$(man -k . | bemenu --prompt "man" | awk '{print $1}')" - [ -n "$page" ] && exec footclient man "$page";; - "logout ") - conf && swaymsg exit;; - "poweroff "|"reboot ") - conf && exec systemctl "$out";; - "sway reload ") - exec $out;; - # term session - "term ") - exec footclient -D ~/;; - # term exec pure - "man "*|"htop ") - exec footclient -D ~/ "$out";; - # term exec in shell - "vifm "*|"vim "*) - exec footclient -D ~/ "$SHELL" -c "$out";; - #term exec in shell and wait - *) - exec footclient -D ~/ "$SHELL" -c "$out; read -n1";; -esac +exec_gui() { + exec "$@" +} +exec_tui() { + exec footclient -D ~/ "$@" +} +exec_shell_tui() { + exec footclient -D ~/ "$SHELL" -c "$@" +} +exec_shell_full() { + exec footclient -D ~/ "$SHELL" -c "($1); read -n1" +} +exec_direct() { + exec "$@" +} +exec_term() { + exec footclient -D ~/ +} +# custom +exec_web() { + /bin/qutebrowser --set tabs.tabs_are_windows true --set tabs.show never "https://google.com" +} +exec_power() { + case "$1" in + poweroff|reboot|suspend) sure && systemctl "$@";; + logout) sure && swaymsg exit;; + esac +} +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/$/%/')"; + target="$( + echo "$list" | bemenu --prompt "$current ->" + )"; + fi + if [ -n "$target" ] && [ "$target" != "ok" ]; then + brightnessctl set "$target" + [ -z "$1" ] && exec_brightness brightness + fi +} +exec_man() { + shift + page="$1" + if [ -z "$page" ]; then + page="$( + man -k . | \ + bemenu --prompt "man" | \ + sed ' s/\s*\-.*//;s/ //g' + )" + fi + [ -n "$page" ] && exec footclient "$SHELL" -c "man '$page' || read -n1" +} +exec_pass() { + echo 1 +} + +if [ -n "$1" ]; then + out="$*"; +else + out=$( + for (( i=1; i<${#LIST[@]}; i+=2 )); do + echo "${LIST[$i]}"; + done | bemenu --prompt ">" + ) +fi + + +if [ "$out" ]; then + for (( i=1; i<${#LIST[@]}; i+=2 )); do + if [[ "$out" == "${LIST[$i]}"* ]]; then + executor=${LIST[$((i-1))]} + fi + done + [ -z "$executor" ] && executor=shell_full + + if [ "$executor" = "shell_full" ]; then + "exec_$executor" "$out" + else + eval "executor_args=($out)" + #shellcheck disable=SC2154 + "exec_$executor" "${executor_args[@]}" + fi +fi