GNOME dependable installation, structure and style improvements
Split utils in utils.py to a directory Moved ./gnome-shell_css/ to ./gnome-shell/.css/
@@ -14,6 +14,10 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# TODO: output current GNOME version. Warn if it's not supported
|
||||||
|
# TODO: rework checkboxes for GNOME 47
|
||||||
|
# TODO: test on older GNOME versions
|
||||||
|
# TODO: install theme using only standard colors from settings color picker
|
||||||
|
|
||||||
import json # working with json files
|
import json # working with json files
|
||||||
import argparse # command-line options
|
import argparse # command-line options
|
||||||
@@ -24,6 +28,7 @@ from scripts import config # folder and files definitions
|
|||||||
from scripts.tweaks_manager import TweaksManager # load tweaks from files
|
from scripts.tweaks_manager import TweaksManager # load tweaks from files
|
||||||
|
|
||||||
from scripts.utils import remove_files # delete already installed Marble theme
|
from scripts.utils import remove_files # delete already installed Marble theme
|
||||||
|
from scripts.utils.gnome import apply_gnome_theme # apply theme to GNOME shell
|
||||||
|
|
||||||
from scripts.theme import Theme
|
from scripts.theme import Theme
|
||||||
from scripts.gdm import GlobalTheme
|
from scripts.gdm import GlobalTheme
|
||||||
@@ -202,6 +207,8 @@ def main():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
local_theme(args, colors)
|
local_theme(args, colors)
|
||||||
|
apply_gnome_theme()
|
||||||
|
# TODO: inform user about already applied theme. if not, apply it manually
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
# TODO: Add more tests
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
@@ -33,7 +33,10 @@ class Theme:
|
|||||||
|
|
||||||
# move files to temp folder
|
# move files to temp folder
|
||||||
copy_files(self.theme_folder, self.temp_folder)
|
copy_files(self.theme_folder, self.temp_folder)
|
||||||
generate_file(f"{self.theme_folder}_css/", self.main_styles)
|
generate_file(f"{self.theme_folder}", self.main_styles)
|
||||||
|
# after generating main styles, remove .css and .versions folders
|
||||||
|
shutil.rmtree(f"{self.temp_folder}/.css/", ignore_errors=True)
|
||||||
|
shutil.rmtree(f"{self.temp_folder}/.versions/", ignore_errors=True)
|
||||||
|
|
||||||
# if theme is filled
|
# if theme is filled
|
||||||
if is_filled:
|
if is_filled:
|
||||||
|
230
scripts/utils.py
@@ -1,230 +0,0 @@
|
|||||||
import os
|
|
||||||
from . import config # name of folders and files
|
|
||||||
|
|
||||||
|
|
||||||
def generate_file(folder, final_file):
|
|
||||||
"""
|
|
||||||
Combines all files in a folder into a single file
|
|
||||||
:param folder: source folder
|
|
||||||
:param final_file: location where file will be created
|
|
||||||
"""
|
|
||||||
|
|
||||||
opened_file = open(final_file, "w")
|
|
||||||
|
|
||||||
for file in os.listdir(folder):
|
|
||||||
with open(folder + file) as f:
|
|
||||||
opened_file.write(f.read() + '\n')
|
|
||||||
|
|
||||||
opened_file.close()
|
|
||||||
|
|
||||||
|
|
||||||
def concatenate_files(edit_file, file):
|
|
||||||
"""
|
|
||||||
Merge two files
|
|
||||||
:param edit_file: where it will be appended
|
|
||||||
:param file: file you want to append
|
|
||||||
"""
|
|
||||||
|
|
||||||
with open(file, 'r') as read_file:
|
|
||||||
file_content = read_file.read()
|
|
||||||
|
|
||||||
with open(edit_file, 'a') as write_file:
|
|
||||||
write_file.write('\n' + file_content)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_files():
|
|
||||||
"""
|
|
||||||
Delete already installed Marble theme
|
|
||||||
"""
|
|
||||||
|
|
||||||
paths = (config.themes_folder, "~/.local/share/themes")
|
|
||||||
|
|
||||||
print("💡 You do not need to delete files if you want to update theme.\n")
|
|
||||||
|
|
||||||
confirmation = input(f"Do you want to delete all \"Marble\" folders in {' and in '.join(paths)}? (y/N) ").lower()
|
|
||||||
|
|
||||||
if confirmation == "y":
|
|
||||||
for path in paths:
|
|
||||||
|
|
||||||
# Check if the path exists
|
|
||||||
if os.path.exists(os.path.expanduser(path)):
|
|
||||||
|
|
||||||
# Get the list of folders in the path
|
|
||||||
folders = os.listdir(os.path.expanduser(path))
|
|
||||||
|
|
||||||
# toggle if folder has no marble theme
|
|
||||||
found_folder = False
|
|
||||||
|
|
||||||
for folder in folders:
|
|
||||||
if folder.startswith("Marble"):
|
|
||||||
folder_path = os.path.join(os.path.expanduser(path), folder)
|
|
||||||
print(f"Deleting folder {folder_path}...", end='')
|
|
||||||
|
|
||||||
try:
|
|
||||||
os.system(f"rm -r {folder_path}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error deleting folder {folder_path}: {e}")
|
|
||||||
|
|
||||||
else:
|
|
||||||
found_folder = True
|
|
||||||
print("Done.")
|
|
||||||
|
|
||||||
if not found_folder:
|
|
||||||
print(f"No folders starting with \"Marble\" found in {path}.")
|
|
||||||
|
|
||||||
else:
|
|
||||||
print(f"The path {path} does not exist.")
|
|
||||||
|
|
||||||
|
|
||||||
def destination_return(themes_folder, path_name, theme_mode, theme_type):
|
|
||||||
"""
|
|
||||||
Copied/modified theme location
|
|
||||||
:param themes_folder: themes folder location
|
|
||||||
:param path_name: color name
|
|
||||||
:param theme_mode: theme name (light or dark)
|
|
||||||
:param theme_type: theme type (gnome-shell, gtk-4.0, ...)
|
|
||||||
:return: copied files' folder location
|
|
||||||
"""
|
|
||||||
|
|
||||||
return f"{themes_folder}/Marble-{path_name}-{theme_mode}/{theme_type}/"
|
|
||||||
|
|
||||||
|
|
||||||
def copy_files(source, destination):
|
|
||||||
"""
|
|
||||||
Copy files from the source to another directory
|
|
||||||
:param source: where files will be copied
|
|
||||||
:param destination: where files will be pasted
|
|
||||||
"""
|
|
||||||
|
|
||||||
destination = os.path.expanduser(destination) # expand ~ to /home/user
|
|
||||||
os.makedirs(destination, exist_ok=True)
|
|
||||||
os.system(f"cp -aT {source} {destination}")
|
|
||||||
|
|
||||||
|
|
||||||
def replace_keywords(file, *args):
|
|
||||||
"""
|
|
||||||
Replace file with several keywords
|
|
||||||
:param file: file name where keywords must be replaced
|
|
||||||
:param args: (keyword, replacement), (...), ...
|
|
||||||
"""
|
|
||||||
|
|
||||||
# skip binary files in project
|
|
||||||
if not file.lower().endswith(('.css', '.scss', '.svg')):
|
|
||||||
return
|
|
||||||
|
|
||||||
with open(file, "r") as read_file:
|
|
||||||
content = read_file.read()
|
|
||||||
|
|
||||||
for keyword, replacement in args:
|
|
||||||
content = content.replace(keyword, replacement)
|
|
||||||
|
|
||||||
with open(file, "w") as write_file:
|
|
||||||
write_file.write(content)
|
|
||||||
|
|
||||||
|
|
||||||
def hex_to_rgba(hex_color):
|
|
||||||
"""
|
|
||||||
Convert hex(a) to rgba
|
|
||||||
:param hex_color: input value
|
|
||||||
"""
|
|
||||||
|
|
||||||
try:
|
|
||||||
if len(hex_color) in range(6, 10):
|
|
||||||
hex_color = hex_color.lstrip('#') + "ff"
|
|
||||||
# if is convertable
|
|
||||||
int(hex_color[:], 16)
|
|
||||||
else:
|
|
||||||
raise ValueError
|
|
||||||
|
|
||||||
except ValueError:
|
|
||||||
raise ValueError(f'Error: Invalid HEX color code: {hex_color}')
|
|
||||||
|
|
||||||
else:
|
|
||||||
return int(hex_color[0:2], 16), \
|
|
||||||
int(hex_color[2:4], 16), \
|
|
||||||
int(hex_color[4:6], 16), \
|
|
||||||
int(hex_color[6:8], 16) / 255
|
|
||||||
|
|
||||||
|
|
||||||
def label_files(directory, label, *args):
|
|
||||||
"""
|
|
||||||
Add a label to all files in a directory
|
|
||||||
:param directory: folder where files are located
|
|
||||||
:param label: label to add
|
|
||||||
:param args: files to change links to labeled files
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Open all files
|
|
||||||
files = [open(file, 'r') for file in args]
|
|
||||||
read_files = []
|
|
||||||
|
|
||||||
filenames = []
|
|
||||||
|
|
||||||
for filename in os.listdir(directory):
|
|
||||||
# Skip if the file is already labeled
|
|
||||||
if label in filename:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Split the filename into name and extension
|
|
||||||
name, extension = os.path.splitext(filename)
|
|
||||||
|
|
||||||
# Form the new filename and rename the file
|
|
||||||
new_filename = f"{name}-{label}{extension}"
|
|
||||||
os.rename(os.path.join(directory, filename), os.path.join(directory, new_filename))
|
|
||||||
|
|
||||||
filenames.append((filename, new_filename))
|
|
||||||
|
|
||||||
# Replace the filename in all files
|
|
||||||
for i, file in enumerate(files):
|
|
||||||
read_file = file.read()
|
|
||||||
read_file.replace(filenames[i][0], filenames[i][1])
|
|
||||||
read_files.append(read_file)
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
write_files = [open(file, 'w') for file in args]
|
|
||||||
|
|
||||||
# Write the changes to the files and close them
|
|
||||||
for i, file in enumerate(write_files):
|
|
||||||
file.write(read_files[i])
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
|
|
||||||
def remove_properties(file, *args):
|
|
||||||
"""
|
|
||||||
Remove properties from a file
|
|
||||||
:param file: file name
|
|
||||||
:param args: properties to remove
|
|
||||||
"""
|
|
||||||
|
|
||||||
new_content = ""
|
|
||||||
|
|
||||||
with open(file, "r") as read_file:
|
|
||||||
content = read_file.read()
|
|
||||||
|
|
||||||
for line in content.splitlines():
|
|
||||||
if not any(prop in line for prop in args):
|
|
||||||
new_content += line + "\n"
|
|
||||||
elif "}" in line:
|
|
||||||
new_content += "}\n"
|
|
||||||
|
|
||||||
with open(file, "w") as write_file:
|
|
||||||
write_file.write(new_content)
|
|
||||||
|
|
||||||
|
|
||||||
def remove_keywords(file, *args):
|
|
||||||
"""
|
|
||||||
Remove keywords from a file
|
|
||||||
:param file: file name
|
|
||||||
:param args: keywords to remove
|
|
||||||
"""
|
|
||||||
|
|
||||||
with open(file, "r") as read_file:
|
|
||||||
content = read_file.read()
|
|
||||||
|
|
||||||
for arg in args:
|
|
||||||
content = content.replace(arg, "")
|
|
||||||
|
|
||||||
with open(file, "w") as write_file:
|
|
||||||
write_file.write(content)
|
|
10
scripts/utils/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from .concatenate_files import concatenate_files
|
||||||
|
from .copy_files import copy_files
|
||||||
|
from .destinaiton_return import destination_return
|
||||||
|
from .generate_file import generate_file
|
||||||
|
from .hex_to_rgba import hex_to_rgba
|
||||||
|
from .label_files import label_files
|
||||||
|
from .remove_files import remove_files
|
||||||
|
from .remove_keywords import remove_keywords
|
||||||
|
from .remove_properties import remove_properties
|
||||||
|
from .replace_keywords import replace_keywords
|
12
scripts/utils/concatenate_files.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
def concatenate_files(edit_file, file):
|
||||||
|
"""
|
||||||
|
Merge two files
|
||||||
|
:param edit_file: where it will be appended
|
||||||
|
:param file: file you want to append
|
||||||
|
"""
|
||||||
|
|
||||||
|
with open(file, 'r') as read_file:
|
||||||
|
file_content = read_file.read()
|
||||||
|
|
||||||
|
with open(edit_file, 'a') as write_file:
|
||||||
|
write_file.write('\n' + file_content)
|
12
scripts/utils/copy_files.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
def copy_files(source, destination):
|
||||||
|
"""
|
||||||
|
Copy files from the source to another directory
|
||||||
|
:param source: where files will be copied
|
||||||
|
:param destination: where files will be pasted
|
||||||
|
"""
|
||||||
|
|
||||||
|
destination = os.path.expanduser(destination) # expand ~ to /home/user
|
||||||
|
os.makedirs(destination, exist_ok=True)
|
||||||
|
os.system(f"cp -aT {source} {destination}")
|
11
scripts/utils/destinaiton_return.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
def destination_return(themes_folder, path_name, theme_mode, theme_type):
|
||||||
|
"""
|
||||||
|
Copied/modified theme location
|
||||||
|
:param themes_folder: themes folder location
|
||||||
|
:param path_name: color name
|
||||||
|
:param theme_mode: theme name (light or dark)
|
||||||
|
:param theme_type: theme type (gnome-shell, gtk-4.0, ...)
|
||||||
|
:return: copied files' folder location
|
||||||
|
"""
|
||||||
|
|
||||||
|
return f"{themes_folder}/Marble-{path_name}-{theme_mode}/{theme_type}/"
|
37
scripts/utils/generate_file.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from .gnome import gnome_version
|
||||||
|
from .get_version_folder import get_version_folders
|
||||||
|
|
||||||
|
def generate_file(folder, final_file):
|
||||||
|
"""
|
||||||
|
Combines all files in a folder into a single file
|
||||||
|
:param folder: source folder
|
||||||
|
:param final_file: location where file will be created
|
||||||
|
"""
|
||||||
|
opened_file = open(final_file, "w")
|
||||||
|
css_folder = f"{folder}/.css/"
|
||||||
|
|
||||||
|
for file in os.listdir(css_folder):
|
||||||
|
with open(os.path.join(css_folder, file)) as f:
|
||||||
|
opened_file.write(f.read() + '\n')
|
||||||
|
|
||||||
|
version = gnome_version()
|
||||||
|
|
||||||
|
if version:
|
||||||
|
base_path = f"{folder}/.versions/"
|
||||||
|
version_folders = get_version_folders(version, base_path)
|
||||||
|
|
||||||
|
for version_folder in version_folders:
|
||||||
|
version_path = os.path.join(base_path, version_folder)
|
||||||
|
css_path = os.path.join(version_path, '.css')
|
||||||
|
|
||||||
|
for css_file in os.listdir(css_path):
|
||||||
|
with open(os.path.join(css_path, css_file)) as f:
|
||||||
|
opened_file.write(f.read() + '\n')
|
||||||
|
|
||||||
|
for file in os.listdir(version_path):
|
||||||
|
if file.endswith('.svg'):
|
||||||
|
shutil.move(os.path.join(version_path, file), folder)
|
||||||
|
|
||||||
|
opened_file.close()
|
29
scripts/utils/get_version_folder.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
def get_version_folders(version, base_path):
|
||||||
|
"""
|
||||||
|
Get version folders
|
||||||
|
:param version: gnome-shell version
|
||||||
|
:param base_path: base path to version folders
|
||||||
|
:return: list of matching version folders
|
||||||
|
"""
|
||||||
|
version_folders = os.listdir(base_path)
|
||||||
|
version = int(version.split('.')[0]) # Use only the major version for comparison
|
||||||
|
matching_folders = []
|
||||||
|
|
||||||
|
for folder in version_folders:
|
||||||
|
if '..' in folder:
|
||||||
|
from_version, to_version = folder.split('..')
|
||||||
|
if from_version and to_version:
|
||||||
|
if int(from_version) <= version <= int(to_version):
|
||||||
|
matching_folders.append(folder)
|
||||||
|
elif from_version:
|
||||||
|
if version >= int(from_version):
|
||||||
|
matching_folders.append(folder)
|
||||||
|
elif to_version:
|
||||||
|
if version <= int(to_version):
|
||||||
|
matching_folders.append(folder)
|
||||||
|
elif int(folder) == version:
|
||||||
|
matching_folders.append(folder)
|
||||||
|
|
||||||
|
return matching_folders
|
32
scripts/utils/gnome.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
|
def gnome_version():
|
||||||
|
"""
|
||||||
|
Get gnome-shell version
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
output = subprocess.check_output(['gnome-shell', '--version'], text=True).strip()
|
||||||
|
return output.split(' ')[2]
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def apply_gnome_theme(theme=None):
|
||||||
|
"""
|
||||||
|
Apply gnome-shell theme
|
||||||
|
:param theme: theme name
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
if theme is None:
|
||||||
|
current_theme = subprocess.check_output(['dconf', 'read', '/org/gnome/shell/extensions/user-theme/name'], text=True).strip().strip("'")
|
||||||
|
if current_theme.startswith("Marble"):
|
||||||
|
theme = current_theme
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
subprocess.run(['dconf', 'reset', '/org/gnome/shell/extensions/user-theme/name'], check=True)
|
||||||
|
subprocess.run(['dconf', 'write', '/org/gnome/shell/extensions/user-theme/name', f"'{theme}'"], check=True)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return False
|
||||||
|
return True
|
22
scripts/utils/hex_to_rgba.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
def hex_to_rgba(hex_color):
|
||||||
|
"""
|
||||||
|
Convert hex(a) to rgba
|
||||||
|
:param hex_color: input value
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
if len(hex_color) in range(6, 10):
|
||||||
|
hex_color = hex_color.lstrip('#') + "ff"
|
||||||
|
# if is convertable
|
||||||
|
int(hex_color[:], 16)
|
||||||
|
else:
|
||||||
|
raise ValueError
|
||||||
|
|
||||||
|
except ValueError:
|
||||||
|
raise ValueError(f'Error: Invalid HEX color code: {hex_color}')
|
||||||
|
|
||||||
|
else:
|
||||||
|
return int(hex_color[0:2], 16), \
|
||||||
|
int(hex_color[2:4], 16), \
|
||||||
|
int(hex_color[4:6], 16), \
|
||||||
|
int(hex_color[6:8], 16) / 255
|
44
scripts/utils/label_files.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
def label_files(directory, label, *args):
|
||||||
|
"""
|
||||||
|
Add a label to all files in a directory
|
||||||
|
:param directory: folder where files are located
|
||||||
|
:param label: label to add
|
||||||
|
:param args: files to change links to labeled files
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Open all files
|
||||||
|
files = [open(file, 'r') for file in args]
|
||||||
|
read_files = []
|
||||||
|
|
||||||
|
filenames = []
|
||||||
|
|
||||||
|
for filename in os.listdir(directory):
|
||||||
|
# Skip if the file is already labeled
|
||||||
|
if label in filename:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Split the filename into name and extension
|
||||||
|
name, extension = os.path.splitext(filename)
|
||||||
|
|
||||||
|
# Form the new filename and rename the file
|
||||||
|
new_filename = f"{name}-{label}{extension}"
|
||||||
|
os.rename(os.path.join(directory, filename), os.path.join(directory, new_filename))
|
||||||
|
|
||||||
|
filenames.append((filename, new_filename))
|
||||||
|
|
||||||
|
# Replace the filename in all files
|
||||||
|
for i, file in enumerate(files):
|
||||||
|
read_file = file.read()
|
||||||
|
read_file.replace(filenames[i][0], filenames[i][1])
|
||||||
|
read_files.append(read_file)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
write_files = [open(file, 'w') for file in args]
|
||||||
|
|
||||||
|
# Write the changes to the files and close them
|
||||||
|
for i, file in enumerate(write_files):
|
||||||
|
file.write(read_files[i])
|
||||||
|
file.close()
|
48
scripts/utils/remove_files.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# TODO: Less verbose output for the user and simplify the code
|
||||||
|
|
||||||
|
from .. import config
|
||||||
|
import os
|
||||||
|
|
||||||
|
def remove_files():
|
||||||
|
"""
|
||||||
|
Delete already installed Marble theme
|
||||||
|
"""
|
||||||
|
|
||||||
|
paths = (config.themes_folder, "~/.local/share/themes")
|
||||||
|
|
||||||
|
print("💡 You do not need to delete files if you want to update theme.\n")
|
||||||
|
|
||||||
|
confirmation = input(f"Do you want to delete all \"Marble\" folders in {' and in '.join(paths)}? (y/N) ").lower()
|
||||||
|
|
||||||
|
if confirmation == "y":
|
||||||
|
for path in paths:
|
||||||
|
|
||||||
|
# Check if the path exists
|
||||||
|
if os.path.exists(os.path.expanduser(path)):
|
||||||
|
|
||||||
|
# Get the list of folders in the path
|
||||||
|
folders = os.listdir(os.path.expanduser(path))
|
||||||
|
|
||||||
|
# toggle if folder has no marble theme
|
||||||
|
found_folder = False
|
||||||
|
|
||||||
|
for folder in folders:
|
||||||
|
if folder.startswith("Marble"):
|
||||||
|
folder_path = os.path.join(os.path.expanduser(path), folder)
|
||||||
|
print(f"Deleting folder {folder_path}...", end='')
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.system(f"rm -r {folder_path}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error deleting folder {folder_path}: {e}")
|
||||||
|
|
||||||
|
else:
|
||||||
|
found_folder = True
|
||||||
|
print("Done.")
|
||||||
|
|
||||||
|
if not found_folder:
|
||||||
|
print(f"No folders starting with \"Marble\" found in {path}.")
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(f"The path {path} does not exist.")
|
15
scripts/utils/remove_keywords.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
def remove_keywords(file, *args):
|
||||||
|
"""
|
||||||
|
Remove keywords from a file
|
||||||
|
:param file: file name
|
||||||
|
:param args: keywords to remove
|
||||||
|
"""
|
||||||
|
|
||||||
|
with open(file, "r") as read_file:
|
||||||
|
content = read_file.read()
|
||||||
|
|
||||||
|
for arg in args:
|
||||||
|
content = content.replace(arg, "")
|
||||||
|
|
||||||
|
with open(file, "w") as write_file:
|
||||||
|
write_file.write(content)
|
20
scripts/utils/remove_properties.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
def remove_properties(file, *args):
|
||||||
|
"""
|
||||||
|
Remove properties from a file
|
||||||
|
:param file: file name
|
||||||
|
:param args: properties to remove
|
||||||
|
"""
|
||||||
|
|
||||||
|
new_content = ""
|
||||||
|
|
||||||
|
with open(file, "r") as read_file:
|
||||||
|
content = read_file.read()
|
||||||
|
|
||||||
|
for line in content.splitlines():
|
||||||
|
if not any(prop in line for prop in args):
|
||||||
|
new_content += line + "\n"
|
||||||
|
elif "}" in line:
|
||||||
|
new_content += "}\n"
|
||||||
|
|
||||||
|
with open(file, "w") as write_file:
|
||||||
|
write_file.write(new_content)
|
19
scripts/utils/replace_keywords.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
def replace_keywords(file, *args):
|
||||||
|
"""
|
||||||
|
Replace file with several keywords
|
||||||
|
:param file: file name where keywords must be replaced
|
||||||
|
:param args: (keyword, replacement), (...), ...
|
||||||
|
"""
|
||||||
|
|
||||||
|
# skip binary files in project
|
||||||
|
if not file.lower().endswith(('.css', '.scss', '.svg')):
|
||||||
|
return
|
||||||
|
|
||||||
|
with open(file, "r") as read_file:
|
||||||
|
content = read_file.read()
|
||||||
|
|
||||||
|
for keyword, replacement in args:
|
||||||
|
content = content.replace(keyword, replacement)
|
||||||
|
|
||||||
|
with open(file, "w") as write_file:
|
||||||
|
write_file.write(content)
|
@@ -25,8 +25,9 @@
|
|||||||
|
|
||||||
/* Toggles */
|
/* Toggles */
|
||||||
|
|
||||||
|
/* .toggle-switch handle styled in ..46, 47.. */
|
||||||
|
|
||||||
.toggle-switch {
|
.toggle-switch {
|
||||||
/* background-image: url("./toggle-off.svg"); */
|
|
||||||
/* size same as svg */
|
/* size same as svg */
|
||||||
height: 18px;
|
height: 18px;
|
||||||
width: 33px;
|
width: 33px;
|
||||||
@@ -36,23 +37,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.toggle-switch:checked {
|
.toggle-switch:checked {
|
||||||
/* background-image: url("./toggle-on.svg"); */
|
|
||||||
background-color: BUTTON-COLOR;
|
background-color: BUTTON-COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-switch .handle {
|
|
||||||
/* toggle-switch height - handle margin * 2 */
|
|
||||||
width: 14px;
|
|
||||||
height: 14px;
|
|
||||||
margin: 2px;
|
|
||||||
background-color: TEXT-SECONDARY-COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-switch:checked .handle {
|
|
||||||
background-color: BUTTON-TEXT-COLOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Do Not Distrub toggle */
|
/* Do Not Distrub toggle */
|
||||||
|
|
||||||
.dnd-button {
|
.dnd-button {
|
||||||
@@ -64,26 +51,15 @@
|
|||||||
width: 40px;
|
width: 40px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
border-radius: 9px;
|
border-radius: 9px;
|
||||||
/* background-image: url("./toggle-off_dnd.svg"); */
|
|
||||||
background-color: ACCENT-DISABLED-COLOR;
|
background-color: ACCENT-DISABLED-COLOR;
|
||||||
transition-duration: 100ms;
|
transition-duration: 100ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* toggle */
|
|
||||||
.dnd-button .toggle-switch .handle {
|
|
||||||
/* toggle-switch height - handle margin * 2 */
|
|
||||||
width: 16px;
|
|
||||||
height: 16px;
|
|
||||||
border-radius: 6px;
|
|
||||||
margin: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dnd-button:hover .toggle-switch {
|
.dnd-button:hover .toggle-switch {
|
||||||
background-color: ACCENT-DISABLED_HOVER;
|
background-color: ACCENT-DISABLED_HOVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dnd-button .toggle-switch:checked {
|
.dnd-button .toggle-switch:checked {
|
||||||
/* background-image: url("./toggle-on_dnd.svg"); */
|
|
||||||
background-color: BUTTON-COLOR;
|
background-color: BUTTON-COLOR;
|
||||||
}
|
}
|
||||||
|
|
@@ -65,19 +65,15 @@
|
|||||||
/* Modal dialog */
|
/* Modal dialog */
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 0; /* 47+ */
|
padding: 12px;
|
||||||
background-color: BACKGROUND-COLOR;
|
background-color: BACKGROUND-COLOR;
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: inset 0 0 0 1px BORDER-SHADOW;
|
box-shadow: inset 0 0 0 1px BORDER-SHADOW;
|
||||||
color: TEXT-PRIMARY-COLOR;
|
color: TEXT-PRIMARY-COLOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-dialog .modal-dialog-content-box {
|
|
||||||
margin: 32px 40px; /* bring it back because of https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/a32f735ec09bc3bb0309818cfb15f313338f4c8c */
|
|
||||||
}
|
|
||||||
|
|
||||||
.end-session-dialog {
|
.end-session-dialog {
|
||||||
width: 30em; /* revert changes on 47+ */
|
width: 28em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user avatar */
|
/* user avatar */
|
||||||
@@ -101,51 +97,24 @@
|
|||||||
|
|
||||||
/* button in modals */
|
/* button in modals */
|
||||||
.modal-dialog-linked-button,
|
.modal-dialog-linked-button,
|
||||||
.notification-button,
|
.notification-button {
|
||||||
.hotplug-notification-item {
|
|
||||||
padding: 10px 0 !important;
|
|
||||||
border-radius: 12px !important;
|
|
||||||
box-shadow: inset 0 0 0 1px BORDER-SHADOW;
|
box-shadow: inset 0 0 0 1px BORDER-SHADOW;
|
||||||
background-color: ACCENT-DISABLED-COLOR;
|
background-color: ACCENT-DISABLED-COLOR;
|
||||||
color: TEXT-PRIMARY-COLOR;
|
color: TEXT-PRIMARY-COLOR;
|
||||||
animation-duration: 100ms;
|
animation-duration: 100ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-dialog-linked-button {
|
||||||
/* if first button: margin-right: 12px/2 */
|
padding: 10px 0;
|
||||||
.modal-dialog-linked-button:ltr:first-child,
|
border-radius: 12px;
|
||||||
.notification-button:ltr:first-child,
|
|
||||||
.hotplug-notification-item:ltr:first-child,
|
|
||||||
.modal-dialog-linked-button:rtl:last-child,
|
|
||||||
.notification-button:rtl:last-child,
|
|
||||||
.hotplug-notification-item:rtl:last-child {
|
|
||||||
margin: 0 6px 12px 12px !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if last button: margin-left: 12px/2 */
|
.notification-button {
|
||||||
.modal-dialog-linked-button:ltr:last-child,
|
padding: 7px 12px;
|
||||||
.notification-button:ltr:last-child,
|
border-radius: 10px;
|
||||||
.hotplug-notification-item:ltr:last-child,
|
|
||||||
.modal-dialog-linked-button:rtl:first-child,
|
|
||||||
.notification-button:rtl:first-child,
|
|
||||||
.hotplug-notification-item:rtl:first-child {
|
|
||||||
margin: 0 12px 12px 6px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if only button: normal margin */
|
|
||||||
.modal-dialog-linked-button:first-child:last-child,
|
|
||||||
.notification-button:first-child:last-child,
|
|
||||||
.hotplug-notification-item:first-child:last-child {
|
|
||||||
margin: 0 12px 12px 12px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* else: margin-right/left: 12px/2 */
|
|
||||||
.modal-dialog-linked-button,
|
|
||||||
.notification-button,
|
|
||||||
.hotplug-notification-item {
|
|
||||||
margin: 0 6px 12px 6px !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* see button spacing in ..46 and 47.. */
|
||||||
|
|
||||||
.modal-dialog-linked-button:hover,
|
.modal-dialog-linked-button:hover,
|
||||||
.modal-dialog-linked-button:focus,
|
.modal-dialog-linked-button:focus,
|
||||||
@@ -165,24 +134,19 @@
|
|||||||
background-color: BUTTON_HOVER;
|
background-color: BUTTON_HOVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-dialog-linked-button:focus,
|
.modal-dialog-linked-button:focus {
|
||||||
.hotplug-notification-item:focus,
|
|
||||||
.notification-button:focus {
|
|
||||||
animation-duration: 100ms;
|
animation-duration: 100ms;
|
||||||
box-shadow: inset 0 0 0 1px TEXT-DISABLED-COLOR !important;
|
box-shadow: inset 0 0 0 1px TEXT-DISABLED-COLOR !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-dialog-linked-button:focus:hover,
|
.modal-dialog-linked-button:focus:hover,
|
||||||
.hotplug-notification-item:focus:hover,
|
|
||||||
.notification-button:focus:hover,
|
.notification-button:focus:hover,
|
||||||
.modal-dialog-linked-button:focus:active,
|
.modal-dialog-linked-button:focus:active,
|
||||||
.hotplug-notification-item:focus:active,
|
|
||||||
.notification-button:focus:active {
|
.notification-button:focus:active {
|
||||||
box-shadow: inset 0 0 0 1px TEXT-SECONDARY-COLOR !important;
|
box-shadow: inset 0 0 0 1px TEXT-SECONDARY-COLOR !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-dialog .modal-dialog-linked-button:insensitive,
|
.modal-dialog .modal-dialog-linked-button:insensitive,
|
||||||
.hotplug-notification-item:insensitive,
|
|
||||||
.notification-banner .notification-button:insensitive {
|
.notification-banner .notification-button:insensitive {
|
||||||
color: BUTTON-TEXT_SECONDARY;
|
color: BUTTON-TEXT_SECONDARY;
|
||||||
background-color: BUTTON_INSENSITIVE;
|
background-color: BUTTON_INSENSITIVE;
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* QS section */
|
/* QS section */
|
||||||
.quick-settings {
|
.quick-settings {
|
||||||
padding: 18px;
|
padding: 15px;
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
.quick-slider .slider-bin {
|
.quick-slider .slider-bin {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: BUTTON-TEXT-COLOR;
|
color: BUTTON-TEXT-COLOR; /* up tp 46 */
|
||||||
border-radius: 99px;
|
border-radius: 99px;
|
||||||
}
|
}
|
||||||
|
|
33
theme/gnome-shell/.versions/..46/.css/buttons.css
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/* if first button: margin-right: 12px/2 */
|
||||||
|
.modal-dialog-linked-button:ltr:first-child,
|
||||||
|
.notification-button:ltr:first-child,
|
||||||
|
.hotplug-notification-item:ltr:first-child,
|
||||||
|
.modal-dialog-linked-button:rtl:last-child,
|
||||||
|
.notification-button:rtl:last-child,
|
||||||
|
.hotplug-notification-item:rtl:last-child {
|
||||||
|
margin: 0 6px 0 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if last button: margin-left: 12px/2 */
|
||||||
|
.modal-dialog-linked-button:ltr:last-child,
|
||||||
|
.notification-button:ltr:last-child,
|
||||||
|
.hotplug-notification-item:ltr:last-child,
|
||||||
|
.modal-dialog-linked-button:rtl:first-child,
|
||||||
|
.notification-button:rtl:first-child,
|
||||||
|
.hotplug-notification-item:rtl:first-child {
|
||||||
|
margin: 0 0 0 6px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if only button: normal margin */
|
||||||
|
.modal-dialog-linked-button:first-child:last-child,
|
||||||
|
.notification-button:first-child:last-child,
|
||||||
|
.hotplug-notification-item:first-child:last-child {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* else: margin-right/left: 12px/2 */
|
||||||
|
.modal-dialog-linked-button,
|
||||||
|
.notification-button,
|
||||||
|
.hotplug-notification-item {
|
||||||
|
margin: 0 6px !important;
|
||||||
|
}
|
15
theme/gnome-shell/.versions/..46/.css/toggle.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
.toggle-switch {
|
||||||
|
background-image: url("./toggle-off.svg");
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-switch:checked {
|
||||||
|
background-image: url("./toggle-on.svg");
|
||||||
|
}
|
||||||
|
|
||||||
|
.dnd-button .toggle-switch {
|
||||||
|
background-image: url("./toggle-off_dnd.svg");
|
||||||
|
}
|
||||||
|
|
||||||
|
.dnd-button .toggle-switch:checked {
|
||||||
|
background-image: url("./toggle-on_dnd.svg");
|
||||||
|
}
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
7
theme/gnome-shell/.versions/47../.css/buttons.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.modal-dialog-linked-button {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-buttons-bin {
|
||||||
|
spacing: 1px;
|
||||||
|
}
|
19
theme/gnome-shell/.versions/47../.css/toggle.css
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
.toggle-switch .handle {
|
||||||
|
/* toggle-switch height - handle margin * 2 */
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
margin: 2px;
|
||||||
|
background-color: TEXT-SECONDARY-COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-switch:checked .handle {
|
||||||
|
background-color: BUTTON-TEXT-COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dnd-button .toggle-switch .handle {
|
||||||
|
/* toggle-switch height - handle margin * 2 */
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin: 3px;
|
||||||
|
}
|