forked from Shinonome/dots-hyprland
Merge branch 'main' into hefty-hype
This commit is contained in:
@@ -74,9 +74,6 @@ Scope {
|
||||
// Unlock the screen before exiting, or the compositor will display a
|
||||
// fallback lock you can't interact with.
|
||||
GlobalStates.screenLocked = false;
|
||||
|
||||
// Refocus last focused window on unlock (hack)
|
||||
Quickshell.execDetached(["bash", "-c", `sleep 0.2; hyprctl dispatch 'hl.dsp.workspace.toggle_special("special")'; hyprctl dispatch 'hl.dsp.workspace.toggle_special("special")'`])
|
||||
|
||||
// Reset
|
||||
lockContext.reset();
|
||||
|
||||
@@ -46,8 +46,8 @@ Scope { // Scope
|
||||
implicitWidth: cheatsheetBackground.width + Appearance.sizes.elevationMargin * 2
|
||||
implicitHeight: cheatsheetBackground.height + Appearance.sizes.elevationMargin * 2
|
||||
WlrLayershell.namespace: "quickshell:cheatsheet"
|
||||
// Hyprland 0.49: Focus is always exclusive and setting this breaks mouse focus grab
|
||||
// WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||
// Setting this value makes it take its sweet time to open
|
||||
// WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
color: "transparent"
|
||||
|
||||
mask: Region {
|
||||
|
||||
@@ -24,7 +24,7 @@ Item {
|
||||
id: flow
|
||||
height: flickable.height
|
||||
flow: Flow.TopToBottom
|
||||
spacing: 12
|
||||
spacing: 10
|
||||
Repeater {
|
||||
model: [...HyprlandKeybinds.keybindCategories, ""]
|
||||
delegate: CheatsheetKeybindsCategory {
|
||||
|
||||
@@ -61,11 +61,11 @@ Column {
|
||||
property var keyBlacklist: ["SUPER_L", "SUPER_R"]
|
||||
property var keySubstitutions: Object.assign({
|
||||
"Super": "",
|
||||
"mouse_up": "Scroll ↓", // ikr, weird
|
||||
"mouse_down": "Scroll ↑", // trust me bro
|
||||
"mouse:272": "LMB",
|
||||
"mouse:273": "RMB",
|
||||
"mouse:275": "MouseBack",
|
||||
"Mouse_up": "Scroll ↓", // ikr, weird
|
||||
"Mouse_down": "Scroll ↑", // trust me bro
|
||||
"Mouse:272": "LMB",
|
||||
"Mouse:273": "RMB",
|
||||
"Mouse:275": "MouseBack",
|
||||
"Slash": "/",
|
||||
"Hash": "#",
|
||||
"Return": "Enter",
|
||||
@@ -152,7 +152,10 @@ Column {
|
||||
id: keybindKey
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: !keyBlacklist.includes(bindLine.keyData.key)
|
||||
key: StringUtils.toTitleCase(root.keySubstitutions[bindLine.keyData.key] || bindLine.keyData.key)
|
||||
key: {
|
||||
const k = StringUtils.toTitleCase(bindLine.keyData.key)
|
||||
return root.keySubstitutions[k] || k
|
||||
}
|
||||
pixelSize: Config.options.cheatsheet.fontSize.key
|
||||
color: Appearance.colors.colOnLayer0
|
||||
}
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
#!/usr/bin/env -S\_/bin/sh\_-c\_"source\_\$(eval\_echo\_\$ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate&&exec\_python\_-E\_"\$0"\_"\$@""
|
||||
import argparse
|
||||
import re
|
||||
import os
|
||||
from os.path import expandvars as os_expandvars
|
||||
from typing import Dict, List
|
||||
|
||||
TITLE_REGEX = "#+!"
|
||||
HIDE_COMMENT = "[hidden]"
|
||||
MOD_SEPARATORS = ['+', ' ']
|
||||
COMMENT_BIND_PATTERN = "#/#"
|
||||
|
||||
parser = argparse.ArgumentParser(description='Hyprland keybind reader')
|
||||
parser.add_argument('--path', type=str, default="$HOME/.config/hypr/hyprland.conf", help='path to keybind file (sourcing isn\'t supported)')
|
||||
args = parser.parse_args()
|
||||
content_lines = []
|
||||
reading_line = 0
|
||||
|
||||
# Little Parser made for hyprland keybindings conf file
|
||||
Variables: Dict[str, str] = {}
|
||||
|
||||
|
||||
class KeyBinding(dict):
|
||||
def __init__(self, mods, key, dispatcher, params, comment) -> None:
|
||||
self["mods"] = mods
|
||||
self["key"] = key
|
||||
self["dispatcher"] = dispatcher
|
||||
self["params"] = params
|
||||
self["comment"] = comment
|
||||
|
||||
class Section(dict):
|
||||
def __init__(self, children, keybinds, name) -> None:
|
||||
self["children"] = children
|
||||
self["keybinds"] = keybinds
|
||||
self["name"] = name
|
||||
|
||||
|
||||
def read_content(path: str) -> str:
|
||||
if (not os.access(os.path.expanduser(os.path.expandvars(path)), os.R_OK)):
|
||||
return ("error")
|
||||
with open(os.path.expanduser(os.path.expandvars(path)), "r") as file:
|
||||
return file.read()
|
||||
|
||||
|
||||
def autogenerate_comment(dispatcher: str, params: str = "") -> str:
|
||||
match dispatcher:
|
||||
|
||||
case "resizewindow":
|
||||
return "Resize window"
|
||||
|
||||
case "movewindow":
|
||||
if(params == ""):
|
||||
return "Move window"
|
||||
else:
|
||||
return "Window: move in {} direction".format({
|
||||
"l": "left",
|
||||
"r": "right",
|
||||
"u": "up",
|
||||
"d": "down",
|
||||
}.get(params, "null"))
|
||||
|
||||
case "pin":
|
||||
return "Window: pin (show on all workspaces)"
|
||||
|
||||
case "splitratio":
|
||||
return "Window split ratio {}".format(params)
|
||||
|
||||
case "togglefloating":
|
||||
return "Float/unfloat window"
|
||||
|
||||
case "resizeactive":
|
||||
return "Resize window by {}".format(params)
|
||||
|
||||
case "killactive":
|
||||
return "Close window"
|
||||
|
||||
case "fullscreen":
|
||||
return "Toggle {}".format(
|
||||
{
|
||||
"0": "fullscreen",
|
||||
"1": "maximization",
|
||||
"2": "fullscreen on Hyprland's side",
|
||||
}.get(params, "null")
|
||||
)
|
||||
|
||||
case "fakefullscreen":
|
||||
return "Toggle fake fullscreen"
|
||||
|
||||
case "workspace":
|
||||
if params == "+1":
|
||||
return "Workspace: focus right"
|
||||
elif params == "-1":
|
||||
return "Workspace: focus left"
|
||||
return "Focus workspace {}".format(params)
|
||||
|
||||
case "movefocus":
|
||||
return "Window: move focus {}".format(
|
||||
{
|
||||
"l": "left",
|
||||
"r": "right",
|
||||
"u": "up",
|
||||
"d": "down",
|
||||
}.get(params, "null")
|
||||
)
|
||||
|
||||
case "swapwindow":
|
||||
return "Window: swap in {} direction".format(
|
||||
{
|
||||
"l": "left",
|
||||
"r": "right",
|
||||
"u": "up",
|
||||
"d": "down",
|
||||
}.get(params, "null")
|
||||
)
|
||||
|
||||
case "movetoworkspace":
|
||||
if params == "+1":
|
||||
return "Window: move to right workspace (non-silent)"
|
||||
elif params == "-1":
|
||||
return "Window: move to left workspace (non-silent)"
|
||||
return "Window: move to workspace {} (non-silent)".format(params)
|
||||
|
||||
case "movetoworkspacesilent":
|
||||
if params == "+1":
|
||||
return "Window: move to right workspace"
|
||||
elif params == "-1":
|
||||
return "Window: move to right workspace"
|
||||
return "Window: move to workspace {}".format(params)
|
||||
|
||||
case "togglespecialworkspace":
|
||||
return "Workspace: toggle special"
|
||||
|
||||
case "exec":
|
||||
return "Execute: {}".format(params)
|
||||
|
||||
case _:
|
||||
return ""
|
||||
|
||||
def get_keybind_at_line(line_number, line_start = 0):
|
||||
global content_lines
|
||||
line = content_lines[line_number]
|
||||
_, keys = line.split("=", 1)
|
||||
keys, *comment = keys.split("#", 1)
|
||||
|
||||
mods, key, dispatcher, *params = list(map(str.strip, keys.split(",", 4)))
|
||||
params = "".join(map(str.strip, params))
|
||||
|
||||
# Remove empty spaces
|
||||
comment = list(map(str.strip, comment))
|
||||
# Add comment if it exists, else generate it
|
||||
if comment:
|
||||
comment = comment[0]
|
||||
if comment.startswith("[hidden]"):
|
||||
return None
|
||||
else:
|
||||
comment = autogenerate_comment(dispatcher, params)
|
||||
|
||||
if mods:
|
||||
modstring = mods + MOD_SEPARATORS[0] # Add separator at end to ensure last mod is read
|
||||
mods = []
|
||||
p = 0
|
||||
for index, char in enumerate(modstring):
|
||||
if(char in MOD_SEPARATORS):
|
||||
if(index - p > 1):
|
||||
mods.append(modstring[p:index])
|
||||
p = index+1
|
||||
else:
|
||||
mods = []
|
||||
|
||||
return KeyBinding(mods, key, dispatcher, params, comment)
|
||||
|
||||
def get_binds_recursive(current_content, scope):
|
||||
global content_lines
|
||||
global reading_line
|
||||
# print("get_binds_recursive({0}, {1}) [@L{2}]".format(current_content, scope, reading_line + 1))
|
||||
while reading_line < len(content_lines): # TODO: Adjust condition
|
||||
line = content_lines[reading_line]
|
||||
heading_search_result = re.search(TITLE_REGEX, line)
|
||||
# print("Read line {0}: {1}\tisHeading: {2}".format(reading_line + 1, content_lines[reading_line], "[{0}, {1}, {2}]".format(heading_search_result.start(), heading_search_result.start() == 0, ((heading_search_result != None) and (heading_search_result.start() == 0))) if heading_search_result != None else "No"))
|
||||
if ((heading_search_result != None) and (heading_search_result.start() == 0)): # Found title
|
||||
# Determine scope
|
||||
heading_scope = line.find('!')
|
||||
# Lower? Return
|
||||
if(heading_scope <= scope):
|
||||
reading_line -= 1
|
||||
return current_content
|
||||
|
||||
section_name = line[(heading_scope+1):].strip()
|
||||
# print("[[ Found h{0} at line {1} ]] {2}".format(heading_scope, reading_line+1, content_lines[reading_line]))
|
||||
reading_line += 1
|
||||
current_content["children"].append(get_binds_recursive(Section([], [], section_name), heading_scope))
|
||||
|
||||
elif line.startswith(COMMENT_BIND_PATTERN):
|
||||
keybind = get_keybind_at_line(reading_line, line_start=len(COMMENT_BIND_PATTERN))
|
||||
if(keybind != None):
|
||||
current_content["keybinds"].append(keybind)
|
||||
|
||||
elif line == "" or not line.lstrip().startswith("bind"): # Comment, ignore
|
||||
pass
|
||||
|
||||
else: # Normal keybind
|
||||
keybind = get_keybind_at_line(reading_line)
|
||||
if(keybind != None):
|
||||
current_content["keybinds"].append(keybind)
|
||||
|
||||
reading_line += 1
|
||||
|
||||
return current_content;
|
||||
|
||||
def parse_keys(path: str) -> Dict[str, List[KeyBinding]]:
|
||||
global content_lines
|
||||
content_lines = read_content(path).splitlines()
|
||||
if content_lines[0] == "error":
|
||||
return "error"
|
||||
return get_binds_recursive(Section([], [], ""), 0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import json
|
||||
|
||||
ParsedKeys = parse_keys(args.path)
|
||||
print(json.dumps(ParsedKeys))
|
||||
@@ -1,79 +0,0 @@
|
||||
import re
|
||||
import os
|
||||
|
||||
def read_scss(file_path):
|
||||
"""Reads an SCSS file and returns a dictionary of color variables."""
|
||||
colors = {}
|
||||
with open(file_path, 'r') as file:
|
||||
for line in file:
|
||||
match = re.match(r'\$(\w+):\s*(#[0-9A-Fa-f]{6});', line.strip())
|
||||
if match:
|
||||
variable_name, color = match.groups()
|
||||
colors[variable_name] = color
|
||||
return colors
|
||||
|
||||
def update_svg_colors(svg_path, old_to_new_colors, output_path):
|
||||
"""
|
||||
Updates the colors in an SVG file based on the provided color map.
|
||||
|
||||
:param svg_path: Path to the SVG file.
|
||||
:param old_to_new_colors: Dictionary mapping old colors to new colors.
|
||||
:param output_path: Path to save the updated SVG file.
|
||||
"""
|
||||
# Read the SVG content
|
||||
with open(svg_path, 'r') as file:
|
||||
svg_content = file.read()
|
||||
|
||||
# Replace old colors with new colors
|
||||
for old_color, new_color in old_to_new_colors.items():
|
||||
svg_content = re.sub(old_color, new_color, svg_content, flags=re.IGNORECASE)
|
||||
|
||||
# Write the updated SVG content to the output file
|
||||
with open(output_path, 'w') as file:
|
||||
file.write(svg_content)
|
||||
|
||||
print(f"SVG colors have been updated and saved to {output_path}!")
|
||||
|
||||
def main():
|
||||
xdg_config_home = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
||||
xdg_state_home = os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))
|
||||
|
||||
scss_file = os.path.join(xdg_state_home, "quickshell", "user", "generated", "material_colors.scss")
|
||||
svg_path = os.path.join(xdg_config_home, "Kvantum", "Colloid", "Colloid.svg")
|
||||
output_path = os.path.join(xdg_config_home, "Kvantum", "MaterialAdw", "MaterialAdw.svg")
|
||||
|
||||
# Read colors from the SCSS file
|
||||
color_data = read_scss(scss_file)
|
||||
|
||||
# Specify the old colors and map them to new colors from the SCSS file
|
||||
old_to_new_colors = {
|
||||
#'#cccccc': color_data['surfaceDim'], # Map old SVG color to new SCSS color
|
||||
#'#666666': color_data['surfaceDim'],
|
||||
'#3c84f7': color_data['primary'],
|
||||
#'#5a5a5a': color_data['neutral_paletteKeyColor'],
|
||||
'#000000': color_data['shadow'],
|
||||
'#f04a50': color_data['error'],
|
||||
'#4285f4': color_data['primaryFixedDim'],
|
||||
'#f2f2f2': color_data['background'],
|
||||
#'#dfdfdf': color_data['surfaceContainerLow'],
|
||||
'#ffffff': color_data['background'],
|
||||
'#1e1e1e': color_data['onPrimaryFixed'],
|
||||
#'#b6b6b6': color_data['surfaceContainer'],
|
||||
'#333': color_data['inverseSurface'],
|
||||
'#212121': color_data['onSecondaryFixed'],
|
||||
'#5b9bf8': color_data['secondaryContainer'],
|
||||
'#26272a': color_data['term7'],
|
||||
#'#b3b3b3': color_data['surfaceBright'],
|
||||
#'#b74aff': color_data['tertiary'],
|
||||
#'#989898': color_data['surfaceContainerHighest'],
|
||||
#'#c1c1c1': color_data['surfaceContainerHigh'],
|
||||
'#444444': color_data['onBackground'],
|
||||
'#333333': color_data['onPrimaryFixed'],
|
||||
}
|
||||
|
||||
# Update the SVG colors
|
||||
update_svg_colors(svg_path, old_to_new_colors, output_path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
import re
|
||||
import os
|
||||
|
||||
def read_scss(file_path):
|
||||
"""Reads an SCSS file and returns a dictionary of color variables."""
|
||||
colors = {}
|
||||
with open(file_path, 'r') as file:
|
||||
for line in file:
|
||||
match = re.match(r'\$(\w+):\s*(#[0-9A-Fa-f]{6});', line.strip())
|
||||
if match:
|
||||
variable_name, color = match.groups()
|
||||
colors[variable_name] = color
|
||||
return colors
|
||||
|
||||
def update_svg_colors(svg_path, old_to_new_colors, output_path):
|
||||
"""
|
||||
Updates the colors in an SVG file based on the provided color map.
|
||||
|
||||
:param svg_path: Path to the SVG file.
|
||||
:param old_to_new_colors: Dictionary mapping old colors to new colors.
|
||||
:param output_path: Path to save the updated SVG file.
|
||||
"""
|
||||
# Read the SVG content
|
||||
with open(svg_path, 'r') as file:
|
||||
svg_content = file.read()
|
||||
|
||||
# Replace old colors with new colors
|
||||
for old_color, new_color in old_to_new_colors.items():
|
||||
svg_content = re.sub(old_color, new_color, svg_content, flags=re.IGNORECASE)
|
||||
|
||||
# Write the updated SVG content to the output file
|
||||
with open(output_path, 'w') as file:
|
||||
file.write(svg_content)
|
||||
|
||||
print(f"SVG colors have been updated and saved to {output_path}!")
|
||||
|
||||
def main():
|
||||
xdg_config_home = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
||||
xdg_state_home = os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))
|
||||
|
||||
scss_file = os.path.join(xdg_state_home, "quickshell", "user", "generated", "material_colors.scss")
|
||||
svg_path = os.path.join(xdg_config_home, "Kvantum", "Colloid", "ColloidDark.svg")
|
||||
output_path = os.path.join(xdg_config_home, "Kvantum", "MaterialAdw", "MaterialAdw.svg")
|
||||
|
||||
# Read colors from the SCSS file
|
||||
color_data = read_scss(scss_file)
|
||||
|
||||
# Specify the old colors and map them to new colors from the SCSS file
|
||||
old_to_new_colors = {
|
||||
#'#525252': color_data['surfaceDim'], # Map old SVG color to new SCSS color
|
||||
#'#666666': color_data['surfaceDim'],
|
||||
'#31363b': color_data['background'],
|
||||
#'#eff0f1': color_data['neutral_paletteKeyColor'],
|
||||
'#000000': color_data['shadow'],
|
||||
'#5b9bf8': color_data['primary'],
|
||||
'#93cee9': color_data['onSecondaryContainer'],
|
||||
'#3daee9': color_data['secondary'],
|
||||
#'#fff': color_data['term10'],
|
||||
#'#5a5a5a': color_data['surfaceVariant'],
|
||||
#'#acb1bc': color_data['onPrimaryFixed'],
|
||||
'#ffffff': color_data['term11'],
|
||||
'#5a616e': color_data['surfaceVariant'],
|
||||
'#f04a50': color_data['error'],
|
||||
'#4285f4': color_data['secondary'],
|
||||
'#242424': color_data['background'],
|
||||
'#2c2c2c': color_data['background'],
|
||||
#'#dfdfdf': color_data['onSurfaceVariant'],
|
||||
#'#646464': color_data['surfaceContainerHighest'],
|
||||
#'#989898': color_data['surfaceContainerHigh'],
|
||||
#'#c1c1c1': color_data['primaryFixedDim'],
|
||||
'#1e1e1e': color_data['background'],
|
||||
'#3c3c3c': color_data['background'],
|
||||
'#26272a': color_data['surfaceBright'],
|
||||
'#000000': color_data['shadow'],
|
||||
'#b74aff': color_data['tertiary'],
|
||||
#'#b6b6b6': color_data['onSurfaceVariant'],
|
||||
'#1a1a1a': color_data['background'],
|
||||
'#333': color_data['term0'],
|
||||
'#212121': color_data['background'],
|
||||
}
|
||||
|
||||
# Update the SVG colors
|
||||
update_svg_colors(svg_path, old_to_new_colors, output_path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
import re
|
||||
import os
|
||||
|
||||
def get_colors_from_scss(scss_file):
|
||||
colors = {}
|
||||
with open(scss_file, 'r') as file:
|
||||
for line in file:
|
||||
match = re.match(r'\$(\w+):\s*(#[0-9A-Fa-f]{6});', line)
|
||||
if match:
|
||||
colors[match.group(1)] = match.group(2)
|
||||
return colors
|
||||
|
||||
def update_config_colors(config_file, colors, mappings):
|
||||
with open(config_file, 'r') as file:
|
||||
config_content = file.read()
|
||||
|
||||
for key, variable in mappings.items():
|
||||
if variable in colors:
|
||||
color = colors[variable]
|
||||
pattern = rf'({key}=)#?\w+\b'
|
||||
new_line = f'\\1{color}'
|
||||
if re.search(pattern, config_content):
|
||||
config_content = re.sub(pattern, new_line, config_content)
|
||||
else:
|
||||
config_content += f"\n{key}={color}"
|
||||
|
||||
with open(config_file, 'w') as file:
|
||||
file.write(config_content)
|
||||
|
||||
if __name__ == "__main__":
|
||||
xdg_config_home = os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
||||
xdg_state_home = os.environ.get("XDG_STATE_HOME", os.path.expanduser("~/.local/state"))
|
||||
|
||||
config_file = os.path.join(xdg_config_home, "Kvantum", "MaterialAdw", "MaterialAdw.kvconfig")
|
||||
scss_file = os.path.join(xdg_state_home, "quickshell", "user", "generated", "material_colors.scss")
|
||||
|
||||
# Define your mappings here
|
||||
mappings = {
|
||||
'window.color': 'background',
|
||||
'base.color': 'background',
|
||||
'alt.base.color': 'background',
|
||||
'button.color': 'surfaceContainer',
|
||||
'light.color': 'surfaceContainerLow',
|
||||
'mid.light.color': 'surfaceContainer',
|
||||
'dark.color': 'surfaceContainerHighest',
|
||||
'mid.color': 'surfaceContainerHigh',
|
||||
'highlight.color': 'primary',
|
||||
'inactive.highlight.color': 'primary',
|
||||
'text.color': 'onBackground',
|
||||
'window.text.color': 'onBackground',
|
||||
'button.text.color': 'onBackground',
|
||||
'disabled.text.color': 'onBackground',
|
||||
'tooltip.text.color': 'onBackground',
|
||||
'highlight.text.color': 'onSurface',
|
||||
'link.color': 'tertiary',
|
||||
'link.visited.color': 'tertiaryFixed',
|
||||
'progress.indicator.text.color': 'onBackground',
|
||||
'text.normal.color': 'onBackground',
|
||||
'text.focus.color': 'onBackground',
|
||||
'text.press.color': 'onsecondarycontainer',
|
||||
'text.toggle.color': 'onsecondarycontainer',
|
||||
'text.disabled.color': 'surfaceDim',
|
||||
|
||||
|
||||
# Add more mappings as needed
|
||||
}
|
||||
|
||||
colors = get_colors_from_scss(scss_file)
|
||||
update_config_colors(config_file, colors, mappings)
|
||||
print("Config colors updated successfully!")
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
QUICKSHELL_CONFIG_NAME="ii"
|
||||
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/quickshell/$QUICKSHELL_CONFIG_NAME"
|
||||
CACHE_DIR="$XDG_CACHE_HOME/quickshell"
|
||||
STATE_DIR="$XDG_STATE_HOME/quickshell"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
get_light_dark() {
|
||||
current_mode=$(gsettings get org.gnome.desktop.interface color-scheme 2>/dev/null | tr -d "'")
|
||||
if [[ "$current_mode" == "prefer-dark" ]]; then
|
||||
echo "dark"
|
||||
else
|
||||
echo "light"
|
||||
fi
|
||||
}
|
||||
|
||||
apply_qt() {
|
||||
# Check if the theme exists
|
||||
FOLDER_PATH="$XDG_CONFIG_HOME/Kvantum/Colloid/"
|
||||
|
||||
if [ ! -d "$FOLDER_PATH" ]; then
|
||||
# Send a notification
|
||||
notify-send "Colloid-kde theme required" " The folder '$FOLDER_PATH' does not exist."
|
||||
exit 1 # Exit the function if the folder does not exist
|
||||
fi
|
||||
|
||||
lightdark=$(get_light_dark)
|
||||
if [ "$lightdark" = "light" ]; then
|
||||
# apply ligght colors
|
||||
cp "$XDG_CONFIG_HOME/Kvantum/Colloid/Colloid.kvconfig" "$XDG_CONFIG_HOME/Kvantum/MaterialAdw/MaterialAdw.kvconfig"
|
||||
python "$CONFIG_DIR/scripts/kvantum/adwsvg.py"
|
||||
|
||||
else
|
||||
#apply dark colors
|
||||
cp "$XDG_CONFIG_HOME/Kvantum/Colloid/ColloidDark.kvconfig" "$XDG_CONFIG_HOME/Kvantum/MaterialAdw/MaterialAdw.kvconfig"
|
||||
python "$CONFIG_DIR/scripts/kvantum/adwsvgDark.py"
|
||||
fi
|
||||
}
|
||||
|
||||
apply_qt
|
||||
Reference in New Issue
Block a user