initial commit
No files matched your search
@@ -61,19 +61,19 @@ cd Tela-icon-theme
|
||||
<table align="center">
|
||||
|
||||
<tr>
|
||||
<td colspan="1"><img src="assets/bluetooth.png"></td>
|
||||
<td colspan="1"><img src="assets/cliphist.png"></td>
|
||||
<td colspan="1"><img src="assets/wallpaper.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/bluetooth.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/cliphist.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/wallpaper.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1"><img src="assets/todo.png"></td>
|
||||
<td colspan="1"><img src="assets/shrunner.png"></td>
|
||||
<td colspan="1"><img src="assets/osd.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/todo.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/shrunner.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/osd.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1"><img src="assets/powermenu.png"></td>
|
||||
<td colspan="1"><img src="assets/notification.png"></td>
|
||||
<td colspan="1"><img src="assets/emoji.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/powermenu.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/notification.png"></td>
|
||||
<td colspan="1"><img src="assets/screenshots/emoji.png"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 2.8 MiB After Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 945 KiB After Width: | Height: | Size: 945 KiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 5.8 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 325 KiB |
|
After Width: | Height: | Size: 440 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1 @@
|
||||
{"prefix_restart": "SHIFT ALT", "suffix_restart": "T", "prefix_bluetooth": "ALT", "suffix_bluetooth": "B", "prefix_emoji": "SUPER", "suffix_emoji": "E", "prefix_cliphist": "SUPER", "suffix_cliphist": "V", "prefix_todo": "SUPER", "suffix_todo": "T", "prefix_sh": "SUPER", "suffix_sh": "S", "prefix_walls": "SUPER", "suffix_walls": "W", "prefix_screenshotregion": "SUPER", "suffix_screenshotregion": "Z", "prefix_screenshot": "", "suffix_screenshot": "Print", "prefix_screencast": "SUPER", "suffix_screencast": "R", "prefix_launcher": "SUPER", "suffix_launcher": "D", "prefix_power": "SUPER", "suffix_power": "X", "prefix_toggle": "SUPER", "suffix_toggle": "H", "prefix_randomwallpaper": "ALT SHIFT", "suffix_randomwallpaper": "W", "wallpapers_dir": "/home/sankalp/Pictures/wallpapers"}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"commands": {
|
||||
":wp": "launcher.open(\"wallpapers\")",
|
||||
":em": "launcher.open(\"emoji\")",
|
||||
":ch": "launcher.open(\"cliphist\")",
|
||||
":td": "launcher.open(\"todo\")",
|
||||
":bt": "launcher.open(\"bluetooth\")",
|
||||
":sh": "launcher.open(\"sh\")",
|
||||
":pw": "launcher.open(\"power\")"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"color-scheme": "dark",
|
||||
"custom-color": "none",
|
||||
"generation-scheme": "tonalSpot"
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
import gi
|
||||
import subprocess
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
# Constants
|
||||
SOURCE_STRING = """
|
||||
# Modus
|
||||
source = ~/Modus/config/hypr/modus.conf
|
||||
"""
|
||||
|
||||
CONFIG_DIR = os.path.expanduser("~/Modus")
|
||||
WALLPAPERS_DIR_DEFAULT = os.path.expanduser("~/Modus/assets/wallpaper")
|
||||
|
||||
# Default key binding values
|
||||
bind_vars = {
|
||||
"prefix_restart": "SHIFT ALT",
|
||||
"suffix_restart": "T",
|
||||
"prefix_bluetooth": "ALT",
|
||||
"suffix_bluetooth": "B",
|
||||
"prefix_emoji": "SUPER",
|
||||
"suffix_emoji": "E",
|
||||
"prefix_cliphist": "SUPER",
|
||||
"suffix_cliphist": "V",
|
||||
"prefix_todo": "SUPER",
|
||||
"suffix_todo": "T",
|
||||
"prefix_sh": "SUPER",
|
||||
"suffix_sh": "S",
|
||||
"prefix_walls": "SUPER",
|
||||
"suffix_walls": "W",
|
||||
"prefix_screenshotregion": "SUPER",
|
||||
"suffix_screenshotregion": "Z",
|
||||
"prefix_screenshot": "",
|
||||
"suffix_screenshot": "Print",
|
||||
"prefix_screencast": "SUPER",
|
||||
"suffix_screencast": "R",
|
||||
"prefix_launcher": "SUPER",
|
||||
"suffix_launcher": "D",
|
||||
"prefix_power": "SUPER",
|
||||
"suffix_power": "X",
|
||||
"prefix_toggle": "SUPER",
|
||||
"suffix_toggle": "H",
|
||||
"prefix_randomwallpaper": "ALT SHIFT",
|
||||
"suffix_randomwallpaper": "W",
|
||||
"wallpapers_dir": WALLPAPERS_DIR_DEFAULT,
|
||||
}
|
||||
|
||||
|
||||
def deep_update(target: dict, update: dict) -> dict:
|
||||
"""
|
||||
Recursively update a nested dictionary with values from another dictionary.
|
||||
"""
|
||||
for key, value in update.items():
|
||||
if isinstance(value, dict):
|
||||
target[key] = deep_update(target.get(key, {}), value)
|
||||
else:
|
||||
target[key] = value
|
||||
return target
|
||||
|
||||
|
||||
def parallel_subprocesses(commands):
|
||||
"""
|
||||
Run multiple subprocess commands in parallel.
|
||||
"""
|
||||
with ThreadPoolExecutor() as executor:
|
||||
executor.map(subprocess.run, commands)
|
||||
|
||||
|
||||
def setup_colors():
|
||||
subprocess.run(
|
||||
[
|
||||
"python",
|
||||
"-O",
|
||||
os.path.expanduser("~/Modus/config/material-colors/generate.py"),
|
||||
"--color",
|
||||
"#0000FF",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def setup_sddm():
|
||||
commands = [
|
||||
["sudo", "mkdir", "-p", "/etc/sddm.conf.d"],
|
||||
[
|
||||
"sudo",
|
||||
"cp",
|
||||
os.path.expanduser("~/Modus/config/sddm/sddm.conf"),
|
||||
"/etc/sddm.conf.d/",
|
||||
],
|
||||
[
|
||||
"sudo",
|
||||
"cp",
|
||||
os.path.expanduser("~/Modus/config/sddm/sddm.conf"),
|
||||
"/etc/",
|
||||
],
|
||||
["sudo", "chmod", "644", "/etc/sddm.conf.d/sddm.conf"],
|
||||
["sudo", "chmod", "644", "/etc/sddm.conf"],
|
||||
["sudo", "chmod", "-R", "755", "/usr/share/sddm/themes/corners/"],
|
||||
]
|
||||
parallel_subprocesses(commands)
|
||||
subprocess.run([os.path.expanduser("~/Modus/config/sddm/scripts/wallpaper.sh")])
|
||||
|
||||
|
||||
def copy_wallpapers():
|
||||
dest_wallpaper_dir = os.path.expanduser("~/Pictures/wallpaper")
|
||||
src_wallpaper_dir = os.path.expanduser("~/Modus/assets/wallpaper")
|
||||
if not os.path.exists(dest_wallpaper_dir):
|
||||
shutil.copytree(src_wallpaper_dir, dest_wallpaper_dir, dirs_exist_ok=True)
|
||||
subprocess.run(
|
||||
[
|
||||
"python",
|
||||
os.path.expanduser("~/Modus/config/wallpaper.py"),
|
||||
"-I",
|
||||
os.path.join(dest_wallpaper_dir, "example-1.jpg"),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def load_bind_vars():
|
||||
"""
|
||||
Load saved key binding variables from JSON, if available.
|
||||
"""
|
||||
config_json = os.path.expanduser("~/Modus/config/assets/config.json")
|
||||
try:
|
||||
with open(config_json, "r") as f:
|
||||
saved_vars = json.load(f)
|
||||
bind_vars.update(saved_vars)
|
||||
except FileNotFoundError:
|
||||
# Use default values if no saved config exists
|
||||
pass
|
||||
|
||||
|
||||
def generate_hyprconf() -> str:
|
||||
"""
|
||||
Generate the Hypr configuration string using the current bind_vars.
|
||||
"""
|
||||
home = os.path.expanduser("~")
|
||||
return f"""exec-once = python {home}/Modus/main.py
|
||||
exec = pgrep -x "hypridle" > /dev/null || hypridle
|
||||
exec = swww-daemon
|
||||
exec-once = wl-paste --type text --watch cliphist store
|
||||
exec-once = wl-paste --type image --watch cliphist store
|
||||
|
||||
$fabricSend = fabric-cli exec modus
|
||||
$scriptsDir = $HOME/Modus/config
|
||||
|
||||
bind = {bind_vars["prefix_restart"]}, {bind_vars["suffix_restart"]}, exec, killall modus; python {home}/Modus/main.py # Reload Modus | Default: SUPER ALT + T
|
||||
bind = {bind_vars["prefix_bluetooth"]}, {bind_vars["suffix_bluetooth"]}, exec, $fabricSend 'launcher.open("bluetooth")' # Bluetooth | Default: ALT + B
|
||||
bind = {bind_vars["prefix_emoji"]}, {bind_vars["suffix_emoji"]}, exec, $fabricSend 'launcher.open("emoji")' # Emoji | Default: SUPER + E
|
||||
bind = {bind_vars["prefix_cliphist"]}, {bind_vars["suffix_cliphist"]}, exec, $fabricSend 'launcher.open("cliphist")' # Cliphist | Default: SUPER + V
|
||||
bind = {bind_vars["prefix_todo"]}, {bind_vars["suffix_todo"]}, exec, $fabricSend 'launcher.open("todo")' # Todo | Default: SUPER + T
|
||||
bind = {bind_vars["prefix_sh"]}, {bind_vars["suffix_sh"]}, exec, $fabricSend 'launcher.open("sh")' # Sh | Default: SUPER + S
|
||||
bind = {bind_vars["prefix_walls"]}, {bind_vars["suffix_walls"]}, exec, $fabricSend 'launcher.open("wallpapers")' # Wallpaper Selector | Default: SUPER + W
|
||||
bind ={bind_vars["prefix_randomwallpaper"]}, {bind_vars["suffix_randomwallpaper"]}, exec, python -O $scriptsDir/wallpaper.py -R # Random Wallpaper | Default: ALT SHIFT + W
|
||||
bind = {bind_vars["prefix_launcher"]}, {bind_vars["suffix_launcher"]}, exec, $fabricSend 'launcher.open("launcher")' # App Launcher | Default: SUPER + D
|
||||
bind = {bind_vars["prefix_power"]}, {bind_vars["suffix_power"]}, exec, $fabricSend 'launcher.open("power")' # Power Menu | Default: SUPER + X
|
||||
bind = {bind_vars["prefix_toggle"]}, {bind_vars["suffix_toggle"]}, exec, $fabricSend 'bar.toggle_hidden()' # Toggle Bar | Default: SUPER + H
|
||||
bind = {bind_vars["prefix_screenshotregion"]}, {bind_vars["suffix_screenshotregion"]}, exec, $fabricSend 'sc.screenshot()' # Screenshot Region | Default: SUPER + Z
|
||||
bind = {bind_vars["prefix_screenshot"]}, {bind_vars["suffix_screenshot"]}, exec, $fabricSend 'sc.screenshot(True)' # ScreenshotFullScreen | Default: Print
|
||||
bind = {bind_vars["prefix_screencast"]}, {bind_vars["suffix_screencast"]}, exec, $fabricSend 'sc.screencast()' # Screencast | Default: SUPER + R
|
||||
|
||||
|
||||
# Wallpapers directory: {bind_vars["wallpapers_dir"]}
|
||||
|
||||
general {{
|
||||
gaps_in = 2
|
||||
gaps_out = 4
|
||||
border_size = 0
|
||||
layout = dwindle
|
||||
}}
|
||||
|
||||
decoration {{
|
||||
blur {{
|
||||
enabled = false
|
||||
}}
|
||||
rounding = 15
|
||||
active_opacity = 1
|
||||
inactive_opacity = 1
|
||||
fullscreen_opacity = 1
|
||||
|
||||
dim_inactive = true
|
||||
dim_strength = 0.1
|
||||
dim_special = 0.8
|
||||
shadow {{
|
||||
enabled = false
|
||||
}}
|
||||
}}
|
||||
|
||||
animations {{
|
||||
enabled = true
|
||||
# Animation curves
|
||||
bezier = linear, 0, 0, 1, 1
|
||||
bezier = md3_standard, 0.2, 0, 0, 1
|
||||
bezier = md3_decel, 0.05, 0.7, 0.1, 1
|
||||
bezier = md3_accel, 0.3, 0, 0.8, 0.15
|
||||
bezier = overshot, 0.05, 0.9, 0.1, 1.1
|
||||
bezier = crazyshot, 0.1, 1.5, 0.76, 0.92
|
||||
bezier = hyprnostretch, 0.05, 0.9, 0.1, 1.0
|
||||
bezier = menu_decel, 0.1, 1, 0, 1
|
||||
bezier = menu_accel, 0.38, 0.04, 1, 0.07
|
||||
bezier = easeInOutCirc, 0.85, 0, 0.15, 1
|
||||
bezier = easeOutCirc, 0, 0.55, 0.45, 1
|
||||
bezier = easeOutExpo, 0.16, 1, 0.3, 1
|
||||
bezier = softAcDecel, 0.26, 0.26, 0.15, 1
|
||||
bezier = md2, 0.4, 0, 0.2, 1 # use with .2s duration
|
||||
# Animation configs
|
||||
animation = windows, 1, 3, md3_decel, popin 60%
|
||||
animation = windowsIn, 1, 3, md3_decel, popin 60%
|
||||
animation = windowsOut, 1, 3, md3_accel, popin 60%
|
||||
animation = border, 1, 10, default
|
||||
animation = fade, 1, 3, md3_decel
|
||||
animation = layers, 1, 2, md3_decel, slide
|
||||
animation = layersIn, 1, 3, menu_decel, slide
|
||||
animation = layersOut, 1, 1.6, menu_accel, slide
|
||||
animation = fadeLayersIn, 1, 2, menu_decel
|
||||
animation = fadeLayersOut, 1, 4.5, menu_accel
|
||||
animation = workspaces, 1, 7, menu_decel, slide
|
||||
# animation = workspaces, 1, 2.5, softAcDecel, slide
|
||||
# animation = workspaces, 1, 7, menu_decel, slidefade 15%
|
||||
# animation = specialWorkspace, 1, 3, md3_decel, slidefadevert 15%
|
||||
animation = specialWorkspace, 1, 3, md3_decel, slidevert
|
||||
}}
|
||||
"""
|
||||
|
||||
|
||||
def backup_and_replace(src: str, dest: str, config_name: str):
|
||||
"""
|
||||
Backup the existing configuration file and replace it with a new one.
|
||||
"""
|
||||
if os.path.exists(dest):
|
||||
backup_path = dest + ".bak"
|
||||
if not os.path.exists(backup_path):
|
||||
shutil.copy(dest, backup_path)
|
||||
print(f"{config_name} config backed up to {backup_path}")
|
||||
shutil.copy(src, dest)
|
||||
print(f"{config_name} config replaced from {src}")
|
||||
|
||||
|
||||
class HyprConfGUI(Gtk.Window):
|
||||
def __init__(self, show_lock_checkbox: bool, show_idle_checkbox: bool):
|
||||
super().__init__(title="Configure Key Binds")
|
||||
self.set_border_width(20)
|
||||
self.set_default_size(500, 450)
|
||||
self.set_resizable(False)
|
||||
|
||||
self.selected_face_icon = None
|
||||
|
||||
# Main container
|
||||
main_vbox = Gtk.VBox(spacing=10)
|
||||
self.add(main_vbox)
|
||||
|
||||
# Create input entries for key bindings
|
||||
self.entries = []
|
||||
bindings = [
|
||||
("Reload Modus", "prefix_restart", "suffix_restart"),
|
||||
("Bluetooth", "prefix_bluetooth", "suffix_bluetooth"),
|
||||
("Wallpaper Selector", "prefix_walls", "suffix_walls"),
|
||||
("Random Wallpaper", "prefix_randomwallpaper", "suffix_randomwallpaper"),
|
||||
("App Launcher", "prefix_launcher", "suffix_launcher"),
|
||||
("Power Menu", "prefix_power", "suffix_power"),
|
||||
("Emoji Selector", "prefix_emoji", "suffix_emoji"),
|
||||
("Clipboard History", "prefix_cliphist", "suffix_cliphist"),
|
||||
("Screenshot", "prefix_screenshot", "suffix_screenshot"),
|
||||
("ScreenRecorder", "prefix_screencast", "suffix_screencast"),
|
||||
("Screenshot Region", "prefix_screenshotregion", "suffix_screenshotregion"),
|
||||
("Sh runner", "prefix_sh", "suffix_sh"),
|
||||
("Todo List", "prefix_todo", "suffix_todo"),
|
||||
("Toggle Bar", "prefix_toggle", "suffix_toggle"),
|
||||
]
|
||||
|
||||
for label_text, prefix_key, suffix_key in bindings:
|
||||
entry_box = Gtk.HBox(spacing=10)
|
||||
|
||||
label = Gtk.Label(label=label_text)
|
||||
entry_box.pack_start(label, False, False, 0)
|
||||
|
||||
prefix_entry = Gtk.Entry()
|
||||
prefix_entry.set_text(bind_vars[prefix_key])
|
||||
entry_box.pack_start(prefix_entry, True, True, 0)
|
||||
|
||||
plus_label = Gtk.Label(label=" + ")
|
||||
entry_box.pack_start(plus_label, False, False, 0)
|
||||
|
||||
suffix_entry = Gtk.Entry()
|
||||
suffix_entry.set_text(bind_vars[suffix_key])
|
||||
entry_box.pack_start(suffix_entry, True, True, 0)
|
||||
|
||||
main_vbox.pack_start(entry_box, False, False, 0)
|
||||
self.entries.append((prefix_key, suffix_key, prefix_entry, suffix_entry))
|
||||
|
||||
# Wallpaper directory chooser
|
||||
wall_box = Gtk.HBox(spacing=10)
|
||||
wall_label = Gtk.Label(label="Wallpapers Directory")
|
||||
wall_box.pack_start(wall_label, False, False, 0)
|
||||
self.wall_dir_chooser = Gtk.FileChooserButton(
|
||||
title="Select a folder", action=Gtk.FileChooserAction.SELECT_FOLDER
|
||||
)
|
||||
self.wall_dir_chooser.set_filename(bind_vars["wallpapers_dir"])
|
||||
wall_box.pack_start(self.wall_dir_chooser, True, True, 0)
|
||||
main_vbox.pack_start(wall_box, False, False, 0)
|
||||
|
||||
# Optional checkboxes for replacing configs
|
||||
if show_lock_checkbox:
|
||||
self.lock_checkbox = Gtk.CheckButton(label="Replace Hyprlock config")
|
||||
self.lock_checkbox.set_active(False)
|
||||
main_vbox.pack_start(self.lock_checkbox, False, False, 0)
|
||||
if show_idle_checkbox:
|
||||
self.idle_checkbox = Gtk.CheckButton(label="Replace Hypridle config")
|
||||
self.idle_checkbox.set_active(False)
|
||||
main_vbox.pack_start(self.idle_checkbox, False, False, 0)
|
||||
|
||||
# Accept and Cancel buttons
|
||||
button_box = Gtk.HBox(spacing=10)
|
||||
cancel_btn = Gtk.Button(label="Cancel")
|
||||
cancel_btn.connect("clicked", self.on_cancel)
|
||||
accept_btn = Gtk.Button(label="Accept")
|
||||
accept_btn.connect("clicked", self.on_accept)
|
||||
button_box.pack_end(accept_btn, False, False, 0)
|
||||
button_box.pack_end(cancel_btn, False, False, 0)
|
||||
main_vbox.pack_start(button_box, False, False, 0)
|
||||
|
||||
def on_accept(self, widget):
|
||||
"""
|
||||
Save the configuration and update the necessary files.
|
||||
"""
|
||||
# Update bind_vars from user inputs
|
||||
for prefix_key, suffix_key, prefix_entry, suffix_entry in self.entries:
|
||||
bind_vars[prefix_key] = prefix_entry.get_text()
|
||||
bind_vars[suffix_key] = suffix_entry.get_text()
|
||||
|
||||
# Update wallpaper directory
|
||||
bind_vars["wallpapers_dir"] = self.wall_dir_chooser.get_filename()
|
||||
|
||||
# Save the updated bind_vars to a JSON file
|
||||
config_json = os.path.expanduser("~/Modus/config/assets/config.json")
|
||||
os.makedirs(os.path.dirname(config_json), exist_ok=True)
|
||||
with open(config_json, "w") as f:
|
||||
json.dump(bind_vars, f)
|
||||
|
||||
# Replace hyprlock config if requested
|
||||
if hasattr(self, "lock_checkbox") and self.lock_checkbox.get_active():
|
||||
src_lock = os.path.expanduser("~/Modus/config/hypr/hyprlock.conf")
|
||||
dest_lock = os.path.expanduser("~/.config/hypr/hyprlock.conf")
|
||||
backup_and_replace(src_lock, dest_lock, "Hyprlock")
|
||||
|
||||
# Replace hypridle config if requested
|
||||
if hasattr(self, "idle_checkbox") and self.idle_checkbox.get_active():
|
||||
src_idle = os.path.expanduser("~/Modus/config/hypr/hypridle.conf")
|
||||
dest_idle = os.path.expanduser("~/.config/hypr/hypridle.conf")
|
||||
backup_and_replace(src_idle, dest_idle, "Hypridle")
|
||||
|
||||
# Append the source string to the Hyprland config if not present
|
||||
hyprland_config_path = os.path.expanduser("~/.config/hypr/hyprland.conf")
|
||||
with open(hyprland_config_path, "r") as f:
|
||||
content = f.read()
|
||||
if SOURCE_STRING not in content:
|
||||
with open(hyprland_config_path, "a") as f:
|
||||
f.write(SOURCE_STRING)
|
||||
|
||||
start_config()
|
||||
self.destroy()
|
||||
|
||||
def on_cancel(self, widget):
|
||||
self.destroy()
|
||||
|
||||
|
||||
def start_config():
|
||||
"""
|
||||
Run final configuration steps: ensure necessary configs, write the hyprconf, and reload.
|
||||
"""
|
||||
copy_wallpapers()
|
||||
setup_colors()
|
||||
|
||||
# Write the generated hypr configuration to file
|
||||
hypr_config_dir = os.path.expanduser("~/Modus/config/hypr/")
|
||||
os.makedirs(hypr_config_dir, exist_ok=True)
|
||||
hypr_conf_path = os.path.join(hypr_config_dir, "modus.conf")
|
||||
with open(hypr_conf_path, "w") as f:
|
||||
f.write(generate_hyprconf())
|
||||
|
||||
# Reload Hyprland configuration
|
||||
os.system("hyprctl reload")
|
||||
|
||||
|
||||
def open_config():
|
||||
"""
|
||||
Entry point for opening the configuration GUI.
|
||||
"""
|
||||
load_bind_vars()
|
||||
|
||||
# Check and copy hyprlock config if needed
|
||||
dest_lock = os.path.expanduser("~/.config/hypr/hyprlock.conf")
|
||||
src_lock = os.path.expanduser("~/Modus/config/hypr/hyprlock.conf")
|
||||
os.makedirs(os.path.dirname(dest_lock), exist_ok=True)
|
||||
show_lock_checkbox = True
|
||||
if not os.path.exists(dest_lock):
|
||||
shutil.copy(src_lock, dest_lock)
|
||||
show_lock_checkbox = False
|
||||
|
||||
# Check and copy hypridle config if needed
|
||||
dest_idle = os.path.expanduser("~/.config/hypr/hypridle.conf")
|
||||
src_idle = os.path.expanduser("~/Modus/config/hypr/hypridle.conf")
|
||||
show_idle_checkbox = True
|
||||
if not os.path.exists(dest_idle):
|
||||
shutil.copy(src_idle, dest_idle)
|
||||
show_idle_checkbox = False
|
||||
|
||||
# Create and run the GUI
|
||||
window = HyprConfGUI(show_lock_checkbox, show_idle_checkbox)
|
||||
window.connect("destroy", Gtk.main_quit)
|
||||
window.show_all()
|
||||
Gtk.main()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
open_config()
|
||||
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to get the relative path based on the current script's location
|
||||
get_relative_path() {
|
||||
local path=$1
|
||||
local level=$2
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
for ((i = 1; i <= level; i++)); do
|
||||
script_dir="$(dirname "$script_dir")"
|
||||
done
|
||||
|
||||
echo "$script_dir/$path"
|
||||
}
|
||||
|
||||
# Assign relative paths to variables
|
||||
GENERATOR=$(get_relative_path "./material-colors/generate.py")
|
||||
SETTINGS_FILE=$(get_relative_path "./assets/settings.json")
|
||||
|
||||
# Function to read a value from the JSON file
|
||||
get_json_value() {
|
||||
local key=$1
|
||||
jq -r --arg key "$key" '.[$key]' $SETTINGS_FILE
|
||||
}
|
||||
|
||||
# Function to update a value in the JSON file
|
||||
update_json_value() {
|
||||
local key=$1
|
||||
local value=$2
|
||||
jq --arg key "$key" --arg value "$value" \
|
||||
'.[$key] = $value' $SETTINGS_FILE >"$SETTINGS_FILE.tmp" && mv "$SETTINGS_FILE.tmp" $SETTINGS_FILE
|
||||
}
|
||||
|
||||
toggle() {
|
||||
local color_scheme=$(get_json_value "color-scheme")
|
||||
local generation_scheme=$(get_json_value "generation-scheme")
|
||||
|
||||
if [ "$color_scheme" == "dark" ]; then
|
||||
python -O $GENERATOR -R --color-scheme light --scheme $generation_scheme
|
||||
update_json_value "color-scheme" "light"
|
||||
elif [ "$color_scheme" == "light" ]; then
|
||||
python -O $GENERATOR -R --color-scheme dark --scheme $generation_scheme
|
||||
update_json_value "color-scheme" "dark"
|
||||
else
|
||||
echo "Unknown color scheme: $color_scheme"
|
||||
fi
|
||||
}
|
||||
|
||||
set() {
|
||||
local new_scheme=$1
|
||||
local generation_scheme=$(get_json_value "generation-scheme")
|
||||
python -O $GENERATOR -R --color-scheme $new_scheme --scheme $generation_scheme
|
||||
update_json_value "color-scheme" $new_scheme
|
||||
}
|
||||
|
||||
# Process arguments
|
||||
if [[ "$1" == "--toggle" ]]; then
|
||||
toggle
|
||||
elif [[ "$1" == "--set" ]]; then
|
||||
set $2
|
||||
else
|
||||
echo "Usage: $0 --toggle | --set <color-scheme>"
|
||||
fi
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
listener {
|
||||
timeout = 500 # in seconds.
|
||||
on-timeout = notify-send "You are idle!" # command to run when timeout has passed.
|
||||
on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired.
|
||||
}
|
||||
|
||||
general {
|
||||
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
|
||||
before_sleep_cmd = loginctl lock-session # lock before suspend.
|
||||
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
|
||||
}
|
||||
|
||||
listener {
|
||||
timeout = 150 # 2.5min.
|
||||
on-timeout = brightnessctl -s set 10 # set monitor backlight to minimum, avoid 0 on OLED monitor.
|
||||
on-resume = brightnessctl -r # monitor backlight restore.
|
||||
}
|
||||
|
||||
# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
|
||||
listener {
|
||||
timeout = 150 # 2.5min.
|
||||
on-timeout = brightnessctl -sd rgb:kbd_backlight set 0 # turn off keyboard backlight.
|
||||
on-resume = brightnessctl -rd rgb:kbd_backlight # turn on keyboard backlight.
|
||||
}
|
||||
|
||||
listener {
|
||||
timeout = 300 # 5min
|
||||
on-timeout = loginctl lock-session # lock screen when timeout has passed
|
||||
}
|
||||
|
||||
listener {
|
||||
timeout = 330 # 5.5min
|
||||
on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed
|
||||
on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired.
|
||||
}
|
||||
|
||||
listener {
|
||||
timeout = 1800 # 30min
|
||||
on-timeout = systemctl suspend # suspend pc
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
source = ~/.cache/material/hyprlock.conf
|
||||
@@ -0,0 +1,85 @@
|
||||
exec-once = python /home/sankalp/Modus/main.py
|
||||
exec = pgrep -x "hypridle" > /dev/null || hypridle
|
||||
exec = swww-daemon
|
||||
exec-once = wl-paste --type text --watch cliphist store
|
||||
exec-once = wl-paste --type image --watch cliphist store
|
||||
|
||||
$fabricSend = fabric-cli exec modus
|
||||
$scriptsDir = $HOME/Modus/config
|
||||
|
||||
bind = SHIFT ALT, T, exec, killall modus; python /home/sankalp/Modus/main.py # Reload Modus | Default: SUPER ALT + T
|
||||
bind = ALT, B, exec, $fabricSend 'launcher.open("bluetooth")' # Bluetooth | Default: ALT + B
|
||||
bind = SUPER, E, exec, $fabricSend 'launcher.open("emoji")' # Emoji | Default: SUPER + E
|
||||
bind = SUPER, V, exec, $fabricSend 'launcher.open("cliphist")' # Cliphist | Default: SUPER + V
|
||||
bind = SUPER, T, exec, $fabricSend 'launcher.open("todo")' # Todo | Default: SUPER + T
|
||||
bind = SUPER, S, exec, $fabricSend 'launcher.open("sh")' # Sh | Default: SUPER + S
|
||||
bind = SUPER, W, exec, $fabricSend 'launcher.open("wallpapers")' # Wallpaper Selector | Default: SUPER + W
|
||||
bind =ALT SHIFT, W, exec, python -O $scriptsDir/wallpaper.py -R # Random Wallpaper | Default: ALT SHIFT + W
|
||||
bind = SUPER, D, exec, $fabricSend 'launcher.open("launcher")' # App Launcher | Default: SUPER + D
|
||||
bind = SUPER, X, exec, $fabricSend 'launcher.open("power")' # Power Menu | Default: SUPER + X
|
||||
bind = SUPER, H, exec, $fabricSend 'bar.toggle_hidden()' # Toggle Bar | Default: SUPER + H
|
||||
bind = SUPER, Z, exec, $fabricSend 'sc.screenshot()' # Screenshot Region | Default: SUPER + Z
|
||||
bind = , Print, exec, $fabricSend 'sc.screenshot(True)' # ScreenshotFullScreen | Default: Print
|
||||
bind = SUPER, R, exec, $fabricSend 'sc.screencast()' # Screencast | Default: SUPER + R
|
||||
|
||||
|
||||
# Wallpapers directory: /home/sankalp/Pictures/wallpapers
|
||||
|
||||
general {
|
||||
gaps_in = 2
|
||||
gaps_out = 4
|
||||
border_size = 0
|
||||
layout = dwindle
|
||||
}
|
||||
|
||||
decoration {
|
||||
blur {
|
||||
enabled = false
|
||||
}
|
||||
rounding = 15
|
||||
active_opacity = 1
|
||||
inactive_opacity = 1
|
||||
fullscreen_opacity = 1
|
||||
|
||||
dim_inactive = true
|
||||
dim_strength = 0.1
|
||||
dim_special = 0.8
|
||||
shadow {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
animations {
|
||||
enabled = true
|
||||
# Animation curves
|
||||
bezier = linear, 0, 0, 1, 1
|
||||
bezier = md3_standard, 0.2, 0, 0, 1
|
||||
bezier = md3_decel, 0.05, 0.7, 0.1, 1
|
||||
bezier = md3_accel, 0.3, 0, 0.8, 0.15
|
||||
bezier = overshot, 0.05, 0.9, 0.1, 1.1
|
||||
bezier = crazyshot, 0.1, 1.5, 0.76, 0.92
|
||||
bezier = hyprnostretch, 0.05, 0.9, 0.1, 1.0
|
||||
bezier = menu_decel, 0.1, 1, 0, 1
|
||||
bezier = menu_accel, 0.38, 0.04, 1, 0.07
|
||||
bezier = easeInOutCirc, 0.85, 0, 0.15, 1
|
||||
bezier = easeOutCirc, 0, 0.55, 0.45, 1
|
||||
bezier = easeOutExpo, 0.16, 1, 0.3, 1
|
||||
bezier = softAcDecel, 0.26, 0.26, 0.15, 1
|
||||
bezier = md2, 0.4, 0, 0.2, 1 # use with .2s duration
|
||||
# Animation configs
|
||||
animation = windows, 1, 3, md3_decel, popin 60%
|
||||
animation = windowsIn, 1, 3, md3_decel, popin 60%
|
||||
animation = windowsOut, 1, 3, md3_accel, popin 60%
|
||||
animation = border, 1, 10, default
|
||||
animation = fade, 1, 3, md3_decel
|
||||
animation = layers, 1, 2, md3_decel, slide
|
||||
animation = layersIn, 1, 3, menu_decel, slide
|
||||
animation = layersOut, 1, 1.6, menu_accel, slide
|
||||
animation = fadeLayersIn, 1, 2, menu_decel
|
||||
animation = fadeLayersOut, 1, 4.5, menu_accel
|
||||
animation = workspaces, 1, 7, menu_decel, slide
|
||||
# animation = workspaces, 1, 2.5, softAcDecel, slide
|
||||
# animation = workspaces, 1, 7, menu_decel, slidefade 15%
|
||||
# animation = specialWorkspace, 1, 3, md3_decel, slidefadevert 15%
|
||||
animation = specialWorkspace, 1, 3, md3_decel, slidevert
|
||||
}
|
||||
@@ -0,0 +1,487 @@
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pickle
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import numpy as np
|
||||
from materialyoucolor.dynamiccolor.material_dynamic_colors import (
|
||||
MaterialDynamicColors,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.hct import Hct # type: ignore
|
||||
from materialyoucolor.quantize import QuantizeCelebi # type: ignore
|
||||
from materialyoucolor.scheme.dynamic_scheme import DynamicScheme # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_content import SchemeContent # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_expressive import (
|
||||
SchemeExpressive,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_fidelity import (
|
||||
SchemeFidelity,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_fruit_salad import (
|
||||
SchemeFruitSalad,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_monochrome import (
|
||||
SchemeMonochrome,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_neutral import SchemeNeutral # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_rainbow import SchemeRainbow # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_tonal_spot import (
|
||||
SchemeTonalSpot,
|
||||
) # type: ignore # noqa
|
||||
from materialyoucolor.scheme.scheme_vibrant import SchemeVibrant # type: ignore # noqa
|
||||
from materialyoucolor.score.score import Score # type: ignore
|
||||
from PIL import Image
|
||||
|
||||
schemes = {
|
||||
"tonalSpot": SchemeTonalSpot,
|
||||
"expressive": SchemeExpressive,
|
||||
"fruitSalad": SchemeFruitSalad,
|
||||
"monochrome": SchemeMonochrome,
|
||||
"rainbow": SchemeRainbow,
|
||||
"vibrant": SchemeVibrant,
|
||||
"neutral": SchemeNeutral,
|
||||
"fidelity": SchemeFidelity,
|
||||
"content": SchemeContent,
|
||||
}
|
||||
|
||||
|
||||
def join(*args):
|
||||
return os.path.join(*args)
|
||||
|
||||
|
||||
home = os.path.expanduser("~")
|
||||
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
cache_path = f"{home}/.cache/material/"
|
||||
os.makedirs(cache_path, exist_ok=True)
|
||||
|
||||
|
||||
def rgb_to_hex(rgb):
|
||||
return "#{:02x}{:02x}{:02x}".format(*rgb[:3])
|
||||
|
||||
|
||||
def rgba_to_rgb(rgba):
|
||||
return f"{rgba[0]}, {rgba[1]}, {rgba[2]}"
|
||||
|
||||
|
||||
class Color:
|
||||
def __init__(self, scheme) -> None:
|
||||
self.scheme = scheme
|
||||
|
||||
def __call__(self, name: str):
|
||||
color_name = getattr(MaterialDynamicColors, name)
|
||||
if hasattr(color_name, "get_hct"):
|
||||
return rgb_to_hex(color_name.get_hct(self.scheme).to_rgba())
|
||||
else:
|
||||
return "#000000"
|
||||
|
||||
|
||||
class ColorsCache:
|
||||
def __init__(
|
||||
self,
|
||||
colors: DynamicScheme | dict,
|
||||
wallpaper: str,
|
||||
original_color: int,
|
||||
contrast_level: int,
|
||||
scheme_name: str,
|
||||
) -> None:
|
||||
self.colors: dict[str, str] = {}
|
||||
self.wallpaper = wallpaper
|
||||
self.original_color = original_color
|
||||
self.contrast_level = contrast_level
|
||||
self.scheme_name = scheme_name
|
||||
if isinstance(colors, DynamicScheme):
|
||||
for color in vars(MaterialDynamicColors).keys():
|
||||
color_name = getattr(MaterialDynamicColors, color)
|
||||
if hasattr(color_name, "get_hct"):
|
||||
self.colors[str(color)] = rgb_to_hex(
|
||||
color_name.get_hct(colors).to_rgba()
|
||||
)
|
||||
else:
|
||||
self.colors = colors
|
||||
|
||||
|
||||
def colors_dict(cache: ColorsCache):
|
||||
dict = {
|
||||
"wallpaper": cache.wallpaper,
|
||||
"colors": cache.colors,
|
||||
"original_color": cache.original_color,
|
||||
"contrast_level": cache.contrast_level,
|
||||
"scheme_name": cache.scheme_name,
|
||||
}
|
||||
return dict
|
||||
|
||||
|
||||
def get_cache_object(object: dict | str):
|
||||
if isinstance(object, str):
|
||||
object = dict(json.loads(object))
|
||||
colors = object["colors"]
|
||||
wallpaper = object["wallpaper"]
|
||||
original_color = object["original_color"]
|
||||
contrast_level = object.get("contrast_level", 0)
|
||||
scheme_name = object.get("scheme_name", "tonalSpot")
|
||||
return ColorsCache(colors, wallpaper, original_color, contrast_level, scheme_name)
|
||||
|
||||
|
||||
def get_file_list(folder_path):
|
||||
file_list = []
|
||||
for file in os.listdir(folder_path):
|
||||
if os.path.isfile(join(folder_path, file)):
|
||||
file_list.append(join(folder_path, file))
|
||||
return file_list
|
||||
|
||||
|
||||
ready_templates = {
|
||||
"colors.css": "@define-color {name} {hex};\n",
|
||||
"colors.scss": "${name}: {hex};\n",
|
||||
}
|
||||
additional = {"onBackground": "foreground"}
|
||||
|
||||
|
||||
def generate_color_map(scheme: DynamicScheme):
|
||||
color_map: dict[str, str] = {}
|
||||
for color in vars(MaterialDynamicColors).keys():
|
||||
color_name = getattr(MaterialDynamicColors, color)
|
||||
if hasattr(color_name, "get_hct"):
|
||||
rgba = color_name.get_hct(scheme).to_rgba()
|
||||
color_map[color.strip()] = rgb_to_hex(rgba)
|
||||
return color_map
|
||||
|
||||
|
||||
class ColorFormatter:
|
||||
def __init__(self, scheme: DynamicScheme):
|
||||
self.color_map = generate_color_map(scheme)
|
||||
|
||||
def apply_transformations(self, value, transformations):
|
||||
intermediate_transforms = [
|
||||
t for t in transformations if not (t.startswith("strip") or t == "rgb")
|
||||
]
|
||||
final_transforms = [
|
||||
t for t in transformations if t.startswith("strip") or t == "rgb"
|
||||
]
|
||||
|
||||
for transform in intermediate_transforms:
|
||||
if transform.startswith("lighten"):
|
||||
percent = int(re.search(r"\d+", transform).group())
|
||||
value = self.adjust_brightness(value, percent)
|
||||
elif transform.startswith("darken"):
|
||||
percent = int(re.search(r"\d+", transform).group())
|
||||
value = self.adjust_brightness(value, -percent)
|
||||
|
||||
for transform in final_transforms:
|
||||
if transform.startswith("strip"):
|
||||
value = value.lstrip("#")
|
||||
elif transform == "rgb":
|
||||
value = self.hex_to_rgb(value)
|
||||
|
||||
return value
|
||||
|
||||
def adjust_brightness(self, hex_color, factor):
|
||||
def min_max(v):
|
||||
return min(255, max(0, v))
|
||||
|
||||
hex_color = hex_color.lstrip("#")
|
||||
r, g, b = (int(hex_color[i : i + 2], 16) for i in (0, 2, 4))
|
||||
|
||||
r = min_max(int(r * (1 + factor / 100)))
|
||||
g = min_max(int(g * (1 + factor / 100)))
|
||||
b = min_max(int(b * (1 + factor / 100)))
|
||||
|
||||
return f"#{r:02X}{g:02X}{b:02X}".lower()
|
||||
|
||||
def hex_to_rgb(self, hex_color):
|
||||
hex_color = hex_color.lstrip("#")
|
||||
r, g, b = (int(hex_color[i : i + 2], 16) for i in (0, 2, 4))
|
||||
return f"{r},{g},{b}"
|
||||
|
||||
def parse_transformations(self, transformations_str):
|
||||
transformations = re.findall(r"(\w+)(?:\((\d*)\))?", transformations_str)
|
||||
result = []
|
||||
for command, arg in transformations:
|
||||
if command:
|
||||
if arg:
|
||||
result.append(f"{command}({arg})")
|
||||
else:
|
||||
result.append(command)
|
||||
return result
|
||||
|
||||
def format(self, text):
|
||||
pattern = r"(<(\w+)(?:\.(.+))?>)"
|
||||
matches = re.findall(pattern, text)
|
||||
result = []
|
||||
last_end = 0
|
||||
|
||||
for match in matches:
|
||||
full_match, key, transformations_str = match
|
||||
if key in self.color_map:
|
||||
result.append(text[last_end : text.find(full_match, last_end)])
|
||||
value = self.color_map[key]
|
||||
if transformations_str:
|
||||
transformations = self.parse_transformations(transformations_str)
|
||||
value = self.apply_transformations(value, transformations)
|
||||
result.append(value)
|
||||
last_end = text.find(full_match, last_end) + len(full_match)
|
||||
|
||||
result.append(text[last_end:])
|
||||
result = "".join(result)
|
||||
pattern = r"<\\\\([^>]+)>"
|
||||
|
||||
result = re.sub(pattern, r"<\1>", result)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def generate_templates(
|
||||
folder: str,
|
||||
output_folder: str,
|
||||
scheme: DynamicScheme,
|
||||
color_scheme: str,
|
||||
wallpaper: str = "",
|
||||
):
|
||||
if not os.path.exists(output_folder):
|
||||
os.makedirs(output_folder)
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
file_list = get_file_list(folder)
|
||||
|
||||
for file_path in file_list:
|
||||
with open(file_path) as f:
|
||||
template = f.read()
|
||||
formatter = ColorFormatter(scheme)
|
||||
template = formatter.format(template)
|
||||
template = (
|
||||
template.replace("<color-scheme>", color_scheme)
|
||||
.replace("<output-folder>", output_folder)
|
||||
.replace("<wallpaper>", wallpaper)
|
||||
)
|
||||
new_path = join(output_folder, os.path.basename(file_path))
|
||||
with open(new_path, "w") as f:
|
||||
f.write(template)
|
||||
|
||||
for file in ready_templates:
|
||||
_template = ""
|
||||
for color in vars(MaterialDynamicColors).keys():
|
||||
color_name = getattr(MaterialDynamicColors, color)
|
||||
if hasattr(color_name, "get_hct"):
|
||||
rgba = color_name.get_hct(scheme).to_rgba()
|
||||
hex_color = rgb_to_hex(rgba)
|
||||
rgb_color = rgba_to_rgb(rgba)
|
||||
new_line = ready_templates[file].format(
|
||||
name=color, hex=hex_color, rgb=rgb_color
|
||||
)
|
||||
_template += new_line
|
||||
if color in additional:
|
||||
new_line = ready_templates[file].format(
|
||||
name=additional[color], hex=hex_color, rgb=rgb_color
|
||||
)
|
||||
_template += new_line
|
||||
|
||||
new_path = join(output_folder, os.path.basename(file))
|
||||
with open(new_path, "w") as f:
|
||||
f.write(_template)
|
||||
|
||||
|
||||
def run_hooks(folder: str):
|
||||
if not os.path.exists(folder):
|
||||
os.makedirs(folder)
|
||||
file_list = get_file_list(folder)
|
||||
for file_path in file_list:
|
||||
file_name = os.path.basename(file_path)
|
||||
if str(file_name).endswith(".py"):
|
||||
subprocess.run(["python", "-O", file_path])
|
||||
elif str(file_name).endswith(".sh"):
|
||||
subprocess.run(["sh", file_path])
|
||||
|
||||
|
||||
def process_image(image_path, quality=2, num_colors=128):
|
||||
def get_cache_path(image_path):
|
||||
global cache_path
|
||||
_cache_path = join(cache_path, "cached_colors")
|
||||
hash_object = hashlib.md5(image_path.encode())
|
||||
cache_filename = hash_object.hexdigest() + ".pkl"
|
||||
os.makedirs(_cache_path, exist_ok=True)
|
||||
return join(_cache_path, cache_filename)
|
||||
|
||||
def load_from_cache(cache_path):
|
||||
if os.path.exists(cache_path):
|
||||
with open(cache_path, "rb") as f:
|
||||
return pickle.load(f)
|
||||
return None
|
||||
|
||||
def save_to_cache(cache_path, data):
|
||||
with open(cache_path, "wb") as f:
|
||||
pickle.dump(data, f)
|
||||
|
||||
cache_path = get_cache_path(image_path)
|
||||
|
||||
cached_result = load_from_cache(cache_path)
|
||||
if cached_result is not None:
|
||||
return cached_result
|
||||
|
||||
image = Image.open(image_path).convert("RGB")
|
||||
|
||||
image_data = np.array(image)
|
||||
pixel_array = image_data[::quality, ::quality].reshape(-1, 3)
|
||||
|
||||
result = QuantizeCelebi(pixel_array, num_colors)
|
||||
|
||||
color = Score.score(result)[0]
|
||||
|
||||
save_to_cache(cache_path, color)
|
||||
|
||||
return color
|
||||
|
||||
|
||||
def main(
|
||||
color_scheme: str,
|
||||
image_path: str,
|
||||
use_color: int | None = None,
|
||||
scheme_name: str | None = None,
|
||||
contrast_level: int = 0,
|
||||
):
|
||||
scheme_name = scheme_name or "tonalSpot"
|
||||
scheme = schemes[scheme_name]
|
||||
is_dark = True if color_scheme == "dark" else False
|
||||
if use_color is None:
|
||||
color = process_image(image_path, 4, 1024)
|
||||
|
||||
else:
|
||||
color = use_color
|
||||
|
||||
scheme = scheme(Hct.from_int(color), is_dark, contrast_level)
|
||||
# for color in vars(MaterialDynamicColors).keys():
|
||||
# color_name = getattr(MaterialDynamicColors, color)
|
||||
# if hasattr(color_name, "get_hct"):
|
||||
# print(color, rgb_to_hex(color_name.get_hct(scheme).to_rgba()))
|
||||
|
||||
with open(join(cache_path, "colors.json"), "w") as f:
|
||||
object = ColorsCache(scheme, image_path, color, contrast_level, scheme_name)
|
||||
json.dump(colors_dict(object), f, indent=2)
|
||||
|
||||
generate_templates(
|
||||
f"{script_dir}/templates", cache_path, scheme, color_scheme, image_path
|
||||
)
|
||||
generate_templates(
|
||||
f"{script_dir}/templates/svg",
|
||||
join(cache_path, "svg/"),
|
||||
scheme,
|
||||
color_scheme,
|
||||
image_path,
|
||||
)
|
||||
|
||||
if is_dark:
|
||||
subprocess.run(["sh", join(script_dir, "gtk-material.sh")])
|
||||
else:
|
||||
subprocess.run(["sh", join(script_dir, "gtk-material.sh"), "--light"])
|
||||
|
||||
run_hooks(join(script_dir, "hooks"))
|
||||
|
||||
|
||||
def _argparse() -> tuple[bool, bool, str, str, str, str]:
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument("-R", help="Restore previous colorscheme.", action="store_true")
|
||||
group.add_argument(
|
||||
"-w", help="Use last used wallpaper for color generation.", action="store_true"
|
||||
)
|
||||
group.add_argument("--image", type=str, help="Image for color scheme generation")
|
||||
group.add_argument(
|
||||
"--color", type=str, help="Main color for color scheme generation"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--color-scheme",
|
||||
type=str,
|
||||
default="dark",
|
||||
choices=["dark", "light"],
|
||||
help="Color scheme variant",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--scheme",
|
||||
type=str,
|
||||
default="",
|
||||
choices=list(schemes.keys()),
|
||||
help="Scheme for color generation",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
restore_palette = args.R
|
||||
use_last_used_wallpaper = args.w
|
||||
image = args.image
|
||||
color_scheme = args.color_scheme
|
||||
use_color = args.color
|
||||
scheme = args.scheme
|
||||
return (
|
||||
restore_palette,
|
||||
use_last_used_wallpaper,
|
||||
image,
|
||||
color_scheme,
|
||||
use_color,
|
||||
scheme,
|
||||
)
|
||||
|
||||
|
||||
def _main():
|
||||
(
|
||||
restore_palette,
|
||||
use_last_used_wallpaper,
|
||||
image,
|
||||
color_scheme,
|
||||
use_color,
|
||||
scheme,
|
||||
) = _argparse()
|
||||
if not scheme:
|
||||
scheme = None
|
||||
if use_color is not None:
|
||||
try:
|
||||
with open(join(cache_path, "colors.json")) as f:
|
||||
content = get_cache_object(f.read())
|
||||
main(
|
||||
color_scheme,
|
||||
image_path=content.wallpaper,
|
||||
use_color=int(use_color.lstrip("#"), 16),
|
||||
scheme_name=scheme,
|
||||
)
|
||||
except Exception:
|
||||
main(
|
||||
color_scheme,
|
||||
image_path="/dev/null",
|
||||
use_color=int(use_color.lstrip("#"), 16),
|
||||
scheme_name=scheme,
|
||||
)
|
||||
|
||||
elif restore_palette:
|
||||
with open(join(cache_path, "colors.json")) as f:
|
||||
content = get_cache_object(f.read())
|
||||
main(
|
||||
color_scheme,
|
||||
image_path=content.wallpaper,
|
||||
use_color=content.original_color,
|
||||
scheme_name=scheme or content.scheme_name,
|
||||
contrast_level=content.contrast_level,
|
||||
)
|
||||
elif use_last_used_wallpaper:
|
||||
with open(join(cache_path, "colors.json")) as f:
|
||||
content = get_cache_object(f.read())
|
||||
main(
|
||||
color_scheme,
|
||||
image_path=content.wallpaper,
|
||||
scheme_name=scheme or content.scheme_name,
|
||||
contrast_level=content.contrast_level,
|
||||
)
|
||||
else:
|
||||
if os.path.isdir(image):
|
||||
files = [
|
||||
f for f in os.listdir(image) if f.endswith((".png", ".jpg", ".jpeg"))
|
||||
]
|
||||
if files:
|
||||
image = join(image, random.choice(files))
|
||||
main(color_scheme, image_path=image, scheme_name=scheme)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
_main()
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
dark_icon="Tela-nord-dark"
|
||||
light_icon="Tela-nord-light"
|
||||
|
||||
if [ "$1" == "--light" ]; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$light_icon"
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-dark
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
gsettings set org.gnome.desktop.interface icon-theme "$dark_icon"
|
||||
fi
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
material_cache="$HOME"/.cache/material/
|
||||
|
||||
sass $material_cache/material-discord.scss $material_cache/material-discord.css
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
"$HOME"/dotfiles/sddm/scripts/wallpaper.sh 1>/dev/null
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
cache_folder="$HOME"/.cache/material
|
||||
telegram_theme_cache="$HOME"/.cache/telegram-theme
|
||||
|
||||
bg_color_file="$cache_folder/bg-color"
|
||||
bg_color=$(cat "$bg_color_file")
|
||||
magick -size 256x256 "xc:$bg_color" $telegram_theme_cache/tiled.png
|
||||
|
||||
mkdir -p $telegram_theme_cache
|
||||
|
||||
cp $cache_folder/colors.tdesktop-theme $telegram_theme_cache/colors.tdesktop-theme
|
||||
|
||||
zip -q -j $telegram_theme_cache/pallete.tdesktop-theme $telegram_theme_cache/tiled.png $telegram_theme_cache/colors.tdesktop-theme
|
||||
@@ -0,0 +1,72 @@
|
||||
[colors.primary]
|
||||
background = '<background>'
|
||||
foreground = '<onBackground>'
|
||||
|
||||
|
||||
[colors.cursor]
|
||||
text = '#1E1E2E'
|
||||
cursor = '#F5E0DC'
|
||||
|
||||
[colors.vi_mode_cursor]
|
||||
text = '#1E1E2E'
|
||||
cursor = '#B4BEFE'
|
||||
|
||||
|
||||
[colors.search.matches]
|
||||
foreground = '#1E1E2E'
|
||||
background = '#A6ADC8'
|
||||
|
||||
[colors.search.focused_match]
|
||||
foreground = '#1E1E2E'
|
||||
background = '#A6E3A1'
|
||||
|
||||
[colors.footer_bar]
|
||||
foreground = '#1E1E2E'
|
||||
background = '#A6ADC8'
|
||||
|
||||
|
||||
[colors.hints.start]
|
||||
foreground = '#1E1E2E'
|
||||
background = '#F9E2AF'
|
||||
|
||||
[colors.hints.end]
|
||||
foreground = '#1E1E2E'
|
||||
background = '#A6ADC8'
|
||||
|
||||
|
||||
[colors.selection]
|
||||
text = '#1E1E2E'
|
||||
background = '#F5E0DC'
|
||||
|
||||
|
||||
[colors.normal]
|
||||
black = '#45475A'
|
||||
red = '#F38BA8'
|
||||
green = '#A6E3A1'
|
||||
yellow = '#F9E2AF'
|
||||
blue = '#89B4FA'
|
||||
magenta = '#F5C2E7'
|
||||
cyan = '#94E2D5'
|
||||
white = '#BAC2DE'
|
||||
|
||||
|
||||
[colors.bright]
|
||||
black = '#585B70'
|
||||
red = '#F38BA8'
|
||||
green = '#A6E3A1'
|
||||
yellow = '#F9E2AF'
|
||||
blue = '#89B4FA'
|
||||
magenta = '#F5C2E7'
|
||||
cyan = '#94E2D5'
|
||||
white = '#A6ADC8'
|
||||
|
||||
|
||||
[colors.dim]
|
||||
black = '#45475A'
|
||||
red = '#F38BA8'
|
||||
green = '#A6E3A1'
|
||||
yellow = '#F9E2AF'
|
||||
blue = '#89B4FA'
|
||||
magenta = '#F5C2E7'
|
||||
cyan = '#94E2D5'
|
||||
white = '#BAC2DE'
|
||||
@@ -0,0 +1,72 @@
|
||||
[colors.primary]
|
||||
background = '<background>'
|
||||
foreground = '<onBackground>'
|
||||
|
||||
|
||||
[colors.cursor]
|
||||
text = '#EFF1F5'
|
||||
cursor = '#DC8A78'
|
||||
|
||||
[colors.vi_mode_cursor]
|
||||
text = '#EFF1F5'
|
||||
cursor = '#7287FD'
|
||||
|
||||
|
||||
[colors.search.matches]
|
||||
foreground = '#EFF1F5'
|
||||
background = '#6C6F85'
|
||||
|
||||
[colors.search.focused_match]
|
||||
foreground = '#EFF1F5'
|
||||
background = '#40A02B'
|
||||
|
||||
[colors.footer_bar]
|
||||
foreground = '#EFF1F5'
|
||||
background = '#6C6F85'
|
||||
|
||||
|
||||
[colors.hints.start]
|
||||
foreground = '#EFF1F5'
|
||||
background = '#DF8E1D'
|
||||
|
||||
[colors.hints.end]
|
||||
foreground = '#EFF1F5'
|
||||
background = '#6C6F85'
|
||||
|
||||
|
||||
[colors.selection]
|
||||
text = '#EFF1F5'
|
||||
background = '#DC8A78'
|
||||
|
||||
|
||||
[colors.normal]
|
||||
black = '#5C5F77'
|
||||
red = '#D20F39'
|
||||
green = '#40A02B'
|
||||
yellow = '#DF8E1D'
|
||||
blue = '#1E66F5'
|
||||
magenta = '#EA76CB'
|
||||
cyan = '#179299'
|
||||
white = '#ACB0BE'
|
||||
|
||||
|
||||
[colors.bright]
|
||||
black = '#6C6F85'
|
||||
red = '#D20F39'
|
||||
green = '#40A02B'
|
||||
yellow = '#DF8E1D'
|
||||
blue = '#1E66F5'
|
||||
magenta = '#EA76CB'
|
||||
cyan = '#179299'
|
||||
white = '#BCC0CC'
|
||||
|
||||
|
||||
[colors.dim]
|
||||
black = '#5C5F77'
|
||||
red = '#D20F39'
|
||||
green = '#40A02B'
|
||||
yellow = '#DF8E1D'
|
||||
blue = '#1E66F5'
|
||||
magenta = '#EA76CB'
|
||||
cyan = '#179299'
|
||||
white = '#ACB0BE'
|
||||
@@ -0,0 +1,10 @@
|
||||
[general]
|
||||
import = [
|
||||
"<output-folder>/alacritty-<color-scheme>.toml"
|
||||
]
|
||||
[font]
|
||||
normal = { family = "MesloLGS NF", style = "Regular" }
|
||||
bold = { family = "MesloLGS NF", style = "Bold" }
|
||||
italic = { family = "MesloLGS NF", style = "Italic" }
|
||||
bold_italic = { family = "MesloLGS NF", style = "Bold Italic" }
|
||||
size = 12.0
|
||||
@@ -0,0 +1 @@
|
||||
<background>
|
||||
@@ -0,0 +1,5 @@
|
||||
$background = rgb(<background.strip>)
|
||||
$foreground = rgb(<onBackground.strip>)
|
||||
$border_color_active = rgb(<primary.strip>)
|
||||
$border_color_inactive = rgb(<primary.darken(50).strip>)
|
||||
# <\\outline>
|
||||
@@ -0,0 +1,27 @@
|
||||
foreground <onSurface>
|
||||
background <surface>
|
||||
cursor <onSurface>
|
||||
|
||||
color0 <surface>
|
||||
color8 <surface>
|
||||
|
||||
color1 <error>
|
||||
color9 <error>
|
||||
|
||||
color2 <inversePrimary>
|
||||
color10 <inversePrimary>
|
||||
|
||||
color3 <error>
|
||||
color11 <error>
|
||||
|
||||
color4 <primaryContainer>
|
||||
color12 <primaryContainer>
|
||||
|
||||
color5 <onSecondaryContainer>
|
||||
color13 <onSecondaryContainer>
|
||||
|
||||
color6 <primary>
|
||||
color14 <primary>
|
||||
|
||||
color7 <onSurface>
|
||||
color15 <onSurface>
|
||||
@@ -0,0 +1,129 @@
|
||||
## Please see https://github.com/aczw/sddm-theme-corners/blob/main/CONFIG.md for
|
||||
## more information about these options. Happy configuring!
|
||||
|
||||
[General]
|
||||
|
||||
# BgSource: string. Path to an image, used as the wallpaper. Can be placed
|
||||
# in the `backgrounds/` folder for convenience (see below!)
|
||||
#
|
||||
# FontFamily: string. Name of the font family. You can find this with
|
||||
# something like `fontconfig`, for example.
|
||||
#
|
||||
# FontSize: number. This value is used for everything *except* the date/time.
|
||||
#
|
||||
# Padding: number. How far away things should be from the edge of your screen.
|
||||
#
|
||||
# Radius: number. Corner radius for UI. Set to 0 to disable rounded corners.
|
||||
#
|
||||
# Scale: number. Adjusts the size of UI elements. Can be anything, but I
|
||||
# would stick between 1 and 2 (e.g. 1.5).
|
||||
|
||||
BgSource="backgrounds/CURRENTWALLPAPER"
|
||||
FontFamily="Atkinson Hyperlegible"
|
||||
FontSize=9
|
||||
Padding=50
|
||||
Radius=10
|
||||
Scale=1
|
||||
|
||||
# UserPictureEnabled: boolean. By default the user picture is shown. Set to false
|
||||
# if you don't have/want a user picture, or you don't use the
|
||||
# user selection functionality.
|
||||
#
|
||||
# UserBorderWidth: number. Width of the border around your picture. Set to
|
||||
# 0 to remove.
|
||||
#
|
||||
# UserBorderColor: color. Border color around your picture. Useless if border
|
||||
# width is 0.
|
||||
#
|
||||
# UserColor: color. Background color of the default, blank avatar. Only
|
||||
# visible if you don't have your own picture.
|
||||
|
||||
UserPictureEnabled=false
|
||||
UserBorderWidth=5
|
||||
UserBorderColor="<onPrimary>"
|
||||
UserColor="<primary>"
|
||||
|
||||
# InputColor: color. Background color of the input fields.
|
||||
#
|
||||
# InputTextColor: color. Color of text you enter in the fields.
|
||||
#
|
||||
# InputBorderWidth: number. Width of the border around the active field. Set
|
||||
# to 0 to remove.
|
||||
#
|
||||
# InputBorderColor: color. Border color of active field. Useless if border
|
||||
# width is 0.
|
||||
#
|
||||
# UserPlaceholderText: string. Placeholder text shown when user field is empty.
|
||||
#
|
||||
# PassPlaceholderText: string. Placeholder text shown when user field is empty.
|
||||
#
|
||||
# HidePassword: boolean. Whether to replace your entered password with dots.
|
||||
|
||||
InputColor="<surfaceContainer>"
|
||||
InputTextColor="<onBackground>"
|
||||
InputBorderWidth=4
|
||||
InputBorderColor="<primary>"
|
||||
UserPlaceholderText="user"
|
||||
PassPlaceholderText="password"
|
||||
HidePassword=true
|
||||
|
||||
# LoginButtonTextColor: color. Text color on the login button.
|
||||
#
|
||||
# LoginButtonText: string. Text displayed on the button.
|
||||
#
|
||||
# LoginButtonColor: color. Background color of the button.
|
||||
|
||||
LoginButtonTextColor="<onPrimary>"
|
||||
LoginButtonText="Login"
|
||||
LoginButtonColor="<primary>"
|
||||
|
||||
# PopupColor: color. Background color of popup window.
|
||||
#
|
||||
# PopupActiveColor: color. Color around the currently selected entry.
|
||||
#
|
||||
# PopupActiveTextColor: color. Text color of the currently selected entry.
|
||||
# Mainly provided for potential contrast issues.
|
||||
|
||||
PopupColor="<surfaceContainer>"
|
||||
PopupActiveColor="<primary>"
|
||||
PopupActiveTextColor="<onPrimary>"
|
||||
|
||||
# SessionButtonColor: color. Session button background color.
|
||||
#
|
||||
# SessionIconColor: color. Color of the icon inside the session button.
|
||||
#
|
||||
# PowerButtonColor: color. Power button background color.
|
||||
#
|
||||
# PowerIconColor: color. Color of the icon inside the power button.
|
||||
|
||||
SessionButtonColor="<primary>"
|
||||
SessionIconColor="<onPrimary>"
|
||||
PowerButtonColor="<primary>"
|
||||
PowerIconColor="<onPrimary>"
|
||||
|
||||
# DateTimeSpacing: number. Spacing between the date and time.
|
||||
#
|
||||
# Date/TimeColor: color. Date/time text color.
|
||||
#
|
||||
# Date/TimeSize: number. Font size for the date/time.
|
||||
#
|
||||
# Date/TimeIsBold: boolean. Whether date/time text should be bolded.
|
||||
#
|
||||
# Date/TimeOpacity: number. Date/time text opacity.
|
||||
#
|
||||
# Date/TimeFormat: string. Change the format of how the date and time is displayed.
|
||||
# Note that they use different formats.
|
||||
|
||||
DateTimeSpacing=-20
|
||||
|
||||
DateColor="<primary>"
|
||||
DateSize=36
|
||||
DateIsBold=false
|
||||
DateOpacity=1.0
|
||||
DateFormat="dddd, MMMM d"
|
||||
|
||||
TimeColor="<primary>"
|
||||
TimeSize=48
|
||||
TimeIsBold=true
|
||||
TimeOpacity=1.0
|
||||
TimeFormat="hh:mm AP"
|
||||
@@ -0,0 +1,568 @@
|
||||
// vim:ft=cfg
|
||||
|
||||
name: pywal;
|
||||
|
||||
// Color presets //
|
||||
|
||||
secondary: <secondary>;
|
||||
onSecondary: <onSecondary>;
|
||||
outline: <outline>;
|
||||
shadow: <shadow>;
|
||||
|
||||
BACKGROUND: <background>;
|
||||
BACKGROUND_LIT_LIGHT: <surfaceContainerLowest>;
|
||||
BACKGROUND_LIGHT: <surfaceContainer>;
|
||||
BACKGROUND_EXTRA_LIGHT: <surfaceContainerHigh>;
|
||||
ON_BACKGROUND: <onBackground>;
|
||||
ON_BACKGROUND_DARKER: <onSurfaceVariant>;
|
||||
|
||||
ACCENT: <primary>;
|
||||
ON_ACCENT: <onPrimary>;
|
||||
ACCENT_LIGHT: <primary.lighten(10)>;
|
||||
ON_ACCENT_LIGHT: <onPrimary>;
|
||||
ACCENT_DARK: <primary.darken(25)>;
|
||||
ON_ACCENT_DARK: <onPrimary>;
|
||||
|
||||
ERROR: <error>;
|
||||
ERROR_RIPPLE: #ff9180;
|
||||
ON_ERROR: <onError>;
|
||||
|
||||
SUCCES: #66bb6a;
|
||||
SUCCES_LIGHT: #81c784;
|
||||
SUCCES_DARK: #388e3c;
|
||||
|
||||
COLOR_PINK: #e016a0; // Just for testing purposes :)
|
||||
|
||||
// basic
|
||||
windowBg: BACKGROUND; // Window backgrounds
|
||||
windowFg: ON_BACKGROUND; // Main text / chat text
|
||||
windowBgOver: BACKGROUND_LIGHT; // Search field background + buttons color in context menu
|
||||
windowBgRipple: BACKGROUND_EXTRA_LIGHT; // Inactive chat in chats list (press & hold)
|
||||
windowFgOver: windowFg; // black: fallback for over text color
|
||||
windowSubTextFg: ON_BACKGROUND_DARKER; // Chats list message preview text
|
||||
windowSubTextFgOver: ON_BACKGROUND_DARKER; // Mouse over chats list message preview text
|
||||
windowBoldFg: ON_BACKGROUND; // Bold font (titles in Settings, Left menu options)
|
||||
windowBoldFgOver: ACCENT_LIGHT; // Mouse over chats list chat name text (+ Left menu options on hover)
|
||||
windowBgActive: ACCENT; // Active button background (+ checkboxes background)
|
||||
windowFgActive: ON_ACCENT; // Active selected chats list text / button text + checkboxes' "ticks" color
|
||||
windowActiveTextFg: ACCENT_DARK; // Online status, links, recording cancel, etc
|
||||
windowShadowFg: BACKGROUND; // Window border shadows
|
||||
windowShadowFgFallback: BACKGROUND; // Notification border
|
||||
|
||||
shadowFg: #00000018; // Internal border shadows
|
||||
slideFadeOutBg: #0000003c; // Slide animation (chat to profile) fade out filling
|
||||
slideFadeOutShadowFg: windowShadowFg; // Slide animation (chat to profile) fade out right section shadow
|
||||
|
||||
imageBg: BACKGROUND; // Image background fallback (when photo size is less than minimum allowed)
|
||||
imageBgTransparent: ON_BACKGROUND; // Image background when displaying an image with opacity where no opacity is needed
|
||||
|
||||
//widgets
|
||||
activeButtonBg: ACCENT; // Currently selected button background
|
||||
activeButtonBgOver: ACCENT_LIGHT; // Mouse over currently selected button background
|
||||
activeButtonBgRipple: ACCENT; // Primary button background color (and active chat) - Press & hold
|
||||
activeButtonFg: ON_ACCENT; // Currently selected button text
|
||||
activeButtonFgOver: ON_ACCENT_LIGHT; // Mouse over currently selected button text
|
||||
activeButtonSecondaryFg: ON_BACKGROUND; // Counter color on primary button
|
||||
activeButtonSecondaryFgOver: ON_BACKGROUND; // Counter color on primary button (hover)
|
||||
activeLineFg: ACCENT_LIGHT; // Active input field line color (normal)
|
||||
activeLineFgError: ERROR; // Active input field line color (error)
|
||||
|
||||
lightButtonBg: BACKGROUND; // Secondary button background color (default)
|
||||
lightButtonBgOver: BACKGROUND_LIGHT; // Secondary button background color (hover)
|
||||
lightButtonBgRipple: BACKGROUND_EXTRA_LIGHT; // Secondary button background color (press & hold)
|
||||
lightButtonFg: ON_BACKGROUND; // Secondary button text color
|
||||
lightButtonFgOver: lightButtonFg; // Secondary button text color (hover)
|
||||
|
||||
attentionButtonFg: ERROR; // Default attention button text (like confirm button on log out)
|
||||
attentionButtonFgOver: ON_ERROR; // Default attention button text with mouse over
|
||||
attentionButtonBgOver: ERROR; // Default attention button background with mouse over
|
||||
attentionButtonBgRipple: ERROR_RIPPLE; // Default attention button ripple effect
|
||||
|
||||
outlineButtonBg: BACKGROUND; // Buttons background in profiles (shared media)
|
||||
outlineButtonBgOver: lightButtonBgOver; // Buttons background in profiles (hover)
|
||||
outlineButtonOutlineFg: windowBgActive; // Default left outlined button left outline border
|
||||
outlineButtonBgRipple: lightButtonBgRipple; // Default left outlined button ripple effect
|
||||
|
||||
menuBg: BACKGROUND; // Default popup menu background
|
||||
menuBgOver: windowBgOver; // Default popup menu item background with mouse over
|
||||
menuBgRipple: windowBgRipple; // Default popup menu item ripple effect
|
||||
menuIconFg: ON_BACKGROUND; // Icons color (left menu button, scroll down, paperclip..)
|
||||
menuIconFgOver: ACCENT_DARK; // Icons color on hover (left menu button, scroll down, paperclip..)
|
||||
menuSubmenuArrowFg: #373737; // Default popup menu submenu arrow icon (like in message field context menu in case of RTL system language)
|
||||
menuFgDisabled: #727272; // Default popup menu item disabled text (like unavailable items in message field context menu)
|
||||
menuSeparatorFg: BACKGROUND; // Default popup menu separator (like in message field context menu)
|
||||
|
||||
//
|
||||
|
||||
scrollBarBg: ACCENT; // Scrollbar (chats list) current position
|
||||
scrollBarBgOver: ACCENT_DARK; // Mouse over scrollbar (chats list) current position
|
||||
scrollBg: #0000001a; // Scrollbar (chats list) background
|
||||
scrollBgOver: #0000002c; // Mouse over scrollbar (chats list) background
|
||||
|
||||
smallCloseIconFg: ACCENT; // Notification close button (default)
|
||||
smallCloseIconFgOver: ACCENT_LIGHT; // Notification close button (hover)
|
||||
|
||||
radialFg: ON_BACKGROUND; // Default radial loader line (like in Media Viewer when loading a photo)
|
||||
radialBg: #00000056; // Default radial loader background (like in Media Viewer when loading a photo)
|
||||
|
||||
placeholderFg: ON_BACKGROUND_DARKER; // Inactive input box placeholder text
|
||||
placeholderFgActive: ON_BACKGROUND_DARKER; // Active input box placeholder text
|
||||
inputBorderFg: ACCENT; // Default input field bottom border (like in code input field when you log in and field is not focused)
|
||||
filterInputBorderFg: ACCENT_DARK; // Default rounded input field border (like in chats list search field when field is focused)
|
||||
filterInputInactiveBg: windowBgOver; // Default rounded input field background (like in chats list search field when field is inactive)
|
||||
checkboxFg: #b3b3b3; // Default unchecked checkbox rounded rectangle (and also emoji category icons)
|
||||
|
||||
sliderBgInactive: #e1eaef; // Inactive media player button (prev/next song)
|
||||
sliderBgActive: windowBgActive; // Active media player button (prev/next song)
|
||||
|
||||
tooltipBg: #eef2f5; // Tooltip background (hover on message sent time)
|
||||
tooltipFg: #5d6c80; // Tooltip text color
|
||||
tooltipBorderFg: #c9d1db; // Tooltip border color
|
||||
|
||||
|
||||
// custom title bar for Windows and macOS
|
||||
titleBg: BACKGROUND; // Title bar color
|
||||
titleBgActive: titleBg; // Title bar color when Telegram window is focused
|
||||
titleButtonBg: titleBg; // Title bar min/max/close buttons background (Windows only)
|
||||
titleShadow: #00000003; // One pixel line shadow at the bottom of custom window title
|
||||
titleButtonFg: BACKGROUND; // Title bar buttons(min/max/close) (Windows only)
|
||||
titleButtonBgOver: BACKGROUND_LIGHT; // Title bar min/max background (hover) (Windows only)
|
||||
titleButtonFgOver: ON_BACKGROUND; // Title bar min/max icons (Windows only)
|
||||
titleButtonBgActive: titleButtonBg; // Custom window title minimize/maximize/restore button background when window is active (Windows only)
|
||||
titleButtonFgActive: titleButtonFg; // Custom window title minimize/maximize/restore button icon when window is active (Windows only)
|
||||
titleButtonBgActiveOver: titleButtonBgOver; // Custom window title minimize/maximize/restore button background with mouse over when window is active (Windows only)
|
||||
titleButtonFgActiveOver: titleButtonFgOver; // Custom window title minimize/maximize/restore button icon with mouse over when window is active (Windows only)
|
||||
titleButtonCloseBg: titleButtonBg; // Custom window title close button background when window is inactive (Windows only)
|
||||
titleButtonCloseFg: titleButtonFg; // Custom window title close button icon when window is inactive (Windows only)
|
||||
titleButtonCloseBgOver: ERROR; // Close button background (hover)
|
||||
titleButtonCloseFgOver: ON_ERROR; // Close button icon color (hover)
|
||||
titleButtonCloseBgActive: titleButtonCloseBg; // Custom window title close button background when window is active (Windows only)
|
||||
titleButtonCloseFgActive: titleButtonCloseFg; // Custom window title close button icon when window is active (Windows only)
|
||||
titleButtonCloseBgActiveOver: titleButtonCloseBgOver; // Custom window title close button background with mouse over when window is active (Windows only)
|
||||
titleButtonCloseFgActiveOver: titleButtonCloseFgOver; // Custom window title close button icon with mouse over when window is active (Windows only)
|
||||
titleFgActive: #3e3c3e; // Active title bar text (Mac)
|
||||
titleFg: #acacac; // Inactive title bar text (Mac)
|
||||
|
||||
// tray icon
|
||||
trayCounterBg: ON_ERROR; // Unread messages counter background in tray (not muted, default red)
|
||||
trayCounterBgMute: BACKGROUND; // Unread messages counter background in tray (muted, default gray)
|
||||
trayCounterFg: ON_BACKGROUND; // Unread messages counter text (number)
|
||||
trayCounterBgMacInvert: ON_BACKGROUND; // Tray icon counter background when tray icon is pressed or when dark theme of macOS is used (macOS only)
|
||||
trayCounterFgMacInvert: ON_BACKGROUND; // Tray icon counter text when tray icon is pressed or when dark theme of macOS is used (macOS only)
|
||||
|
||||
// layers
|
||||
layerBg: #0000007f; // Box and main menu background layer fade (for example, current chat tint when forwarding message)
|
||||
|
||||
cancelIconFg: menuIconFg; // Default for settings close icon and box search cancel icon
|
||||
cancelIconFgOver: menuIconFgOver; // Default for settings close icon and box search cancel icon with mouse over
|
||||
|
||||
// boxes
|
||||
boxBg: BACKGROUND; // Popup windows background color
|
||||
boxTextFg: ON_BACKGROUND; // Popup windows text color
|
||||
boxTextFgGood: SUCCES; // Popup windows "good" text (e.g. "Username available")
|
||||
boxTextFgError: ERROR; // Popup windows "bad" text (e.g. "Username already taken")
|
||||
boxTitleFg: ACCENT; // Popup windows titles color (sessions, contacts...)
|
||||
boxSearchBg: boxBg; // Box search field background (like in contacts box)
|
||||
// boxSearchCancelIconFg: cancelIconFg; // (not implemented yet) Search cancel X button icon (like in contacts box)
|
||||
boxSearchCancelIconFgOver: cancelIconFgOver; // (not implemented yet) Search cancel X button icon with mouse over
|
||||
|
||||
boxTitleAdditionalFg: ACCENT_LIGHT; // Box title additional text (like in create group box when you see chosen members count)
|
||||
boxTitleCloseFg: cancelIconFg; // Settings close icon and box search cancel icon (like in contacts box)
|
||||
boxTitleCloseFgOver: cancelIconFgOver; // Settings close icon and box search cancel icon (like in contacts box) with mouse over
|
||||
|
||||
membersAboutLimitFg: windowSubTextFgOver; // Text in channel members box about the limit (max 200 last members are shown)
|
||||
|
||||
contactsBg: BACKGROUND; // Contacts (and some other) list background color
|
||||
contactsBgOver: windowBgOver; // Contacts (and some other) list mouse over background
|
||||
contactsNameFg: ON_BACKGROUND; // Contacts (and some other) box row name text
|
||||
contactsStatusFg: ON_BACKGROUND_DARKER; // Contacts (and some other) box row additional text (like last seen stamp)
|
||||
contactsStatusFgOver: windowSubTextFgOver; // Contacts (and some other) box row additional text (like last seen stamp) with mouse over
|
||||
contactsStatusFgOnline: ACCENT_LIGHT; // Contacts (and some other) box row active additional text (like online status)
|
||||
|
||||
photoCropFadeBg: layerBg; // "Out-of-bounds" area in photo cropping (avatars etc...)
|
||||
photoCropPointFg: ON_BACKGROUND; // Photo crop "corners" (which you drag to crop photo)
|
||||
|
||||
callArrowFg: boxTextFgGood; // Received phone call arrow (in calls list box)
|
||||
callArrowMissedFg: boxTextFgError; // Missed phone call arrow (in calls list box)
|
||||
|
||||
// intro
|
||||
introBg: BACKGROUND; // Login screen background
|
||||
introTitleFg: windowBoldFg; // Login title text
|
||||
introDescriptionFg: ON_BACKGROUND_DARKER; // Login description text
|
||||
introErrorFg: ERROR; // Login error text (like when providing a wrong log in code)
|
||||
|
||||
introCoverTopBg: BACKGROUND; // Gradient finish at the top of the login screen
|
||||
introCoverBottomBg: BACKGROUND; // Gradient start at the bottom of the login screen
|
||||
introCoverIconsFg: ACCENT_DARK; // Icons and clouds colors
|
||||
introCoverPlaneTrace: <primary>69; // Plane trace
|
||||
introCoverPlaneInner: ON_ACCENT; // Plane color inside
|
||||
introCoverPlaneOuter: ACCENT; // Plane color outside
|
||||
introCoverPlaneTop: ON_BACKGROUND; // Main plane color
|
||||
|
||||
dialogsMenuIconFg: menuIconFg; // Main menu and lock telegram icon
|
||||
dialogsMenuIconFgOver: menuIconFgOver; // Main menu and lock telegram icon with mouse over
|
||||
|
||||
dialogsBg: BACKGROUND; // Chats list background color
|
||||
dialogsNameFg: ON_BACKGROUND; // Chat list name text
|
||||
dialogsChatIconFg: dialogsNameFg; // Chat list group or channel icon
|
||||
dialogsDateFg: ON_BACKGROUND_DARKER; // Chats list date text
|
||||
dialogsTextFg: ON_BACKGROUND_DARKER; // Chats list message preview text
|
||||
dialogsTextFgService: ACCENT_LIGHT; // Chats list message preview sender name
|
||||
dialogsDraftFg: ACCENT; // "Draft" word
|
||||
dialogsVerifiedIconBg: windowBgActive; // Verification icon background
|
||||
dialogsVerifiedIconFg: ON_ACCENT; // Verification icon check color
|
||||
dialogsSendingIconFg: #c1c1c1; // Chat list sending message icon (clock)
|
||||
dialogsSentIconFg: ACCENT; // Chat list sent message tick / double tick icon
|
||||
dialogsUnreadBg: ACCENT; // Chats list unread counter background
|
||||
dialogsUnreadBgMuted: ACCENT_DARK; // Chat list unread badge background for muted chat
|
||||
dialogsUnreadFg: ON_ACCENT; // Unread counter text color
|
||||
dialogsOnlineBadgeFg: ACCENT_LIGHT; // Chat list online status (for inactive item)
|
||||
|
||||
dialogsBgOver: BACKGROUND_LIGHT; // Inactive chat color on hover
|
||||
dialogsNameFgOver: ACCENT_LIGHT; // Chat list name text with mouse over
|
||||
dialogsChatIconFgOver: dialogsNameFgOver; // Chat list group or channel icon with mouse over
|
||||
dialogsDateFgOver: windowSubTextFgOver; // Chat list date text with mouse over
|
||||
dialogsTextFgOver: windowSubTextFgOver; // Chat list message text with mouse over
|
||||
dialogsTextFgServiceOver: dialogsTextFgService; // Mouse over chats list message preview sender name
|
||||
dialogsDraftFgOver: dialogsDraftFg; // Chat list draft label with mouse over
|
||||
dialogsVerifiedIconBgOver: dialogsVerifiedIconBg; // Chat list verified icon background with mouse over
|
||||
dialogsVerifiedIconFgOver: dialogsVerifiedIconFg; // Chat list verified icon check with mouse over
|
||||
dialogsSendingIconFgOver: dialogsSendingIconFg; // Chat list sending message icon (clock) with mouse over
|
||||
dialogsSentIconFgOver: dialogsSentIconFg; // Chat list sent message tick / double tick icon with mouse over
|
||||
dialogsUnreadBgOver: dialogsUnreadBg; // Chat list unread badge background for NOT muted chat with mouse over
|
||||
dialogsUnreadBgMutedOver: dialogsUnreadBgMuted; // Chat list unread badge background for muted chat with mouse over
|
||||
dialogsUnreadFgOver: dialogsUnreadFg; // Chat list unread badge text with mouse over
|
||||
|
||||
dialogsBgActive: ACCENT; // Active chat color (in chats list)
|
||||
dialogsNameFgActive: ON_ACCENT; // Active chat name text (in chats list)
|
||||
dialogsChatIconFgActive: dialogsNameFgActive; // Active chat group or channel icon (in chats list)
|
||||
dialogsDateFgActive: ON_ACCENT; // Active chat date color
|
||||
dialogsTextFgActive: ON_ACCENT; // Active chat message preview color
|
||||
dialogsTextFgServiceActive: dialogsTextFgActive;// Active chat service messages color
|
||||
dialogsDraftFgActive: ON_ACCENT_LIGHT; // "Draft" word when chat is selected
|
||||
dialogsVerifiedIconBgActive: dialogsTextFgActive; // Active chat verified icon background (in chats list)
|
||||
dialogsVerifiedIconFgActive: dialogsBgActive; // Active chat verified icon check (in chats list)
|
||||
dialogsSendingIconFgActive: ON_ACCENT_LIGHT; // Active chat sending message icon (clock) (in chats list)
|
||||
dialogsSentIconFgActive: dialogsTextFgActive; // Active chat sent message tick / double tick icon (in chats list)
|
||||
dialogsUnreadBgActive: dialogsTextFgActive; // Active chat unread badge background for NOT muted chat (in chats list)
|
||||
dialogsUnreadBgMutedActive: dialogsDraftFgActive; // Active chat unread badge background for muted chat (in chats list)
|
||||
dialogsUnreadFgActive: dialogsBgActive; // Active chat unread badge text (in chats list)
|
||||
|
||||
dialogsRippleBg: windowBgRipple;
|
||||
dialogsRippleBgActive: activeButtonBgRipple;
|
||||
|
||||
dialogsForwardBg: dialogsBgActive; // Forwarding panel background (when forwarding messages in the smallest window size)
|
||||
dialogsForwardFg: dialogsNameFgActive; // Forwarding panel text (when forwarding messages in the smallest window size)
|
||||
|
||||
searchedBarBg: BACKGROUND; // Search results window background color
|
||||
searchedBarFg: ACCENT_LIGHT; // Search results text color
|
||||
|
||||
// history
|
||||
topBarBg: BACKGROUND; // Chat header background
|
||||
|
||||
emojiPanBg: BACKGROUND; // Sticker panel background
|
||||
emojiPanCategories: BACKGROUND; // Sticker panel bottom bar background
|
||||
emojiPanHeaderFg: ACCENT; // Sticker panel title text
|
||||
emojiPanHeaderBg: BACKGROUND; // Sticker panel top bar background
|
||||
stickerPanDeleteBg: #000000cc; // Delete X button background for custom sent stickers in stickers panel (legacy)
|
||||
stickerPanDeleteFg: ON_BACKGROUND; // Delete X button icon for custom sent stickers in stickers panel (legacy)
|
||||
stickerPreviewBg: #2f2f2fCC; // Sticker and GIF preview background (when you press and hold on a sticker)
|
||||
|
||||
historyTextInFg: ON_BACKGROUND; // Incoming message text color
|
||||
historyTextInFgSelected: ON_ACCENT; // Selected incoming message text or text in a selected message
|
||||
historyTextOutFg: ON_BACKGROUND; // Outgoing message text color
|
||||
historyTextOutFgSelected: ON_ACCENT; // Outgoing message selected text or text in a selected message
|
||||
historyLinkInFg: ACCENT_LIGHT; // Incoming message link color
|
||||
historyLinkInFgSelected: historyLinkInFg; // Incoming message link in a selected text or message
|
||||
historyLinkOutFg: ACCENT_LIGHT; // Outgoing message link color
|
||||
historyLinkOutFgSelected: historyLinkOutFg; // Outgoing message link in a selected text or message
|
||||
historyFileNameInFg: historyTextInFg; // Incoming message filename text color
|
||||
historyFileNameInFgSelected: historyFileNameInFg; // Incoming media filename text in a selected message
|
||||
historyFileNameOutFg: historyTextOutFg; // Outgoing message filename text color
|
||||
historyFileNameOutFgSelected: historyFileNameOutFg; // Outgoing media filename text in a selected message
|
||||
historyOutIconFg: dialogsSentIconFg; // "Eye" and "Checks" color for outgoing messages (selected)
|
||||
historyOutIconFgSelected: ACCENT_DARK; // "Eye" and "Checks" color for outgoing messages (selected)
|
||||
historyIconFgInverted: ON_ACCENT; // "Checks" on stickers (outgoing)
|
||||
historySendingOutIconFg: ACCENT_LIGHT; // "Clock" icon while sending file (outgoing)
|
||||
historySendingInIconFg: ACCENT_LIGHT; // "Clock" icon while sending file (incoming)
|
||||
historySendingInvertedIconFg: ACCENT_LIGHT; // Media sending message icon (clock) (like in sent photo)
|
||||
historyCallArrowInFg: callArrowFg; // Received phone call arrow
|
||||
historyCallArrowInFgSelected: callArrowFg; // Received phone call arrow in a selected message
|
||||
historyCallArrowMissedInFg: callArrowMissedFg; // Missed phone call arrow
|
||||
historyCallArrowMissedInFgSelected: callArrowMissedFg; // Missed phone call arrow in a selected message
|
||||
historyCallArrowOutFg: historyCallArrowInFg; // Outgoing phone call arrow
|
||||
historyCallArrowOutFgSelected: historyCallArrowInFgSelected; // Outgoing phone call arrow
|
||||
|
||||
historyUnreadBarBg: #424444; // Unread messages bar background color
|
||||
historyUnreadBarBorder: BACKGROUND; // Unread messages bar border color
|
||||
historyUnreadBarFg: #ededed; // Unread messages bar text color
|
||||
|
||||
historyForwardChooseBg: #0000004c; // "Choose recipient" BACKGROUND color (forwarding)
|
||||
historyForwardChooseFg: BACKGROUND; // "Choose recipient" text color (forwarding)
|
||||
|
||||
historyPeer1NameFg: #E53935; // Group chat sender name - Red
|
||||
historyPeer1NameFgSelected: historyPeer1NameFg; // Red group member name in a selected message
|
||||
historyPeer1UserpicBg: #EF9A9A; // Group chat userpic background - Red
|
||||
|
||||
historyPeer2NameFg: #7CB342; // Sender name - Green
|
||||
historyPeer2NameFgSelected: historyPeer2NameFg; // Green group member name in a selected message
|
||||
historyPeer2UserpicBg: #C5E1A5; // Userpic background - Green
|
||||
|
||||
historyPeer3NameFg: #FDD835; // Sender name - Yellow
|
||||
historyPeer3NameFgSelected: historyPeer3NameFg; // Yellow group member name in a selected message
|
||||
historyPeer3UserpicBg: #FFF59D; // Userpic background - Yellow
|
||||
|
||||
historyPeer4NameFg: #C0CA33; // Sender name - Light green
|
||||
historyPeer4NameFgSelected: historyPeer4NameFg; // Blue group member name in a selected message
|
||||
historyPeer4UserpicBg: #81D4FA; // Userpic background - Blue
|
||||
|
||||
historyPeer5NameFg: #7E57C2; // Sender name - Purple
|
||||
historyPeer5NameFgSelected: historyPeer5NameFg; // Purple group member name in a selected message
|
||||
historyPeer5UserpicBg: #B39DDB; // Userpic background - Light Purple
|
||||
|
||||
historyPeer6NameFg: #D81B60; // Sender name - "Raspberry"
|
||||
historyPeer6NameFgSelected: historyPeer6NameFg; // "Raspberry" group member name in a selected message
|
||||
historyPeer6UserpicBg: #F48FB1; // Userpic background - Light "Raspberry"
|
||||
|
||||
historyPeer7NameFg: #00ACC1; // Sender name - Cyan
|
||||
historyPeer7NameFgSelected: historyPeer7NameFg; // Cyan group member name in a selected message
|
||||
historyPeer7UserpicBg: #80DEEA; // Userpic background - Cyan
|
||||
|
||||
historyPeer8NameFg: #FB8C00; // Sender name - Orange
|
||||
historyPeer8NameFgSelected: historyPeer8NameFg; // Orange group member name in a selected message
|
||||
historyPeer8UserpicBg: #FFE082; // Userpic background - Light Orange
|
||||
|
||||
historyPeerUserpicFg: ON_BACKGROUND; // Default userpic initials
|
||||
|
||||
// Some values are marked as (adjusted), it means they're adjusted by
|
||||
// hue and saturation of the average background color if user chooses
|
||||
// some other (not bundled to this color theme) background. If the
|
||||
// bundled background is used those colors are not adjusted in any way.
|
||||
historyScrollBarBg: ACCENT; // Scrollbar (history view) background (adjusted)
|
||||
historyScrollBarBgOver: ACCENT_LIGHT; // Scrollbar (history view) background (hover) (adjusted)
|
||||
historyScrollBg: BACKGROUND; // Scrollbar (history view) current position background (adjusted)
|
||||
historyScrollBgOver: BACKGROUND_LIGHT; // Scrollbar (history view) current position background (hover) (adjusted)
|
||||
|
||||
msgInBg: BACKGROUND_LIGHT; // Incoming message background
|
||||
msgInBgSelected: ACCENT; // Selected incoming message background
|
||||
msgOutBg: BACKGROUND_EXTRA_LIGHT; // Outgoing message background
|
||||
msgOutBgSelected: ACCENT; // Selected outgoing message background
|
||||
msgSelectOverlay: <primary>50; // Selected media (images...) overlay
|
||||
msgStickerOverlay: <primary>50; // Selected sticker overlay
|
||||
msgInServiceFg: ACCENT; // Incoming reply quoted name
|
||||
msgInServiceFgSelected: ON_ACCENT; // Selected incoming reply quoted name
|
||||
msgOutServiceFg: ACCENT; // Outgoing reply quoted name
|
||||
msgOutServiceFgSelected: ON_ACCENT; // Selected outgoing reply quoted name
|
||||
msgInShadow: BACKGROUND_LIT_LIGHT; // Incoming message box shadow
|
||||
msgInShadowSelected: BACKGROUND_LIT_LIGHT; // Selected incoming message box shadow
|
||||
msgOutShadow: BACKGROUND_LIT_LIGHT; // Outgoing message box shadow
|
||||
msgOutShadowSelected: BACKGROUND_LIT_LIGHT; // Selected outgoing message box shadow
|
||||
msgInDateFg: ON_BACKGROUND_DARKER; // Incoming message date text
|
||||
msgInDateFgSelected: ON_ACCENT; // Incoming selected message date text
|
||||
msgOutDateFg: ON_BACKGROUND; // Outgoing message date text
|
||||
msgOutDateFgSelected: ON_ACCENT; // Outgoing selected message date text
|
||||
msgServiceFg: ON_ACCENT; // Service messages text color (join, left etc)
|
||||
msgServiceBg: ACCENT; // Service messages BACKGROUND color (join, left etc) (adjusted)
|
||||
msgServiceBgSelected: ACCENT; // Service message selected text background (like in a service message about group title being changed) (adjusted)
|
||||
msgInReplyBarColor: ACCENT; // Incoming msg: vertical bar next to reply
|
||||
msgInReplyBarSelColor: ACCENT; // Incoming msg: vertical bar next to reply (selected)
|
||||
msgOutReplyBarColor: ACCENT; // Outgoing msg: vertical bar next to reply
|
||||
msgOutReplyBarSelColor: ACCENT; // Outgoing msg: vertical bar next to reply (selected)
|
||||
msgImgReplyBarColor: msgServiceFg; // Sticker message reply outline
|
||||
msgInMonoFg: ACCENT_LIGHT; // Monowidth font / incoming msg
|
||||
msgOutMonoFg: ACCENT_LIGHT; // Monowidth font / outgoing msg
|
||||
msgInMonoFgSelected: msgInMonoFg; // Incoming message monospace text in a selected text or message
|
||||
msgOutMonoFgSelected: msgOutMonoFg; // Outgoing message monospace text in a selected text or message
|
||||
msgDateImgFg: msgServiceFg; // Media message time text (like time text in a sent photo)
|
||||
msgDateImgBg: ACCENT; // Media message time bubble background (like time bubble in a sent photo) or file with thumbnail download icon circle background
|
||||
msgDateImgBgOver: ON_ACCENT; // Media message download icon circle background with mouse over (like file with thumbnail download icon)
|
||||
msgDateImgBgSelected: ACCENT; // Selected media message time bubble background
|
||||
|
||||
msgFileThumbLinkInFg: lightButtonFg; // Incoming media file message with thumbnail download / open with button text
|
||||
msgFileThumbLinkInFgSelected: lightButtonFgOver; // Incoming selected media file message with thumbnail download / open with button text
|
||||
msgFileThumbLinkOutFg: ACCENT; // Outgoing media file message with thumbnail download / open with button text
|
||||
msgFileThumbLinkOutFgSelected: ACCENT_LIGHT; // Outgoing selected media file message with thumbnail download / open with button text
|
||||
msgFileInBg: windowBgActive; // Incoming audio file download circle background
|
||||
msgFileInBgOver: ACCENT_LIGHT; // Incoming audio file download circle background with mouse over
|
||||
msgFileInBgSelected: ACCENT_LIGHT; // Incoming selected audio file download circle background
|
||||
msgFileOutBg: ACCENT; // Outgoing audio file download circle background
|
||||
msgFileOutBgOver: ACCENT_DARK; // Outgoing audio file download circle background with mouse over
|
||||
msgFileOutBgSelected: ACCENT; // Outgoing selected audio file download circle background
|
||||
|
||||
msgFile1Bg: #72b1df; // Blue shared links / files without image square thumbnail
|
||||
msgFile1BgDark: #5c9ece; // Blue shared files without image download circle background
|
||||
msgFile1BgOver: #5294c4; // Blue shared files without image download circle background with mouse over
|
||||
msgFile1BgSelected: #5099d0; // Blue shared files without image download circle background if file is selected
|
||||
msgFile2Bg: #61b96e; // Green shared links / shared files without image square thumbnail
|
||||
msgFile2BgDark: #4da859; // Green shared files without image download circle background
|
||||
msgFile2BgOver: #44a050; // Green shared files without image download circle background with mouse over
|
||||
msgFile2BgSelected: #46a07e; // Green shared files without image download circle background if file is selected
|
||||
msgFile3Bg: #e47272; // Red shared links / shared files without image square thumbnail
|
||||
msgFile3BgDark: #cd5b5e; // Red shared files without image download circle background
|
||||
msgFile3BgOver: #c35154; // Red shared files without image download circle background with mouse over
|
||||
msgFile3BgSelected: #9f6a82; // Red shared files without image download circle background if file is selected
|
||||
msgFile4Bg: #efc274; // Yellow shared links / shared files without image square thumbnail
|
||||
msgFile4BgDark: #e6a561; // Yellow shared files without image download circle background
|
||||
msgFile4BgOver: #dc9c5a; // Yellow shared files without image download circle background with mouse over
|
||||
msgFile4BgSelected: #b19d84; // Yellow shared files without image download circle background if file is selected
|
||||
|
||||
historyFileInIconFg: ON_ACCENT; // Incoming file without thumbnail (like audio file) download arrow icon
|
||||
historyFileInIconFgSelected: ON_ACCENT; // Incoming selected file without thumbnail (like audio file) download arrow icon
|
||||
historyFileInRadialFg: ON_ACCENT; // Incoming file without thumbnail (like audio file) radial download animation line
|
||||
historyFileInRadialFgSelected: ON_ACCENT; // Incoming selected file without thumbnail (like audio file) radial download animation line
|
||||
historyFileOutIconFg: ON_ACCENT; // Outgoing file without thumbnail (like audio file) download arrow icon
|
||||
historyFileOutIconFgSelected: ON_ACCENT; // Outgoing selected file without thumbnail (like audio file) download arrow icon
|
||||
historyFileOutRadialFg: ON_ACCENT; // Outgoing file without thumbnail (like audio file) radial download animation line
|
||||
historyFileOutRadialFgSelected: ON_ACCENT; // Outgoing selected file without thumbnail (like audio file) radial download animation line
|
||||
historyFileThumbIconFg: ON_ACCENT; // File with thumbnail (or photo / video) download arrow icon
|
||||
historyFileThumbIconFgSelected: ON_ACCENT; // Selected file with thumbnail (or photo / video) download arrow icon
|
||||
historyFileThumbRadialFg: ON_ACCENT; // File with thumbnail (or photo / video) radial download animation line
|
||||
historyFileThumbRadialFgSelected: ON_ACCENT; // Selected file with thumbnail (or photo / video) radial download animation line
|
||||
|
||||
historyVideoMessageProgressFg: historyFileThumbIconFg; // Radial playback progress in round video messages
|
||||
msgWaveformInActive: windowBgActive; // Incoming Voice "heard" part
|
||||
msgWaveformInActiveSelected: ACCENT_LIGHT; // Selected incoming Voice "heard" part
|
||||
msgWaveformInInactive: #d4dee6; // Incoming Voice "unheard" part
|
||||
msgWaveformInInactiveSelected: ON_BACKGROUND; // Selected incoming Voice "unheard" part
|
||||
msgWaveformOutActive: windowBgActive; // Outgoing Voice "heard" part
|
||||
msgWaveformOutActiveSelected: ACCENT_LIGHT; // Selected outgoing Voice "heard" part
|
||||
msgWaveformOutInactive: ON_BACKGROUND; // Outgoing Voice "unheard" part
|
||||
msgWaveformOutInactiveSelected: ON_BACKGROUND; // Selected outgoing Voice "unheard" part
|
||||
|
||||
msgBotKbOverBgAdd: ACCENT_DARK; // Inline button (hover)
|
||||
msgBotKbIconFg: ON_ACCENT; // Inline button icon color (URL Buttons, for example)
|
||||
msgBotKbRippleBg: #00000020; // Inline button (press & hold)
|
||||
|
||||
mediaInFg: msgInDateFg; // Incoming media message status text (like in file that is being downloaded)
|
||||
mediaInFgSelected: msgInDateFgSelected; // Incoming selected media message status text (like in file that is being downloaded)
|
||||
mediaOutFg: msgOutDateFg; // Outgoing media message status text (like in file that is being downloaded)
|
||||
mediaOutFgSelected: msgOutDateFgSelected; // Outgoing selected media message status text (like in file that is being downloaded)
|
||||
|
||||
youtubePlayIconBg: #ef5350ee; // Youtube play icon background (when a link to a youtube video with a webpage preview is sent)
|
||||
youtubePlayIconFg: #ffcdd2; // Youtube play icon arrow (when a link to a youtube video with a webpage preview is sent)
|
||||
videoPlayIconBg: #0000007f; // Other video play icon background (like when a link to a vimeo video with a webpage preview is sent)
|
||||
videoPlayIconFg: ON_BACKGROUND; // Other video play icon arrow (like when a link to a vimeo video with a webpage preview is sent)
|
||||
toastBg: #000000b2; // Toast notification background (like when you click on your t.me link when editing your username)
|
||||
toastFg: ON_BACKGROUND; // Toast notification text (like when you click on your t.me link when editing your username)
|
||||
|
||||
reportSpamBg: emojiPanHeaderBg; // Report spam panel background (like a non contact user writes your for the first time)
|
||||
reportSpamFg: ON_BACKGROUND_DARKER; // Report spam panel text (when you send a report from that panel)
|
||||
|
||||
historyToDownBg: BACKGROUND; // "Scroll to bottom" button background
|
||||
historyToDownBgOver: windowBgOver; // "Scroll to bottom" button background (hover)
|
||||
historyToDownBgRipple: windowBgRipple; // "Scroll to bottom" button background (press & hold)
|
||||
historyToDownFg: menuIconFg; // "Scroll to bottom" internal icon color
|
||||
historyToDownFgOver: menuIconFgOver; // "Scroll to bottom" internal icon color (hover)
|
||||
historyToDownShadow: #00000040; // "Scroll to bottom" button shadow
|
||||
|
||||
historyComposeAreaBg: BACKGROUND; // Text input field background
|
||||
historyComposeAreaFg: ON_BACKGROUND; // Text color in "Type your message" field
|
||||
historyComposeAreaFgService: msgInDateFg; // Text color in "Type your message" field when replying to a media message
|
||||
historyComposeIconFg: menuIconFg; // Text input field: Paperclip, Smile, Bot command icons
|
||||
historyComposeIconFgOver: ACCENT_DARK; // Text input field: Paperclip, Smile, Bot command icons (hover)
|
||||
historySendIconFg: ACCENT_DARK; // Text input field: Send icon
|
||||
historySendIconFgOver: ACCENT; // Text input field: Send icon (hover)
|
||||
historyPinnedBg: historyComposeAreaBg; // Pinned message area background
|
||||
historyReplyBg: historyComposeAreaBg; // Reply / forward / edit message area background
|
||||
historyReplyIconFg: windowBgActive; // Reply / forward / edit message left icon
|
||||
historyReplyCancelFg: cancelIconFg; // Reply / forward / edit message cancel button
|
||||
historyReplyCancelFgOver: cancelIconFgOver; // Reply / forward / edit message cancel button with mouse over
|
||||
|
||||
historyComposeButtonBg: historyComposeAreaBg; // Unblock / join channel / mute channel button background
|
||||
historyComposeButtonBgOver: windowBgOver; // Unblock / join channel / mute channel button background with mouse over
|
||||
historyComposeButtonBgRipple: windowBgRipple; // Unblock / join channel / mute channel button ripple effect
|
||||
|
||||
// overview
|
||||
overviewCheckBg: #00000040; // Shared files / links checkbox background for not selected rows when some rows are selected
|
||||
overviewCheckFg: BACKGROUND; // Shared files / links checkbox icon for not selected rows when some rows are selected
|
||||
overviewCheckFgActive: BACKGROUND; // Shared files / links checkbox icon for selected rows
|
||||
overviewPhotoSelectOverlay: #40ace333; // Shared photos / videos / links fill for selected rows
|
||||
|
||||
// profile
|
||||
profileStatusFgOver: COLOR_PINK; // Group members list in group profile user last seen text with mouse over
|
||||
profileVerifiedCheckBg: windowBgActive; // Profile verified check icon background
|
||||
profileVerifiedCheckFg: windowFgActive; // Profile verified check icon tick
|
||||
profileAdminStartFg: ACCENT_LIGHT; // Star color for group/channhel admins and moderators (look in members list)
|
||||
|
||||
// settings
|
||||
notificationsBoxMonitorFg: ON_BACKGROUND_DARKER;// Custom notifications settings box monitor color
|
||||
notificationsBoxScreenBg: dialogsBgActive; // Custom notifications settings box monitor screen background
|
||||
|
||||
notificationSampleUserpicFg: windowBgActive; // Custom notifications settings box small sample userpic placeholder
|
||||
notificationSampleCloseFg: #d7d7d7; // Custom notifications settings box small sample close button placeholder
|
||||
notificationSampleTextFg: #d7d7d7; // Custom notifications settings box small sample text placeholder
|
||||
notificationSampleNameFg: #939393; // Custom notifications settings box small sample name placeholder
|
||||
|
||||
changePhoneSimcardFrom: notificationSampleTextFg; // Change phone number box left simcard icon
|
||||
changePhoneSimcardTo: notificationSampleNameFg; // Change phone number box right simcard and plane icons
|
||||
|
||||
mainMenuBg: BACKGROUND; // Left menu background (lower part, not buttons)
|
||||
mainMenuCoverBg: dialogsBgActive; // Left menu background (upper part)
|
||||
mainMenuCoverFg: ON_BACKGROUND; // Main menu top cover text
|
||||
mainMenuCloudFg: activeButtonFg; // "Cloud" icon in main menu
|
||||
mainMenuCloudBg: activeButtonBgRipple; // "Cloud" icon background in main menu
|
||||
|
||||
mediaPlayerBg: BACKGROUND; // Music player background
|
||||
mediaPlayerActiveFg: ACCENT; // Clickable Next song/Prev song button in music player + played part color
|
||||
mediaPlayerInactiveFg: #4f5151; // "Disabled" Next song/Prev song button in music player + not player part color
|
||||
mediaPlayerDisabledFg: ACCENT_DARK; // Music player audio loading progress (when you're playing an audio file and switch to the previous one which is not loaded yet)
|
||||
|
||||
// mediaview
|
||||
mediaviewFileBg: BACKGROUND; // File rectangle background (when you view a png file in Media Viewer and go to a previous, not loaded yet, file)
|
||||
mediaviewFileNameFg: ON_BACKGROUND_DARKER; // File name in file rectangle
|
||||
mediaviewFileSizeFg: ON_BACKGROUND_DARKER; // File size text in file rectangle
|
||||
mediaviewFileRedCornerFg: #d55959; // Red file thumbnail placeholder corner in file rectangle (for a file without thumbnail, like .pdf)
|
||||
mediaviewFileYellowCornerFg: #e8a659; // Yellow file thumbnail placeholder corner in file rectangle (for a file without thumbnail, like .zip)
|
||||
mediaviewFileGreenCornerFg: #49a957; // Green file thumbnail placeholder corner in file rectangle (for a file without thumbnail, like .exe)
|
||||
mediaviewFileBlueCornerFg: #599dcf; // Blue file thumbnail placeholder corner in file rectangle (for a file without thumbnail, like .dmg)
|
||||
mediaviewFileExtFg: activeButtonFg; // File extension text in file thumbnail placeholder in file rectangle
|
||||
|
||||
mediaviewMenuBg: BACKGROUND; // Context menu in Media Viewer background
|
||||
mediaviewMenuBgOver: BACKGROUND_LIGHT; // Menu items background (hover)
|
||||
mediaviewMenuBgRipple: BACKGROUND_EXTRA_LIGHT; // Menu items background (press & hold)
|
||||
mediaviewMenuFg: ON_BACKGROUND; // Text color in media view menu
|
||||
|
||||
mediaviewBg: #222222eb; // Media Viewer background
|
||||
mediaviewVideoBg: imageBg; // Media Viewer background when viewing a video in full screen
|
||||
mediaviewControlBg: #0000003c; // Controls background (like next photo / previous photo)
|
||||
mediaviewControlFg: ON_BACKGROUND; // Controls icon (like next photo / previous photo)
|
||||
mediaviewCaptionBg: #11111180; // Caption text background (when viewing photo with caption)
|
||||
mediaviewCaptionFg: mediaviewControlFg; // Caption text color
|
||||
mediaviewTextLinkFg: #91d9ff; // Links color in captions
|
||||
mediaviewSaveMsgBg: toastBg; // 'Something was saved to % folder' message background
|
||||
mediaviewSaveMsgFg: toastFg; // 'Something was saved to % folder' message text color
|
||||
|
||||
mediaviewPlaybackActive: #c7c7c7; // Video playback progress already played part
|
||||
mediaviewPlaybackInactive: #252525; // Video playback progress upcoming (not played yet) part
|
||||
mediaviewPlaybackActiveOver: ON_BACKGROUND; // Video playback progress already played part with mouse over
|
||||
mediaviewPlaybackInactiveOver: #474747; // Video playback progress upcoming (not played yet) part with mouse over
|
||||
mediaviewPlaybackProgressFg: ON_BACKGROUND; // Video playback progress text
|
||||
mediaviewPlaybackIconFg: mediaviewPlaybackActive; // Video playback controls icon
|
||||
mediaviewPlaybackIconFgOver: mediaviewPlaybackActiveOver; // Video playback controls icon with mouse over
|
||||
mediaviewTransparentBg: ON_BACKGROUND; // Transparent filling part (when viewing a transparent .png file in Media Viewer)
|
||||
mediaviewTransparentFg: #cccccc; // Another transparent filling part
|
||||
|
||||
// notification
|
||||
notificationBg: BACKGROUND; // Notification background
|
||||
|
||||
// calls
|
||||
callBg: #26282cf2; // Phone call popup background
|
||||
callNameFg: #ffffff; // Phone call popup name text
|
||||
callFingerprintBg: #00000066; // Phone call popup emoji fingerprint background
|
||||
callStatusFg: #aaabac; // Phone call popup status text
|
||||
callIconFg: #ffffff; // Phone call popup answer, hangup and mute mic icon
|
||||
callAnswerBg: #64c15b; // Phone call popup answer button background
|
||||
callAnswerRipple: #52b149; // Phone call popup answer button ripple effect
|
||||
callAnswerBgOuter: #50eb4126; // Phone call popup answer button outer ripple effect
|
||||
callHangupBg: #d75a5a; // Phone call popup hangup button background
|
||||
callHangupRipple: #c04646; // Phone call popup hangup button ripple effect
|
||||
callCancelBg: #ffffff; // Phone call popup line busy cancel button background
|
||||
callCancelFg: #777777; // Phone call popup line busy cancel button icon
|
||||
callCancelRipple: #f1f1f1; // Phone call popup line busy cancel button ripple effect
|
||||
callMuteRipple: #ffffff12; // Phone call popup mute mic ripple effect
|
||||
|
||||
callBarBg: dialogsBgActive; // Active phone call bar background
|
||||
callBarMuteRipple: dialogsRippleBgActive; // Active phone call bar mute and hangup button ripple effect
|
||||
callBarBgMuted: dialogsUnreadBgMuted; // Phone call bar with muted mic background
|
||||
callBarUnmuteRipple: shadowFg; // Phone call bar with muted mic mute and hangup button ripple effect
|
||||
callBarFg: dialogsNameFgActive; // Phone call bar text and icons
|
||||
@@ -0,0 +1,145 @@
|
||||
# Configuration
|
||||
# (general settings)
|
||||
general {
|
||||
grace = 2
|
||||
hide_cursor = true
|
||||
ignore_empty_input = true
|
||||
text_trim = true
|
||||
}
|
||||
# (background config)
|
||||
background {
|
||||
monitor =
|
||||
path = ~/.cache/current_wallpaper.png # only png supported for now
|
||||
color = rgba(<background.rgb>, 1.0)
|
||||
blur_passes = 3 # 0 disables blurring
|
||||
blur_size = 1
|
||||
noise = 0.01
|
||||
contrast = 0.8916
|
||||
brightness = 0.7
|
||||
vibrancy = 0.1696
|
||||
vibrancy_darkness = 0.0
|
||||
}
|
||||
#
|
||||
|
||||
# Password input
|
||||
input-field {
|
||||
monitor =
|
||||
size = 225, 50
|
||||
outline_thickness = 0
|
||||
dots_size = 0.33
|
||||
dots_spacing = 0.45
|
||||
dots_center = true
|
||||
dots_rounding = -1
|
||||
outer_color = rgba(0,0,0,0)
|
||||
inner_color = rgba(0,0,0,0)
|
||||
font_color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
fade_on_empty = false
|
||||
fade_timeout = 1000
|
||||
font_family = Product Sans
|
||||
placeholder_text =
|
||||
hide_input = false
|
||||
rounding = 4
|
||||
check_color = rgba(0,0,0,0)
|
||||
fail_color = rgba(0,0,0,0)
|
||||
fail_text = <i>$FAIL <b>($ATTEMPTS)</b></i>
|
||||
fail_transition = 200
|
||||
capslock_color = -1
|
||||
numlock_color = -1
|
||||
bothlock_color = -1
|
||||
invert_numlock = false
|
||||
swap_font_color = false
|
||||
position = 0, 150
|
||||
halign = center
|
||||
valign = bottom
|
||||
}
|
||||
#
|
||||
|
||||
|
||||
# Time
|
||||
# (hours)
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(date +"%H")"
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
shadow_pass = 2
|
||||
shadow_size = 3
|
||||
shadow_color = rgb(0,0,0)
|
||||
shadow_boost = 1.2
|
||||
font_size = 150
|
||||
font_family = Product Sans Light
|
||||
position = 0, 90
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
# (minutes)
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(date +"%M")"
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 150
|
||||
font_family = Product Sans Light
|
||||
position = 0, -90
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
#
|
||||
|
||||
# Date
|
||||
# (label)
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo -e "$(date +"%A, %B %d")"
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 15
|
||||
font_family = Product Sans Medium
|
||||
position = 100, -75
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
halign = left
|
||||
valign = top
|
||||
}
|
||||
# (icon)
|
||||
label {
|
||||
monitor =
|
||||
text = calendar_today
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 15
|
||||
font_family = Material Symbols Outlined
|
||||
position = 75, -75
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
halign = left
|
||||
valign = top
|
||||
}
|
||||
#
|
||||
|
||||
# Input layout
|
||||
# (label)
|
||||
label {
|
||||
monitor =
|
||||
text = $LAYOUT
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 15
|
||||
font_family = Product Sans Medium
|
||||
position = 100, -110
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
halign = left
|
||||
valign = top
|
||||
}
|
||||
# (icon)
|
||||
label {
|
||||
monitor =
|
||||
text = keyboard
|
||||
color = rgba(<primaryFixed.rgb>, 1.0)
|
||||
font_size = 15
|
||||
font_family = Material Symbols Outlined
|
||||
position = 75, -112
|
||||
shadow_passes = 5
|
||||
shadow_size = 10
|
||||
halign = left
|
||||
valign = top
|
||||
}
|
||||
#
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
@use "sass:color";
|
||||
|
||||
@import url(https://capnkitten.github.io/BetterDiscord/Themes/Material-Discord/css/source.css);
|
||||
@import "<output-folder>/colors.scss";
|
||||
|
||||
|
||||
$color-scheme: <color-scheme>;
|
||||
|
||||
$hue: round(color.channel($primary, "hue", $space: hsl));
|
||||
$saturation: round(color.channel($primary, "saturation", $space: hsl));
|
||||
$lightness: round(color.channel($primary, "lightness", $space: hsl));
|
||||
|
||||
* {
|
||||
transition: color 0.2s ease-in-out;
|
||||
transition-property: background-color, color;
|
||||
}
|
||||
|
||||
.theme-#{$color-scheme} {
|
||||
--main-color: #{$background};
|
||||
--main-alt: #{$surfaceContainerLow};
|
||||
|
||||
--message-color: #{$surfaceContainerLowest};
|
||||
--message-color-hover: #{$surfaceContainer};
|
||||
--message-color-alt: #{$surfaceContainer};
|
||||
--attachment-color: #{$background};
|
||||
|
||||
--accent-hue: #{$hue};
|
||||
--accent-saturation: #{$saturation};
|
||||
--accent-lightness: #{$lightness};
|
||||
--accent-text-color: #{$onPrimary};
|
||||
|
||||
--main-textarea-color: #{$surfaceContainerHigh};
|
||||
--main-textarea-color-alt: #{$surfaceContainerHighest};
|
||||
--status-picker-color: #{$surfaceContainerHigh};
|
||||
|
||||
--tooltip-color: #{$surfaceContainer};
|
||||
--popout-color: #{$surfaceContainer};
|
||||
--popout-color-alt: #{$surfaceContainerLowest};
|
||||
--popout-header-border: #{$onSurface};
|
||||
--separator-color: #{$outlineVariant};
|
||||
--sidebar-panel-color: #{$surfaceContainerLowest};
|
||||
--server-color: #{$surfaceContainerLow};
|
||||
}
|
||||
|
||||
[class*="botTag_"] svg path {
|
||||
fill: #{$onPrimary};
|
||||
}
|
||||
|
||||
[class*="repliedTextContent_"] {
|
||||
padding: 0px 5px 0px 5px !important;
|
||||
}
|
||||
|
||||
[class*="userPopoutOuter_"] {
|
||||
border-radius: 16px !important;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px"
|
||||
fill="<onPrimary>">
|
||||
<path
|
||||
d="M480-72 360-192H192v-168L72-480l120-120v-168h168l120-120 120 120h168v168l120 120-120 120v168H600L480-72Zm.23-216Q560-288 616-344.23q56-56.22 56-136Q672-560 615.77-616q-56.22-56-136-56Q400-672 344-615.77q-56 56.22-56 136Q288-400 344.23-344q56.22 56 136 56ZM480-480Zm0 306 90-90h126v-126l90-90-90-90v-126H570l-90-90-90 90H264v126l-90 90 90 90v126h126l90 90Zm0-306Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 514 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 -960 960 960" width="20px"
|
||||
fill="<onPrimary>">
|
||||
<path
|
||||
d="M480-72 360-192H192v-168L72-480l120-120v-168h168l120-120 120 120h168v168l120 120-120 120v168H600L480-72Zm0-216q80 0 136-56.23 56-56.22 56-136Q672-560 615.84-616 559.68-672 480-672v384Zm0 114 90-90h126v-126l90-90-90-90v-126H570l-90-90-90 90H264v126l-90 90 90 90v126h126l90 90Zm0-306Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 430 B |
@@ -0,0 +1,38 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Window 2.15
|
||||
|
||||
import "./components"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
height: Screen.height
|
||||
width: Screen.width
|
||||
|
||||
Image {
|
||||
anchors { fill: parent }
|
||||
|
||||
source: config.BgSource
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
clip: true
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: config.Padding
|
||||
}
|
||||
|
||||
DateTimePanel {
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
LoginPanel {
|
||||
anchors { fill: parent }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
figlet "Disable SDDM"
|
||||
if [ -f /etc/systemd/system/display-manager.service ]; then
|
||||
if gum confirm "Do you want to disable the current display manager?"; then
|
||||
sudo rm /etc/systemd/system/display-manager.service
|
||||
echo ":: Current display manager removed."
|
||||
echo ":: Please reboot your system."
|
||||
fi
|
||||
else
|
||||
echo ":: No Display Manager enabled."
|
||||
fi
|
||||
sleep 3
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
figlet "Enable SDDM"
|
||||
if [ -f /etc/systemd/system/display-manager.service ]; then
|
||||
echo ":: Display Manager is already enabled."
|
||||
else
|
||||
if gum confirm "Do you want to enable SDDM as your display manager?"; then
|
||||
sudo systemctl enable sddm.service
|
||||
echo ":: Display manager SDDM has been enabled."
|
||||
echo ":: Please reboot your system!"
|
||||
fi
|
||||
fi
|
||||
sleep 3
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
cache_file="$HOME/.cache/current_wallpaper"
|
||||
if [ ! -d /etc/sddm.conf.d/ ]; then
|
||||
sudo mkdir /etc/sddm.conf.d
|
||||
echo "Folder /etc/sddm.conf.d created."
|
||||
fi
|
||||
|
||||
cp $HOME/dotfiles/sddm/sddm.conf /etc/sddm.conf.d/
|
||||
cp $HOME/dotfiles/sddm/sddm.conf /etc/
|
||||
if [ "$1" != "init" ]; then
|
||||
echo "File /etc/sddm.conf.d/sddm.conf updated."
|
||||
fi
|
||||
|
||||
current_wallpaper=$(cat "$cache_file")
|
||||
extension="${current_wallpaper##*.}"
|
||||
|
||||
cp $current_wallpaper /usr/share/sddm/themes/corners/backgrounds/current_wallpaper.$extension
|
||||
|
||||
if [ "$1" != "init" ]; then
|
||||
echo "Current wallpaper copied into /usr/share/sddm/themes/corners/backgrounds/"
|
||||
fi
|
||||
|
||||
new_wall=$(echo $current_wallpaper | sed "s|$HOME/wallpaper/||g")
|
||||
cp $HOME/.cache/material/colors-sddm-style.conf /usr/share/sddm/themes/corners/theme.conf
|
||||
sed -i 's/CURRENTWALLPAPER/'"current_wallpaper.$extension"'/' /usr/share/sddm/themes/corners/theme.conf
|
||||
|
||||
if [ "$1" != "init" ]; then
|
||||
echo "File theme.conf updated in /usr/share/sddm/themes/corners/"
|
||||
|
||||
echo "DONE! Please logout to test sddm."
|
||||
fi
|
||||
@@ -0,0 +1,138 @@
|
||||
[Autologin]
|
||||
# Whether sddm should automatically log back into sessions when they exit
|
||||
Relogin=false
|
||||
|
||||
# Name of session file for autologin session (if empty try last logged in)
|
||||
Session=
|
||||
|
||||
# Username for autologin session
|
||||
User=
|
||||
|
||||
[General]
|
||||
# Which display server should be used.
|
||||
# Valid values are: x11, x11-user, wayland. Wayland support is experimental
|
||||
DisplayServer=x11
|
||||
|
||||
# Comma-separated list of environment variables to be set
|
||||
GreeterEnvironment=
|
||||
|
||||
# Halt command
|
||||
HaltCommand=/usr/bin/systemctl poweroff
|
||||
|
||||
# Input method module
|
||||
InputMethod=
|
||||
|
||||
# Comma-separated list of Linux namespaces for user session to enter
|
||||
Namespaces=
|
||||
|
||||
# Initial NumLock state. Can be on, off or none.
|
||||
# If property is set to none, numlock won't be changed
|
||||
# NOTE: Currently ignored if autologin is enabled.
|
||||
Numlock=none
|
||||
|
||||
# Reboot command
|
||||
RebootCommand=/usr/bin/systemctl reboot
|
||||
|
||||
|
||||
[Theme]
|
||||
# Current theme name
|
||||
Current=corners
|
||||
|
||||
# Cursor size used in the greeter
|
||||
CursorSize=6
|
||||
|
||||
# Cursor theme used in the greeter
|
||||
CursorTheme=Bibata-Original-Classic
|
||||
|
||||
# Number of users to use as threshold
|
||||
# above which avatars are disabled
|
||||
# unless explicitly enabled with EnableAvatars
|
||||
DisableAvatarsThreshold=7
|
||||
|
||||
# Enable display of custom user avatars
|
||||
EnableAvatars=false
|
||||
|
||||
# Global directory for user avatars
|
||||
# The files should be named <username>.face.icon
|
||||
FacesDir=/usr/share/sddm/faces
|
||||
|
||||
# Font used in the greeter
|
||||
Font=
|
||||
|
||||
# Theme directory path
|
||||
# ThemeDir=/usr/share/sddm/themes
|
||||
ThemeDir=/usr/share/sddm/themes
|
||||
|
||||
[Users]
|
||||
# Default $PATH for logged in users
|
||||
DefaultPath=/usr/local/sbin:/usr/local/bin:/usr/bin
|
||||
|
||||
# Comma-separated list of shells.
|
||||
# Users with these shells as their default won't be listed
|
||||
HideShells=
|
||||
|
||||
# Comma-separated list of users that should not be listed
|
||||
HideUsers=
|
||||
|
||||
# Maximum user id for displayed users
|
||||
MaximumUid=60513
|
||||
|
||||
# Minimum user id for displayed users
|
||||
MinimumUid=1000
|
||||
|
||||
# Remember the session of the last successfully logged in user
|
||||
RememberLastSession=true
|
||||
|
||||
# Remember the last successfully logged in user
|
||||
RememberLastUser=true
|
||||
|
||||
# When logging in as the same user twice, restore the original session, rather than create a new one
|
||||
ReuseSession=true
|
||||
|
||||
|
||||
[Wayland]
|
||||
# Path of the Wayland compositor to execute when starting the greeter
|
||||
CompositorCommand=weston --shell=fullscreen-shell.so
|
||||
|
||||
# Enable Qt's automatic high-DPI scaling
|
||||
EnableHiDPI=true
|
||||
|
||||
# Path to a script to execute when starting the desktop session
|
||||
SessionCommand=/usr/share/sddm/scripts/wayland-session
|
||||
|
||||
# Comma-separated list of directories containing available Wayland sessions
|
||||
SessionDir=/usr/local/share/wayland-sessions,/usr/share/wayland-sessions
|
||||
|
||||
# Path to the user session log file
|
||||
SessionLogFile=.local/share/sddm/wayland-session.log
|
||||
|
||||
|
||||
[X11]
|
||||
# Path to a script to execute when starting the display server
|
||||
DisplayCommand=/usr/share/sddm/scripts/Xsetup
|
||||
|
||||
# Path to a script to execute when stopping the display server
|
||||
DisplayStopCommand=/usr/share/sddm/scripts/Xstop
|
||||
|
||||
# Enable Qt's automatic high-DPI scaling
|
||||
EnableHiDPI=true
|
||||
|
||||
# Arguments passed to the X server invocation
|
||||
ServerArguments=-nolisten tcp
|
||||
|
||||
# Path to X server binary
|
||||
ServerPath=/usr/bin/X
|
||||
|
||||
# Path to a script to execute when starting the desktop session
|
||||
SessionCommand=/usr/share/sddm/scripts/Xsession
|
||||
|
||||
# Comma-separated list of directories containing available X sessions
|
||||
SessionDir=/usr/local/share/xsessions,/usr/share/xsessions
|
||||
|
||||
# Path to the user session log file
|
||||
SessionLogFile=.local/share/sddm/xorg-session.log
|
||||
|
||||
# Path to Xephyr binary
|
||||
XephyrPath=/usr/bin/Xephyr
|
||||
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
import os
|
||||
import sys
|
||||
import importlib.util
|
||||
import argparse
|
||||
import fcntl
|
||||
import subprocess
|
||||
import asyncio
|
||||
import random as _random
|
||||
import colorsys
|
||||
import json
|
||||
import inspect
|
||||
|
||||
|
||||
def get_relative_path(path: str, level: int = 1) -> str:
|
||||
prev_globals = inspect.stack()[level][0].f_globals
|
||||
file_var = (
|
||||
os.path.dirname(os.path.abspath(prev_globals["__file__"]))
|
||||
if "__file__" in prev_globals
|
||||
else os.getcwd()
|
||||
)
|
||||
return os.path.join(file_var, path)
|
||||
|
||||
|
||||
lock_file_path = "/tmp/wallpaper.lock"
|
||||
settings_file_path = get_relative_path("../config/assets/settings.json")
|
||||
|
||||
|
||||
def acquire_lock():
|
||||
global lock_file
|
||||
lock_file = open(lock_file_path, "w")
|
||||
try:
|
||||
fcntl.flock(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||
lock_file.write(str(os.getpid()))
|
||||
lock_file.flush()
|
||||
except IOError:
|
||||
print("Another instance of the script is already running.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def release_lock():
|
||||
fcntl.flock(lock_file, fcntl.LOCK_UN)
|
||||
lock_file.close()
|
||||
os.remove(lock_file_path)
|
||||
|
||||
|
||||
def hue_to_numeric_hex(hue):
|
||||
hue = hue / 360.0
|
||||
rgb = colorsys.hls_to_rgb(hue, 0.5, 1.0)
|
||||
hex_color_str = "#{:02x}{:02x}{:02x}".format(
|
||||
int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255)
|
||||
)
|
||||
numeric_hex_color = int(hex_color_str.lstrip("#"), 16)
|
||||
return numeric_hex_color
|
||||
|
||||
|
||||
def load_settings():
|
||||
default_settings = {
|
||||
"color-scheme": "dark",
|
||||
"custom-color": "none",
|
||||
"generation-scheme": "tonalSpot",
|
||||
}
|
||||
|
||||
if not os.path.exists(settings_file_path):
|
||||
os.makedirs(os.path.dirname(settings_file_path), exist_ok=True)
|
||||
with open(settings_file_path, "w") as file:
|
||||
json.dump(default_settings, file, indent=4)
|
||||
|
||||
with open(settings_file_path, "r") as file:
|
||||
return json.load(file)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument("-I", "--image", type=str, help="Image")
|
||||
group.add_argument(
|
||||
"-P",
|
||||
"--prev",
|
||||
help="Use last used wallpaper for color generation",
|
||||
action="store_true",
|
||||
)
|
||||
group.add_argument(
|
||||
"-R", "--random", help="Random image from folder", action="store_true"
|
||||
)
|
||||
parser.add_argument("-n", "--notify", help="Send notifications", action="store_true")
|
||||
parser.add_argument(
|
||||
"--status", type=str, help="Status file", default="/tmp/wallpaper.status"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
random = args.random
|
||||
prev = args.prev
|
||||
image = args.image
|
||||
notify = args.notify
|
||||
status = args.status
|
||||
|
||||
HOME = os.path.expanduser("~")
|
||||
|
||||
module_path = get_relative_path("./material-colors")
|
||||
sys.path.append(module_path)
|
||||
|
||||
module_name = "generate"
|
||||
file_path = f"{module_path}/{module_name}.py"
|
||||
|
||||
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
||||
GENERATOR = importlib.util.module_from_spec(spec) # type: ignore
|
||||
spec.loader.exec_module(GENERATOR) # type: ignore
|
||||
|
||||
cache_file = f"{HOME}/.cache/current_wallpaper"
|
||||
square = f"{HOME}/.cache/square_wallpaper.png"
|
||||
png = f"{HOME}/.cache/current_wallpaper.png"
|
||||
|
||||
|
||||
def current_state(state_str: str):
|
||||
with open(status, "w") as f:
|
||||
f.write(state_str)
|
||||
|
||||
|
||||
def send_notify(label: str, desc: str):
|
||||
if not notify:
|
||||
return
|
||||
subprocess.run(["notify-send", label, desc])
|
||||
|
||||
|
||||
def state(name: str | None, label: str | None, desc: str | None):
|
||||
if name is not None:
|
||||
current_state(name)
|
||||
if label is not None:
|
||||
send_notify(label, desc or "")
|
||||
|
||||
|
||||
def join(*args):
|
||||
return os.path.join(*args)
|
||||
|
||||
|
||||
async def main():
|
||||
state("init", None, None)
|
||||
|
||||
settings = load_settings()
|
||||
color_scheme = settings["color-scheme"]
|
||||
custom_color = settings["custom-color"]
|
||||
generation_scheme = settings["generation-scheme"]
|
||||
swww_animation = "wipe"
|
||||
wallpaper_engine = "swww"
|
||||
|
||||
new_wallpaper = f"{HOME}/Pictures/wallpapers/example-1.jpg"
|
||||
# new_wallpaper = get_relative_path("../assets/wallpapers/1.png")
|
||||
|
||||
if random:
|
||||
files = [
|
||||
f
|
||||
for f in os.listdir(f"{HOME}/Pictures/wallpapers/")
|
||||
if f.endswith((".png", ".jpg", ".jpeg"))
|
||||
]
|
||||
if files:
|
||||
new_wallpaper = join(f"{HOME}/Pictures/wallpapers", _random.choice(files))
|
||||
elif prev:
|
||||
try:
|
||||
with open(cache_file) as f:
|
||||
new_wallpaper = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
elif image is not None:
|
||||
new_wallpaper = os.path.abspath(image)
|
||||
|
||||
print(f":: Wallpaper {new_wallpaper}")
|
||||
|
||||
with open(cache_file, "w") as f:
|
||||
f.write(new_wallpaper)
|
||||
|
||||
with_image = f"with image {new_wallpaper}"
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Set the new wallpaper
|
||||
# -----------------------------------------------------
|
||||
|
||||
transition_type = swww_animation
|
||||
|
||||
state("changing", "Changing wallpaper...", with_image)
|
||||
print(":: Changing wallpaper...")
|
||||
|
||||
if wallpaper_engine == "swww":
|
||||
print(":: Using swww")
|
||||
|
||||
cursor_pos = subprocess.getoutput("hyprctl cursorpos").replace(", ", ",")
|
||||
|
||||
subprocess.run(
|
||||
[
|
||||
"swww",
|
||||
"img",
|
||||
new_wallpaper,
|
||||
"--transition-bezier",
|
||||
".43,1.19,1,.4",
|
||||
"--transition-fps",
|
||||
"60",
|
||||
"--transition-type",
|
||||
transition_type,
|
||||
"--transition-duration",
|
||||
"0.7",
|
||||
"--transition-pos",
|
||||
cursor_pos,
|
||||
]
|
||||
)
|
||||
|
||||
else:
|
||||
print(":: Wallpaper Engine disabled")
|
||||
|
||||
# -----------------------------------------------------
|
||||
# Generate colors
|
||||
# -----------------------------------------------------
|
||||
state("colors", "Generating colors...", with_image)
|
||||
print(":: Generate colors")
|
||||
_starts_with = lambda x: str(x).startswith("-")
|
||||
|
||||
GENERATOR.main(
|
||||
color_scheme,
|
||||
new_wallpaper,
|
||||
(
|
||||
hue_to_numeric_hex(int(custom_color.lstrip("-")))
|
||||
if _starts_with(custom_color)
|
||||
else (int(custom_color.lstrip("#"), 16) if custom_color != "none" else None)
|
||||
),
|
||||
scheme_name=generation_scheme,
|
||||
)
|
||||
|
||||
# Generate square and png versions
|
||||
await asyncio.gather(square_image(new_wallpaper), png_image(new_wallpaper))
|
||||
|
||||
state("finish", "Wallpaper procedure complete!", with_image)
|
||||
|
||||
|
||||
async def png_image(wallpaper: str):
|
||||
if wallpaper.lower().endswith((".jpg", ".jpeg")):
|
||||
state(None, "Converting jpg to png...", f"with image {wallpaper}")
|
||||
print(":: Converting jpg to png...")
|
||||
cmd = f"magick {wallpaper}[0] {png}"
|
||||
else:
|
||||
cmd = f"cp -f {wallpaper} {png}"
|
||||
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: JPG successfully converted to PNG!")
|
||||
|
||||
|
||||
async def square_image(wallpaper):
|
||||
state(None, "Creating square version...", f"with image {wallpaper}")
|
||||
print(":: Creating square version")
|
||||
cmd = f"magick {wallpaper}[0] -gravity Center -extent 1:1 {square}"
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode != 0:
|
||||
print(f":: Error while processing image: {stderr.decode()}")
|
||||
else:
|
||||
print(":: Square image created!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
acquire_lock()
|
||||
try:
|
||||
asyncio.run(main())
|
||||
finally:
|
||||
release_lock()
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from signal import SIGINT, SIGTERM, signal
|
||||
from threading import Event
|
||||
import setproctitle
|
||||
|
||||
from pywayland.client.display import Display # type: ignore
|
||||
from pywayland.protocol.idle_inhibit_unstable_v1.zwp_idle_inhibit_manager_v1 import ( # type: ignore
|
||||
ZwpIdleInhibitManagerV1,
|
||||
)
|
||||
from pywayland.protocol.wayland.wl_compositor import WlCompositor # type: ignore
|
||||
from pywayland.protocol.wayland.wl_registry import WlRegistryProxy # type: ignore
|
||||
from pywayland.protocol.wayland.wl_surface import WlSurface # type: ignore
|
||||
|
||||
|
||||
@dataclass
|
||||
class GlobalRegistry:
|
||||
surface: WlSurface | None = None
|
||||
inhibit_manager: ZwpIdleInhibitManagerV1 | None = None
|
||||
|
||||
|
||||
def handle_registry_global(
|
||||
wl_registry: WlRegistryProxy, id_num: int, iface_name: str, version: int
|
||||
) -> None:
|
||||
global_registry: GlobalRegistry = wl_registry.user_data or GlobalRegistry()
|
||||
|
||||
if iface_name == "wl_compositor":
|
||||
compositor = wl_registry.bind(id_num, WlCompositor, version)
|
||||
global_registry.surface = compositor.create_surface() # type: ignore
|
||||
elif iface_name == "zwp_idle_inhibit_manager_v1":
|
||||
global_registry.inhibit_manager = wl_registry.bind(
|
||||
id_num, ZwpIdleInhibitManagerV1, version
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
done = Event()
|
||||
signal(SIGINT, lambda _, __: done.set())
|
||||
signal(SIGTERM, lambda _, __: done.set())
|
||||
|
||||
global_registry = GlobalRegistry()
|
||||
|
||||
display = Display()
|
||||
display.connect()
|
||||
|
||||
registry = display.get_registry() # type: ignore
|
||||
registry.user_data = global_registry
|
||||
registry.dispatcher["global"] = handle_registry_global
|
||||
|
||||
def shutdown() -> None:
|
||||
display.dispatch()
|
||||
display.roundtrip()
|
||||
display.disconnect()
|
||||
|
||||
display.dispatch()
|
||||
display.roundtrip()
|
||||
|
||||
if global_registry.surface is None or global_registry.inhibit_manager is None:
|
||||
print("Wayland seems not to support idle_inhibit_unstable_v1 protocol.")
|
||||
shutdown()
|
||||
sys.exit(1)
|
||||
|
||||
inhibitor = global_registry.inhibit_manager.create_inhibitor( # type: ignore
|
||||
global_registry.surface
|
||||
)
|
||||
|
||||
display.dispatch()
|
||||
display.roundtrip()
|
||||
|
||||
print("Inhibiting idle...")
|
||||
done.wait()
|
||||
print("Shutting down...")
|
||||
|
||||
inhibitor.destroy()
|
||||
|
||||
shutdown()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
setproctitle.setproctitle("wayland-idle-inhibitor.py")
|
||||
main()
|
||||
@@ -25,6 +25,7 @@ PACKAGES=(
|
||||
python-numpy
|
||||
python-pywayland
|
||||
python-pyxdg
|
||||
sddm-theme-corners-git
|
||||
swww
|
||||
swappy
|
||||
wl-clipboard
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import os
|
||||
|
||||
import setproctitle
|
||||
from fabric import Application
|
||||
from fabric.utils import get_relative_path, monitor_file
|
||||
from loguru import logger
|
||||
|
||||
from modules.bar.bar import Bar
|
||||
from modules.launcher.launcher import Launcher
|
||||
from modules.notification_popup import NotificationPopup
|
||||
from modules.osd import OSDContainer
|
||||
from modules.corners import Corners
|
||||
from services import sc
|
||||
|
||||
for log in [
|
||||
"fabric.hyprland.widgets",
|
||||
"fabric.audio.service",
|
||||
"fabric.bluetooth.service",
|
||||
]:
|
||||
logger.disable(log)
|
||||
|
||||
|
||||
def update_main_css():
|
||||
colors_css_path = f"/home/{os.getlogin()}/.cache/material/colors.css"
|
||||
main_css_path = get_relative_path("styles/main.css")
|
||||
|
||||
if os.path.exists(colors_css_path):
|
||||
with open(main_css_path, "r+") as css_file:
|
||||
content = css_file.read()
|
||||
updated_content = content.replace("@COLORS_CSS_PATH", colors_css_path)
|
||||
css_file.seek(0)
|
||||
css_file.write(updated_content)
|
||||
css_file.truncate()
|
||||
else:
|
||||
logger.warning(f"[Main] colors.css not found at {colors_css_path}")
|
||||
|
||||
|
||||
def apply_style(app: Application):
|
||||
logger.info("[Main] Applying CSS")
|
||||
app.set_stylesheet_from_file(get_relative_path("styles/main.css"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
update_main_css()
|
||||
sc = sc
|
||||
bar = Bar()
|
||||
corners = Corners()
|
||||
osd = OSDContainer()
|
||||
notif = NotificationPopup()
|
||||
launcher = Launcher()
|
||||
|
||||
app = Application(
|
||||
"modus",
|
||||
bar,
|
||||
launcher,
|
||||
osd,
|
||||
)
|
||||
setproctitle.setproctitle("modus")
|
||||
|
||||
# Monitor CSS files for changes
|
||||
css_file = monitor_file(get_relative_path("styles"))
|
||||
_ = css_file.connect("changed", lambda *_: apply_style(app))
|
||||
|
||||
color_css_file = monitor_file(f"/home/{os.getlogin()}/.cache/material/colors.css")
|
||||
_ = color_css_file.connect("changed", lambda *_: apply_style(app))
|
||||
|
||||
# Apply the styles and run the application
|
||||
apply_style(app)
|
||||
app.run()
|
||||
@@ -0,0 +1,138 @@
|
||||
from fabric.hyprland.widgets import Language
|
||||
from fabric.system_tray.widgets import SystemTray
|
||||
from fabric.utils import FormattedString, bulk_replace
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.centerbox import CenterBox
|
||||
from fabric.widgets.datetime import DateTime
|
||||
from fabric.widgets.label import Label
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
from gi.repository import GLib
|
||||
from modules.bar.components import (
|
||||
BatteryLabel,
|
||||
BluetoothIndicator,
|
||||
IdleIndicator,
|
||||
MicrophoneIndicator,
|
||||
NetworkIndicator,
|
||||
PowerProfileIndicator,
|
||||
SystemInfo,
|
||||
TaskBar,
|
||||
VolumeIndicator,
|
||||
workspace,
|
||||
)
|
||||
from snippets import MaterialIcon
|
||||
from services import sc
|
||||
|
||||
|
||||
class Bar(Window):
|
||||
def __init__(self):
|
||||
self.workspaces = Button(child=workspace, name="workspaces")
|
||||
self.language = Language(
|
||||
formatter=FormattedString(
|
||||
"{replace_lang(language)}",
|
||||
replace_lang=lambda lang: bulk_replace(
|
||||
lang,
|
||||
(r".*Eng.*", r".*Nep.*"),
|
||||
("en", "np"),
|
||||
regex=True,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
self.recording_indicator = Button(
|
||||
name="recording-indicator",
|
||||
child=MaterialIcon("screen_record", 14),
|
||||
visible=False,
|
||||
on_clicked=lambda *_: sc.screencast_stop(),
|
||||
)
|
||||
|
||||
sc.connect(
|
||||
"recording", lambda _, status: self.on_recording_status_change(status)
|
||||
)
|
||||
|
||||
self.date_time = DateTime(formatters=["%-I:%M %a %d %b"], name="datetime")
|
||||
|
||||
self.battery = BatteryLabel(name="battery")
|
||||
self.volume = VolumeIndicator()
|
||||
self.bluetooth = BluetoothIndicator()
|
||||
self.network = NetworkIndicator()
|
||||
self.microphone = MicrophoneIndicator()
|
||||
self.idle = IdleIndicator()
|
||||
self.taskbar = TaskBar()
|
||||
self.info = SystemInfo()
|
||||
self.powerindicator = PowerProfileIndicator()
|
||||
self.tray = SystemTray(name="tray", icon_size=16, spacing=4)
|
||||
self.launcher = Button(
|
||||
name="logo",
|
||||
child=Label(name="logo-name", label=" "),
|
||||
on_clicked=lambda *_: GLib.spawn_command_line_async(
|
||||
"fabric-cli exec modus 'launcher.open(\"launcher\")'"
|
||||
),
|
||||
)
|
||||
|
||||
self.applets = Box(
|
||||
name="applets",
|
||||
spacing=4,
|
||||
orientation="h",
|
||||
children=[
|
||||
self.language,
|
||||
self.battery,
|
||||
self.powerindicator,
|
||||
self.bluetooth,
|
||||
self.network,
|
||||
self.volume,
|
||||
self.microphone,
|
||||
self.idle,
|
||||
],
|
||||
)
|
||||
|
||||
self.bar = CenterBox(
|
||||
name="bar",
|
||||
start_children=Box(
|
||||
name="start-container",
|
||||
spacing=8,
|
||||
orientation="h",
|
||||
children=[
|
||||
self.launcher,
|
||||
self.workspaces,
|
||||
self.info,
|
||||
],
|
||||
),
|
||||
center_children=Box(
|
||||
name="center-container",
|
||||
spacing=8,
|
||||
orientation="h",
|
||||
children=self.taskbar,
|
||||
),
|
||||
end_children=Box(
|
||||
name="end-container",
|
||||
spacing=8,
|
||||
orientation="h",
|
||||
children=[
|
||||
self.recording_indicator,
|
||||
self.tray,
|
||||
self.applets,
|
||||
self.date_time,
|
||||
],
|
||||
),
|
||||
)
|
||||
super().__init__(
|
||||
layer="top",
|
||||
anchor="left bottom right",
|
||||
exclusivity="auto",
|
||||
visible=True,
|
||||
child=self.bar,
|
||||
)
|
||||
|
||||
self.hidden = False
|
||||
|
||||
def on_recording_status_change(self, status):
|
||||
print(f"Recording status changed: {status}")
|
||||
self.recording_indicator.set_visible(status)
|
||||
|
||||
def toggle_hidden(self):
|
||||
self.hidden = not self.hidden
|
||||
if self.hidden:
|
||||
self.bar.add_style_class("hidden")
|
||||
else:
|
||||
self.bar.remove_style_class("hidden")
|
||||
@@ -0,0 +1,10 @@
|
||||
from .battery import *
|
||||
from .bluetooth import *
|
||||
from .idle import *
|
||||
from .stats import *
|
||||
from .microphone import *
|
||||
from .network import *
|
||||
from .powerprofile import *
|
||||
from .taskbar import *
|
||||
from .volume import *
|
||||
from .workspace import *
|
||||
@@ -0,0 +1,68 @@
|
||||
import psutil
|
||||
from fabric import Fabricator
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.overlay import Overlay
|
||||
from fabric.widgets.circularprogressbar import CircularProgressBar
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class BatteryLabel(Box):
|
||||
ICONS_CHARGING = [
|
||||
"battery_charging_20",
|
||||
"battery_charging_20",
|
||||
"battery_charging_20",
|
||||
"battery_charging_30",
|
||||
"battery_charging_30",
|
||||
"battery_charging_50",
|
||||
"battery_charging_60",
|
||||
"battery_charging_80",
|
||||
"battery_charging_80",
|
||||
"battery_charging_90",
|
||||
"battery_charging_full",
|
||||
]
|
||||
ICONS_NOT_CHARGING = [
|
||||
"battery_alert",
|
||||
"battery_1_bar",
|
||||
"battery_1_bar",
|
||||
"battery_2_bar",
|
||||
"battery_2_bar",
|
||||
"battery_3_bar",
|
||||
"battery_4_bar",
|
||||
"battery_4_bar",
|
||||
"battery_5_bar",
|
||||
"battery_6_bar",
|
||||
"battery_full",
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
Fabricator(interval=1000, poll_from=self.update_battery_status)
|
||||
|
||||
def update_battery_status(self, *_):
|
||||
battery = psutil.sensors_battery()
|
||||
if battery is None:
|
||||
self.hide()
|
||||
return
|
||||
is_charging = battery.power_plugged if battery else False
|
||||
icons = self.ICONS_CHARGING if is_charging else self.ICONS_NOT_CHARGING
|
||||
battery_percent = round(battery.percent)
|
||||
index = min(max(battery_percent // 10, 0), 10)
|
||||
battery_icon = MaterialIcon(icons[index], size=16)
|
||||
|
||||
self.progress_bar = CircularProgressBar(
|
||||
name="progress", line_style="round", line_width=1, size=24
|
||||
)
|
||||
|
||||
self.battery_overlay = Overlay(child=self.progress_bar, overlays=battery_icon)
|
||||
|
||||
self.children = self.battery_overlay
|
||||
|
||||
battery_percent = round(battery.percent)
|
||||
self.progress_bar.value = battery_percent / 100
|
||||
# self.show() if battery_percent < 100 else self.hide()
|
||||
|
||||
self.set_tooltip_text(
|
||||
f"Battery: {battery_percent}%\nStatus: {'Charging' if is_charging else 'Discharging'}"
|
||||
)
|
||||
|
||||
return True
|
||||
@@ -0,0 +1,34 @@
|
||||
from fabric.bluetooth import BluetoothClient
|
||||
from fabric.widgets.box import Box
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class BluetoothIndicator(Box):
|
||||
ICON_ENABLED = "bluetooth"
|
||||
ICON_DISABLED = "bluetooth_disabled"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.bluetooth_client = BluetoothClient()
|
||||
|
||||
self.bluetooth_icon = None
|
||||
|
||||
self.bluetooth_client.connect("changed", self.update_bluetooth_status)
|
||||
|
||||
self.update_bluetooth_status()
|
||||
|
||||
def update_bluetooth_status(self, *_):
|
||||
icon_label = (
|
||||
self.ICON_ENABLED if self.bluetooth_client.enabled else self.ICON_DISABLED
|
||||
)
|
||||
|
||||
new_icon = MaterialIcon(icon_label, size=16)
|
||||
|
||||
if self.bluetooth_icon:
|
||||
self.remove(self.bluetooth_icon)
|
||||
|
||||
self.bluetooth_icon = new_icon
|
||||
self.add(self.bluetooth_icon)
|
||||
|
||||
def on_destroy(self):
|
||||
self.bluetooth_client.disconnect("changed", self.update_bluetooth_status)
|
||||
@@ -0,0 +1,27 @@
|
||||
from fabric import Fabricator
|
||||
from fabric.utils import exec_shell_command
|
||||
from fabric.widgets.box import Box
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class IdleIndicator(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.idle_icon = self.create_idle_icon()
|
||||
self.fabricator = Fabricator(interval=1000, poll_from=self.check_idle_status)
|
||||
|
||||
self.children = [self.idle_icon]
|
||||
|
||||
def create_idle_icon(self):
|
||||
return MaterialIcon("coffee", 16)
|
||||
|
||||
def check_idle_status(self, *_):
|
||||
output = exec_shell_command("pidof wayland-idle-inhibitor.py")
|
||||
is_idle = bool(str(output).strip())
|
||||
self.update_idle_status(is_idle)
|
||||
|
||||
def update_idle_status(self, is_idle):
|
||||
if is_idle:
|
||||
self.idle_icon.set_visible(True)
|
||||
else:
|
||||
self.idle_icon.set_visible(False)
|
||||
@@ -0,0 +1,33 @@
|
||||
from fabric.audio.service import Audio
|
||||
from fabric.widgets.box import Box
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class MicrophoneIndicator(Box):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.audio_service = Audio()
|
||||
self.microphone_icon = self.create_microphone_icon()
|
||||
|
||||
self.audio_service.connect("microphone_changed", self.update_microphone_status)
|
||||
self.update_microphone_status()
|
||||
|
||||
self.children = (self.microphone_icon,)
|
||||
|
||||
def create_microphone_icon(self):
|
||||
return MaterialIcon("mic_off", size=16)
|
||||
|
||||
def update_microphone_status(self, *args):
|
||||
current_microphone = self.audio_service.microphone
|
||||
|
||||
if current_microphone:
|
||||
is_muted = current_microphone.muted
|
||||
icon_name = "mic_off" if is_muted else "mic"
|
||||
|
||||
self.microphone_icon.set_label(icon_name)
|
||||
self.microphone_icon.set_visible(is_muted)
|
||||
else:
|
||||
self.microphone_icon.set_visible(False)
|
||||
|
||||
return True
|
||||
@@ -0,0 +1,84 @@
|
||||
import subprocess
|
||||
|
||||
import psutil
|
||||
from fabric import Fabricator
|
||||
from fabric.widgets.box import Box
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class NetworkIndicator(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.update_interval = 5000 # Increased interval to 5 seconds
|
||||
self.last_status = None
|
||||
self.wifi_strength_cache = None
|
||||
self.fabricator = Fabricator(
|
||||
interval=self.update_interval,
|
||||
poll_from=self.update_network_status,
|
||||
)
|
||||
|
||||
def update_network_status(self, *_):
|
||||
current_status = self.get_network_status()
|
||||
if current_status != self.last_status:
|
||||
self.update_icon(current_status)
|
||||
self.last_status = current_status
|
||||
return True
|
||||
|
||||
def update_icon(self, current_status):
|
||||
self.icon_label = MaterialIcon(current_status, size=16)
|
||||
self.children = (self.icon_label,)
|
||||
|
||||
def get_network_status(self):
|
||||
if self.is_ethernet_connected():
|
||||
return "lan"
|
||||
if self.is_wifi_connected():
|
||||
return self.get_wifi_strength_icon()
|
||||
return "signal_wifi_off"
|
||||
|
||||
def get_wifi_strength_icon(self):
|
||||
wifi_strength = self.check_wifi_strength()
|
||||
if wifi_strength is not None:
|
||||
self.wifi_strength_cache = wifi_strength # Cache the result
|
||||
else:
|
||||
wifi_strength = self.wifi_strength_cache # Use cached value if available
|
||||
|
||||
return self.wifi_signal_icon(wifi_strength)
|
||||
|
||||
def wifi_signal_icon(self, strength):
|
||||
if strength is None or strength <= -100:
|
||||
return "signal_wifi_0_bar"
|
||||
if strength > -50:
|
||||
return "signal_wifi_4_bar"
|
||||
if strength > -60:
|
||||
return "network_wifi_3_bar"
|
||||
if strength > -70:
|
||||
return "network_wifi_2_bar"
|
||||
return "network_wifi_1_bar"
|
||||
|
||||
def check_wifi_strength(self):
|
||||
try:
|
||||
result = subprocess.run(["iwconfig"], capture_output=True, text=True)
|
||||
for line in result.stdout.splitlines():
|
||||
if "Signal level" in line:
|
||||
signal_level = line.split("Signal level=")[1].split(" ")[0]
|
||||
return int(signal_level.strip().replace("dBm", ""))
|
||||
return None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def is_wifi_connected(self):
|
||||
return any(
|
||||
self._is_interface_up(interface, ["wlan", "wifi"])
|
||||
for interface in psutil.net_if_addrs()
|
||||
)
|
||||
|
||||
def is_ethernet_connected(self):
|
||||
return any(
|
||||
self._is_interface_up(interface, ["enp", "eth"])
|
||||
for interface in psutil.net_if_addrs()
|
||||
)
|
||||
|
||||
def _is_interface_up(self, interface, keywords):
|
||||
if any(substring in interface.lower() for substring in keywords):
|
||||
return psutil.net_if_stats().get(interface, {}).isup
|
||||
return False
|
||||
@@ -0,0 +1,44 @@
|
||||
from fabric import Fabricator
|
||||
from fabric.utils import exec_shell_command
|
||||
from fabric.widgets.box import Box
|
||||
from snippets import MaterialIcon
|
||||
|
||||
PROFILE_ICONS = {
|
||||
"power-saver": "data_saver_on",
|
||||
"balanced": None,
|
||||
"performance": "mode_heat",
|
||||
}
|
||||
|
||||
|
||||
class PowerProfileIndicator(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.profile_icon = None
|
||||
|
||||
self.fabricator = Fabricator(interval=1000, poll_from=self.update_power_profile)
|
||||
|
||||
def update_power_profile(self, *_):
|
||||
profile = self.get_power_profile()
|
||||
self.update_icon(profile)
|
||||
return True
|
||||
|
||||
def get_power_profile(self):
|
||||
result = exec_shell_command("powerprofilesctl get")
|
||||
return result.strip() or "power-saver"
|
||||
|
||||
def update_icon(self, profile):
|
||||
icon_name = PROFILE_ICONS.get(profile)
|
||||
|
||||
new_icon = MaterialIcon(icon_name, 16) if icon_name else None
|
||||
|
||||
if self.profile_icon:
|
||||
self.remove(self.profile_icon)
|
||||
|
||||
if new_icon:
|
||||
self.profile_icon = new_icon
|
||||
self.add(self.profile_icon)
|
||||
else:
|
||||
if self.profile_icon:
|
||||
self.profile_icon.hide()
|
||||
self.profile_icon = None
|
||||
@@ -0,0 +1,94 @@
|
||||
from time import sleep
|
||||
import psutil
|
||||
from fabric import Fabricator
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.circularprogressbar import CircularProgressBar
|
||||
from fabric.widgets.label import Label
|
||||
from fabric.widgets.overlay import Overlay
|
||||
from snippets import MaterialIcon
|
||||
|
||||
|
||||
class SystemInfo(Button):
|
||||
ICONS = [
|
||||
("CPU", "settings_motion_mode"),
|
||||
("Swap", "swap_horiz"),
|
||||
("RAM", "memory_alt"),
|
||||
("Temp", "thermometer"),
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(child=self._initialize_content())
|
||||
|
||||
Fabricator(
|
||||
poll_from=self._refresh_system_info,
|
||||
stream=True,
|
||||
on_changed=lambda fab, data: self._update_ui(data),
|
||||
)
|
||||
|
||||
def _initialize_content(self):
|
||||
self.box = Box(orientation="h", name="tray")
|
||||
self.progress_bars = {}
|
||||
self.labels = {}
|
||||
self.icons = {}
|
||||
|
||||
for system, icon_name in self.ICONS:
|
||||
self._create_system_item(system, icon_name)
|
||||
|
||||
return self.box
|
||||
|
||||
def _create_system_item(self, system, icon_name):
|
||||
self.progress_bars[system] = self._create_progress_bar()
|
||||
self.labels[system] = self._create_label()
|
||||
self.icons[system] = self._create_icon(icon_name)
|
||||
|
||||
overlay = Overlay(
|
||||
child=self.progress_bars[system], overlays=[self.icons[system]]
|
||||
)
|
||||
self.box.pack_start(overlay, False, False, 0)
|
||||
self.box.pack_start(self.labels[system], False, False, 0)
|
||||
|
||||
def _create_progress_bar(self):
|
||||
return CircularProgressBar(
|
||||
name="progress", line_style="round", line_width=1, size=24
|
||||
)
|
||||
|
||||
def _create_label(self):
|
||||
return Label(style="font-size:14px; margin: 4px;")
|
||||
|
||||
def _create_icon(self, icon_name):
|
||||
return MaterialIcon(icon_name, size=16)
|
||||
|
||||
def _refresh_system_info(self, fab: Fabricator):
|
||||
while True:
|
||||
yield {
|
||||
"CPU": round(psutil.cpu_percent()),
|
||||
"RAM": round(psutil.virtual_memory().percent),
|
||||
"Swap": round(psutil.swap_memory().percent),
|
||||
"Temp": self._get_device_temperature(),
|
||||
}
|
||||
sleep(1)
|
||||
|
||||
@staticmethod
|
||||
def _get_device_temperature():
|
||||
try:
|
||||
temps = psutil.sensors_temperatures()
|
||||
if "coretemp" in temps:
|
||||
return round(temps["coretemp"][0].current, 1)
|
||||
elif "cpu_thermal" in temps:
|
||||
return round(temps["cpu_thermal"][0].current, 1)
|
||||
return None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def _update_ui(self, usages):
|
||||
for system, usage in usages.items():
|
||||
if usage is None:
|
||||
usage = 0
|
||||
self.labels[system].set_label("N/A")
|
||||
else:
|
||||
usage = int(usage)
|
||||
|
||||
self.progress_bars[system].value = usage / 100
|
||||
self.labels[system].set_label(f"{usage}")
|
||||
self.progress_bars[system].set_tooltip_text(f"{system} Usage: {usage}%")
|
||||
@@ -0,0 +1,154 @@
|
||||
import json
|
||||
import os
|
||||
from typing import TypedDict
|
||||
|
||||
from fabric.hyprland.widgets import get_hyprland_connection
|
||||
from fabric.utils import exec_shell_command_async
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.image import Image
|
||||
from gi.repository import GdkPixbuf, GLib, Gtk
|
||||
from loguru import logger
|
||||
|
||||
|
||||
class PagerClient(TypedDict):
|
||||
title: str
|
||||
initialClass: str
|
||||
mapped: bool
|
||||
hidden: bool
|
||||
address: str
|
||||
|
||||
|
||||
class TaskBar(Box):
|
||||
def __init__(self, icon_size: int = 20, **kwargs):
|
||||
super().__init__(
|
||||
orientation="h",
|
||||
spacing=7,
|
||||
name="taskbar",
|
||||
**kwargs,
|
||||
)
|
||||
self.connection = get_hyprland_connection()
|
||||
self.icon_size = icon_size
|
||||
self.icon_theme = Gtk.IconTheme.get_default()
|
||||
|
||||
self.set_visible(False)
|
||||
|
||||
if self.connection.ready:
|
||||
self.render_with_delay()
|
||||
else:
|
||||
self.connection.connect("event::ready", lambda *_: self.render_with_delay())
|
||||
|
||||
for event in (
|
||||
"activewindow",
|
||||
"openwindow",
|
||||
"closewindow",
|
||||
"changefloatingmode",
|
||||
):
|
||||
self.connection.connect("event::" + event, lambda *_: self.render(None))
|
||||
|
||||
def render_with_delay(self, *_):
|
||||
GLib.timeout_add(101, self.render)
|
||||
|
||||
def render(self, *_):
|
||||
self.children = []
|
||||
|
||||
clients = self.fetch_clients()
|
||||
active_window_address = self.get_active_window_address()
|
||||
|
||||
visible_clients = [
|
||||
client for client in clients if client["mapped"] and not client["hidden"]
|
||||
]
|
||||
|
||||
if visible_clients:
|
||||
for client in visible_clients:
|
||||
window_class = client["initialClass"].lower()
|
||||
icon = self.bake_window_icon(window_class)
|
||||
|
||||
button = Button(image=icon, tooltip_text=client["title"])
|
||||
if client["address"] == active_window_address:
|
||||
button.add_style_class("activated")
|
||||
button.connect(
|
||||
"button-press-event",
|
||||
self.on_icon_click,
|
||||
client["address"],
|
||||
)
|
||||
|
||||
self.add(button)
|
||||
self.set_visible(True)
|
||||
self.show_all()
|
||||
else:
|
||||
self.set_visible(False)
|
||||
|
||||
self.set_visible(len(self.children) > 0)
|
||||
if self.children:
|
||||
self.show_all()
|
||||
|
||||
def get_active_window_address(self) -> str:
|
||||
active_window_info = json.loads(
|
||||
self.connection.send_command("j/activewindow").reply.decode()
|
||||
)
|
||||
return active_window_info.get("address", "")
|
||||
|
||||
def on_icon_click(self, widget, event, address):
|
||||
exec_shell_command_async(
|
||||
f"hyprctl dispatch focuswindow address:{address}", lambda *_: None
|
||||
)
|
||||
|
||||
def fetch_clients(self) -> list[PagerClient]:
|
||||
return json.loads(self.connection.send_command("j/clients").reply.decode())
|
||||
|
||||
def bake_window_icon(
|
||||
self,
|
||||
window_class: str,
|
||||
fallback_icon: str = "image-missing",
|
||||
) -> Image:
|
||||
icon_name = self.get_icon_from_desktop_entry(window_class)
|
||||
|
||||
if icon_name:
|
||||
pixbuf = self.load_icon(icon_name)
|
||||
else:
|
||||
pixbuf = self.load_icon(window_class, fallback_icon)
|
||||
|
||||
return Image(pixbuf=pixbuf, size=self.icon_size)
|
||||
|
||||
def get_icon_from_desktop_entry(self, window_class: str) -> str:
|
||||
for data_dir in GLib.get_system_data_dirs():
|
||||
applications_dir = os.path.join(data_dir, "applications")
|
||||
|
||||
if os.path.isdir(applications_dir):
|
||||
for desktop_file in os.listdir(applications_dir):
|
||||
if desktop_file.endswith(".desktop"):
|
||||
file_path = os.path.join(applications_dir, desktop_file)
|
||||
try:
|
||||
with open(file_path) as f:
|
||||
app_name = None
|
||||
icon_name = None
|
||||
for line in f:
|
||||
if line.startswith("Name="):
|
||||
app_name = line.split("=", 2)[1].strip().lower()
|
||||
elif line.startswith("Icon=") and app_name:
|
||||
icon_name = line.split("=", 2)[1].strip()
|
||||
if window_class in app_name:
|
||||
return icon_name
|
||||
except Exception as e:
|
||||
logger.error(f"Error reading {file_path}: {e}")
|
||||
return None
|
||||
|
||||
def load_icon(
|
||||
self,
|
||||
icon_name: str,
|
||||
fallback_icon: str = "image-missing",
|
||||
) -> GdkPixbuf.Pixbuf:
|
||||
try:
|
||||
pixbuf = self.icon_theme.load_icon(
|
||||
icon_name,
|
||||
self.icon_size,
|
||||
Gtk.IconLookupFlags.FORCE_SIZE,
|
||||
)
|
||||
except Exception:
|
||||
pixbuf = self.icon_theme.load_icon(
|
||||
fallback_icon,
|
||||
self.icon_size,
|
||||
Gtk.IconLookupFlags.FORCE_SIZE,
|
||||
)
|
||||
return pixbuf
|
||||
@@ -0,0 +1,81 @@
|
||||
from fabric import Fabricator
|
||||
from fabric.utils import exec_shell_command
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from snippets import MaterialIcon
|
||||
from services import audio
|
||||
|
||||
VOLUME_ICONS = {
|
||||
"muted": "volume_off",
|
||||
"low": "volume_mute",
|
||||
"medium-low": "volume_down",
|
||||
"medium-high": "volume_up",
|
||||
"high": "volume_up",
|
||||
}
|
||||
|
||||
|
||||
class VolumeIndicator(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.audio_service = audio
|
||||
self.volume_icon_button = self.create_volume_icon()
|
||||
|
||||
self.volume_icon_button.connect("button-press-event", self.on_button_press)
|
||||
self.audio_service.connect("changed", self.update_volume_status)
|
||||
|
||||
Fabricator(interval=1000, poll_from=self.update_volume_status)
|
||||
self.children = (self.volume_icon_button,)
|
||||
|
||||
def create_volume_icon(self):
|
||||
icon = MaterialIcon(VOLUME_ICONS["muted"], size=16)
|
||||
button = Button(child=icon)
|
||||
button.icon_widget = icon
|
||||
return button
|
||||
|
||||
def on_button_press(self, widget, event):
|
||||
if event.button == 1:
|
||||
self.toggle_mute()
|
||||
elif event.button == 3:
|
||||
self.open_audio_settings()
|
||||
|
||||
def toggle_mute(self):
|
||||
current_stream = self.audio_service.speaker
|
||||
if current_stream:
|
||||
current_stream.muted = not current_stream.muted
|
||||
# self.update_volume_status()
|
||||
|
||||
def open_audio_settings(self):
|
||||
exec_shell_command("pavucontrol")
|
||||
|
||||
def update_volume_status(self, *_):
|
||||
current_stream = self.audio_service.speaker
|
||||
if current_stream:
|
||||
self.update_icon(current_stream)
|
||||
|
||||
return True
|
||||
|
||||
def update_icon(self, stream):
|
||||
if stream.muted:
|
||||
icon_name = VOLUME_ICONS["muted"]
|
||||
volume_percentage = 0
|
||||
tooltip_text = "Volume Muted"
|
||||
else:
|
||||
volume_level = stream.volume
|
||||
icon_name = self.get_volume_icon(volume_level)
|
||||
volume_percentage = int(volume_level)
|
||||
tooltip_text = f"Volume: {volume_percentage}%"
|
||||
|
||||
self.volume_icon_button.icon_widget.set_label(icon_name)
|
||||
|
||||
self.volume_icon_button.set_tooltip_text(tooltip_text)
|
||||
|
||||
def get_volume_icon(self, volume_level):
|
||||
if volume_level == 0:
|
||||
return VOLUME_ICONS["low"]
|
||||
elif volume_level <= 33:
|
||||
return VOLUME_ICONS["medium-low"]
|
||||
elif volume_level <= 66:
|
||||
return VOLUME_ICONS["medium-high"]
|
||||
else:
|
||||
return VOLUME_ICONS["high"]
|
||||
@@ -0,0 +1,19 @@
|
||||
import json
|
||||
|
||||
from fabric.hyprland.service import Hyprland
|
||||
from fabric.widgets.label import Label
|
||||
|
||||
connection = Hyprland()
|
||||
|
||||
workspaceData = connection.send_command("j/activeworkspace").reply
|
||||
activeWorkspace = json.loads(workspaceData.decode("utf-8"))["name"]
|
||||
workspace = Label(label=f"Workspace {activeWorkspace}")
|
||||
|
||||
|
||||
def on_workspace(obj, signal):
|
||||
global activeWorkspace
|
||||
activeWorkspace = json.loads(signal.data[0])
|
||||
workspace.set_label(f"Workspace {activeWorkspace}")
|
||||
|
||||
|
||||
connection.connect("event::workspace", on_workspace)
|
||||
@@ -0,0 +1,64 @@
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
from fabric.widgets.shapes import Corner
|
||||
|
||||
|
||||
class MyCorner(Box):
|
||||
def __init__(self, corner):
|
||||
super().__init__(
|
||||
name="corner-container",
|
||||
children=Corner(
|
||||
name="corner",
|
||||
orientation=corner,
|
||||
size=20,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class Corners(Window):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
name="corners",
|
||||
layer="top",
|
||||
anchor="top bottom left right",
|
||||
exclusivity="normal",
|
||||
pass_through=True,
|
||||
visible=False,
|
||||
all_visible=False,
|
||||
)
|
||||
|
||||
self.all_corners = Box(
|
||||
name="all-corners",
|
||||
orientation="v",
|
||||
h_expand=True,
|
||||
v_expand=True,
|
||||
h_align="fill",
|
||||
v_align="fill",
|
||||
children=[
|
||||
Box(
|
||||
name="top-corners",
|
||||
orientation="h",
|
||||
h_align="fill",
|
||||
children=[
|
||||
MyCorner("top-left"),
|
||||
Box(h_expand=True),
|
||||
MyCorner("top-right"),
|
||||
],
|
||||
),
|
||||
Box(v_expand=True),
|
||||
Box(
|
||||
name="bottom-corners",
|
||||
orientation="h",
|
||||
h_align="fill",
|
||||
children=[
|
||||
MyCorner("bottom-left"),
|
||||
Box(h_expand=True),
|
||||
MyCorner("bottom-right"),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
self.add(self.all_corners)
|
||||
|
||||
self.show_all()
|
||||
@@ -0,0 +1,9 @@
|
||||
from .applauncher import *
|
||||
from .bluetooth import *
|
||||
from .cliphist import *
|
||||
from .dashboard import *
|
||||
from .emoji import *
|
||||
from .power import *
|
||||
from .sh import *
|
||||
from .todo import *
|
||||
from .wallpapers import *
|
||||
@@ -0,0 +1,240 @@
|
||||
from collections.abc import Iterator
|
||||
import operator
|
||||
from fabric.utils import DesktopApp, get_desktop_applications, idle_add, remove_handler
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.entry import Entry
|
||||
from fabric.widgets.label import Label
|
||||
from fabric.widgets.scrolledwindow import ScrolledWindow
|
||||
from gi.repository import GLib, Gdk
|
||||
from snippets import read_config
|
||||
from fabric.widgets.image import Image
|
||||
|
||||
|
||||
class AppLauncher(Box):
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(
|
||||
name="app-launcher",
|
||||
visible=False,
|
||||
all_visible=False,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
self.launcher = kwargs["launcher"]
|
||||
self.selected_index = -1
|
||||
|
||||
self._arranger_handler: int = 0
|
||||
self._all_apps = get_desktop_applications()
|
||||
self.config = read_config()
|
||||
|
||||
self.viewport = Box(name="viewport", spacing=4, orientation="v")
|
||||
self.search_entry = Entry(
|
||||
name="search-entry",
|
||||
h_expand=True,
|
||||
notify_text=lambda entry, *_: self.arrange_viewport(entry.get_text()),
|
||||
on_activate=lambda entry, *_: self.on_search_entry_activate(
|
||||
entry.get_text()
|
||||
),
|
||||
on_key_press_event=self.on_search_entry_key_press, # Handle key presses
|
||||
)
|
||||
self.scrolled_window = ScrolledWindow(
|
||||
name="scrolled-window",
|
||||
spacing=10,
|
||||
h_scrollbar_policy="never",
|
||||
v_scrollbar_policy="never",
|
||||
child=self.viewport,
|
||||
)
|
||||
|
||||
self.header_box = Box(
|
||||
name="header_box",
|
||||
orientation="h",
|
||||
children=[self.search_entry],
|
||||
)
|
||||
|
||||
self.launcher_box = Box(
|
||||
name="launcher-box",
|
||||
h_expand=True,
|
||||
orientation="v",
|
||||
children=[
|
||||
self.header_box,
|
||||
self.scrolled_window,
|
||||
],
|
||||
)
|
||||
|
||||
self.resize_viewport()
|
||||
|
||||
self.add(self.launcher_box)
|
||||
self.show_all()
|
||||
|
||||
def close_launcher(self, *_):
|
||||
self.viewport.children = []
|
||||
self.selected_index = -1 # Reset selection
|
||||
self.launcher.close()
|
||||
|
||||
def open_launcher(self):
|
||||
self._all_apps = get_desktop_applications()
|
||||
self.arrange_viewport()
|
||||
self.show_all()
|
||||
|
||||
def arrange_viewport(self, query: str = ""):
|
||||
remove_handler(self._arranger_handler) if self._arranger_handler else None
|
||||
self.viewport.children = []
|
||||
self.selected_index = -1
|
||||
|
||||
if not query.strip():
|
||||
return False
|
||||
|
||||
filtered_apps = iter(
|
||||
sorted(
|
||||
[
|
||||
app
|
||||
for app in self._all_apps
|
||||
if query.casefold()
|
||||
in (
|
||||
(app.display_name or "")
|
||||
+ (" " + app.name + " ")
|
||||
+ (app.generic_name or "")
|
||||
).casefold()
|
||||
][:6],
|
||||
key=lambda app: (app.display_name or "").casefold(),
|
||||
)
|
||||
)
|
||||
should_resize = operator.length_hint(filtered_apps) == len(self._all_apps)
|
||||
|
||||
self._arranger_handler = idle_add(
|
||||
lambda apps_iter: self.add_next_application(apps_iter)
|
||||
or self.handle_arrange_complete(should_resize, query),
|
||||
filtered_apps,
|
||||
pin=True,
|
||||
)
|
||||
|
||||
def handle_arrange_complete(self, should_resize, query):
|
||||
if should_resize:
|
||||
self.resize_viewport()
|
||||
# Only auto-select first item if query exists
|
||||
if query.strip() != "" and self.viewport.get_children():
|
||||
self.update_selection(0)
|
||||
return False
|
||||
|
||||
def add_next_application(self, apps_iter: Iterator[DesktopApp]):
|
||||
if not (app := next(apps_iter, None)):
|
||||
return False
|
||||
|
||||
self.viewport.add(self.bake_application_slot(app))
|
||||
return True
|
||||
|
||||
def resize_viewport(self):
|
||||
self.scrolled_window.set_min_content_width(
|
||||
self.viewport.get_allocation().width # type: ignore
|
||||
)
|
||||
return False
|
||||
|
||||
def bake_application_slot(self, app: DesktopApp, **kwargs) -> Button:
|
||||
button = Button(
|
||||
name="launcher-app",
|
||||
child=Box(
|
||||
orientation="h",
|
||||
children=[
|
||||
Image(
|
||||
pixbuf=app.get_icon_pixbuf(size=32),
|
||||
h_align="start",
|
||||
name="launcher-app-icon",
|
||||
),
|
||||
Label(
|
||||
label=app.display_name or "Unknown",
|
||||
ellipsization="end",
|
||||
v_align="center",
|
||||
h_align="center",
|
||||
),
|
||||
],
|
||||
),
|
||||
tooltip_text=app.description,
|
||||
on_clicked=lambda *_: (app.launch(), self.close_launcher()),
|
||||
**kwargs,
|
||||
)
|
||||
return button
|
||||
|
||||
def update_selection(self, new_index: int):
|
||||
# Unselect current
|
||||
if self.selected_index != -1 and self.selected_index < len(
|
||||
self.viewport.get_children()
|
||||
):
|
||||
current_button = self.viewport.get_children()[self.selected_index]
|
||||
current_button.get_style_context().remove_class("selected")
|
||||
# Select new
|
||||
if new_index != -1 and new_index < len(self.viewport.get_children()):
|
||||
new_button = self.viewport.get_children()[new_index]
|
||||
new_button.get_style_context().add_class("selected")
|
||||
self.selected_index = new_index
|
||||
self.scroll_to_selected(new_button)
|
||||
else:
|
||||
self.selected_index = -1
|
||||
|
||||
def scroll_to_selected(self, button):
|
||||
def scroll():
|
||||
adj = self.scrolled_window.get_vadjustment()
|
||||
alloc = button.get_allocation()
|
||||
if alloc.height == 0:
|
||||
return False # Retry if allocation isn't ready
|
||||
|
||||
y = alloc.y
|
||||
height = alloc.height
|
||||
page_size = adj.get_page_size()
|
||||
current_value = adj.get_value()
|
||||
|
||||
# Calculate visible boundaries
|
||||
visible_top = current_value
|
||||
visible_bottom = current_value + page_size
|
||||
|
||||
if y < visible_top:
|
||||
# Item above viewport - align to top
|
||||
adj.set_value(y)
|
||||
elif y + height > visible_bottom:
|
||||
# Item below viewport - align to bottom
|
||||
new_value = y + height - page_size
|
||||
adj.set_value(new_value)
|
||||
# No action if already fully visible
|
||||
return False
|
||||
|
||||
GLib.idle_add(scroll)
|
||||
|
||||
def on_search_entry_activate(self, text):
|
||||
commands = self.config.get("commands", {})
|
||||
|
||||
if text in commands:
|
||||
command = commands[text]
|
||||
eval(command, {"launcher": self.launcher}) # Dynamically execute command
|
||||
else:
|
||||
children = self.viewport.get_children()
|
||||
if children:
|
||||
# Only activate if we have selection or non-empty query
|
||||
if text.strip() == "" and self.selected_index == -1:
|
||||
return # Prevent accidental activation when empty
|
||||
selected_index = self.selected_index if self.selected_index != -1 else 0
|
||||
if 0 <= selected_index < len(children):
|
||||
children[selected_index].clicked()
|
||||
|
||||
def on_search_entry_key_press(self, widget, event):
|
||||
keyval = event.keyval
|
||||
if keyval == Gdk.KEY_Down:
|
||||
self.move_selection(1)
|
||||
return True
|
||||
elif keyval == Gdk.KEY_Up:
|
||||
self.move_selection(-1)
|
||||
return True
|
||||
elif keyval == Gdk.KEY_Escape:
|
||||
self.close_launcher()
|
||||
return True
|
||||
return False
|
||||
|
||||
def move_selection(self, delta: int):
|
||||
children = self.viewport.get_children()
|
||||
if not children:
|
||||
return
|
||||
# Allow starting selection from nothing when empty
|
||||
if self.selected_index == -1 and delta == 1:
|
||||
new_index = 0
|
||||
else:
|
||||
new_index = self.selected_index + delta
|
||||
new_index = max(0, min(new_index, len(children) - 1))
|
||||
self.update_selection(new_index)
|
||||