mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
Added fallback if colormode file doesn't exi--
This commit is contained in:
parent
c5d6fa15a8
commit
6f0ca3acaa
2 changed files with 15 additions and 7 deletions
|
|
@ -65,7 +65,9 @@ const ColorSchemeSettingsRevealer = () => {
|
|||
});
|
||||
}
|
||||
|
||||
function calculateSchemeInitIndex(optionsArr, searchValue = 'monochrome') {
|
||||
function calculateSchemeInitIndex(optionsArr, searchValue = 'tonalspot') {
|
||||
if (searchValue == '')
|
||||
searchValue = 'tonalspot';
|
||||
const flatArray = optionsArr.flatMap(subArray => subArray);
|
||||
const result = flatArray.findIndex(element => element.value === searchValue);
|
||||
const rowIndex = Math.floor(result / optionsArr[0].length);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# check if no arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: colorgen.sh /path/to/image (--apply)"
|
||||
|
|
@ -8,15 +7,22 @@ if [ $# -eq 0 ]; then
|
|||
fi
|
||||
|
||||
# check if the file ~/.cache/ags/user/colormode.txt exists. if not, create it. else, read it to $lightdark
|
||||
colormodefile="$HOME/.cache/ags/user/colormode.txt"
|
||||
lightdark="dark"
|
||||
transparency="opaque"
|
||||
materialscheme="tonalspot"
|
||||
if [ ! -f "$HOME/.cache/ags/user/colormode.txt" ]; then
|
||||
echo "dark\nopaque\ntonalspot" > "$HOME/.cache/ags/user/colormode.txt"
|
||||
if [ ! -f $colormodefile ]; then
|
||||
echo "dark" > $colormodefile
|
||||
echo "opaque" >> $colormodefile
|
||||
echo "tonalspot" >> $colormodefile
|
||||
elif [[ $(wc -l < $colormodefile) -ne 3 || $(wc -w < $colormodefile) -ne 3 ]]; then
|
||||
echo "dark" > $colormodefile
|
||||
echo "opaque" >> $colormodefile
|
||||
echo "tonalspot" >> $colormodefile
|
||||
else
|
||||
lightdark=$(sed -n '1p' "$HOME/.cache/ags/user/colormode.txt")
|
||||
transparency=$(sed -n '2p' "$HOME/.cache/ags/user/colormode.txt")
|
||||
materialscheme=$(sed -n '3p' "$HOME/.cache/ags/user/colormode.txt")
|
||||
lightdark=$(sed -n '1p' $colormodefile)
|
||||
transparency=$(sed -n '2p' $colormodefile)
|
||||
materialscheme=$(sed -n '3p' $colormodefile)
|
||||
fi
|
||||
backend="material" # color generator backend
|
||||
if [ ! -f "$HOME/.cache/ags/user/colorbackend.txt" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue