-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdots.py
executable file
·118 lines (98 loc) · 4.35 KB
/
dots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python
import os
import subprocess
import questionary
from rich.console import Console
from rich.text import Text
console = Console()
def clear():
os.system("clear")
def title():
clear()
console.print(Text("""
┌────────────────────────────────────────────┐
│ │
│ ░█▀█░█░█░█▀▀░█▀█░▀█▀░█▀▄░█▀▀░▀░█▀▀ │
│ ░█▀█░▄▀▄░█▀▀░█░█░░█░░█░█░█▀▀░░░▀▀█ │
│ ░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀▀░▀▀░░▀▀▀░░░▀▀▀ │
│ ░█▀▄░█▀█░▀█▀░█▀▀░▀█▀░█░░░█▀▀░█▀▀ │
│ ░█░█░█░█░░█░░█▀▀░░█░░█░░░█▀▀░▀▀█ │
│ ░▀▀░░▀▀▀░░▀░░▀░░░▀▀▀░▀▀▀░▀▀▀░▀▀▀ │
│ │
└────────────────────────────────────────────┘
""", style="bold red"))
def show_menu():
title()
graphics_option = questionary.select(
"Graphics?",
choices=["NVIDIA", "Open Source (AMD/Intel/Nouveau)"]
).ask()
keyboard_option = questionary.select(
"Keyboard layout?",
choices=["US", "LATAM"]
).ask()
return graphics_option, keyboard_option
def copy_config(src, dest):
with open(src, "r") as source:
with open(dest, "w") as destination:
destination.write(source.read())
def stow_files():
title()
console.print("Stowing dotfiles...", style="bold green")
subprocess.run(["stow", "--adopt", "dots"], check=True)
def install_packages():
title()
package_choice = questionary.select(
"Install needed packages?",
choices=["Yes", "No"]
).ask()
if package_choice == "Yes":
subprocess.run(["bash", "pacman.sh"], check=True)
else:
console.print("Skipping package installation.", style="bold yellow")
def install_tpm_plugins():
title()
tpm_choice = questionary.select(
"Install TPM plugins?",
choices=["Yes", "No"]
).ask()
if tpm_choice == "Yes":
tpm_dir = os.path.expanduser("~/.tmux/plugins")
subprocess.run(["rm", "-rf", tpm_dir], check=True)
os.makedirs(tpm_dir, exist_ok=True)
subprocess.run(["git", "clone", "https://github.com/tmux-plugins/tpm", os.path.join(tpm_dir, "tpm")], check=True)
script_path = os.path.join(tpm_dir, "tpm/scripts/install_plugins.sh")
if os.path.isfile(script_path):
subprocess.run([script_path], check=True)
else:
console.print(f"Error: El script no existe en la ruta {script_path}", style="bold red")
else:
console.print("Skipping TPM plugins installation.", style="bold yellow")
def main():
title()
graphics_option, keyboard_option = show_menu()
# Copy configuration files
if graphics_option == "NVIDIA":
copy_config("./options/nvidia.conf", "./dots/.config/hypr/source/nvidia.conf")
else:
copy_config("./options/nvidia-dummy.conf", "./dots/.config/hypr/source/nvidia.conf")
keyboard_file = "us.conf" if keyboard_option == "US" else "latam.conf"
copy_config(f"./options/{keyboard_file}", "./dots/.config/hypr/source/keyboard.conf")
stow_files()
install_packages()
install_tpm_plugins()
# Set wallpaper and theme
subprocess.run(["matugen", "image", "./example_wallpaper.jpg"], check=True, stdout=subprocess.DEVNULL)
clear()
console.print("""
┌────────────────────────────┐
│ │
│ ░█▀▄░█▀█░█▀█░█▀▀░█ │
│ ░█░█░█░█░█░█░█▀▀░▀ │
│ ░▀▀░░▀▀▀░▀░▀░▀▀▀░▀ │
│ │
└────────────────────────────┘
> https://github.com/Axenide <
""", style="bold green")
if __name__ == "__main__":
main()