mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
chore: move more files to XDG_STATE_HOME
This commit is contained in:
parent
0092e7f488
commit
97999cd4e4
10 changed files with 27 additions and 25 deletions
|
|
@ -8,7 +8,7 @@ export const isDebianDistro = (distroID == 'linuxmint' || distroID == 'ubuntu' |
|
|||
export const isArchDistro = (distroID == 'arch' || distroID == 'endeavouros' || distroID == 'cachyos');
|
||||
export const hasFlatpak = !!exec(`bash -c 'command -v flatpak'`);
|
||||
|
||||
const LIGHTDARK_FILE_LOCATION = `${GLib.get_user_cache_dir()}/ags/user/colormode.txt`;
|
||||
const LIGHTDARK_FILE_LOCATION = `${GLib.get_user_state_dir()}/ags/user/colormode.txt`;
|
||||
const colorMode = Utils.exec(`bash -c "sed -n '1p' '${LIGHTDARK_FILE_LOCATION}'"`);
|
||||
export let darkMode = Variable(!(Utils.readFile(LIGHTDARK_FILE_LOCATION).split('\n')[0].trim() == 'light'));
|
||||
export const hasPlasmaIntegration = !!Utils.exec('bash -c "command -v plasma-browser-integration-host"');
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ const schemeOptionsArr = [
|
|||
//]
|
||||
];
|
||||
|
||||
const LIGHTDARK_FILE_LOCATION = `${GLib.get_user_cache_dir()}/ags/user/colormode.txt`;
|
||||
const LIGHTDARK_FILE_LOCATION = `${GLib.get_user_state_dir()}/ags/user/colormode.txt`;
|
||||
const initColorMode = Utils.exec(`bash -c "sed -n \'1p\' ${LIGHTDARK_FILE_LOCATION}"`);
|
||||
const initColorVal = (initColorMode == "dark") ? 1 : 0;
|
||||
const initTransparency = Utils.exec(`bash -c "sed -n \'2p\' ${LIGHTDARK_FILE_LOCATION}"`);
|
||||
|
|
@ -126,7 +126,7 @@ const ColorSchemeSettings = () => Widget.Box({
|
|||
initValue: initColorVal,
|
||||
onChange: (self, newValue) => {
|
||||
let lightdark = newValue == 0 ? "light" : "dark";
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "1s/.*/${lightdark}/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "1s/.*/${lightdark}/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
},
|
||||
|
|
@ -138,7 +138,7 @@ const ColorSchemeSettings = () => Widget.Box({
|
|||
initValue: initTransparencyVal,
|
||||
onChange: (self, newValue) => {
|
||||
let transparency = newValue == 0 ? "opaque" : "transparent";
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "2s/.*/${transparency}/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "2s/.*/${transparency}/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
},
|
||||
|
|
@ -162,7 +162,7 @@ const ColorSchemeSettings = () => Widget.Box({
|
|||
optionsArr: schemeOptionsArr,
|
||||
initIndex: initSchemeIndex,
|
||||
onChange: (value, name) => {
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "3s/.*/${value}/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "3s/.*/${value}/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { showMusicControls } from '../../variables.js';
|
|||
import { darkMode, hasPlasmaIntegration } from '../.miscutils/system.js';
|
||||
|
||||
const COMPILED_STYLE_DIR = `${GLib.get_user_cache_dir()}/ags/user/generated`
|
||||
const LIGHTDARK_FILE_LOCATION = `${GLib.get_user_cache_dir()}/ags/user/colormode.txt`;
|
||||
const LIGHTDARK_FILE_LOCATION = `${GLib.get_user_state_dir()}/ags/user/colormode.txt`;
|
||||
const colorMode = Utils.exec(`bash -c "sed -n \'1p\' '${LIGHTDARK_FILE_LOCATION}'"`);
|
||||
const lightDark = (colorMode == "light") ? '-l' : '';
|
||||
const COVER_COLORSCHEME_SUFFIX = '_colorscheme.css';
|
||||
|
|
|
|||
|
|
@ -33,28 +33,28 @@ export function launchCustomCommand(command) {
|
|||
}
|
||||
else if (args[0] == '>light') { // Light mode
|
||||
darkMode.value = false;
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "1s/.*/light/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "1s/.*/light/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>dark') { // Dark mode
|
||||
darkMode.value = true;
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "1s/.*/dark/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "1s/.*/dark/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>badapple') { // Black and white
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "3s/.*/monochrome/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "3s/.*/monochrome/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>material') { // Use material colors
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && echo "material" > ${GLib.get_user_cache_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && echo "material" > ${GLib.get_user_state_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchwall.sh --noswitch`]).catch(print))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>pywal') { // Use Pywal (ik it looks shit but I'm not removing)
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && echo "pywal" > ${GLib.get_user_cache_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && echo "pywal" > ${GLib.get_user_state_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchwall.sh --noswitch`]).catch(print))
|
||||
.catch(print);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ export default (props) => {
|
|||
icon: 'border_clear',
|
||||
name: 'Transparency',
|
||||
desc: 'Make shell elements transparent\nBlur is also recommended if you enable this',
|
||||
initValue: exec('bash -c "sed -n \'2p\' $HOME/.cache/ags/user/colormode.txt"') == "transparent",
|
||||
initValue: exec(`bash -c "sed -n \'2p\' ${GLib.get_user_state_dir()}/ags/user/colormode.txt"`) == "transparent",
|
||||
onChange: (self, newValue) => {
|
||||
const transparency = newValue == 0 ? "opaque" : "transparent";
|
||||
console.log(transparency);
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_cache_dir()}/ags/user && sed -i "2s/.*/${transparency}/" ${GLib.get_user_cache_dir()}/ags/user/colormode.txt`])
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && sed -i "2s/.*/${transparency}/" ${GLib.get_user_state_dir()}/ags/user/colormode.txt`])
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ transparentize() {
|
|||
|
||||
get_light_dark() {
|
||||
lightdark=""
|
||||
if [ ! -f "$CACHE_DIR"/user/colormode.txt ]; then
|
||||
echo "" > "$CACHE_DIR"/user/colormode.txt
|
||||
if [ ! -f "$STATE_DIR/user/colormode.txt" ]; then
|
||||
echo "" > "$STATE_DIR/user/colormode.txt"
|
||||
else
|
||||
lightdark=$(sed -n '1p' "$CACHE_DIR/user/colormode.txt")
|
||||
lightdark=$(sed -n '1p' "$STATE_DIR/user/colormode.txt")
|
||||
fi
|
||||
echo "$lightdark"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ if [ $# -eq 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# check if the file $CACHE_DIR/user/colormode.txt exists. if not, create it. else, read it to $lightdark
|
||||
colormodefile="$CACHE_DIR/user/colormode.txt"
|
||||
# check if the file $STATE_DIR/user/colormode.txt exists. if not, create it. else, read it to $lightdark
|
||||
colormodefile="$STATE_DIR/user/colormode.txt"
|
||||
lightdark="dark"
|
||||
transparency="opaque"
|
||||
materialscheme="vibrant"
|
||||
|
|
@ -37,10 +37,10 @@ else
|
|||
fi
|
||||
fi
|
||||
backend="material" # color generator backend
|
||||
if [ ! -f "$CACHE_DIR/user/colorbackend.txt" ]; then
|
||||
echo "material" > "$CACHE_DIR/user/colorbackend.txt"
|
||||
if [ ! -f "$STATE_DIR/user/colorbackend.txt" ]; then
|
||||
echo "material" > "$STATE_DIR/user/colorbackend.txt"
|
||||
else
|
||||
backend=$(cat "$CACHE_DIR/user/colorbackend.txt") # either "" or "-l"
|
||||
backend=$(cat "$STATE_DIR/user/colorbackend.txt") # either "" or "-l"
|
||||
fi
|
||||
|
||||
cd "$CONFIG_DIR/scripts/" || exit
|
||||
|
|
@ -61,7 +61,7 @@ elif [ "$backend" = "material" ]; then
|
|||
color_generation/generate_colors_material.py --path "$1" \
|
||||
--mode "$lightdark" --scheme "$materialscheme" --transparency "$transparency" \
|
||||
--termscheme $terminalscheme --blend_bg_fg \
|
||||
--cache "$CACHE_DIR/user/color.txt" $smartflag \
|
||||
--cache "$STATE_DIR/user/color.txt" $smartflag \
|
||||
> "$CACHE_DIR"/user/generated/material_colors.scss
|
||||
if [ "$2" = "--apply" ]; then
|
||||
cp "$CACHE_DIR"/user/generated/material_colors.scss "$STATE_DIR/scss/_material.scss"
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
CONFIG_DIR="$XDG_CONFIG_HOME/ags"
|
||||
CACHE_DIR="$XDG_CACHE_HOME/ags"
|
||||
STATE_DIR="$XDG_STATE_HOME/ags"
|
||||
|
||||
if [ "$1" == "--pick" ]; then
|
||||
color=$(hyprpicker --no-fancy)
|
||||
else
|
||||
color=$(cut -f1 "${CACHE_DIR}/user/color.txt")
|
||||
color=$(cut -f1 "$STATE_DIR/user/color.txt")
|
||||
fi
|
||||
|
||||
# Generate colors for ags n stuff
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class TodoService extends Service {
|
|||
|
||||
constructor() {
|
||||
super();
|
||||
this._todoPath = `${GLib.get_user_cache_dir()}/ags/user/todo.json`;
|
||||
this._todoPath = `${GLib.get_user_state_dir()}/ags/user/todo.json`;
|
||||
try {
|
||||
const fileContents = Utils.readFile(this._todoPath);
|
||||
this._todoJson = JSON.parse(fileContents);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ const { Gdk, GLib } = imports.gi;
|
|||
import Service from 'resource:///com/github/Aylur/ags/service.js';
|
||||
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
|
||||
|
||||
const WALLPAPER_CONFIG_PATH = `${GLib.get_user_cache_dir()}/ags/user/wallpaper.json`;
|
||||
const WALLPAPER_CONFIG_PATH = `${GLib.get_user_state_dir()}/ags/user/wallpaper.json`;
|
||||
|
||||
class WallpaperService extends Service {
|
||||
static {
|
||||
|
|
|
|||
Loading…
Reference in a new issue