This commit is contained in:
sankalp committed 2025-06-11 14:42:26 +05:45
1 parent b6a5343a42
commit a3c423c8b8
18 files changed
+2023 -966

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
{
"prefix_restart": "SUPER ALT",
"suffix_restart": "B",
"prefix_axmsg": "SUPER",
"suffix_axmsg": "A",
"prefix_dash": "SUPER",
"suffix_dash": "D",
"prefix_bluetooth": "SUPER SHIFT",
"suffix_bluetooth": "B",
"prefix_pins": "SUPER",
"suffix_pins": "Q",
"prefix_kanban": "SUPER",
"suffix_kanban": "N",
"prefix_launcher": "SUPER",
"suffix_launcher": "R",
"prefix_tmux": "SUPER",
"suffix_tmux": "T",
"prefix_cliphist": "SUPER",
"suffix_cliphist": "V",
"prefix_toolbox": "SUPER",
"suffix_toolbox": "S",
"prefix_overview": "SUPER",
"suffix_overview": "TAB",
"prefix_wallpapers": "SUPER",
"suffix_wallpapers": "COMMA",
"prefix_randwall": "SUPER SHIFT",
"suffix_randwall": "COMMA",
"prefix_emoji": "SUPER",
"suffix_emoji": "PERIOD",
"prefix_power": "SUPER",
"suffix_power": "ESCAPE",
"prefix_caffeine": "SUPER SHIFT",
"suffix_caffeine": "M",
"prefix_css": "SUPER SHIFT",
"suffix_css": "B",
"prefix_restart_inspector": "SUPER CTRL ALT",
"suffix_restart_inspector": "B",
"wallpapers_dir": "/home/sankalp/Pictures/wallpapers",
"dock_position": "Bottom",
"vertical": false,
"dock_enabled": true,
"dock_auto_hide": true,
"dock_always_occluded": false,
"dock_icon_size": 20,
"terminal_command": "kitty -e",
"corners_visible": true,
"dock_theme": "Pills",
"notif_pos": "Top",
"dock_workspace_visible": true,
"dock_metrics_visible": true,
"dock_date_time_visible": true,
"dock_battery_visible": true,
"dock_controls_visible": true,
"dock_indicators_visible": true,
"dock_applications_visible": true,
"metrics_visible": {
"cpu": true,
"ram": true,
"swap": true,
"disk": false,
"gpu": false
},
"metrics_disks": [
"/"
]
}
+7 -3
View File
@@ -7,7 +7,7 @@ import gi
gi.require_version("Gtk", "3.0")
APP_NAME = "modusv1"
APP_NAME = "modus"
APP_NAME_CAP = "Modus"
@@ -60,6 +60,7 @@ if os.path.exists(CONFIG_FILE):
DOCK_AUTO_HIDE = config.get("dock_auto_hide", True)
DOCK_ALWAYS_OCCLUDED = config.get("dock_always_occluded", False)
DOCK_THEME = config.get("dock_theme", "Pills")
DOCK_ICON_SIZE = config.get("dock_icon_size", 20)
NOTIF_POS = config.get(NOTIF_POS_KEY, NOTIF_POS_DEFAULT)
@@ -70,7 +71,8 @@ if os.path.exists(CONFIG_FILE):
"date_time": config.get("dock_date_time_visible", True),
"controls": config.get("dock_controls_visible", True),
"indicators": config.get("dock_indicators_visible", True),
"tray": config.get("dock_tray_visible", True),
"systray": config.get("dock_tray_visible", True),
"applications": config.get("dock_applications_visible", True),
}
METRICS_DISKS = config.get("metrics_disks", ["/"])
@@ -87,6 +89,7 @@ else:
DOCK_AUTO_HIDE = True
TERMINAL_COMMAND = "kitty -e"
DOCK_THEME = "Pills"
DOCK_ICON_SIZE = 20
NOTIF_POS = NOTIF_POS_DEFAULT
@@ -97,7 +100,8 @@ else:
"date_time": True,
"controls": True,
"indicators": True,
"tray": True,
"systray": True,
"applications": True,
}
METRICS_DISKS = ["/"]
+3
View File
@@ -0,0 +1,3 @@
{
"pinned_apps": []
}
-75
View File
@@ -1,75 +0,0 @@
exec-once = uwsm-app $(python /home/sankalp/.config/Ax-Shell/main.py)
exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle
exec = uwsm app -- swww-daemon
exec-once = wl-paste --type text --watch cliphist store
exec-once = wl-paste --type image --watch cliphist store
$fabricSend = fabric-cli exec ax-shell
$axMessage = notify-send "Axenide" "FIRE IN THE HOLE‼️🗣️🔥🕳️" -i "/home/sankalp/.config/Ax-Shell/assets/ax.png" -A "🗣️" -A "🔥" -A "🕳️" -a "Source Code"
bind = SUPER ALT, B, exec, killall ax-shell; uwsm-app $(python /home/sankalp/.config/Ax-Shell/main.py) # Reload Ax-Shell
bind = SUPER, A, exec, $axMessage # Message
bind = SUPER, D, exec, $fabricSend 'notch.open_notch("dashboard")' # Dashboard
bind = SUPER SHIFT, B, exec, $fabricSend 'notch.open_notch("bluetooth")' # Bluetooth
bind = SUPER, Q, exec, $fabricSend 'notch.open_notch("pins")' # Pins
bind = SUPER, N, exec, $fabricSend 'notch.open_notch("kanban")' # Kanban
bind = SUPER, R, exec, $fabricSend 'notch.open_notch("launcher")' # App Launcher
bind = SUPER, T, exec, $fabricSend 'notch.open_notch("tmux")' # Tmux
bind = SUPER, V, exec, $fabricSend 'notch.open_notch("cliphist")' # Clipboard History
bind = SUPER, S, exec, $fabricSend 'notch.open_notch("tools")' # Toolbox
bind = SUPER, TAB, exec, $fabricSend 'notch.open_notch("overview")' # Overview
bind = SUPER, COMMA, exec, $fabricSend 'notch.open_notch("wallpapers")' # Wallpapers
bind = SUPER SHIFT, COMMA, exec, $fabricSend 'notch.dashboard.wallpapers.set_random_wallpaper(None, external=True)' # Random Wallpaper
bind = SUPER, PERIOD, exec, $fabricSend 'notch.open_notch("emoji")' # Emoji Picker
bind = SUPER, ESCAPE, exec, $fabricSend 'notch.open_notch("power")' # Power Menu
bind = SUPER SHIFT, M, exec, $fabricSend 'notch.dashboard.widgets.buttons.caffeine_button.toggle_inhibit(external=True)' # Toggle Caffeine
bind = SUPER SHIFT, B, exec, $fabricSend 'app.set_css()' # Reload CSS
bind = SUPER CTRL ALT, B, exec, killall ax-shell; uwsm-app $(GTK_DEBUG=interactive python /home/sankalp/.config/Ax-Shell/main.py) # Restart with inspector
# Wallpapers directory: /home/sankalp/Pictures/wallpapers
source = /home/sankalp/.config/Ax-Shell/config/hypr/colors.conf
layerrule = noanim, fabric
exec = cp $wallpaper ~/.current.wall
general {
col.active_border = rgb($primary)
col.inactive_border = rgb($surface)
gaps_in = 2
gaps_out = 4
border_size = 2
layout = dwindle
}
cursor {
no_warps=true
}
decoration {
blur {
enabled = yes
size = 5
passes = 3
new_optimizations = yes
contrast = 1
brightness = 1
}
rounding = 14
shadow {
enabled = true
range = 10
render_power = 2
color = rgba(0, 0, 0, 0.25)
}
}
animations {
enabled = yes
bezier = myBezier, 0.4, 0.0, 0.2, 1.0
animation = windows, 1, 2.5, myBezier, popin 80%
animation = border, 1, 2.5, myBezier
animation = fade, 1, 2.5, myBezier
animation = workspaces, 1, 2.5, myBezier, slidefadevert 20%
}
+11 -11
View File
@@ -1,27 +1,27 @@
$wallpaper = /home/sankalp/Pictures/wallpapers/56.png
$background = 18120b
$foreground = ede0d4
$wallpaper = /home/sankalp/Pictures/wallpapers/165.jpg
$background = 16130b
$foreground = eae1d4
$primary = f5bc6f
$secondary = dec2a2
$tertiary = b9cda0
$surface = 18120b
$surface_bright = 3f3830
$outline = 9c8f80
$primary = e3c46c
$secondary = d5c5a1
$tertiary = adcfae
$surface = 16130b
$surface_bright = 3d392f
$outline = 989080
$error = ff5945
$shadow = 000000
$red = ffb595
$green = b7d085
$yellow = dec56e
$yellow = d7c770
$blue = cebdfe
$magenta = fcb0d5
$cyan = 84d5c4
$white = 82d3e0
$red_dim = ff6e2f
$green_dim = 89ad42
$yellow_dim = bb9b2b
$yellow_dim = b09c31
$blue_dim = 8359fc
$magenta_dim = f84ea1
$cyan_dim = 3eb59c
+22 -11
View File
@@ -7,23 +7,34 @@ exec-once = wl-paste --type image --watch cliphist store
$fabricSend = fabric-cli exec modus
$axMessage = notify-send "Axenide" "FIRE IN THE HOLE‼️🗣️🔥🕳️" -i "/home/sankalp/.config/Modus/assets/ax.png" -A "🗣️" -A "🔥" -A "🕳️" -a "Source Code"
bind = SUPER ALT, B, exec, killall modus; uwsm-app $(python /home/sankalp/.config/Modus/main.py) # Reload Modus
bind = SUPER, A, exec, $axMessage # Message
bind = SUPER, D, exec, $fabricSend 'notch.open_notch("dashboard")' # Dashboard
bind = SUPER SHIFT, B, exec, $fabricSend 'notch.open_notch("bluetooth")' # Bluetooth
# Reload Modus
bind = SUPER ALT, B, exec, killall modus; uwsm-app $(python /home/sankalp/.config/Modus/main.py)
# Message
bind = SUPER, A, exec, $axMessage
# Dashboard
bind = SUPER, D, exec, $fabricSend 'notch.open_notch("dashboard")'
# Bluetooth
bind = SUPER SHIFT, B, exec, $fabricSend 'notch.open_notch("bluetooth")'
bind = SUPER, Q, exec, $fabricSend 'notch.open_notch("pins")' # Pins
bind = SUPER, N, exec, $fabricSend 'notch.open_notch("kanban")' # Kanban
bind = SUPER, R, exec, $fabricSend 'notch.open_notch("launcher")' # App Launcher
# App Launcher
bind = SUPER, R, exec, $fabricSend 'notch.open_notch("launcher")'
bind = SUPER, T, exec, $fabricSend 'notch.open_notch("tmux")' # Tmux
bind = SUPER, V, exec, $fabricSend 'notch.open_notch("cliphist")' # Clipboard History
bind = SUPER, S, exec, $fabricSend 'notch.open_notch("tools")' # Toolbox
# Clipboard History
bind = SUPER, V, exec, $fabricSend 'notch.open_notch("cliphist")'
# Toolbox
bind = SUPER, S, exec, $fabricSend 'notch.open_notch("tools")'
bind = SUPER, TAB, exec, $fabricSend 'notch.open_notch("overview")' # Overview
bind = SUPER, COMMA, exec, $fabricSend 'notch.open_notch("wallpapers")' # Wallpapers
# Wallpapers
bind = SUPER, COMMA, exec, $fabricSend 'notch.open_notch("wallpapers")'
bind = SUPER SHIFT, COMMA, exec, $fabricSend 'notch.dashboard.wallpapers.set_random_wallpaper(None, external=True)' # Random Wallpaper
bind = SUPER, PERIOD, exec, $fabricSend 'notch.open_notch("emoji")' # Emoji Picker
bind = SUPER, ESCAPE, exec, $fabricSend 'notch.open_notch("power")' # Power Menu
# Emoji Picker
bind = SUPER, PERIOD, exec, $fabricSend 'notch.open_notch("emoji")'
# Power Menu
bind = SUPER, ESCAPE, exec, $fabricSend 'notch.open_notch("power")'
bind = SUPER SHIFT, M, exec, $fabricSend 'notch.dashboard.widgets.buttons.caffeine_button.toggle_inhibit(external=True)' # Toggle Caffeine
bind = SUPER SHIFT, B, exec, $fabricSend 'app.set_css()' # Reload CSS
# Reload CSS
bind = SUPER SHIFT, B, exec, $fabricSend 'app.set_css()'
bind = SUPER CTRL ALT, B, exec, killall modus; uwsm-app $(GTK_DEBUG=interactive python /home/sankalp/.config/Modus/main.py) # Restart with inspector
# Wallpapers directory: /home/sankalp/Pictures/wallpapers
+69 -61
View File
@@ -1,4 +1,10 @@
from config.data import (APP_NAME, APP_NAME_CAP, NOTIF_POS_DEFAULT, NOTIF_POS_KEY,WALLPAPERS_DIR_DEFAULT)
from config.data import (
APP_NAME,
APP_NAME_CAP,
NOTIF_POS_DEFAULT,
NOTIF_POS_KEY,
WALLPAPERS_DIR_DEFAULT,
)
SOURCE_STRING = f"""
# {APP_NAME_CAP}
@@ -6,64 +12,66 @@ source = ~/{APP_NAME_CAP}/config/hypr/{APP_NAME}.conf
"""
DEFAULTS = {
"prefix_restart": "SUPER ALT",
"suffix_restart": "B",
"prefix_axmsg": "SUPER",
"suffix_axmsg": "A",
"prefix_dash": "SUPER",
"suffix_dash": "D",
"prefix_bluetooth": "SUPER SHIFT",
"suffix_bluetooth": "B",
"prefix_pins": "SUPER",
"suffix_pins": "Q",
"prefix_kanban": "SUPER",
"suffix_kanban": "N",
"prefix_launcher": "SUPER",
"suffix_launcher": "R",
"prefix_tmux": "SUPER",
"suffix_tmux": "T",
"prefix_cliphist": "SUPER",
"suffix_cliphist": "V",
"prefix_toolbox": "SUPER",
"suffix_toolbox": "S",
"prefix_overview": "SUPER",
"suffix_overview": "TAB",
"prefix_wallpapers": "SUPER",
"suffix_wallpapers": "COMMA",
"prefix_randwall": "SUPER SHIFT",
"suffix_randwall": "COMMA",
"prefix_emoji": "SUPER",
"suffix_emoji": "PERIOD",
"prefix_power": "SUPER",
"suffix_power": "ESCAPE",
"prefix_caffeine": "SUPER SHIFT",
"suffix_caffeine": "M",
"prefix_css": "SUPER SHIFT",
"suffix_css": "B",
"prefix_restart_inspector": "SUPER CTRL ALT",
"suffix_restart_inspector": "B",
"wallpapers_dir": "/home/sankalp/Pictures/wallpapers",
"vertical": True,
"dock_enabled": True,
"dock_always_occluded": False,
"dock_auto_hide": True,
"terminal_command": "kitty -e",
"corners_visible": False,
"dock_theme": "Pills",
"notif_pos": "Top",
"dock_position": "Bottom",
"dock_workspaces_visible": True,
"dock_metrics_visible": True,
"dock_battery_visible": True,
"dock_date_time_visible": True,
"dock_controls_visible": True,
"dock_indicators_visible": True,
"metrics_visible": {
"cpu": True,
"ram": True,
"disk": True,
"swap": True,
"gpu": False
},
"bar_metrics_disks": []
"prefix_restart": "SUPER ALT",
"suffix_restart": "B",
"prefix_axmsg": "SUPER",
"suffix_axmsg": "A",
"prefix_dash": "SUPER",
"suffix_dash": "D",
"prefix_bluetooth": "SUPER SHIFT",
"suffix_bluetooth": "B",
"prefix_pins": "SUPER",
"suffix_pins": "Q",
"prefix_kanban": "SUPER",
"suffix_kanban": "N",
"prefix_launcher": "SUPER",
"suffix_launcher": "R",
"prefix_tmux": "SUPER",
"suffix_tmux": "T",
"prefix_cliphist": "SUPER",
"suffix_cliphist": "V",
"prefix_toolbox": "SUPER",
"suffix_toolbox": "S",
"prefix_overview": "SUPER",
"suffix_overview": "TAB",
"prefix_wallpapers": "SUPER",
"suffix_wallpapers": "COMMA",
"prefix_randwall": "SUPER SHIFT",
"suffix_randwall": "COMMA",
"prefix_emoji": "SUPER",
"suffix_emoji": "PERIOD",
"prefix_power": "SUPER",
"suffix_power": "ESCAPE",
"prefix_caffeine": "SUPER SHIFT",
"suffix_caffeine": "M",
"prefix_css": "SUPER SHIFT",
"suffix_css": "B",
"prefix_restart_inspector": "SUPER CTRL ALT",
"suffix_restart_inspector": "B",
"wallpapers_dir": "/home/sankalp/Pictures/wallpapers",
"vertical": True,
"dock_enabled": True,
"dock_always_occluded": False,
"dock_auto_hide": True,
"terminal_command": "kitty -e",
"corners_visible": False,
"dock_theme": "Pills",
"notif_pos": "Top",
"dock_position": "Bottom",
"dock_icon_size": 20,
"dock_workspaces_visible": True,
"dock_metrics_visible": True,
"dock_battery_visible": True,
"dock_date_time_visible": True,
"dock_controls_visible": True,
"dock_indicators_visible": True,
"dock_applications_visible": True,
"metrics_visible": {
"cpu": True,
"ram": True,
"disk": True,
"swap": True,
"gpu": False,
},
"metrics_disks": ["/"],
}
+38 -11
View File
@@ -286,6 +286,29 @@ class HyprConfGUI(Window):
dock_theme_combo_container.add(self.dock_theme_combo)
layout_grid.attach(dock_theme_combo_container, 3, 0, 1, 1)
# Add icon size scale
icon_size_label = Label(label="Icon Size", h_align="start", v_align="center")
layout_grid.attach(icon_size_label, 0, 3, 1, 1)
icon_size_scale_container = Gtk.Box(
orientation=Gtk.Orientation.HORIZONTAL,
halign=Gtk.Align.START,
valign=Gtk.Align.CENTER,
hexpand=True
)
self.icon_size_scale = Gtk.Scale.new_with_range(
Gtk.Orientation.HORIZONTAL, 20, 30, 2
)
self.icon_size_scale.set_value(bind_vars.get("dock_icon_size", 20))
self.icon_size_scale.set_size_request(150, -1)
self.icon_size_scale.set_draw_value(True)
self.icon_size_scale.set_value_pos(Gtk.PositionType.RIGHT)
self.icon_size_scale.set_tooltip_text("Adjust the size of dock icons")
icon_size_scale_container.add(self.icon_size_scale)
layout_grid.attach(icon_size_scale_container, 1, 3, 3, 1)
dock_label = Label(label="Show Dock", h_align="start", v_align="center")
layout_grid.attach(dock_label, 0, 1, 1, 1)
dock_switch_container = Gtk.Box(
@@ -388,6 +411,7 @@ class HyprConfGUI(Window):
"battery": "Battery Indicator",
"controls": "Control Panel",
"indicators": "Indicators",
"applications": "Taskbar"
}
self.corners_switch = Gtk.Switch(active=bind_vars.get("corners_visible", True))
@@ -535,8 +559,8 @@ class HyprConfGUI(Window):
metric_names = {
"cpu": "CPU",
"ram": "RAM",
"disk": "Disk",
"swap": "Swap",
"disk": "Disk",
"gpu": "GPU",
}
@@ -633,18 +657,18 @@ class HyprConfGUI(Window):
repo_box.add(repo_link)
vbox.add(repo_box)
def on_kofi_clicked(_):
import webbrowser
# def on_kofi_clicked(_):
# import webbrowser
webbrowser.open("https://ko-fi.com/S4NKALP")
# webbrowser.open("https://github.com/S4NKALP")
kofi_btn = Button(
label="Support on Ko-Fi ❤️",
on_clicked=on_kofi_clicked,
tooltip_text="Support S4NKALP on Ko-Fi",
style="margin-top: 18px; min-width: 160px;",
)
vbox.add(kofi_btn)
# kofi_btn = Button(
# label="Support on Ko-Fi ❤️",
# on_clicked=on_kofi_clicked,
# tooltip_text="Support S4NKALP on Ko-Fi",
# style="margin-top: 18px; min-width: 160px;",
# )
# vbox.add(kofi_btn)
vbox.add(Box(v_expand=True))
return vbox
@@ -727,6 +751,7 @@ class HyprConfGUI(Window):
current_bind_vars_snapshot["dock_always_occluded"] = (
self.dock_hover_switch.get_active()
)
current_bind_vars_snapshot["dock_icon_size"] = int(self.icon_size_scale.get_value())
current_bind_vars_snapshot["terminal_command"] = self.terminal_entry.get_text()
current_bind_vars_snapshot["corners_visible"] = self.corners_switch.get_active()
current_bind_vars_snapshot["dock_theme"] = (
@@ -1016,6 +1041,8 @@ class HyprConfGUI(Window):
self.lock_switch.set_active(False)
if self.idle_switch:
self.idle_switch.set_active(False)
# Add reset for icon size scale
self.icon_size_scale.set_value(utils.bind_vars.get("dock_icon_size", 20))
print("Settings reset to defaults.")
def on_close(self, widget):
+158 -95
View File
@@ -1,3 +1,10 @@
from config.data import ( # CONFIG_DIR, HOME_DIR no se usan aquí directamente
APP_NAME,
APP_NAME_CAP,
)
from config.settings import constants as settings_constants
from gi.repository import GLib
from fabric.utils.helpers import exec_shell_command_async
import json
import os
import shutil
@@ -8,17 +15,13 @@ from pathlib import Path
import gi
import toml
gi.require_version('Gtk', '3.0')
from fabric.utils.helpers import exec_shell_command_async
from gi.repository import GLib
gi.require_version("Gtk", "3.0")
# Importar settings_constants para DEFAULTS
from config.settings import constants as settings_constants
from config.data import ( # CONFIG_DIR, HOME_DIR no se usan aquí directamente
APP_NAME, APP_NAME_CAP)
# Global variable to store binding variables, managed by this module
bind_vars = {} # Se inicializa vacío, load_bind_vars lo poblará
bind_vars = {} # Se inicializa vacío, load_bind_vars lo poblará
def deep_update(target: dict, update: dict) -> dict:
"""
@@ -33,7 +36,8 @@ def deep_update(target: dict, update: dict) -> dict:
else:
# De lo contrario, simplemente establece/sobrescribe el valor.
target[key] = value
return target # Aunque modifica in-place, devolverlo es una convención común
return target # Aunque modifica in-place, devolverlo es una convención común
def ensure_matugen_config():
"""
@@ -41,54 +45,64 @@ def ensure_matugen_config():
with the expected settings.
"""
expected_config = {
'config': {
'reload_apps': True,
'wallpaper': {
'command': 'swww',
'arguments': [
'img', '-t', 'outer',
'--transition-duration', '1.5',
'--transition-step', '255',
'--transition-fps', '60',
'-f', 'Nearest'
"config": {
"reload_apps": True,
"wallpaper": {
"command": "swww",
"arguments": [
"img",
"-t",
"outer",
"--transition-duration",
"1.5",
"--transition-step",
"255",
"--transition-fps",
"60",
"-f",
"Nearest",
],
'set': True
"set": True,
},
"custom_colors": {
"red": {"color": "#FF0000", "blend": True},
"green": {"color": "#00FF00", "blend": True},
"yellow": {"color": "#FFFF00", "blend": True},
"blue": {"color": "#0000FF", "blend": True},
"magenta": {"color": "#FF00FF", "blend": True},
"cyan": {"color": "#00FFFF", "blend": True},
"white": {"color": "#FFFFFF", "blend": True},
},
'custom_colors': {
'red': {'color': "#FF0000", 'blend': True},
'green': {'color': "#00FF00", 'blend': True},
'yellow': {'color': "#FFFF00", 'blend': True},
'blue': {'color': "#0000FF", 'blend': True},
'magenta': {'color': "#FF00FF", 'blend': True},
'cyan': {'color': "#00FFFF", 'blend': True},
'white': {'color': "#FFFFFF", 'blend': True}
}
},
'templates': {
'hyprland': {
'input_path': f'~/{APP_NAME_CAP}/config/matugen/templates/hyprland-colors.conf',
'output_path': f'~/{APP_NAME_CAP}/config/hypr/colors.conf'
"templates": {
"hyprland": {
"input_path": f"~/{APP_NAME_CAP}/config/matugen/templates/hyprland-colors.conf",
"output_path": f"~/{APP_NAME_CAP}/config/hypr/colors.conf",
},
f'{APP_NAME}': {
'input_path': f'~/{APP_NAME_CAP}/config/matugen/templates/{APP_NAME}.css',
'output_path': f'~/{APP_NAME_CAP}/styles/colors.css',
'post_hook': f"fabric-cli exec {APP_NAME} 'app.set_css()' &"
}
}
f"{APP_NAME}": {
"input_path": f"~/{APP_NAME_CAP}/config/matugen/templates/{APP_NAME}.css",
"output_path": f"~/{APP_NAME_CAP}/styles/colors.css",
"post_hook": f"fabric-cli exec {APP_NAME} 'app.set_css()' &",
},
},
}
config_path = os.path.expanduser('~/.config/matugen/config.toml')
config_path = os.path.expanduser("~/.config/matugen/config.toml")
os.makedirs(os.path.dirname(config_path), exist_ok=True)
existing_config = {}
if os.path.exists(config_path):
try:
with open(config_path, 'r') as f:
with open(config_path, "r") as f:
existing_config = toml.load(f)
shutil.copyfile(config_path, config_path + '.bak')
shutil.copyfile(config_path, config_path + ".bak")
except toml.TomlDecodeError:
print(f"Warning: Could not decode TOML from {config_path}. A new default config will be created.")
existing_config = {} # Resetear si está corrupto
print(
f"Warning: Could not decode TOML from {
config_path
}. A new default config will be created."
)
existing_config = {} # Resetear si está corrupto
except Exception as e:
print(f"Error reading or backing up {config_path}: {e}")
# existing_config podría estar parcialmente cargado o vacío.
@@ -100,39 +114,50 @@ def ensure_matugen_config():
# Para ser más seguros, podemos pasar una copia si existing_config no debe cambiar.
# merged_config = deep_update(existing_config.copy(), expected_config)
# O si existing_config puede ser modificado:
merged_config = deep_update(existing_config, expected_config) # existing_config se modifica in-place
# existing_config se modifica in-place
merged_config = deep_update(existing_config, expected_config)
try:
with open(config_path, 'w') as f:
with open(config_path, "w") as f:
toml.dump(merged_config, f)
except Exception as e:
print(f"Error writing matugen config to {config_path}: {e}")
current_wall = os.path.expanduser("~/.current.wall")
hypr_colors = os.path.expanduser(f"~/{APP_NAME_CAP}/config/hypr/colors.conf")
css_colors = os.path.expanduser(f"~/{APP_NAME_CAP}/styles/colors.css")
if not os.path.exists(current_wall) or not os.path.exists(hypr_colors) or not os.path.exists(css_colors):
if (
not os.path.exists(current_wall)
or not os.path.exists(hypr_colors)
or not os.path.exists(css_colors)
):
os.makedirs(os.path.dirname(hypr_colors), exist_ok=True)
os.makedirs(os.path.dirname(css_colors), exist_ok=True)
image_path = ""
if not os.path.exists(current_wall):
example_wallpaper_path = os.path.expanduser(f"~/.config/{APP_NAME_CAP}/assets/wallpapers_example/example-1.jpg")
example_wallpaper_path = os.path.expanduser(
f"~/.config/{APP_NAME_CAP}/assets/wallpapers_example/example-1.jpg"
)
if os.path.exists(example_wallpaper_path):
try:
# Si ya existe (posiblemente un enlace roto o archivo regular), eliminar y re-enlazar
if os.path.lexists(current_wall): # lexists para no seguir el enlace si es uno
# lexists para no seguir el enlace si es uno
if os.path.lexists(current_wall):
os.remove(current_wall)
os.symlink(example_wallpaper_path, current_wall)
image_path = example_wallpaper_path
except Exception as e:
print(f"Error creating symlink for wallpaper: {e}")
else:
image_path = os.path.realpath(current_wall) if os.path.islink(current_wall) else current_wall
if image_path and os.path.exists(image_path):
image_path = (
os.path.realpath(current_wall)
if os.path.islink(current_wall)
else current_wall
)
if image_path and os.path.exists(image_path):
print(f"Generating color theme from wallpaper: {image_path}")
try:
matugen_cmd = f"matugen image '{image_path}'"
@@ -143,9 +168,15 @@ def ensure_matugen_config():
except Exception as e:
print(f"Error initiating matugen: {e}")
elif not image_path:
print("Warning: No wallpaper path determined to generate matugen theme from.")
else: # image_path existe pero el archivo no
print(f"Warning: Wallpaper at {image_path} not found. Cannot generate matugen theme.")
print(
"Warning: No wallpaper path determined to generate matugen theme from."
)
else: # image_path existe pero el archivo no
print(
f"Warning: Wallpaper at {
image_path
} not found. Cannot generate matugen theme."
)
def load_bind_vars():
@@ -153,17 +184,18 @@ def load_bind_vars():
Load saved key binding variables from JSON, if available.
Populates the global `bind_vars` in-place.
"""
global bind_vars # Necesario para modificar el objeto global bind_vars
global bind_vars # Necesario para modificar el objeto global bind_vars
# 1. Limpiar el diccionario bind_vars existente.
bind_vars.clear()
# 2. Actualizarlo con una copia de DEFAULTS.
bind_vars.update(settings_constants.DEFAULTS.copy()) # Usar .copy() para no modificar DEFAULTS accidentalmente
# Usar .copy() para no modificar DEFAULTS accidentalmente
bind_vars.update(settings_constants.DEFAULTS.copy())
config_json = os.path.expanduser(f'~/{APP_NAME_CAP}/config/config.json')
config_json = os.path.expanduser(f"~/{APP_NAME_CAP}/config/config.json")
if os.path.exists(config_json):
try:
with open(config_json, 'r') as f:
with open(config_json, "r") as f:
saved_vars = json.load(f)
# 3. Usar deep_update para fusionar saved_vars en el bind_vars existente.
deep_update(bind_vars, saved_vars)
@@ -171,7 +203,7 @@ def load_bind_vars():
# La lógica para asegurar la estructura de diccionarios anidados
# como 'metrics_visible' y 'metrics_small_visible'
# debe operar sobre el 'bind_vars' ya actualizado.
for vis_key in ['metrics_visible']:
for vis_key in ["metrics_visible"]:
# Asegurar que la clave exista en DEFAULTS como referencia de estructura
if vis_key in settings_constants.DEFAULTS:
default_sub_dict = settings_constants.DEFAULTS[vis_key]
@@ -186,26 +218,34 @@ def load_bind_vars():
if m_key not in current_sub_dict:
current_sub_dict[m_key] = m_val
except json.JSONDecodeError:
print(f"Warning: Could not decode JSON from {config_json}. Using defaults (already initialized).")
print(
f"Warning: Could not decode JSON from {
config_json
}. Using defaults (already initialized)."
)
# bind_vars ya está poblado con DEFAULTS, no se necesita acción adicional aquí.
except Exception as e:
print(f"Error loading config from {config_json}: {e}. Using defaults (already initialized).")
print(
f"Error loading config from {config_json}: {
e
}. Using defaults (already initialized)."
)
# bind_vars ya está poblado con DEFAULTS.
# else:
# Si config_json no existe, bind_vars ya está poblado con DEFAULTS.
# print(f"Config file {config_json} not found. Using defaults (already initialized).")
# Si config_json no existe, bind_vars ya está poblado con DEFAULTS.
# print(f"Config file {config_json} not found. Using defaults (already initialized).")
def generate_hyprconf() -> str:
"""
Generate the Hypr configuration string using the current bind_vars.
"""
home = os.path.expanduser('~')
home = os.path.expanduser("~")
# Determine animation type based on bar position
bar_position = bind_vars.get('bar_position', 'Top')
bar_position = bind_vars.get("bar_position", "Top")
is_vertical = bar_position in ["Left", "Right"]
animation_type = "slidefadevert" if is_vertical else "slidefade"
return f"""exec-once = uwsm-app $(python {home}/{APP_NAME_CAP}/main.py)
exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle
exec = uwsm app -- swww-daemon
@@ -215,26 +255,37 @@ exec-once = wl-paste --type image --watch cliphist store
$fabricSend = fabric-cli exec {APP_NAME}
$axMessage = notify-send "Axenide" "FIRE IN THE HOLE‼️🗣️🔥🕳️" -i "{home}/.config/{APP_NAME_CAP}/assets/ax.png" -A "🗣️" -A "🔥" -A "🕳️" -a "Source Code"
bind = {bind_vars.get('prefix_restart', 'SUPER ALT')}, {bind_vars.get('suffix_restart', 'B')}, exec, killall {APP_NAME}; uwsm-app $(python {home}/.config/{APP_NAME_CAP}/main.py) # Reload {APP_NAME_CAP}
bind = {bind_vars.get('prefix_axmsg', 'SUPER')}, {bind_vars.get('suffix_axmsg', 'A')}, exec, $axMessage # Message
bind = {bind_vars.get('prefix_dash', 'SUPER')}, {bind_vars.get('suffix_dash', 'D')}, exec, $fabricSend 'notch.open_notch("dashboard")' # Dashboard
bind = {bind_vars.get('prefix_bluetooth', 'SUPER')}, {bind_vars.get('suffix_bluetooth', 'B')}, exec, $fabricSend 'notch.open_notch("bluetooth")' # Bluetooth
bind = {bind_vars.get('prefix_pins', 'SUPER')}, {bind_vars.get('suffix_pins', 'Q')}, exec, $fabricSend 'notch.open_notch("pins")' # Pins
bind = {bind_vars.get('prefix_kanban', 'SUPER')}, {bind_vars.get('suffix_kanban', 'N')}, exec, $fabricSend 'notch.open_notch("kanban")' # Kanban
bind = {bind_vars.get('prefix_launcher', 'SUPER')}, {bind_vars.get('suffix_launcher', 'R')}, exec, $fabricSend 'notch.open_notch("launcher")' # App Launcher
bind = {bind_vars.get('prefix_tmux', 'SUPER')}, {bind_vars.get('suffix_tmux', 'T')}, exec, $fabricSend 'notch.open_notch("tmux")' # Tmux
bind = {bind_vars.get('prefix_cliphist', 'SUPER')}, {bind_vars.get('suffix_cliphist', 'V')}, exec, $fabricSend 'notch.open_notch("cliphist")' # Clipboard History
bind = {bind_vars.get('prefix_toolbox', 'SUPER')}, {bind_vars.get('suffix_toolbox', 'S')}, exec, $fabricSend 'notch.open_notch("tools")' # Toolbox
bind = {bind_vars.get('prefix_overview', 'SUPER')}, {bind_vars.get('suffix_overview', 'TAB')}, exec, $fabricSend 'notch.open_notch("overview")' # Overview
bind = {bind_vars.get('prefix_wallpapers', 'SUPER')}, {bind_vars.get('suffix_wallpapers', 'COMMA')}, exec, $fabricSend 'notch.open_notch("wallpapers")' # Wallpapers
bind = {bind_vars.get('prefix_randwall', 'SUPER')}, {bind_vars.get('suffix_randwall', 'COMMA')}, exec, $fabricSend 'notch.dashboard.wallpapers.set_random_wallpaper(None, external=True)' # Random Wallpaper
bind = {bind_vars.get('prefix_emoji', 'SUPER')}, {bind_vars.get('suffix_emoji', 'PERIOD')}, exec, $fabricSend 'notch.open_notch("emoji")' # Emoji Picker
bind = {bind_vars.get('prefix_power', 'SUPER')}, {bind_vars.get('suffix_power', 'ESCAPE')}, exec, $fabricSend 'notch.open_notch("power")' # Power Menu
bind = {bind_vars.get('prefix_caffeine', 'SUPER SHIFT')}, {bind_vars.get('suffix_caffeine', 'M')}, exec, $fabricSend 'notch.dashboard.widgets.buttons.caffeine_button.toggle_inhibit(external=True)' # Toggle Caffeine
bind = {bind_vars.get('prefix_css', 'SUPER SHIFT')}, {bind_vars.get('suffix_css', 'B')}, exec, $fabricSend 'app.set_css()' # Reload CSS
bind = {bind_vars.get('prefix_restart_inspector', 'SUPER CTRL ALT')}, {bind_vars.get('suffix_restart_inspector', 'B')}, exec, killall {APP_NAME}; uwsm-app $(GTK_DEBUG=interactive python {home}/.config/{APP_NAME_CAP}/main.py) # Restart with inspector
# Reload {APP_NAME_CAP}
bind = {bind_vars.get("prefix_restart", "SUPER ALT")}, {bind_vars.get("suffix_restart", "B")}, exec, killall {APP_NAME}; uwsm-app $(python {home}/.config/{APP_NAME_CAP}/main.py)
# Message
bind = {bind_vars.get("prefix_axmsg", "SUPER")}, {bind_vars.get("suffix_axmsg", "A")}, exec, $axMessage
# Dashboard
bind = {bind_vars.get("prefix_dash", "SUPER")}, {bind_vars.get("suffix_dash", "D")}, exec, $fabricSend 'notch.open_notch("dashboard")'
# Bluetooth
bind = {bind_vars.get("prefix_bluetooth", "SUPER")}, {bind_vars.get("suffix_bluetooth", "B")}, exec, $fabricSend 'notch.open_notch("bluetooth")'
bind = {bind_vars.get("prefix_pins", "SUPER")}, {bind_vars.get("suffix_pins", "Q")}, exec, $fabricSend 'notch.open_notch("pins")' # Pins
bind = {bind_vars.get("prefix_kanban", "SUPER")}, {bind_vars.get("suffix_kanban", "N")}, exec, $fabricSend 'notch.open_notch("kanban")' # Kanban
# App Launcher
bind = {bind_vars.get("prefix_launcher", "SUPER")}, {bind_vars.get("suffix_launcher", "R")}, exec, $fabricSend 'notch.open_notch("launcher")'
bind = {bind_vars.get("prefix_tmux", "SUPER")}, {bind_vars.get("suffix_tmux", "T")}, exec, $fabricSend 'notch.open_notch("tmux")' # Tmux
# Clipboard History
bind = {bind_vars.get("prefix_cliphist", "SUPER")}, {bind_vars.get("suffix_cliphist", "V")}, exec, $fabricSend 'notch.open_notch("cliphist")'
# Toolbox
bind = {bind_vars.get("prefix_toolbox", "SUPER")}, {bind_vars.get("suffix_toolbox", "S")}, exec, $fabricSend 'notch.open_notch("tools")'
bind = {bind_vars.get("prefix_overview", "SUPER")}, {bind_vars.get("suffix_overview", "TAB")}, exec, $fabricSend 'notch.open_notch("overview")' # Overview
# Wallpapers
bind = {bind_vars.get("prefix_wallpapers", "SUPER")}, {bind_vars.get("suffix_wallpapers", "COMMA")}, exec, $fabricSend 'notch.open_notch("wallpapers")'
bind = {bind_vars.get("prefix_randwall", "SUPER")}, {bind_vars.get("suffix_randwall", "COMMA")}, exec, $fabricSend 'notch.dashboard.wallpapers.set_random_wallpaper(None, external=True)' # Random Wallpaper
# Emoji Picker
bind = {bind_vars.get("prefix_emoji", "SUPER")}, {bind_vars.get("suffix_emoji", "PERIOD")}, exec, $fabricSend 'notch.open_notch("emoji")'
# Power Menu
bind = {bind_vars.get("prefix_power", "SUPER")}, {bind_vars.get("suffix_power", "ESCAPE")}, exec, $fabricSend 'notch.open_notch("power")'
bind = {bind_vars.get("prefix_caffeine", "SUPER SHIFT")}, {bind_vars.get("suffix_caffeine", "M")}, exec, $fabricSend 'notch.dashboard.widgets.buttons.caffeine_button.toggle_inhibit(external=True)' # Toggle Caffeine
# Reload CSS
bind = {bind_vars.get("prefix_css", "SUPER SHIFT")}, {bind_vars.get("suffix_css", "B")}, exec, $fabricSend 'app.set_css()'
bind = {bind_vars.get("prefix_restart_inspector", "SUPER CTRL ALT")}, {bind_vars.get("suffix_restart_inspector", "B")}, exec, killall {APP_NAME}; uwsm-app $(GTK_DEBUG=interactive python {home}/.config/{APP_NAME_CAP}/main.py) # Restart with inspector
# Wallpapers directory: {bind_vars.get('wallpapers_dir', '~/Modus/assets/wallpapers_example')}
# Wallpapers directory: {bind_vars.get("wallpapers_dir", "~/Modus/assets/wallpapers_example")}
source = {home}/{APP_NAME_CAP}/config/hypr/colors.conf
@@ -283,6 +334,7 @@ animations {{
}}
"""
def ensure_face_icon():
"""
Ensure the face icon exists. If not, copy the default icon.
@@ -295,6 +347,7 @@ def ensure_face_icon():
except Exception as e:
print(f"Error copying default face icon: {e}")
def backup_and_replace(src: str, dest: str, config_name: str):
"""
Backup the existing configuration file and replace it with a new one.
@@ -306,7 +359,8 @@ def backup_and_replace(src: str, dest: str, config_name: str):
# os.makedirs(os.path.dirname(backup_path), exist_ok=True)
shutil.copy(dest, backup_path)
print(f"{config_name} config backed up to {backup_path}")
os.makedirs(os.path.dirname(dest), exist_ok=True) # Ensure dest directory exists
# Ensure dest directory exists
os.makedirs(os.path.dirname(dest), exist_ok=True)
shutil.copy(src, dest)
print(f"{config_name} config replaced from {src}")
except Exception as e:
@@ -338,12 +392,21 @@ def start_config():
print(f"{time.time():.4f}: start_config: Initiating hyprctl reload...")
try:
# subprocess.run(["hyprctl", "reload"], check=True, capture_output=True, text=True)
exec_shell_command_async("hyprctl reload") # Mantener async para no bloquear
print(f"{time.time():.4f}: start_config: Hyprland configuration reload initiated.")
# Mantener async para no bloquear
exec_shell_command_async("hyprctl reload")
print(
f"{time.time():.4f}: start_config: Hyprland configuration reload initiated."
)
except FileNotFoundError:
print("Error: hyprctl command not found. Cannot reload Hyprland.")
except subprocess.CalledProcessError as e: # Si usáramos subprocess.run con check=True
print(f"Error reloading Hyprland with hyprctl: {e}\nOutput:\n{e.stdout}\n{e.stderr}")
print("Error: hyprctl command not found. Cannot reload Hyprland.")
except (
subprocess.CalledProcessError
) as e: # Si usáramos subprocess.run con check=True
print(
f"Error reloading Hyprland with hyprctl: {e}\nOutput:\n{e.stdout}\n{
e.stderr
}"
)
except Exception as e:
print(f"An error occurred initiating hyprctl reload: {e}")
print(f"An error occurred initiating hyprctl reload: {e}")
print(f"{time.time():.4f}: start_config: Finished initiating hyprctl reload.")