aboutsummaryrefslogtreecommitdiff
path: root/.local/share/mode
diff options
context:
space:
mode:
Diffstat (limited to '.local/share/mode')
-rwxr-xr-x.local/share/mode/mode18
-rwxr-xr-x.local/share/mode/reload.d/i32
-rwxr-xr-x.local/share/mode/switch.d/anki1
-rwxr-xr-x.local/share/mode/switch.d/chromium6
-rwxr-xr-x.local/share/mode/switch.d/discord2
-rwxr-xr-x.local/share/mode/switch.d/dunst2
-rwxr-xr-x.local/share/mode/switch.d/fcitx52
-rwxr-xr-x.local/share/mode/switch.d/i314
-rwxr-xr-x.local/share/mode/switch.d/kitty2
-rwxr-xr-x.local/share/mode/switch.d/mode2
-rwxr-xr-x.local/share/mode/switch.d/polybar2
-rwxr-xr-x.local/share/mode/switch.d/vim4
-rwxr-xr-x.local/share/mode/switch.d/zathura2
13 files changed, 50 insertions, 9 deletions
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/reload.d/i3 b/.local/share/mode/reload.d/i3
new file mode 100755
index 0000000..96212cf
--- /dev/null
+++ b/.local/share/mode/reload.d/i3
@@ -0,0 +1,2 @@
+#!/bin/sh
+fork i3-msg 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 fb701a5..5ed07fc 100755
--- a/.local/share/mode/switch.d/chromium
+++ b/.local/share/mode/switch.d/chromium
@@ -1,11 +1,13 @@
#!/bin/sh
+[ $no_cfg -eq 1 ] && return
+
mkcd "$XDG_CACHE_HOME/mode/chromium"
rm -f 'Cached Theme.pak'
magick -size 100x100 "xc:$bg" 'bg.png'
-bg_alt=$(mix_rgb $color7 $bg 0.20)
-fg_alt=$(mix_rgb $color15 $fg 0.60)
+bg_alt=$(mix_rgb $bg $color0 0.65)
+fg_alt=$(mix_rgb $fg $color15 0.35)
bg="$(hex_to_rgb_array "$bg")"
fg="$(hex_to_rgb_array "$fg")"
bg_alt="$(hex_to_rgb_array "$bg_alt")"
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/i3 b/.local/share/mode/switch.d/i3
new file mode 100755
index 0000000..713869e
--- /dev/null
+++ b/.local/share/mode/switch.d/i3
@@ -0,0 +1,14 @@
+#!/bin/sh
+[ $no_cfg -eq 1 ] && return
+
+indicator="$color0"
+mkcd "$XDG_CONFIG_HOME/i3"
+cat << EOF > 'color.conf'
+client.focused $fg $bg $fg $indicator $bg
+client.focused_inactive $bg $bg $fg $indicator $bg
+client.unfocused $bg $bg $fg $indicator $bg
+client.urgent $bg $bg $fg $indicator $bg
+client.placeholder $bg $bg $fg $indicator $bg
+client.background $bg
+EOF
+
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 7c2bbf6..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
@@ -13,7 +15,7 @@ let s:test = [ '#ff00ff', 'NONE' ]
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:fg, s:mode ], [ s:faint, s:bg ] ]
let s:p.normal.right = [ [ s:faint, s:bg ] ]
-let s:p.normal.middle = [ [ s:none, s:none ] ]
+let s:p.normal.middle = [ [ s:bg, s:bg ] ]
let s:p.normal.error = [ [ s:test, s:test ] ]
let s:p.normal.warning = [ [ s:test, s:test ] ]
let s:p.inactive.left = copy(s:p.normal.left)
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"