Skip to content

Commit 50004b8

Browse files
committed
Add configuration management and build process for KDE theme
1 parent edad944 commit 50004b8

File tree

5 files changed

+151
-86
lines changed

5 files changed

+151
-86
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
usr/*
2+
__pycache__/*
3+
*.ipynb
4+
*.deb

DEBIAN/control

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Source: kde-bismih-config
2+
Priority: optional
3+
Maintainer: Muhammet Halak <halakmuhammet145@gmail.com>
4+
Section: misc
5+
Standards-Version: 1.0
6+
Build-Depends: debhelper (>= 9)
7+
Package: kde-bismih-config
8+
Architecture: amd64
9+
Description: Bismih KDE Config
10+
This package contains the configuration files for the Bismih KDE desktop
11+
environment.
12+
.
13+
This package is part of the Bismih project.
14+
.
15+
Please visit
16+
Version: 1.0

configs.py

Lines changed: 104 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
import re
2+
3+
version = "1.0"
4+
build_dir = "kde-bismih-config_" + version + "_amd64"
5+
6+
17
class Config:
28
def __init__(
39
self,
@@ -14,88 +20,105 @@ def __init__(
1420
self.file_name = file_name
1521
self.is_compressed = file.endswith((".tar.xz", ".tar.gz", ".plasmoid"))
1622
self.index = index
17-
self.is_folder = is_folder_need
23+
self.is_folder_need = is_folder_need
24+
1825

1926
ids = [
20-
Config(
21-
id_=1901768,
22-
file="Utterly-Round-Desktop.tar.xz",
23-
file_path="usr/share/plasma/desktoptheme/",
24-
file_name=("Utterly-Round"),
25-
index=1,
26-
is_folder_need=True,
27-
),
28-
Config(
29-
id_=2011605,
30-
file="Utterly-Round-Desktop-Solid.tar.xz",
31-
file_path="usr/share/plasma/desktoptheme/",
32-
file_name=("Utterly-Round-Solid"),
33-
index=1,
34-
is_folder_need=True,
35-
),
36-
Config(
37-
id_=1457141,
38-
file="Future-cursors.tar.gz",
39-
file_path="usr/share/icons/",
40-
file_name=("Future-cursors"),
41-
index=1,
42-
is_folder_need=False
43-
),
44-
Config(
45-
id_=1465392,
46-
file="Future-cyan-cursors.tar.gz",
47-
file_path="usr/share/icons/",
48-
file_name=("Future-cyan-cursors"),
49-
index=1,
50-
is_folder_need=False,
51-
),
52-
Config(
53-
id_=2148021,
54-
file="blueberry.colors",
55-
file_path="usr/share/color-schemes/",
56-
file_name=("blueberry.colors"),
57-
index=1,
58-
is_folder_need=False,
59-
),
60-
Config(
61-
id_=1477945,
62-
file="Fluent-orange.tar.xz",
63-
file_path="usr/share/plasma/desktoptheme/",
64-
index=4,
65-
file_name=("Fluent-orange","Fluent-orange-dark","Fluent-orange-light"),
66-
is_folder_need=False,
67-
),
68-
Config(
69-
id_=2203672,
70-
file="HelixAI.plasmoid",
71-
file_path="usr/share/plasma/plasmoids/",
72-
file_name=("com.mrgovinddubey.helixAI"),
73-
index=1,
74-
is_folder_need=False,
75-
),
76-
Config(
77-
id_=998901,
78-
file="eventcalendar-v76-plasma5.13.plasmoid",
79-
file_path="usr/share/plasma/plasmoids/",
80-
file_name=("org.kde.plasma.eventcalendar"),
81-
index=1,
82-
is_folder_need=True,
83-
),
84-
Config(
85-
id_=1570454,
86-
file="energy.monitor.plasmoid",
87-
file_path="usr/share/plasma/plasmoids/",
88-
file_name=("energy.monitor"),
89-
index=1,
90-
is_folder_need=False,
91-
),
92-
Config(
93-
id_=2103591,
94-
file="Clock.Asitoki.Color.tar.xz",
95-
file_path="usr/share/plasma/plasmoids/",
96-
file_name=("Clock.Asitoki.Color"),
97-
index=1,
98-
),
99-
]
27+
Config(
28+
id_=1901768,
29+
file="Utterly-Round-Desktop.tar.xz",
30+
file_path=f"{build_dir}/usr/share/plasma/desktoptheme/",
31+
file_name=("Utterly-Round"),
32+
index=1,
33+
is_folder_need=True,
34+
),
35+
Config(
36+
id_=2011605,
37+
file="Utterly-Round-Desktop-Solid.tar.xz",
38+
file_path=f"{build_dir}/usr/share/plasma/desktoptheme/",
39+
file_name=("Utterly-Round-Solid"),
40+
index=1,
41+
is_folder_need=True,
42+
),
43+
Config(
44+
id_=1457141,
45+
file="Future-cursors.tar.gz",
46+
file_path=f"{build_dir}/usr/share/icons/",
47+
file_name=("Future-cursors"),
48+
index=1,
49+
is_folder_need=False,
50+
),
51+
Config(
52+
id_=1465392,
53+
file="Future-cyan-cursors.tar.gz",
54+
file_path=f"{build_dir}/usr/share/icons/",
55+
file_name=("Future-cyan-cursors"),
56+
index=1,
57+
is_folder_need=False,
58+
),
59+
Config(
60+
id_=2148021,
61+
file="blueberry.colors",
62+
file_path=f"{build_dir}/usr/share/color-schemes/",
63+
file_name=("blueberry.colors"),
64+
index=1,
65+
is_folder_need=False,
66+
),
67+
Config(
68+
id_=1477945,
69+
file="Fluent-orange.tar.xz",
70+
file_path=f"{build_dir}/usr/share/icons/",
71+
index=4,
72+
file_name=("Fluent-orange", "Fluent-orange-dark", "Fluent-orange-light"),
73+
is_folder_need=False,
74+
),
75+
Config(
76+
id_=2203672,
77+
file="HelixAI.plasmoid",
78+
file_path=f"{build_dir}/usr/share/plasma/plasmoids/",
79+
file_name=("com.mrgovinddubey.helixAI"),
80+
index=1,
81+
is_folder_need=False,
82+
),
83+
Config(
84+
id_=998901,
85+
file="eventcalendar-v76-plasma5.13.plasmoid",
86+
file_path=f"{build_dir}/usr/share/plasma/plasmoids/",
87+
file_name=("org.kde.plasma.eventcalendar"),
88+
index=1,
89+
is_folder_need=True,
90+
),
91+
Config(
92+
id_=1570454,
93+
file="energy.monitor.plasmoid",
94+
file_path=f"{build_dir}/usr/share/plasma/plasmoids/",
95+
file_name=("energy.monitor"),
96+
index=1,
97+
is_folder_need=False,
98+
),
99+
Config(
100+
id_=2103591,
101+
file="Clock.Asitoki.Color.tar.xz",
102+
file_path=f"{build_dir}/usr/share/plasma/plasmoids/",
103+
file_name=("Clock.Asitoki.Color"),
104+
index=1,
105+
),
106+
]
107+
108+
109+
def edit_version():
110+
global version
111+
file = "DEBIAN/control"
112+
with open(file, "r") as f:
113+
data = f.read()
100114

115+
# Version satırını değiştirme
116+
new_data = re.sub(r"(?<=^Version: ).*", version, data, flags=re.MULTILINE)
101117

118+
# Standards-Version satırını değiştirme
119+
new_data = re.sub(
120+
r"(?<=^Standards-Version: ).*", version, new_data, flags=re.MULTILINE
121+
)
122+
with open(file, "w") as f:
123+
f.write(new_data)
124+
print(f"Version: {version}")

kde_conifg.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
from configs import ids
1+
from configs import ids, edit_version, build_dir
22
from theme_edits import ThemeEdits
33
import os
4+
import shutil
5+
import subprocess
6+
47
if __name__ == "__main__":
5-
os.removedirs("usr")
8+
if os.path.exists(build_dir):
9+
shutil.rmtree(build_dir)
10+
os.makedirs(build_dir)
11+
edit_version()
12+
613
theme_edits = ThemeEdits()
714
for cfg in ids:
8-
theme_edits.download(theme_edits.get_link(cfg), cfg)
15+
theme_edits.download(theme_edits.get_link(cfg), cfg)
16+
17+
folders = (".config", ".fonts", ".local")
18+
files = (".fonts.conf", ".p10k.zsh", ".zshrc")
19+
os.makedirs(build_dir + "/etc/skel")
20+
21+
for folder in folders:
22+
shutil.copytree(folder, f"{build_dir}/etc/skel/{folder}")
23+
for file in files:
24+
shutil.copy(file, f"{build_dir}/etc/skel/{file}")
25+
26+
shutil.copytree("DEBIAN", build_dir + "/DEBIAN")
27+
28+
subprocess.run(["dpkg-deb", "--build", build_dir])
29+
shutil.rmtree(build_dir)

theme_edits.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def download(self, url: str, cfg: Config):
2121
print("Dosya bulunamadı.")
2222
return
2323
rsp = requests.get(url, stream=True)
24+
if not os.path.exists(cfg.file_path):
25+
os.makedirs(cfg.file_path)
2426
if rsp.status_code == 200:
2527
with open(cfg.file_path + cfg.file, "wb") as file:
2628
for chunk in rsp.iter_content(chunk_size=8192):
@@ -43,9 +45,8 @@ def extract_file(self, cfg: Config):
4345

4446
destination = cfg.file_path
4547
if cfg.is_folder_need:
46-
os.mkdir(cfg.file_name)
4748
destination = cfg.file_path + cfg.file_name
48-
49+
4950
if not os.path.exists(destination):
5051
os.makedirs(destination)
5152

0 commit comments

Comments
 (0)