diff options
| author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-08-24 09:09:13 +0200 |
|---|---|---|
| committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-08-24 09:09:13 +0200 |
| commit | b45d5adbc1237c1889c05d24ae1162e5e808b71d (patch) | |
| tree | 425af858bd537220365e38f0c3205f687e37fbdb | |
| parent | 211d214db4521ce94e5962a4912aecf044ae0686 (diff) | |
improve session start performance
| -rwxr-xr-x | .config/i3/autostart | 2 | ||||
| -rwxr-xr-x | .local/share/mode/mode | 18 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/anki | 1 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/chromium | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/discord | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/dunst | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/fcitx5 | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/kitty | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/mode | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/polybar | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/vim | 2 | ||||
| -rwxr-xr-x | .local/share/mode/switch.d/zathura | 2 |
12 files changed, 32 insertions, 7 deletions
diff --git a/.config/i3/autostart b/.config/i3/autostart index 39aae14..586ccaf 100755 --- a/.config/i3/autostart +++ b/.config/i3/autostart @@ -1,7 +1,7 @@ #!/bin/sh . "$HOME/.profile" xrdb -override < "$XDG_CONFIG_HOME/X11/base" -mode --no-reload restore +mode --no-reload --no-cfggen restore /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & polybar & diff --git a/.local/share/mode/mode b/.local/share/mode/mode index 55de32f..dc188e9 100755 --- a/.local/share/mode/mode +++ b/.local/share/mode/mode @@ -1,10 +1,11 @@ -#!/bin/sh +#!/usr/bin/env sh progname="$(basename "$0")" data="$(dirname "$(readlink -f "$0")")" export data # path to directory containing reload.d, switch.d, etc. -run_cfggen=1 +run_switch=1 run_reload=1 +no_cfg=0 theme="" # absolute path to theme # print error message and exit with error @@ -22,7 +23,8 @@ usage: $progname [-chr] action|theme options: - -c, --no-cfggen disable updating of configuration files + -s, --no-switch disable running switch.d hooks + -c, --no-cfggen disable generation of templated configuration files -h, --help display this help text -r, --no-reload disable reloading of applications after applying theme @@ -105,11 +107,13 @@ for arg in "$@" ; do # help -h|--help|help) usage && exit 0 ;; # only run reload scripts - reload) run_reload=1 run_cfggen=0 ;; + reload) run_reload=1 run_switch=0 ;; # prevent reload.d scripts from running -r|--no-reload) run_reload=0 ;; # prevent switch.d scripts from running - -c|--no-cfggen) run_cfggen=0 ;; + -s|--no-switch) run_switch=0 ;; + # prevent switch.d scripts from running + -c|--no-cfggen) no_cfg=1 ;; # restore previous theme stored as symlink (see switch.d/mode) restore) theme="$(readlink -f "$XDG_CACHE_HOME/mode/state/theme")" @@ -136,7 +140,9 @@ for arg in "$@" ; do esac done +export no_cfg + # main -[ $run_cfggen -eq 1 ] && switch +[ $run_switch -eq 1 ] && switch [ $run_reload -eq 1 ] && reload diff --git a/.local/share/mode/switch.d/anki b/.local/share/mode/switch.d/anki index c9caf5d..7572b00 100755 --- a/.local/share/mode/switch.d/anki +++ b/.local/share/mode/switch.d/anki @@ -1,4 +1,5 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return # this generates theme files compatible with Anki-redesign: # <https://ankiweb.net/shared/info/308574457> diff --git a/.local/share/mode/switch.d/chromium b/.local/share/mode/switch.d/chromium index 7762086..5ed07fc 100755 --- a/.local/share/mode/switch.d/chromium +++ b/.local/share/mode/switch.d/chromium @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CACHE_HOME/mode/chromium" rm -f 'Cached Theme.pak' diff --git a/.local/share/mode/switch.d/discord b/.local/share/mode/switch.d/discord index 5931dec..dd7e5e3 100755 --- a/.local/share/mode/switch.d/discord +++ b/.local/share/mode/switch.d/discord @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CONFIG_HOME/BetterDiscord/themes" cat << EOF > 'mode.theme.css' /** diff --git a/.local/share/mode/switch.d/dunst b/.local/share/mode/switch.d/dunst index f863100..d7d9a2b 100755 --- a/.local/share/mode/switch.d/dunst +++ b/.local/share/mode/switch.d/dunst @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CONFIG_HOME/dunst" cat 'base' - << EOF > 'dunstrc' frame_color = "$accent" diff --git a/.local/share/mode/switch.d/fcitx5 b/.local/share/mode/switch.d/fcitx5 index 71880a7..d9d0032 100755 --- a/.local/share/mode/switch.d/fcitx5 +++ b/.local/share/mode/switch.d/fcitx5 @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_DATA_HOME/fcitx5/themes/default" rounding=6 size=$(( 2 * $rounding + 4 )) diff --git a/.local/share/mode/switch.d/kitty b/.local/share/mode/switch.d/kitty index dddc41b..eeb81d0 100755 --- a/.local/share/mode/switch.d/kitty +++ b/.local/share/mode/switch.d/kitty @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CONFIG_HOME/kitty" cat << EOF > 'color.conf' diff --git a/.local/share/mode/switch.d/mode b/.local/share/mode/switch.d/mode index f4c916e..8866486 100755 --- a/.local/share/mode/switch.d/mode +++ b/.local/share/mode/switch.d/mode @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CACHE_HOME/mode/state" echo "$mode" > mode diff --git a/.local/share/mode/switch.d/polybar b/.local/share/mode/switch.d/polybar index 17fcee2..7087735 100755 --- a/.local/share/mode/switch.d/polybar +++ b/.local/share/mode/switch.d/polybar @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CONFIG_HOME/polybar" cat << EOF > 'colors.ini' [color] diff --git a/.local/share/mode/switch.d/vim b/.local/share/mode/switch.d/vim index cb5a651..2220b1a 100755 --- a/.local/share/mode/switch.d/vim +++ b/.local/share/mode/switch.d/vim @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CONFIG_HOME/nvim/mode" # lightline diff --git a/.local/share/mode/switch.d/zathura b/.local/share/mode/switch.d/zathura index e1a15e7..42d6d90 100755 --- a/.local/share/mode/switch.d/zathura +++ b/.local/share/mode/switch.d/zathura @@ -1,4 +1,6 @@ #!/bin/sh +[ $no_cfg -eq 1 ] && return + mkcd "$XDG_CONFIG_HOME/zathura" cat << EOF > 'colors' set completion-bg "$bg" |