chore: linux configs

This commit is contained in:
hesam-init 2024-06-29 14:25:20 +03:30
parent a8318e723c
commit 92f16c95e9
5 changed files with 9 additions and 126 deletions

View file

@ -1,4 +1,4 @@
@import "./scss/themes/catppuccin.scss";
@import "./scss/themes/feverblush.scss";
@import "./scss/global.scss";

View file

@ -1,58 +0,0 @@
import sys
def format_fennel(code):
# Remove leading/trailing whitespace
code = code.strip()
# Split the code into lines
lines = code.split('\n')
# Initialize variables
formatted_lines = []
indent_level = 0
for line in lines:
# Remove leading/trailing whitespace from each line
line = line.strip()
# Decrease indent for closing parentheses at the start of a line
while line.startswith(')'):
indent_level = max(0, indent_level - 1)
line = line[1:].lstrip()
# Add the formatted line
formatted_lines.append(' ' * indent_level + line)
# Increase indent for opening parentheses
indent_level += line.count('(') - line.count(')')
# Ensure indent level doesn't go negative
indent_level = max(0, indent_level)
# Join the formatted lines
formatted_code = '\n'.join(formatted_lines)
return formatted_code
def main():
if len(sys.argv) != 2:
print("Usage: python fennel_formatter.py <input_file>")
sys.exit(1)
input_file = sys.argv[1]
try:
with open(input_file, 'r') as file:
fennel_code = file.read()
except FileNotFoundError:
print(f"Error: File '{input_file}' not found.")
sys.exit(1)
except IOError:
print(f"Error: Unable to read file '{input_file}'.")
sys.exit(1)
formatted_code = format_fennel(fennel_code)
print(formatted_code)
if __name__ == "__main__":
main()

View file

@ -1,66 +0,0 @@
import re
def format_yuck(input_file, output_file):
def indent_line(line, indent_level):
return " " * indent_level + line.strip()
def format_content(content):
# Preserve strings and comments
placeholders = {}
def replace_with_placeholder(match):
placeholder = f"__PLACEHOLDER_{len(placeholders)}__"
placeholders[placeholder] = match.group(0)
return placeholder
content = re.sub(r'"(?:[^"\\]|\\.)*"', replace_with_placeholder, content)
content = re.sub(r';.*', replace_with_placeholder, content)
# Split content into lines, preserving newlines in the original content
lines = content.split('\n')
formatted_lines = []
indent = 0
for line in lines:
line = line.strip()
if not line:
formatted_lines.append('')
continue
# Handle opening parentheses
while '(' in line:
parts = line.split('(', 1)
if parts[0].strip():
formatted_lines.append(indent_line(parts[0], indent))
formatted_lines.append(indent_line('(', indent))
indent += 1
line = parts[1]
# Handle content and closing parentheses
while line:
if ')' in line:
parts = line.split(')', 1)
if parts[0].strip():
formatted_lines.append(indent_line(parts[0], indent))
indent -= 1
formatted_lines.append(indent_line(')', indent))
line = parts[1]
else:
formatted_lines.append(indent_line(line, indent))
break
# Restore placeholders
formatted_content = '\n'.join(formatted_lines)
for placeholder, original in placeholders.items():
formatted_content = formatted_content.replace(placeholder, original)
return formatted_content
with open(input_file, 'r') as f:
content = f.read()
formatted_content = format_content(content)
with open(output_file, 'w') as f:
f.write(formatted_content)
format_yuck('./src/sidebar/main.yuck', 'output.yuck')

@ -1 +1 @@
Subproject commit 373b9b47b2c5b28b5127fc64befa24566c560f09
Subproject commit 27152de9d27dbce541e2a0893e95c8bcc9a10bfd

View file

@ -5,7 +5,11 @@ source ./.scripts/utils/helpers.sh
DOTS_CONFIG_DIR="$(pwd)/linux-configs"
DOTFILES_DIR="$DOTS_CONFIG_DIR/dotfiles"
SHELL_DIR="$DOTS_CONFIG_DIR/shells/zsh"
EDITOR_DIR="$DOTS_CONFIG_DIR/editor/vim"
UTILS_DIR="$DOTS_CONFIG_DIR/utils"
HYPRLAND_ROOT="$(pwd)/hypr-configs"
@ -30,6 +34,9 @@ stow() {
create_symlinks $SHELL_DIR ~
log "Shell stowed successfully!"
create_symlinks $EDITOR_DIR ~
log "Editor stowed successfully!"
create_symlinks $DOTFILES_DIR ~/.config
log "Dotfiles stowed successfully!"