diff --git a/README.md b/README.md
index 37b817a2..bf33007b 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,7 @@
-> [!WARNING]
-> This configuration is made by myself, for myself, and with very little concern for other's preferences. This configuration is not meant to be "good", it's just meant to be comfortable for me. Let it also known that this is _VERY_ WIP.
-
-
+
+
A ʜᴀᴄᴋᴀʙʟᴇ ᴀɴᴅ ᴘᴏᴡᴇʀꜰᴜʟ sʜᴇʟʟ ꜰᴏʀ Hʏᴘʀʟᴀɴᴅ, ᴘᴏᴡᴇʀᴇᴅ ʙʏ Fᴀʙʀɪᴄ.
@@ -15,28 +13,38 @@
## Overview
-
This repository contains my personal dotfiles and configuration files. It's currently in an early, experimental phase and may not be suitable for general use.
+
+This repository contains my personal dotfiles and configuration files. It is currently in its alpha stage and primarily intended for personal use. As such, it may not be suitable for general use and could undergo significant changes in the future.
-> [!CAUTION]
-> Check [fabric-dev](https://github.com/S4NKALP/hyprland/tree/fabric-dev) branch for latest changes.
+
> [!NOTE]
-> This repository is in the alpha stage and primarily for personal use. The organization and configurations may change significantly in the future.
-
-### Features
-
-**TODO**
-
-### Showcase:
+> Please be aware that this repository is in an experimental phase and subject to frequent updates. The structure and configurations may evolve drastically over time.

-### Installation
+## Packages
-**TODO**
+```sh
+python-setproctitle, python-fabric-git, fabric-cli-git, grimblast, wf-recoder, brightnessctl, gnome-bluetooth-3.0 cliphist, python-psutil python-loguru, adw-gtk-theme, power-profile-daemon, python-materialyoucolor-git, python-pywayland, python-pyxdg, python-pillow, python-numpy, python-requests, python-toml, python-pillow
+```
-### Acknowledgements
+**font**
-**TODO**
+```sh
+ttf-font-awesome, otf-font-awesome, ttf-material-symbols-variable-git, ttf-google-sans, ttf-opensans, ttf-robot
+```
+
+# ToDo
+
+- [x] Add bluetooth widget
+- [x] Add shrunner widget
+- [ ] Add Network widget
+- [ ] Add Notification panel
+- [ ] Improve CSS Styling
+- [ ] Add Documentation
+- [ ] maybe calendar with events
+- [ ] New Screenshot
+- [ ] Power Manager
diff --git a/config/fabric/assets/config.json b/config/fabric/assets/config.json
deleted file mode 100644
index 9b339cff..00000000
--- a/config/fabric/assets/config.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "commands": [
- {
- "command": ":em",
- "description": "Copy an emoji",
- "handler": "show_emojis"
- },
- {
- "command": ":sh",
- "description": "Run executables from PATH",
- "handler": "show_shell_commands"
- },
- {
- "command": ":wl",
- "description": "Set the wallpaper",
- "handler": "show_wallpapers"
- },
- {
- "command": ":nw",
- "description": "List of available wifi networks",
- "handler": "show_network"
- },
- {
- "command": ":bt",
- "description": "Bluetooth",
- "handler": "show_bluetooth_settings"
- },
- {
- "command": ":ch",
- "description": "Copy a clipboard history entry",
- "handler": "show_clipboard_history"
- },
- {
- "command": ":p",
- "description": "Shutdown and go sleepy time",
- "handler": "show_powermenu"
- },
- {
- "command": ":cl",
- "description": "Show the calendar",
- "handler": "show_calendar"
- }
- ]
-}
diff --git a/config/fabric/assets/scripts/cliphist.sh b/config/fabric/assets/scripts/cliphist.sh
deleted file mode 100755
index 3c6ae6ca..00000000
--- a/config/fabric/assets/scripts/cliphist.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-get() {
- cliphist list | iconv -f $(locale charmap) -t UTF-8 -c
-}
-
-copy_by_id() {
- id=$1
- cliphist decode $id | wl-copy
-}
-
-clear() {
- cliphist wipe
-}
-
-save_cache_file() {
- id=$1
-
- output_file="/tmp/ags/cliphist/$id.png"
-
- if [[ ! -f "$output_file" ]]; then
- mkdir -p "/tmp/ags/cliphist/"
- cliphist decode "$id" >"$output_file"
- fi
-
- echo $output_file
-}
-
-clear_tmp() {
- rm "/tmp/ags/cliphist/*"
-}
-
-if [[ "$1" == "--get" ]]; then
- get
-elif [[ "$1" == "--copy-by-id" ]]; then
- { copy_by_id "$2"; }
-elif [[ "$1" == "--save-by-id" ]]; then
- { save_cache_file "$2"; }
-elif [[ "$1" == "--clear-cache" ]]; then
- clear_tmp
-elif [[ "$1" == "--clear" ]]; then
- clear
-fi
-
diff --git a/config/fabric/main.py b/config/fabric/main.py
deleted file mode 100644
index 0e3199eb..00000000
--- a/config/fabric/main.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import os
-
-import setproctitle
-from loguru import logger
-
-from fabric import Application
-from fabric.utils import get_relative_path, monitor_file
-from modules.bar.bar import Bar
-from modules.launcher.launcher import Launcher
-from modules.notification_popup import NotificationPopup
-from modules.osd import OSDContainer
-from services import ScreenRecorder
-
-logger.disable("fabric.hyprland.widgets")
-
-
-def apply_style(app: Application):
- logger.info("[Main] CSS applied")
- app.set_stylesheet_from_file(get_relative_path("styles/main.css"))
-
-
-if __name__ == "__main__":
- sc = ScreenRecorder()
- bar = Bar()
- osd = OSDContainer()
- notif = NotificationPopup()
- launcher = Launcher()
- launcher.hide()
-
- app = Application(
- "quickbar",
- bar,
- launcher,
- osd,
- )
- setproctitle.setproctitle("quickbar")
-
- 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_style(app)
-
- app.run()
diff --git a/config/fabric/modules/bar/widgets/taskbar.py b/config/fabric/modules/bar/widgets/taskbar.py
deleted file mode 100644
index 298fde29..00000000
--- a/config/fabric/modules/bar/widgets/taskbar.py
+++ /dev/null
@@ -1,113 +0,0 @@
-import json
-from typing import TypedDict
-
-from fabric.hyprland.widgets import get_hyprland_connection
-from fabric.utils import exec_shell_command
-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 snippets import IconResolver
-
-
-class PagerClient(TypedDict):
- title: str
- initialClass: str
- mapped: bool
- hidden: bool
- address: str
-
-
-class TaskBar(Box):
- def __init__(self, icon_size: int = 24, **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.icon_resolver = IconResolver()
-
- self.set_visible(False)
- self._icon_cache = {}
-
- 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(f"event::{event}", lambda *_: self.render())
-
- def render_with_delay(self, *_):
- GLib.timeout_add(101, self.render)
-
- def render(self, *_):
- self.children = []
- active_window_address = self.get_active_window_address()
-
- for client in self.fetch_clients():
- if client["mapped"] and not client["hidden"]:
- 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(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):
- command = (
- "focuswindow"
- if event.button == 1
- else "closewindow" if event.button == 3 else None
- )
- if command:
- exec_shell_command(f"hyprctl dispatch {command} address:{address}")
-
- 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.icon_resolver.get_icon_name(window_class) or fallback_icon
- if icon_name not in self._icon_cache:
- pixbuf = self.load_icon(icon_name)
- self._icon_cache[icon_name] = pixbuf
- return Image(pixbuf=self._icon_cache[icon_name], size=self.icon_size)
-
- 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
diff --git a/config/fabric/modules/launcher/launcher.py b/config/fabric/modules/launcher/launcher.py
deleted file mode 100644
index b4f6596f..00000000
--- a/config/fabric/modules/launcher/launcher.py
+++ /dev/null
@@ -1,279 +0,0 @@
-from fabric.utils import (
- get_desktop_applications,
- idle_add,
- invoke_repeater,
- 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.revealer import Revealer
-from fabric.widgets.scrolledwindow import ScrolledWindow
-from fabric.widgets.wayland import WaylandWindow as Window
-from modules.launcher.widgets import (
- BluetoothMenu,
- Calendar,
- ClipboardManager,
- EmojiManager,
- PowerMenu,
- ShellCommandManager,
- WallpaperManager,
- WifiMenu,
- handle_application_search,
-)
-from snippets import (
- MaterialIcon,
- get_current_uptime,
- get_profile_picture_path,
- read_config,
- username,
-)
-
-
-class Launcher(Window):
- def __init__(self, **kwargs):
- self.config = read_config()
- super().__init__(
- layer="top",
- anchor="center",
- exclusivity="none",
- keyboard_mode="on-demand",
- visible=False,
- all_visible=False,
- **kwargs,
- )
- self.all_apps = get_desktop_applications()
- self.initialize_managers()
- self.uptime_label = Label(
- label=get_current_uptime(), style="margin-left: 60px;"
- )
- self.commands = self.config.get("commands", [])
- self.command_map = self.build_command_map()
- self.setup_ui()
- self.connect("key-press-event", self.on_key_press)
- self.update_uptime_label()
-
- def initialize_managers(self):
- self.clipboard_manager = ClipboardManager(self, self.get_viewport())
- self.emoji_manager = EmojiManager(self)
- self.shell_command_manager = ShellCommandManager(self)
- self.wallpaper_manager = WallpaperManager()
- self.power_menu = PowerMenu(self)
- self.bluetooth_menu = BluetoothMenu(self)
- self.network_menu = WifiMenu(self)
- self.calendar_menu = Calendar(self)
-
- def setup_ui(self):
- self.default_button = Button(
- child=MaterialIcon("grid_view"),
- h_align="center",
- v_align="center",
- )
- self.scrolled_window = self.create_scrolled_window()
- self.scrolled_revealer = self.create_revealer()
- self.search_entry = self.create_search_entry()
- self.additional_box = self.create_additional_box()
- self.search_box = Box(
- spacing=10,
- orientation="h",
- children=[self.search_entry, self.default_button],
- )
- launcher_box = Box(
- orientation="v",
- name="launcher",
- children=[
- self.search_box,
- self.additional_box,
- self.scrolled_revealer,
- ],
- )
- self.add(launcher_box)
- self.show_all()
-
- def create_search_entry(self):
- entry = Entry(
- placeholder="Type ':' to list subcommands",
- h_expand=True,
- notify_text=lambda entry, *_: self.debounce_search(entry.get_text()),
- )
- entry.set_icon_from_icon_name(0, "preferences-system-search-symbolic")
- return entry
-
- def create_scrolled_window(self):
- return ScrolledWindow(
- style=" transition: min-height 50s cubic-bezier(0.42, 0, 0.58, 1);",
- child=self.get_viewport(),
- h_scrollbar_policy="never",
- v_scrollbar_policy="never",
- )
-
- def create_revealer(self):
- return Revealer(
- style=" transition: min-height 50s cubic-bezier(0.42, 0, 0.58, 1);",
- child=self.scrolled_window,
- transition_type="crossfade",
- )
-
- def create_additional_box(self):
- return Box(
- orientation="h",
- spacing=10,
- children=[
- Box(
- name="profile-pic",
- style=f"background-image: url(\"file://{get_profile_picture_path() or ''}\")",
- ),
- Label(label=username()),
- self.uptime_label,
- ],
- )
-
- def get_viewport(self):
- if not hasattr(self, "viewport"):
- self.viewport = Box(spacing=10, orientation="v")
- return self.viewport
-
- def update_uptime_label(self):
- self.uptime_label.set_label(get_current_uptime())
- invoke_repeater(
- 60 * 1000, lambda: self.uptime_label.set_label(get_current_uptime())
- )
-
- def build_command_map(self):
- return {cmd["command"]: cmd["handler"] for cmd in self.commands}
-
- def debounce_search(self, query: str):
- if hasattr(self, "_arranger_handler"):
- remove_handler(self._arranger_handler)
- self._arranger_handler = idle_add(self.arrange_viewport, query, pin=True)
-
- def arrange_viewport(self, query: str = ""):
-
- self.get_viewport().children = []
- for command, handler_name in self.command_map.items():
- if query.startswith(command):
- handler = getattr(self, handler_name, None)
- if handler:
- handler(query[len(command) :].strip())
- return
-
- if query.startswith(":"):
- self.additional_box.set_visible(False)
- self.update_dynamic_button([self.default_button])
- self.show_help(query[1:])
- self.scrolled_revealer.reveal()
- return
- handle_application_search(self, query)
-
- def update_dynamic_button(self, new_buttons):
- if not isinstance(new_buttons, list):
- new_buttons = [new_buttons]
- for child in self.search_box.children[1:]:
- self.search_box.remove(child)
- for new_button in new_buttons:
- self.search_box.add(new_button)
-
- def on_key_press(self, widget, event):
- from gi.repository import Gdk
-
- if self.is_visible() and event.keyval == Gdk.KEY_Escape:
- self.set_visible(False)
- return True
- return False
-
- def load_commands(self):
- return {cmd["command"]: cmd["description"] for cmd in self.commands}
-
- def show_help(self, query: str):
- filtered_help = [
- (command, description)
- for command, description in self.load_commands().items()
- if query.lower() in command[1:].lower()
- ]
-
- if not filtered_help:
- return
- for command, description in filtered_help:
- button = Button(
- child=self.create_help_button_content(command, description),
- name="launcher-item",
- )
- self.get_viewport().add(button)
-
- def create_help_button_content(self, command, description):
- return Box(
- orientation="h",
- spacing=10,
- children=[
- Label(label=command, h_expand=True, h_align="start"),
- Label(
- label=description,
- h_expand=True,
- h_align="end",
- ),
- ],
- )
-
- def toggle(self):
- self.set_visible(not self.is_visible())
- if self.is_visible():
- self.update_dynamic_button(self.default_button)
- self.search_entry.set_text("")
- self.search_entry.grab_focus()
-
- def show_network(self, *_):
- self.network_menu.show_wifi_menu(self.viewport)
- dynamic_buttons = self.network_menu.get_wifi_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_emojis(self, query: str):
- self.emoji_manager.show_emojis(self.get_viewport(), query)
- dynamic_buttons = self.emoji_manager.get_emoji_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_clipboard_history(self, query: str):
- self.clipboard_manager.show_clipboard_history(self.get_viewport(), query)
- dynamic_buttons = self.clipboard_manager.get_clipboard_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_powermenu(self, query: str = ""):
- self.power_menu.show_power_menu(self.get_viewport(), query)
- dynamic_buttons = self.power_menu.get_power_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_shell_commands(self, query: str):
- if not query:
- dynamic_buttons = self.shell_command_manager.get_shell_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.unreveal()
- return
- self.shell_command_manager.show_shell_commands(self.get_viewport(), query)
- dynamic_buttons = self.shell_command_manager.get_shell_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_wallpapers(self, query: str):
- if query == "random":
- self.wallpaper_manager.apply_wallpaper_random()
- else:
- self.wallpaper_manager.show_wallpaper_thumbnails(self.get_viewport(), query)
- dynamic_buttons = self.wallpaper_manager.get_wallpaper_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_bluetooth_settings(self, *_):
- self.bluetooth_menu.show_bluetooth_menu(self.viewport)
- dynamic_buttons = self.bluetooth_menu.get_bluetooth_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
-
- def show_calendar(self, *_):
- self.calendar_menu.show_calendar_menu(self.viewport)
- dynamic_buttons = self.calendar_menu.get_calendar_buttons()
- self.update_dynamic_button(dynamic_buttons)
- self.scrolled_revealer.reveal()
diff --git a/config/fabric/modules/launcher/widgets/__init__.py b/config/fabric/modules/launcher/widgets/__init__.py
deleted file mode 100644
index c99174db..00000000
--- a/config/fabric/modules/launcher/widgets/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from .app import *
-from .bluetooth import *
-from .calendar import *
-from .clipboard import *
-from .emoji import *
-from .power_menu import *
-from .shell import *
-from .wallpaper import *
-from .wifi import *
diff --git a/config/fabric/modules/launcher/widgets/app.py b/config/fabric/modules/launcher/widgets/app.py
deleted file mode 100644
index 32d8aaca..00000000
--- a/config/fabric/modules/launcher/widgets/app.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from fabric.widgets.image import Image
-from fabric.widgets.label import Label
-
-
-def handle_application_search(launcher, query: str):
- if not query.strip():
- launcher.additional_box.set_visible(True)
- return
-
- launcher.additional_box.set_visible(False)
- filtered_apps = [
- app
- for app in launcher.all_apps
- if query.casefold()
- in (
- (app.display_name or "")
- + " "
- + (app.name or "")
- + " "
- + (app.generic_name or "")
- ).casefold()
- ]
-
- if filtered_apps:
- launcher.viewport.children = [
- bake_application_slot(launcher, app) for app in filtered_apps[:6]
- ]
- launcher.scrolled_revealer.reveal()
- else:
- launcher.scrolled_revealer.unreveal()
-
-
-def bake_application_slot(launcher, app, **kwargs) -> Button:
- return Button(
- child=Box(
- orientation="h",
- spacing=10,
- children=[
- Image(pixbuf=app.get_icon_pixbuf(), h_align="start", size=62),
- Box(
- orientation="v",
- spacing=10,
- children=[
- Label(
- label=app.display_name or "Unknown",
- h_expand=True,
- name="title",
- v_align="center",
- h_align="start",
- ),
- Label(
- label=app.description or "",
- name="description",
- h_expand=True,
- v_align="center",
- justification="left",
- line_wrap="char",
- ),
- ],
- ),
- ],
- ),
- name="app-item",
- on_clicked=lambda *_: (app.launch(), launcher.set_visible(False)),
- **kwargs,
- )
diff --git a/config/fabric/modules/launcher/widgets/bluetooth.py b/config/fabric/modules/launcher/widgets/bluetooth.py
deleted file mode 100644
index 56f54099..00000000
--- a/config/fabric/modules/launcher/widgets/bluetooth.py
+++ /dev/null
@@ -1,91 +0,0 @@
-from fabric.bluetooth import BluetoothClient
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from fabric.widgets.image import Image
-from fabric.widgets.label import Label
-from snippets import MaterialIcon
-
-
-class BluetoothMenu:
- def __init__(self, launcher):
- self.launcher = launcher
- self.client = BluetoothClient(on_device_added=self.on_device_added)
- self.paired_devices = {}
- self.available_devices = {}
-
- self.bt_button = self.create_bluetooth_button()
- self.scan_button = self.create_scan_button()
- self.update_bt_button_style()
-
- def create_bluetooth_button(self):
- button = Button(
- child=MaterialIcon("bluetooth"),
- h_align="center",
- v_align="center",
- on_clicked=self.bt_toggle,
- )
- return button
-
- def create_scan_button(self):
- return Button(
- child=MaterialIcon("refresh"),
- h_align="center",
- v_align="center",
- on_clicked=lambda *_: self.client.toggle_scan(),
- )
-
- def bt_toggle(self, *_):
- self.client.toggle_power()
- self.update_bt_button_style()
-
- def update_bt_button_style(self):
- style = (
- "background-color: transparent;"
- if self.client.enabled
- else "background-color: @surfaceVariant; border-radius:100px; min-height: 50px; min-width: 50px;"
- )
- self.bt_button.set_style(style)
-
- def show_bluetooth_menu(self, viewport):
- viewport.children = []
- devices_box = Box(orientation="v", spacing=5)
-
- # Combine paired and available devices
- all_devices = {**self.paired_devices, **self.available_devices}
- for address, device in all_devices.items():
- device_button = self.create_device_button(device)
- devices_box.add(device_button)
-
- viewport.add(devices_box)
-
- def create_device_button(self, device):
- connection_status = "Connected" if device.connected else ""
- return Button(
- child=Box(
- orientation="h",
- spacing=10,
- children=[
- Image(icon_name=device.icon_name, size=32),
- Label(label=device.name),
- Label(label=connection_status, h_align="end"),
- ],
- ),
- on_clicked=lambda _, device=device: self.connect_to_device(device),
- name="launcher-item",
- )
-
- def connect_to_device(self, device):
- device.set_connecting(True)
- self.show_bluetooth_menu(self.launcher.viewport)
-
- def on_device_added(self, client, address):
- if device := client.get_device(address):
- if device.paired:
- self.paired_devices[address] = device
- else:
- self.available_devices[address] = device
-
- self.show_bluetooth_menu(self.launcher.viewport)
-
- def get_bluetooth_buttons(self):
- return [self.bt_button, self.scan_button]
diff --git a/config/fabric/modules/launcher/widgets/calendar.py b/config/fabric/modules/launcher/widgets/calendar.py
deleted file mode 100644
index 2b522287..00000000
--- a/config/fabric/modules/launcher/widgets/calendar.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from gi.repository import Gtk
-from snippets import MaterialIcon
-
-
-class Calendar:
- def __init__(self, launcher):
- self.launcher = launcher
- self.today_button = Button(
- child=MaterialIcon("event_available"),
- v_align="center",
- )
-
- def show_calendar_menu(self, viewport):
- viewport.children = []
-
- calendar_container = Box(
- name="calendar",
- children=Gtk.Calendar(visible=True, hexpand=True),
- )
-
- viewport.add(calendar_container)
-
- def get_calendar_buttons(self):
- return self.today_button
diff --git a/config/fabric/modules/launcher/widgets/clipboard.py b/config/fabric/modules/launcher/widgets/clipboard.py
deleted file mode 100644
index 7722633b..00000000
--- a/config/fabric/modules/launcher/widgets/clipboard.py
+++ /dev/null
@@ -1,140 +0,0 @@
-import os
-import subprocess
-
-from fabric import Fabricator
-from fabric.widgets.button import Button
-from fabric.widgets.image import Image
-from fabric.widgets.label import Label
-from snippets import MaterialIcon
-
-
-class ClipboardManager:
- def __init__(self, launcher, viewport):
- self.launcher = launcher
- self.viewport = viewport
- self.clipboard_history = []
- self._initialize_clipboard_watcher()
-
- def _initialize_clipboard_watcher(self):
- self.wl_paste_watcher = Fabricator(
- poll_from="wl-paste --watch echo", stream=True, interval=-1
- )
- self.wl_paste_watcher.connect(
- "changed", lambda *_: self.update_clipboard_history()
- )
-
- def get_clip_history(self):
- try:
- result = subprocess.run(
- ["cliphist", "list"], capture_output=True, text=True, check=True
- )
- return self._parse_clip_history(result.stdout)
- except subprocess.CalledProcessError:
- return []
-
- def _parse_clip_history(self, output):
- return [
- {"content": line.strip(), "id": line.split()[0]}
- for line in output.splitlines()
- if line.strip()
- ][:10]
-
- def update_clipboard_history(self):
- new_history = self.get_clip_history()
- if isinstance(new_history, list) and new_history != self.clipboard_history:
- self.clipboard_history = new_history
- self.refresh_ui()
-
- def refresh_ui(self):
- self._clear_viewport()
- self.show_clipboard_history(self.viewport)
-
- def _clear_viewport(self):
- for child in self.viewport.children:
- self.viewport.remove(child)
-
- def run_command(self, command, input_data=None):
- try:
- input_data = self._ensure_bytes(input_data)
- return subprocess.run(
- command, input=input_data, capture_output=True, check=True
- )
- except subprocess.CalledProcessError:
- return None
-
- def _ensure_bytes(self, input_data):
- if input_data and not isinstance(input_data, bytes):
- return input_data.encode() # Ensure input data is in bytes
- return input_data
-
- def copy_by_id(self, clip_id: str):
- command = f"cliphist decode {clip_id} | wl-copy"
- try:
- subprocess.run(command, shell=True, check=True)
- except subprocess.CalledProcessError:
- pass
-
- def save_cache_file(self, clip_id: str):
- output_file = f"/tmp/cliphist/{clip_id}.png"
- os.makedirs("/tmp/cliphist/", exist_ok=True)
-
- result = self.run_command(["cliphist", "decode", clip_id])
- if result:
- self._write_to_cache(output_file, result.stdout)
- return output_file
- return None
-
- def _write_to_cache(self, output_file, data):
- with open(output_file, "wb") as f:
- f.write(data)
-
- def show_clipboard_history(self, viewport, query=""):
- filtered_history = self._filter_clip_history(query)
- for item in filtered_history:
- self.add_clipboard_item(viewport, item)
-
- def _filter_clip_history(self, query):
- if not self.clipboard_history: # Safeguard against None or empty
- return []
- return [item for item in self.clipboard_history if query in item["content"]]
- # return [item for item in self.clipboard_history if query in item["content"]]
-
- def add_clipboard_item(self, viewport, item):
- if "png" in item["content"]:
- self._add_image_button(viewport, item)
- else:
- self._add_text_button(viewport, item)
-
- def _add_image_button(self, viewport, item):
- output_file = self.save_cache_file(item["id"])
- if output_file and os.path.exists(output_file):
- image_button = Button(
- h_align="start",
- child=Image(file=output_file),
- on_clicked=lambda _, clip_id=item["id"]: self.handle_clip_click(
- clip_id
- ),
- name="cliphist-img-item",
- )
- image_button.set_style(f"background-image: url('{output_file}');")
- viewport.add(image_button)
-
- def _add_text_button(self, viewport, item):
- label_button = Button(
- child=Label(
- label=item["content"][:35], # Truncate text for display
- h_expand=True,
- v_align="center",
- h_align="start",
- ),
- on_clicked=lambda _, clip_id=item["id"]: self.handle_clip_click(clip_id),
- name="launcher-item",
- )
- viewport.add(label_button)
-
- def handle_clip_click(self, clip_id):
- self.copy_by_id(clip_id)
- self.launcher.set_visible(False)
-
- def get_clipboard_buttons(self):
- return MaterialIcon("content_paste")
diff --git a/config/fabric/modules/launcher/widgets/emoji.py b/config/fabric/modules/launcher/widgets/emoji.py
deleted file mode 100644
index 10d869d2..00000000
--- a/config/fabric/modules/launcher/widgets/emoji.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import os
-import subprocess
-from typing import Generator, List
-
-import ijson
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from fabric.widgets.label import Label
-from snippets import MaterialIcon
-
-
-class EmojiManager:
- def __init__(self, launcher):
- self.launcher = launcher
- self.emoji_file_path = os.path.expanduser("~/fabric/assets/emoji.json")
-
- def load_emojis(self) -> Generator[tuple, None, None]:
- if not os.path.exists(self.emoji_file_path):
- return
- try:
- with open(self.emoji_file_path, "r") as file:
- for emoji_str, item in ijson.kvitems(file, ""):
- yield emoji_str, item["name"], item["slug"], item["group"]
- except (ijson.JSONError, KeyError, OSError):
- return
-
- def query_emojis(self, query: str) -> List[tuple]:
- query = query.lower()
- return [
- (emoji_str, name, slug, group)
- for emoji_str, name, slug, group in self.load_emojis()
- if query in name.lower() or query in slug.lower() or query in group.lower()
- ][:48]
-
- def copy_emoji(self, emoji: tuple):
- subprocess.run(["wl-copy"], input=emoji[0].encode(), check=True)
- self.launcher.set_visible(False)
-
- def show_emojis(self, viewport, query: str):
- filtered_emojis = self.query_emojis(query)
- self._display_emoji_grid(viewport, filtered_emojis)
-
- def _display_emoji_grid(self, viewport, emojis: List[tuple]):
- row = Box(orientation="h", spacing=10)
- for emoji in emojis:
- button = self._create_emoji_button(emoji)
- row.add(button)
-
- if len(row.children) >= 12:
- viewport.add(row)
- row = Box(orientation="h", spacing=10)
-
- if row.children:
- viewport.add(row)
-
- def _create_emoji_button(self, emoji: tuple) -> Button:
- return Button(
- child=Label(label=emoji[0], h_pack="start"),
- tooltip_text=f"Copy {emoji[1]}",
- on_clicked=lambda *_: self.copy_emoji(emoji),
- name="emoji-item",
- )
-
- def get_emoji_buttons(self):
- return MaterialIcon("mood")
diff --git a/config/fabric/modules/launcher/widgets/power_menu.py b/config/fabric/modules/launcher/widgets/power_menu.py
deleted file mode 100644
index 97f052a8..00000000
--- a/config/fabric/modules/launcher/widgets/power_menu.py
+++ /dev/null
@@ -1,102 +0,0 @@
-import os
-
-from fabric.utils import exec_shell_command, exec_shell_command_async
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from fabric.widgets.label import Label
-from loguru import logger
-from snippets import MaterialIcon
-
-IDLE_BUTTON_ACTIVE_STYLE = "background-color: @surfaceVariant; min-width:50px; min-height:50px; border-radius:100px;"
-IDLE_BUTTON_INACTIVE_STYLE = "background-color: transparent;"
-
-
-class PowerMenu:
- def __init__(self, launcher):
- self.launcher = launcher
- self.idle_inhibitor = False
- self.idle_button = Button(
- child=MaterialIcon("schedule"),
- v_align="center",
- on_clicked=self.toggle_idle_inhibitor,
- )
- self.idle_button.set_style(IDLE_BUTTON_INACTIVE_STYLE)
-
- def toggle_idle_inhibitor(self, *_):
- self.idle_inhibitor = not self.idle_inhibitor
- script_path = os.path.expanduser(
- "~/fabric/assets/scripts/wayland-idle-inhibitor.py"
- )
-
- if self.idle_inhibitor and not self.check_idle_state():
- exec_shell_command_async(
- ["python3", script_path],
- lambda output: logger.info(f"Idle inhibitor output: {output}"),
- )
- self.idle_button.set_style(IDLE_BUTTON_ACTIVE_STYLE)
- else:
- exec_shell_command("pkill -f wayland-idle-inhibitor.py")
- self.idle_button.set_style(IDLE_BUTTON_INACTIVE_STYLE)
-
- def check_idle_state(self):
- pid_check = exec_shell_command("pidof wayland-idle-inhibitor.py")
- return "wayland-idle-inhibitor.py" in pid_check
-
- def show_power_menu(self, viewport, query: str = ""):
- viewport.children = []
-
- power_options = [
- {
- "label": "Shutdown",
- "icon": "power_settings_new",
- "action": self.shutdown,
- },
- {"label": "Logout", "icon": "logout", "action": self.logout},
- {"label": "Reboot", "icon": "restart_alt", "action": self.reboot},
- {"label": "Suspend", "icon": "sleep", "action": self.suspend},
- {"label": "Lock", "icon": "lock", "action": self.lock},
- ]
-
- # Filter power options based on the query using a generator
- filtered_options = (
- (
- option
- for option in power_options
- if query.lower() in option["label"].lower()
- )
- if query
- else power_options
- )
-
- for option in filtered_options:
- button = Button(
- child=Box(
- orientation="h",
- spacing=10,
- children=[
- MaterialIcon(option["icon"], size=28),
- Label(label=option["label"], h_align="start"),
- ],
- ),
- on_clicked=lambda _, action=option["action"]: action(),
- name="launcher-item",
- )
- viewport.add(button)
-
- def shutdown(self):
- exec_shell_command("systemctl poweroff")
-
- def reboot(self):
- exec_shell_command("systemctl reboot")
-
- def suspend(self):
- exec_shell_command("systemctl suspend")
-
- def logout(self):
- exec_shell_command("hyprctl dispatch logout")
-
- def lock(self):
- exec_shell_command("hyprlock --immediate")
-
- def get_power_buttons(self):
- return self.idle_button
diff --git a/config/fabric/modules/launcher/widgets/shell.py b/config/fabric/modules/launcher/widgets/shell.py
deleted file mode 100644
index 729c6544..00000000
--- a/config/fabric/modules/launcher/widgets/shell.py
+++ /dev/null
@@ -1,78 +0,0 @@
-import os
-import subprocess
-
-from fabric.widgets.button import Button
-from fabric.widgets.label import Label
-from snippets import MaterialIcon
-
-CACHE_DIR = os.getenv(
- "XDG_CACHE_HOME", os.path.join(os.path.expanduser("~"), ".cache", "fabric")
-)
-BINS = os.path.join(CACHE_DIR, "binaries")
-
-
-class ShellCommandManager:
- def __init__(self, launcher):
- self.launcher = launcher
- self.binaries = set() # Use a set to store unique binaries
- self.reload_binaries()
-
- def reload_binaries(self):
- paths = os.getenv("PATH", "").split(":")
- self.binaries = set()
-
- for path in paths:
- self.binaries.update(self.list_binaries_in_path(path))
-
- # Write unique binaries to the cache file
- with open(BINS, "w") as f:
- f.write("\n".join(self.binaries))
-
- def list_binaries_in_path(self, path):
- if not os.path.exists(path):
- return []
- try:
- return [
- entry
- for entry in os.listdir(path)
- if os.access(os.path.join(path, entry), os.X_OK)
- ]
- except OSError:
- return []
-
- def show_shell_commands(self, viewport, search_query: str):
- if not search_query:
- return
-
- results = self.query_binaries(search_query)
- self.display_results(viewport, results)
-
- def query_binaries(self, filter_str: str):
- # Use a generator to filter binaries on demand
- filtered_bins = (cmd for cmd in self.binaries if filter_str in cmd)
- return list(dict.fromkeys(filtered_bins))[:16] # Deduplicate and limit to 16
-
- def display_results(self, viewport, results):
- for command in results:
- button = Button(
- child=Label(
- label=command,
- v_align="center",
- h_align="start",
- ),
- on_clicked=lambda _, cmd=command: self.execute_command(cmd),
- name="launcher-item",
- )
- viewport.add(button)
-
- def execute_command(self, cmd: str):
- try:
- output = subprocess.check_output(cmd, shell=True, text=True)
- print(output)
- except subprocess.CalledProcessError as e:
- print(e.output)
- finally:
- self.launcher.set_visible(False)
-
- def get_shell_buttons(self):
- return MaterialIcon("terminal")
diff --git a/config/fabric/modules/launcher/widgets/wallpaper.py b/config/fabric/modules/launcher/widgets/wallpaper.py
deleted file mode 100644
index 7ea4b8a3..00000000
--- a/config/fabric/modules/launcher/widgets/wallpaper.py
+++ /dev/null
@@ -1,167 +0,0 @@
-import hashlib
-import os
-
-from fabric.utils import exec_shell_command, exec_shell_command_async
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from gi.repository import GdkPixbuf
-from loguru import logger
-
-from snippets import MaterialIcon
-
-
-class WallpaperManager:
- IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".webp"}
- CACHE_DIR = os.path.expanduser("~/.cache/fabric/thumbnails/wallpapers")
- WALLPAPER_SCRIPT_PATH = os.path.expanduser("~/dotfiles/hypr/scripts/wallpaper.py")
-
- def __init__(self):
- self.wallpaper_dir = os.path.expanduser("~/Pictures/wallpapers")
- os.makedirs(self.CACHE_DIR, exist_ok=True)
- self.thumbnails = []
- self.theme_toggle_button = self._create_theme_toggle_button()
- self._update_button_style()
-
- def _create_theme_toggle_button(self):
- return Button(
- child=MaterialIcon("contrast"),
- v_align="center",
- on_clicked=self.toggle_dark_mode,
- )
-
- def toggle_dark_mode(self, *_):
- exec_shell_command(
- os.path.expanduser("~/fabric/assets/scripts/dark-theme.sh --toggle")
- )
- self._update_button_style()
-
- def check_dark_mode_state(self):
- result = exec_shell_command(
- "gsettings get org.gnome.desktop.interface color-scheme"
- )
- return result.strip().replace("'", "") == "prefer-dark"
-
- def _update_button_style(self):
- dark_mode = self.check_dark_mode_state()
- style = (
- "background-color: @surfaceVariant; border-radius:100px; min-height:50px; min-width:50px;"
- if dark_mode
- else "background-color: transparent; border-radius:100px;"
- )
- self.theme_toggle_button.set_style(style)
-
- def get_cache_path(self, file_name: str) -> str:
- file_hash = hashlib.md5(file_name.encode("utf-8")).hexdigest()
- return os.path.join(self.CACHE_DIR, f"{file_hash}.png")
-
- def create_thumbnail(self, image_path: str, thumbnail_size=100):
- try:
- pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_path)
- width, height = pixbuf.get_width(), pixbuf.get_height()
- if width > height:
- new_width = thumbnail_size
- new_height = int(height * (thumbnail_size / width))
- else:
- new_height = thumbnail_size
- new_width = int(width * (thumbnail_size / height))
- return pixbuf.scale_simple(
- new_width, new_height, GdkPixbuf.InterpType.BILINEAR
- )
- except Exception as e:
- logger.error(f"Error creating thumbnail for {image_path}: {e}")
- return None
-
- def generate_or_load_thumbnail(self, wallpaper_path):
- cache_path = self.get_cache_path(os.path.basename(wallpaper_path))
-
- if not os.path.exists(cache_path):
- pixbuf = self.create_thumbnail(wallpaper_path)
- if pixbuf:
- pixbuf.savev(cache_path, "png", [], [])
- return cache_path
-
- def show_wallpaper_thumbnails(self, viewport, search_term: str = ""):
- wallpapers = list(self._get_wallpapers(search_term))[:24]
- if not wallpapers:
- self._show_no_wallpapers_message(viewport)
- return
-
- self._display_thumbnails(viewport, wallpapers)
-
- def _show_no_wallpapers_message(self, viewport):
- viewport.add(
- Box(
- orientation="h",
- style="padding:20px;",
- children=[Button(child="No wallpapers found!", v_align="center")],
- )
- )
-
- def _display_thumbnails(self, viewport, wallpapers):
- row = Box(orientation="h", spacing=10, style="margin:5px;")
-
- for index, wallpaper in enumerate(wallpapers, 1):
- thumbnail_path = self.generate_or_load_thumbnail(wallpaper)
- row.add(self._create_wallpaper_thumbnail(thumbnail_path, wallpaper))
-
- if index % 6 == 0:
- viewport.add(row)
- row = Box(orientation="h", spacing=10, style="margin:5px;")
-
- if row.children:
- viewport.add(row)
-
- def _get_wallpapers(self, search_term: str):
- return (
- os.path.join(self.wallpaper_dir, file_name)
- for file_name in os.listdir(self.wallpaper_dir)
- if os.path.isfile(os.path.join(self.wallpaper_dir, file_name))
- and os.path.splitext(file_name)[1].lower() in self.IMAGE_EXTENSIONS
- and self._matches_search(file_name, search_term)
- )
-
- def _matches_search(self, file_name, search_term: str):
- return not search_term or search_term.lower() in file_name.lower()
-
- def _thumbnail_style(self, thumbnail_path):
- return (
- f"background-image: url('{thumbnail_path}'); "
- "min-width: 64px; min-height: 64px; "
- "background-repeat: no-repeat; "
- "background-size: cover; background-position: center;"
- )
-
- def _create_wallpaper_thumbnail(self, thumbnail_path, wallpaper_path):
- return Button(
- child=Box(
- orientation="h",
- h_align="center",
- v_align="center",
- style=self._thumbnail_style(thumbnail_path),
- ),
- h_align="start",
- v_align="center",
- name="wall-item",
- on_clicked=lambda _: self._select_wallpaper(wallpaper_path),
- )
-
- def _select_wallpaper(self, wallpaper_path):
- self._apply_wallpaper(wallpaper_path)
-
- def _apply_wallpaper(self, wallpaper_path):
- self._execute_wallpaper_script("--image", wallpaper_path)
-
- def apply_wallpaper_random(self):
- self._execute_wallpaper_script("-R")
-
- def _execute_wallpaper_script(self, *args):
- try:
- exec_shell_command_async(
- ["python3", self.WALLPAPER_SCRIPT_PATH, *args],
- lambda output: logger.info(f"Wallpaper script output: {output}"),
- )
- except Exception as e:
- logger.error(f"Error executing wallpaper script: {e}")
-
- def get_wallpaper_buttons(self):
- return self.theme_toggle_button
diff --git a/config/fabric/modules/launcher/widgets/wifi.py b/config/fabric/modules/launcher/widgets/wifi.py
deleted file mode 100644
index 0b8ee2a2..00000000
--- a/config/fabric/modules/launcher/widgets/wifi.py
+++ /dev/null
@@ -1,99 +0,0 @@
-from fabric.widgets.box import Box
-from fabric.widgets.button import Button
-from fabric.widgets.image import Image
-from fabric.widgets.label import Label
-from services import NetworkClient
-from snippets import MaterialIcon
-
-
-class WifiMenu:
- def __init__(self, launcher):
- self.launcher = launcher
- self.client = NetworkClient()
- self.paired_devices = {}
- self.available_devices = {}
-
- self.wifi_toggle_button = Button(
- child=MaterialIcon("signal_wifi_4_bar"),
- h_align="center",
- v_align="center",
- on_clicked=self.toggle_wifi,
- )
- self.update_wifi_button_style()
-
- self.rescan_button = Button(
- child=MaterialIcon("refresh"),
- h_align="center",
- v_align="center",
- on_clicked=self.scan_for_networks,
- )
-
- self.client.device_ready.connect(self.on_device_added)
-
- def update_wifi_button_style(self):
- if self.check_wifi_state():
- self.wifi_toggle_button.set_style("background-color: transparent;")
- else:
- self.wifi_toggle_button.set_style(
- "background-color: @surfaceVariant; border-radius:100px; min-height:50px; min-width:50px;"
- )
-
- def check_wifi_state(self):
- return self.client.wifi_device.enabled if self.client.wifi_device else False
-
- def show_wifi_menu(self, viewport):
- viewport.children = []
-
- devices_box = Box(orientation="v", spacing=5)
-
- # Iterate over the list of available access points
- for ap in self.client.wifi_device.access_points:
- is_connected = ap["ssid"] == self.client.wifi_device.ssid # Compare SSID
-
- device_button = Button(
- child=Box(
- orientation="h",
- spacing=10,
- children=[
- Image(icon_name=ap["icon-name"], size=32),
- Label(label=ap["ssid"]), # Show SSID
- Box(
- orientation="h",
- children=[
- Label(
- label="Connected" if is_connected else "",
- h_align="end",
- ),
- ],
- ),
- ],
- ),
- on_clicked=lambda _, ap=ap: (
- self.connect_to_ap(ap, is_connected),
- self.launcher.set_visible(False),
- ),
- name="launcher-item",
- )
- devices_box.add(device_button)
-
- viewport.add(devices_box)
-
- def connect_to_ap(self, ap, is_connected):
- if not is_connected:
- self.client.connect_wifi_bssid(ap["bssid"])
-
- def on_device_added(self, client):
- self.show_wifi_menu(self.launcher.viewport)
-
- def scan_for_networks(self, button):
- self.client.wifi_device.scan()
- self.show_wifi_menu(self.launcher.viewport)
-
- def toggle_wifi(self, button):
- self.update_wifi_button_style()
- if self.client.wifi_device:
- self.client.wifi_device.toggle_wifi()
- self.show_wifi_menu(self.launcher.viewport)
-
- def get_wifi_buttons(self):
- return [self.wifi_toggle_button, self.rescan_button]
diff --git a/config/fabric/ruff.toml b/config/fabric/ruff.toml
deleted file mode 100644
index 2e2889de..00000000
--- a/config/fabric/ruff.toml
+++ /dev/null
@@ -1,10 +0,0 @@
-line-length = 88
-indent-width = 4
-
-[lint]
-# ignore gi imports not begin at the top of the file
-ignore = ["E402"]
-
-[format]
-quote-style = "double"
-indent-style = "space"
\ No newline at end of file
diff --git a/config/fabric/services/__init__.py b/config/fabric/services/__init__.py
deleted file mode 100644
index 7373da1a..00000000
--- a/config/fabric/services/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from .brightness import *
-from .screen_record import *
-from .wifi import *
diff --git a/config/fabric/snippets/__init__.py b/config/fabric/snippets/__init__.py
deleted file mode 100644
index add4b114..00000000
--- a/config/fabric/snippets/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from .animator import *
-from .custom_image import *
-from .functions import *
-from .icon import *
-from .icon_resolver import *
diff --git a/config/fabric/snippets/functions.py b/config/fabric/snippets/functions.py
deleted file mode 100644
index f9606e31..00000000
--- a/config/fabric/snippets/functions.py
+++ /dev/null
@@ -1,43 +0,0 @@
-import json
-import os
-import time
-
-import psutil
-from gi.repository import GLib
-from loguru import logger
-
-
-def read_config():
- home_dir = GLib.get_home_dir()
- config_path = f"{home_dir}/fabric/assets/config.json"
-
- with open(config_path, "r") as file:
- # Load JSON data into a Python dictionary
- data = json.load(file)
- return data
-
-
-def get_current_uptime():
- uptime = time.time() - psutil.boot_time()
- uptime_hours, remainder = divmod(uptime, 3600)
- uptime_minutes, _ = divmod(remainder, 60)
- return (
- f"Up: {int(uptime_hours)} {'hours' if uptime_hours != 1 else 'hour'}, "
- f"{int(uptime_minutes)} {'minutes' if uptime_minutes != 1 else 'minute'}"
- )
-
-
-def get_profile_picture_path() -> str | None:
- path = os.path.expanduser("~/Pictures/Other/face.jpg")
- if not os.path.exists(path):
- path = os.path.expanduser("~/.face")
- if not os.path.exists(path):
- logger.warning(
- "can't fetch a user profile picture, add a profile picture image at ~/.face or at ~/Pictures/Other/profile.jpg"
- )
- path = None
- return path
-
-
-def username():
- return os.getlogin().title()
diff --git a/config/fabric/snippets/icon_resolver.py b/config/fabric/snippets/icon_resolver.py
deleted file mode 100644
index 6c1fc9c6..00000000
--- a/config/fabric/snippets/icon_resolver.py
+++ /dev/null
@@ -1,100 +0,0 @@
-import json
-import os
-import re
-
-import gi
-
-gi.require_version("Gtk", "3.0")
-from gi.repository import GLib, Gtk
-from loguru import logger
-
-# TODO WIP
-# Idea: nearest string matching algorithm
-# if already exists: retrieve from json
-# if found: stor in json: app_id -> icon_name
-# if not found: store in json -> misisng-icon
-
-
-CACHE_DIR = str(GLib.get_user_cache_dir()) + "/fabric"
-ICON_CACHE_FILE = CACHE_DIR + "/icons.json"
-if not os.path.exists(CACHE_DIR):
- os.makedirs(CACHE_DIR)
-
-
-class IconResolver:
- def __init__(self, default_applicaiton_icon: str = "image-missing"):
- if os.path.exists(ICON_CACHE_FILE):
- f = open(ICON_CACHE_FILE)
- try:
- self._icon_dict = json.load(f)
- except json.JSONDecodeError:
- logger.info("[ICONS] Cache file does not exist or is corrupted")
- f.close()
- else:
- self._icon_dict = {}
-
- self.default_applicaiton_icon = default_applicaiton_icon
-
- def get_icon_name(self, app_id: str):
- if app_id in self._icon_dict:
- return self._icon_dict[app_id]
- new_icon = self._compositor_find_icon(app_id)
- logger.info(
- f"[ICONS] found new icon: '{new_icon}' for app id: '{app_id}', storing..."
- )
- self._store_new_icon(app_id, new_icon)
- return new_icon
-
- def get_icon_pixbuf(self, app_id: str, size: int = 16):
- return Gtk.IconTheme.get_default().load_icon(
- self.get_icon_name(app_id),
- size,
- Gtk.IconLookupFlags.FORCE_SIZE,
- )
-
- def _store_new_icon(self, app_id: str, icon: str):
- self._icon_dict[app_id] = icon
- with open(ICON_CACHE_FILE, "w") as f:
- json.dump(self._icon_dict, f)
- f.close()
-
- def _get_icon_from_desktop_file(self, desktop_file_path: str):
- # TODO: get icon in the [Desktop Entry] section only
- with open(desktop_file_path) as f:
- for line in f.readlines():
- if "Icon=" in line:
- return "".join(line[5:].split())
- return self.default_applicaiton_icon
-
- def _get_desktop_file(self, app_id: str) -> str | None:
- data_dirs = GLib.get_system_data_dirs()
- for data_dir in data_dirs:
- data_dir = data_dir + "/applications/"
- if os.path.exists(data_dir):
- # Do name resolving here
-
- files = os.listdir(data_dir)
- matching = [
- s for s in files if "".join(app_id.lower().split()) in s.lower()
- ]
- if matching:
- return data_dir + matching[0]
-
- for word in list(filter(None, re.split(r"-|\.|_|\s", app_id))):
- matching = [s for s in files if word.lower() in s.lower()]
- if matching:
- return data_dir + matching[0]
-
- return None
-
- def _compositor_find_icon(self, app_id: str):
- if Gtk.IconTheme.get_default().has_icon(app_id):
- return app_id
- if Gtk.IconTheme.get_default().has_icon(app_id + "-desktop"):
- return app_id + "-desktop"
- desktop_file = self._get_desktop_file(app_id)
- return (
- self._get_icon_from_desktop_file(desktop_file)
- if desktop_file
- else self.default_applicaiton_icon
- )
diff --git a/config/fabric/styles/launcher.css b/config/fabric/styles/launcher.css
deleted file mode 100644
index 0ad7cb01..00000000
--- a/config/fabric/styles/launcher.css
+++ /dev/null
@@ -1,186 +0,0 @@
-#launcher {
- margin: 18px;
- border: 1px solid @outlineVariant;
- background-color: @surface;
- border-radius: 24px;
- padding: 18px;
- min-width: 480px;
-}
-
-#launcher entry {
- transition: all 0.1s ease;
- border-radius: 11px;
- padding: 10px;
- margin: 12px;
- box-shadow: inset 0 0 0 1px @outlineVariant;
-}
-
-#launcher entry:focus {
- background-color: @background;
-}
-
-#launcher entry:hover {
- background-color: @background;
-}
-
-#launcher entry selection {
- color: @outline;
- background-color: transparent;
-}
-
-#profile-pic {
- background-color: transparent;
- background-position: center;
- background-repeat: no-repeat;
- background-size: cover;
- border-radius: 100px;
- padding: 20px;
- margin: 4px;
-}
-
-#launcher button#app-item {
- border-radius: 11px;
- background-color: transparent;
- background-image: none;
- box-shadow: none;
- transition: 200ms;
- padding: 7px;
-}
-
-#launcher button#app-item:hover #title,
-#launcher button#app-item:focus #title {
- color: @primar;
-}
-
-#launcher button#app-item:hover #description,
-#launcher button#app-item:focus #description {
- color: @inversePrimary;
-}
-
-#launcher button#app-item:hover image,
-#launcher button#app-item:focus image {
- -gtk-icon-shadow: 2px 2px @primary;
-}
-
-#launcher button#app-item:active {
- background-color: @primaryContainer;
- border-radius: 11px;
- box-shadow: inset 0 0 0 1px rgba(158, 142, 130, 0.04);
-}
-
-#launcher button#app-item:active #title {
- color: @foreground;
-}
-
-#launcher button#emoji-item {
- border-radius: 11px;
- background-color: transparent;
- background-image: none;
- box-shadow: none;
- padding: 0px;
-}
-
-#launcher button#emoji-item:disabled {
- color: mix(@onSurface, transparent, 0.38);
-}
-
-#launcher button#emoji-item label {
- font-size: 24px;
-}
-
-#launcher button#emoji-item:hover,
-#launcher button#emoji-item:focus {
- text-shadow: 2px 2px 2px @primary;
-}
-
-#launcher button#cliphist-img-item {
- background-size: cover;
- background-position: center;
- background-repeat: no-repeat;
- border-radius: 8px;
- min-width: 70px;
- min-height: 70px;
-}
-
-#launcher button#cliphist-img-item:hover,
-#launcher button#cliphist-img-item:focus {
- box-shadow: 2px 2px 2px @primary;
-}
-
-#launcher button#launcher-item {
- border-radius: 11px;
- background-color: transparent;
- background-image: none;
- box-shadow: none;
-}
-
-#launcher button#launcher-item:disabled {
- color: mix(@onSurface, transparent, 0.38);
-}
-
-#launcher button#launcher-item:hover,
-#launcher button#launcher-item:focus {
- text-shadow: 2pt 2pt 2pt @primary;
-}
-
-#launcher button#wall-item {
- border-radius: 0px;
- background-color: transparent;
- background-image: none;
- box-shadow: none;
- padding: 5px;
-}
-
-#launcher button#wall-item:disabled {
- color: mix(@onSurface, transparent, 0.38);
-}
-
-#launcher button#wall-item:hover,
-#launcher button#wall-item:focus {
- box-shadow: 2pt 2pt 2pt @primary;
-}
-
-.activated {
- background-color: @surfaceVariant;
- border-radius: 100px;
-}
-
-#calendar calendar {
- all: unset;
- font-size: 18px;
- padding: 5px;
-}
-
-#calendar calendar.button {
- all: unset;
- transition: 200ms;
- border-radius: 10px;
- background-color: transparent;
- background-image: none;
- box-shadow: none;
-}
-
-#calendar calendar:selected {
- box-shadow:
- inset 0 -7px 0 0 @primary,
- inset 0 0 0 1px @surfaceVariant;
- border-radius: 6px;
-}
-
-#calendar calendar.header {
- background-color: transparent;
- border: none;
-}
-
-#calendar calendar.highlight {
- background-color: transparent;
- color: @onSurface;
-}
-
-#calendar calendar:hover {
- color: @errorContainer;
-}
-
-#calendar calendar:indeterminate {
- color: mix(@onSurfaceVariant, transparent, 0.3);
-}
diff --git a/config/hypr/UserConfigs/Startup_Apps.conf b/config/hypr/UserConfigs/Startup_Apps.conf
index 0ecd3d48..2ee7d734 100644
--- a/config/hypr/UserConfigs/Startup_Apps.conf
+++ b/config/hypr/UserConfigs/Startup_Apps.conf
@@ -13,10 +13,8 @@ exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME
exec-once = $scriptsDir/Polkit.sh
# startup apps
-#exec-once = waybar &
-# exec-once = ~/fabric/start &
-# exec-once = ags &
-exec-once = cd ~/fabric && python main.py
+
+exec-once = cd ~/dotfiles/modus && python main.py
exec-once = wl-gammarelay-rs &
exec-once = blueman-applet &
exec-once = nm-applet --indicator &
diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf
index 980c3c20..55d44050 100644
--- a/config/hypr/UserConfigs/UserKeybinds.conf
+++ b/config/hypr/UserConfigs/UserKeybinds.conf
@@ -7,7 +7,7 @@ $mainMod = SUPER
$scriptsDir = $HOME/dotfiles/hypr/scripts
$RunCMD = $scriptsDir/RunCMD.sh
-$fabric = python -m fabric execute quickbar
+$fabric = fabric-cli exec modus
# Testing
bind = Alt, f12, exec, notify-send 'Test notification' "Here's a really long message to test truncation and wrapping\nYou can middle click or flick this notification to dismiss it!" -a 'terminal' -A "Test1=I got it!" -A "Test2=Another action"
@@ -16,9 +16,9 @@ bind = Alt, Equal, exec, notify-send 'hmm' ${SLURP_ARGS}
# Applications
bind = ALT SHIFT,Return, exec, kitty --title Kitty --single-instance
bind = $mainMod, Return, exec, kitty
-bind = $mainMod, E, exec, thunar
+bind = ALT, E, exec, thunar
bind = $mainMod, B, exec, firefox
-bind = $mainMod, T, exec, materialgram
+bind = ALT, T, exec, materialgram
# Actions
bind = $mainMod SHIFT, G, exec, $RunCMD gamemode
@@ -28,9 +28,9 @@ bind = SHIFT ALT,W, exec, python -O $scriptsDir/wallpaper.py -R
bind = $mainMod CTRL, L, exec, pidof hyprlock || hyprlock -q
bind = $mainMod CTRL, P, exec, systemctl poweroff
bind = $mainMod CTRL, R, exec, systemctl reboot
-bind = ALT, t, exec, killall quickbar || sleep 0.5 && python ~/fabric/main.py &
+bind = ALT_SHIFT, t, exec, killall modus || sleep 0.5 && python ~/dotfiles/modus/main.py &
-bind = $mainMod, R, exec, $fabric 'sc.screencast_start(True)'
+bind = $mainMod, R, exec, $fabric 'sc.screencast_start()'
bind = $mainMod_SHIFT, R, exec, $fabric 'sc.screencast_stop()'
bind=$mainMod,Z, exec, $fabric 'sc.screenshot()'
@@ -38,6 +38,14 @@ bind=,Print, exec, $fabric 'sc.screenshot(True)'
bind = Super, y, exec, XDG_CURRENT_DESKTOP="gnome" gnome-control-center
-bind = $mainMod, D, exec, $fabric 'launcher.toggle()'
+bind = $mainMod, D, exec, $fabric 'launcher.open("launcher")'
+bind = $mainMod, W, exec, $fabric 'launcher.open("wallpapers")'
+bind = $mainMod, X, exec, $fabric 'launcher.open("power")'
+bind = $mainMod, V, exec, $fabric 'launcher.open("cliphist")'
+bind = $mainMod, T, exec, $fabric 'launcher.open("todo")'
+bind = $mainMod, E, exec, $fabric 'launcher.open("emoji")'
+bind = ALT, B, exec, $fabric 'launcher.open("bluetooth")'
+bind = ALT, S, exec, $fabric 'launcher.open("sh")'
+bind = $mainMod, H, exec, $fabric 'bar.toggle_hidden()'
diff --git a/config/hypr/UserConfigs/WindowRules.conf b/config/hypr/UserConfigs/WindowRules.conf
index 95a31db5..a893df14 100644
--- a/config/hypr/UserConfigs/WindowRules.conf
+++ b/config/hypr/UserConfigs/WindowRules.conf
@@ -8,8 +8,6 @@ windowrulev2 = noinitialfocus,class:^(xwaylandvideobridge)$
windowrulev2 = maxsize 1 1,class:^(xwaylandvideobridge)$
windowrulev2 = noblur,class:^(xwaylandvideobridge)$
-# Workspace Rules
-#windowrule = stayfocused, ^(com.github.Aylur.ags)$
# MPV/VLC
windowrule = workspace 5, ^(.*vlc.*)$|(.*mpv.*)$
diff --git a/config/material-colors/generate.py b/config/material-colors/generate.py
index d4edcc57..32504e0c 100644
--- a/config/material-colors/generate.py
+++ b/config/material-colors/generate.py
@@ -41,7 +41,7 @@ def join(*args):
return os.path.join(*args)
-home = os.path.expanduser("~")
+home = os.path.expanduser('~')
script_dir = os.path.dirname(os.path.abspath(__file__))
cache_path = f"{home}/.cache/material/"
@@ -49,14 +49,14 @@ os.makedirs(cache_path, exist_ok=True)
def rgb_to_hex(rgb):
- return "#{:02x}{:02x}{:02x}".format(*rgb[:3])
+ return '#{:02x}{:02x}{:02x}'.format(*rgb[:3])
def rgba_to_rgb(rgba):
- return f"{rgba[0]}, {rgba[1]}, {rgba[2]}"
+ return f'{rgba[0]}, {rgba[1]}, {rgba[2]}'
-class Color:
+class Color():
def __init__(self, scheme) -> None:
self.scheme = scheme
@@ -70,12 +70,8 @@ class Color:
class ColorsCache:
def __init__(
- self,
- colors: DynamicScheme | dict,
- wallpaper: str,
- original_color: int,
- contrast_level: int,
- scheme_name: str,
+ self, colors: DynamicScheme | dict, wallpaper: str,
+ original_color: int, contrast_level: int, scheme_name: str
) -> None:
self.colors: dict[str, str] = {}
self.wallpaper = wallpaper
@@ -99,7 +95,7 @@ def colors_dict(cache: ColorsCache):
"colors": cache.colors,
"original_color": cache.original_color,
"contrast_level": cache.contrast_level,
- "scheme_name": cache.scheme_name,
+ "scheme_name": cache.scheme_name
}
return dict
@@ -112,7 +108,10 @@ def get_cache_object(object: dict | str):
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)
+ return ColorsCache(
+ colors, wallpaper, original_color,
+ contrast_level, scheme_name
+ )
def get_file_list(folder_path):
@@ -125,9 +124,11 @@ def get_file_list(folder_path):
ready_templates = {
"colors.css": "@define-color {name} {hex};\n",
- "colors.scss": "${name}: {hex};\n",
+ "colors.scss": "${name}: {hex};\n"
+}
+additional = {
+ "onBackground": "foreground"
}
-additional = {"onBackground": "foreground"}
def generate_color_map(scheme: DynamicScheme):
@@ -146,23 +147,25 @@ class ColorFormatter:
def apply_transformations(self, value, transformations):
intermediate_transforms = [
- t for t in transformations if not (t.startswith("strip") or t == "rgb")
+ 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"
+ 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())
+ 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())
+ 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("#")
+ value = value.lstrip('#')
elif transform == "rgb":
value = self.hex_to_rgb(value)
@@ -172,22 +175,24 @@ class ColorFormatter:
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))
+ 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()
+ 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}"
+ 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)
+ transformations = re.findall(
+ r'(\w+)(?:\((\d*)\))?', transformations_str
+ )
result = []
for command, arg in transformations:
if command:
@@ -198,7 +203,7 @@ class ColorFormatter:
return result
def format(self, text):
- pattern = r"(<(\w+)(?:\.(.+))?>)"
+ pattern = r'(<(\w+)(?:\.(.+))?>)'
matches = re.findall(pattern, text)
result = []
last_end = 0
@@ -206,30 +211,27 @@ class ColorFormatter:
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)])
+ 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)
+ 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 = ''.join(result)
+ pattern = r'<\\\\([^>]+)>'
- result = re.sub(pattern, r"<\1>", result)
+ result = re.sub(pattern, r'<\1>', result)
return result
-def generate_templates(
- folder: str,
- output_folder: str,
- scheme: DynamicScheme,
- color_scheme: str,
- wallpaper: str = "",
-):
+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):
@@ -242,12 +244,13 @@ def generate_templates(
formatter = ColorFormatter(scheme)
template = formatter.format(template)
template = (
- template.replace("
", color_scheme)
+ template
+ .replace("", color_scheme)
.replace("", output_folder)
.replace("", wallpaper)
)
new_path = join(output_folder, os.path.basename(file_path))
- with open(new_path, "w") as f:
+ with open(new_path, 'w') as f:
f.write(template)
for file in ready_templates:
@@ -259,17 +262,21 @@ def generate_templates(
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
+ 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
+ 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:
+ with open(new_path, 'w') as f:
f.write(_template)
@@ -280,9 +287,9 @@ def run_hooks(folder: str):
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])
+ subprocess.run(['python', '-O', file_path])
elif str(file_name).endswith(".sh"):
- subprocess.run(["sh", file_path])
+ subprocess.run(['sh', file_path])
def process_image(image_path, quality=2, num_colors=128):
@@ -290,18 +297,18 @@ def process_image(image_path, quality=2, num_colors=128):
global cache_path
_cache_path = join(cache_path, "cached_colors")
hash_object = hashlib.md5(image_path.encode())
- cache_filename = hash_object.hexdigest() + ".pkl"
+ 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:
+ 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:
+ with open(cache_path, 'wb') as f:
pickle.dump(data, f)
cache_path = get_cache_path(image_path)
@@ -310,7 +317,7 @@ def process_image(image_path, quality=2, num_colors=128):
if cached_result is not None:
return cached_result
- image = Image.open(image_path).convert("RGB")
+ image = Image.open(image_path).convert('RGB')
image_data = np.array(image)
pixel_array = image_data[::quality, ::quality].reshape(-1, 3)
@@ -325,11 +332,8 @@ def process_image(image_path, quality=2, num_colors=128):
def main(
- color_scheme: str,
- image_path: str,
- use_color: int | None = None,
- scheme_name: str | None = None,
- contrast_level: int = 0,
+ 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]
@@ -340,31 +344,34 @@ def main(
else:
color = use_color
- scheme = scheme(Hct.from_int(color), is_dark, contrast_level)
+ 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)
+ 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,
+ 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")])
+ subprocess.run(['sh', join(script_dir, 'gtk-material.sh')])
else:
- subprocess.run(["sh", join(script_dir, "gtk-material.sh"), "--light"])
+ subprocess.run(['sh', join(script_dir, 'gtk-material.sh'), '--light'])
run_hooks(join(script_dir, "hooks"))
@@ -372,27 +379,26 @@ def main(
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"
+ "-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("--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",
+ '--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",
+ '--scheme', type=str, default="",
+ choices=list(schemes.keys()), help="Scheme for color generation"
)
args = parser.parse_args()
@@ -404,23 +410,15 @@ def _argparse() -> tuple[bool, bool, str, str, str, str]:
use_color = args.color
scheme = args.scheme
return (
- restore_palette,
- use_last_used_wallpaper,
- image,
- color_scheme,
- use_color,
- scheme,
+ 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,
+ restore_palette, use_last_used_wallpaper, image,
+ color_scheme, use_color, scheme
) = _argparse()
if not scheme:
scheme = None
@@ -429,17 +427,13 @@ def _main():
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,
+ 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,
+ color_scheme, image_path="/dev/null",
+ use_color=int(use_color.lstrip('#'), 16), scheme_name=scheme
)
elif restore_palette:
@@ -450,7 +444,7 @@ def _main():
image_path=content.wallpaper,
use_color=content.original_color,
scheme_name=scheme or content.scheme_name,
- contrast_level=content.contrast_level,
+ contrast_level=content.contrast_level
)
elif use_last_used_wallpaper:
with open(join(cache_path, "colors.json")) as f:
@@ -459,12 +453,13 @@ def _main():
color_scheme,
image_path=content.wallpaper,
scheme_name=scheme or content.scheme_name,
- contrast_level=content.contrast_level,
+ 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"))
+ f for f in os.listdir(image)
+ if f.endswith(('.png', '.jpg', '.jpeg'))
]
if files:
image = join(image, random.choice(files))
diff --git a/config/material-colors/templates/alacritty-dark.toml b/config/material-colors/templates/alacritty-dark.toml
new file mode 100644
index 00000000..3f3c701b
--- /dev/null
+++ b/config/material-colors/templates/alacritty-dark.toml
@@ -0,0 +1,72 @@
+[colors.primary]
+background = ''
+foreground = ''
+
+
+[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'
diff --git a/config/material-colors/templates/alacritty-light.toml b/config/material-colors/templates/alacritty-light.toml
new file mode 100644
index 00000000..a86bdecd
--- /dev/null
+++ b/config/material-colors/templates/alacritty-light.toml
@@ -0,0 +1,72 @@
+[colors.primary]
+background = ''
+foreground = ''
+
+
+[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'
diff --git a/config/material-colors/templates/alacritty.toml b/config/material-colors/templates/alacritty.toml
new file mode 100644
index 00000000..f62d7013
--- /dev/null
+++ b/config/material-colors/templates/alacritty.toml
@@ -0,0 +1,10 @@
+[general]
+import = [
+ "/alacritty-.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
diff --git a/config/material-colors/templates/material-discord.scss b/config/material-colors/templates/material-discord.scss
index ca6cc513..607ee998 100644
--- a/config/material-colors/templates/material-discord.scss
+++ b/config/material-colors/templates/material-discord.scss
@@ -11,46 +11,45 @@ $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;
+ transition: color 0.2s ease-in-out;
+ transition-property: background-color, color;
}
.theme-#{$color-scheme} {
- --main-color: #{$background};
- --main-alt: #{$surfaceContainerLow};
+ --main-color: #{$background};
+ --main-alt: #{$surfaceContainerLow};
- --message-color: #{$surfaceContainerLowest};
- --message-color-hover: #{$surfaceContainer};
- --message-color-alt: #{$surfaceContainer};
- --attachment-color: #{$background};
+ --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};
+ --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};
+ --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};
+ --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};
+ fill: #{$onPrimary};
}
[class*="repliedTextContent_"] {
- padding: 0px 5px 0px 5px !important;
+ padding: 0px 5px 0px 5px !important;
}
[class*="userPopoutOuter_"] {
- border-radius: 16px !important;
+ border-radius: 16px !important;
}
-
diff --git a/config/modus/assets/config.json b/config/modus/assets/config.json
new file mode 100644
index 00000000..1a52b6f7
--- /dev/null
+++ b/config/modus/assets/config.json
@@ -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\")",
+ ":sh": "launcher.open(\"power\")"
+ }
+}
diff --git a/config/fabric/assets/emoji.json b/config/modus/assets/emoji.json
similarity index 100%
rename from config/fabric/assets/emoji.json
rename to config/modus/assets/emoji.json
diff --git a/config/fabric/assets/scripts/dark-theme.sh b/config/modus/assets/scripts/dark-theme.sh
similarity index 100%
rename from config/fabric/assets/scripts/dark-theme.sh
rename to config/modus/assets/scripts/dark-theme.sh
diff --git a/config/fabric/assets/scripts/wayland-idle-inhibitor.py b/config/modus/assets/scripts/wayland-idle-inhibitor.py
similarity index 100%
rename from config/fabric/assets/scripts/wayland-idle-inhibitor.py
rename to config/modus/assets/scripts/wayland-idle-inhibitor.py
diff --git a/config/modus/main.py b/config/modus/main.py
new file mode 100644
index 00000000..56baf289
--- /dev/null
+++ b/config/modus/main.py
@@ -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()
diff --git a/config/fabric/modules/bar/bar.py b/config/modus/modules/bar/bar.py
similarity index 77%
rename from config/fabric/modules/bar/bar.py
rename to config/modus/modules/bar/bar.py
index 12f7ab1f..9842b2a6 100644
--- a/config/fabric/modules/bar/bar.py
+++ b/config/modus/modules/bar/bar.py
@@ -6,7 +6,7 @@ from fabric.widgets.button import Button
from fabric.widgets.centerbox import CenterBox
from fabric.widgets.datetime import DateTime
from fabric.widgets.wayland import WaylandWindow as Window
-from modules.bar.widgets import (
+from modules.bar.components import (
BatteryLabel,
BluetoothIndicator,
IdleIndicator,
@@ -17,22 +17,13 @@ from modules.bar.widgets import (
TaskBar,
VolumeIndicator,
workspace,
- Recorder,
)
-from services import ScreenRecorder
from snippets import MaterialIcon
+from services import sc
class Bar(Window):
def __init__(self):
- super().__init__(
- layer="top",
- anchor="left bottom right",
- exclusivity="auto",
- visible=False,
- all_visible=False,
- )
- self.screen_recorder = ScreenRecorder()
self.workspaces = Button(child=workspace, name="workspaces")
self.language = Language(
formatter=FormattedString(
@@ -45,20 +36,20 @@ class Bar(Window):
),
),
)
- self.date_time = DateTime(formatters=["%-I:%M %a %d %b"], name="datetime")
self.recording_indicator = Button(
- name="bar-button",
- child=MaterialIcon("screen_record", size=16),
+ name="recording-indicator",
+ child=MaterialIcon("screen_record", 14),
visible=False,
- on_clicked=lambda *_: self.screen_recorder.screencast_stop(),
+ on_clicked=lambda *_: sc.screencast_stop(),
)
- self.screen_recorder.connect(
- "recording",
- lambda _, status: self.recording_indicator.set_visible(status),
+ 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()
@@ -69,7 +60,6 @@ class Bar(Window):
self.info = SystemInfo()
self.powerindicator = PowerProfileIndicator()
self.tray = SystemTray(name="tray", icon_size=16, spacing=4)
- self.recorder = Recorder()
self.applets = Box(
name="applets",
@@ -86,7 +76,7 @@ class Bar(Window):
],
)
- self.children = CenterBox(
+ self.bar = CenterBox(
name="bar",
start_children=Box(
name="start-container",
@@ -108,7 +98,7 @@ class Bar(Window):
spacing=8,
orientation="h",
children=[
- self.recorder,
+ self.recording_indicator,
self.tray,
self.battery,
self.applets,
@@ -116,5 +106,24 @@ class Bar(Window):
],
),
)
+ super().__init__(
+ layer="top",
+ anchor="left bottom right",
+ # anchor="left top right",
+ exclusivity="auto",
+ visible=True,
+ child=self.bar,
+ )
- self.show_all()
+ 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")
diff --git a/config/fabric/modules/bar/widgets/__init__.py b/config/modus/modules/bar/components/__init__.py
similarity index 91%
rename from config/fabric/modules/bar/widgets/__init__.py
rename to config/modus/modules/bar/components/__init__.py
index 0c03b6da..278c35fd 100644
--- a/config/fabric/modules/bar/widgets/__init__.py
+++ b/config/modus/modules/bar/components/__init__.py
@@ -1,7 +1,7 @@
from .battery import *
from .bluetooth import *
from .idle import *
-from .info import *
+from .stats import *
from .microphone import *
from .network import *
from .powerprofile import *
diff --git a/config/fabric/modules/bar/widgets/battery.py b/config/modus/modules/bar/components/battery.py
similarity index 95%
rename from config/fabric/modules/bar/widgets/battery.py
rename to config/modus/modules/bar/components/battery.py
index ea82395a..0d298202 100644
--- a/config/fabric/modules/bar/widgets/battery.py
+++ b/config/modus/modules/bar/components/battery.py
@@ -43,7 +43,7 @@ class BatteryLabel(Box):
self.hide()
return
- battery_percent = round(battery.percent) if battery else 0.0
+ battery_percent = round(battery.percent)
battery_label = Label(label=f"{battery_percent}%")
is_charging = battery.power_plugged if battery else False
diff --git a/config/fabric/modules/bar/widgets/bluetooth.py b/config/modus/modules/bar/components/bluetooth.py
similarity index 100%
rename from config/fabric/modules/bar/widgets/bluetooth.py
rename to config/modus/modules/bar/components/bluetooth.py
diff --git a/config/fabric/modules/bar/widgets/idle.py b/config/modus/modules/bar/components/idle.py
similarity index 94%
rename from config/fabric/modules/bar/widgets/idle.py
rename to config/modus/modules/bar/components/idle.py
index 6cfb1a0f..6ad444af 100644
--- a/config/fabric/modules/bar/widgets/idle.py
+++ b/config/modus/modules/bar/components/idle.py
@@ -5,7 +5,6 @@ from snippets import MaterialIcon
class IdleIndicator(Box):
-
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.idle_icon = self.create_idle_icon()
@@ -14,10 +13,9 @@ class IdleIndicator(Box):
self.children = [self.idle_icon]
def create_idle_icon(self):
- return MaterialIcon("schedule", size=16)
+ 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)
diff --git a/config/fabric/modules/bar/widgets/microphone.py b/config/modus/modules/bar/components/microphone.py
similarity index 100%
rename from config/fabric/modules/bar/widgets/microphone.py
rename to config/modus/modules/bar/components/microphone.py
diff --git a/config/fabric/modules/bar/widgets/network.py b/config/modus/modules/bar/components/network.py
similarity index 100%
rename from config/fabric/modules/bar/widgets/network.py
rename to config/modus/modules/bar/components/network.py
diff --git a/config/fabric/modules/bar/widgets/powerprofile.py b/config/modus/modules/bar/components/powerprofile.py
similarity index 93%
rename from config/fabric/modules/bar/widgets/powerprofile.py
rename to config/modus/modules/bar/components/powerprofile.py
index 34884adf..a1817cc2 100644
--- a/config/fabric/modules/bar/widgets/powerprofile.py
+++ b/config/modus/modules/bar/components/powerprofile.py
@@ -30,7 +30,7 @@ class PowerProfileIndicator(Box):
def update_icon(self, profile):
icon_name = PROFILE_ICONS.get(profile)
- new_icon = MaterialIcon(icon_name, size=16) if icon_name else None
+ new_icon = MaterialIcon(icon_name, 16) if icon_name else None
if self.profile_icon:
self.remove(self.profile_icon)
diff --git a/config/fabric/modules/bar/widgets/info.py b/config/modus/modules/bar/components/stats.py
similarity index 71%
rename from config/fabric/modules/bar/widgets/info.py
rename to config/modus/modules/bar/components/stats.py
index 18f095f8..8ab3cf4b 100644
--- a/config/fabric/modules/bar/widgets/info.py
+++ b/config/modus/modules/bar/components/stats.py
@@ -1,3 +1,4 @@
+from time import sleep
import psutil
from fabric import Fabricator
from fabric.widgets.box import Box
@@ -18,10 +19,15 @@ class SystemInfo(Button):
def __init__(self):
super().__init__(child=self._initialize_content())
- self.fabricator = Fabricator(poll_from=self._refresh_system_info, interval=1000)
+
+ 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="info")
+ self.box = Box(orientation="h", name="tray")
self.progress_bars = {}
self.labels = {}
self.icons = {}
@@ -36,7 +42,9 @@ class SystemInfo(Button):
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])
+ 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)
@@ -51,32 +59,29 @@ class SystemInfo(Button):
def _create_icon(self, icon_name):
return MaterialIcon(icon_name, size=16)
- def _refresh_system_info(self, *_):
- usages = self._retrieve_system_data()
- self._update_tooltip(usages)
- return True
+ 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 temps["coretemp"][0].current
+ return round(temps["coretemp"][0].current, 1)
elif "cpu_thermal" in temps:
- return temps["cpu_thermal"][0].current
+ return round(temps["cpu_thermal"][0].current, 1)
return None
except Exception:
return None
- def _retrieve_system_data(self):
- return {
- "CPU": round(psutil.cpu_percent()),
- "RAM": round(psutil.virtual_memory().percent),
- "Swap": round(psutil.swap_memory().percent),
- "Temp": self._get_device_temperature(),
- }
-
- def _update_tooltip(self, usages):
+ def _update_ui(self, usages):
for system, usage in usages.items():
if usage is None:
usage = 0
diff --git a/config/modus/modules/bar/components/taskbar.py b/config/modus/modules/bar/components/taskbar.py
new file mode 100644
index 00000000..09bb7bb6
--- /dev/null
+++ b/config/modus/modules/bar/components/taskbar.py
@@ -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 = 24, **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
diff --git a/config/fabric/modules/bar/widgets/volume.py b/config/modus/modules/bar/components/volume.py
similarity index 95%
rename from config/fabric/modules/bar/widgets/volume.py
rename to config/modus/modules/bar/components/volume.py
index b6577678..0fed57c9 100644
--- a/config/fabric/modules/bar/widgets/volume.py
+++ b/config/modus/modules/bar/components/volume.py
@@ -1,9 +1,9 @@
from fabric import Fabricator
-from fabric.audio.service import Audio
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",
@@ -18,7 +18,7 @@ class VolumeIndicator(Box):
def __init__(self, **kwargs):
super().__init__(**kwargs)
- self.audio_service = Audio()
+ self.audio_service = audio
self.volume_icon_button = self.create_volume_icon()
self.volume_icon_button.connect("button-press-event", self.on_button_press)
@@ -43,7 +43,7 @@ class VolumeIndicator(Box):
current_stream = self.audio_service.speaker
if current_stream:
current_stream.muted = not current_stream.muted
- self.update_volume_status()
+ # self.update_volume_status()
def open_audio_settings(self):
exec_shell_command("pavucontrol")
diff --git a/config/fabric/modules/bar/widgets/workspace.py b/config/modus/modules/bar/components/workspace.py
similarity index 100%
rename from config/fabric/modules/bar/widgets/workspace.py
rename to config/modus/modules/bar/components/workspace.py
diff --git a/config/modus/modules/corners.py b/config/modus/modules/corners.py
new file mode 100644
index 00000000..10ce26d3
--- /dev/null
+++ b/config/modus/modules/corners.py
@@ -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()
diff --git a/config/modus/modules/launcher/components/__init__.py b/config/modus/modules/launcher/components/__init__.py
new file mode 100644
index 00000000..d2a8f85c
--- /dev/null
+++ b/config/modus/modules/launcher/components/__init__.py
@@ -0,0 +1,10 @@
+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 *
+# from .window_switcher import *
diff --git a/config/modus/modules/launcher/components/applauncher.py b/config/modus/modules/launcher/components/applauncher.py
new file mode 100644
index 00000000..4e755ae4
--- /dev/null
+++ b/config/modus/modules/launcher/components/applauncher.py
@@ -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)
diff --git a/config/modus/modules/launcher/components/bluetooth.py b/config/modus/modules/launcher/components/bluetooth.py
new file mode 100644
index 00000000..6a3adc7f
--- /dev/null
+++ b/config/modus/modules/launcher/components/bluetooth.py
@@ -0,0 +1,128 @@
+from fabric.widgets.box import Box
+from fabric.widgets.label import Label
+from fabric.widgets.image import Image
+from fabric.widgets.button import Button
+from fabric.widgets.centerbox import CenterBox
+from fabric.widgets.scrolledwindow import ScrolledWindow
+from fabric.bluetooth import BluetoothClient, BluetoothDevice
+from snippets import MaterialIcon
+
+
+class BluetoothDeviceSlot(CenterBox):
+ def __init__(self, device: BluetoothDevice, **kwargs):
+ super().__init__(name="bluetooth-device", **kwargs)
+ self.device = device
+ self.device.connect("changed", self.on_changed)
+ self.device.connect(
+ "notify::closed", lambda *_: self.device.closed and self.destroy()
+ )
+
+ self.connection_icon = MaterialIcon("bluetooth_disabled", 12)
+ self.connect_button = Button(
+ name="bluetooth-connect",
+ label="Connect",
+ on_clicked=lambda *_: self.device.set_connecting(not self.device.connected),
+ )
+
+ self.start_children = [
+ Box(
+ spacing=8,
+ children=[
+ Image(icon_name=device.icon_name + "-symbolic", size=32),
+ Label(label=device.name),
+ self.connection_icon,
+ ],
+ )
+ ]
+ self.end_children = self.connect_button
+
+ self.device.emit("changed") # to update display status
+
+ def on_changed(self, *_):
+ self.connection_icon.set_label(
+ "bluetooth" if self.device.connected else "bluetooth_disabled"
+ )
+
+ if self.device.connecting:
+ self.connect_button.set_label(
+ "Connecting..." if not self.device.connecting else "Disconnecting..."
+ )
+ else:
+ self.connect_button.set_label(
+ "Connect" if not self.device.connected else "Disconnect"
+ )
+ return
+
+
+class BluetoothConnections(Box):
+ def __init__(self, **kwargs):
+ super().__init__(
+ name="bluetooth",
+ spacing=8,
+ orientation="vertical",
+ **kwargs,
+ )
+
+ self.client = BluetoothClient(on_device_added=self.on_device_added)
+ self.toggle_icon = MaterialIcon("bluetooth_disabled")
+ self.scan_icon = MaterialIcon("bluetooth_searching")
+
+ self.scan_button = Button(
+ name="bluetooth-scan",
+ child=self.scan_icon,
+ tooltip_text="scan",
+ on_clicked=lambda *_: self.client.toggle_scan(),
+ )
+ self.toggle_button = Button(
+ name="bluetooth-toggle",
+ tooltip_text="bluetooth-toggle",
+ child=self.toggle_icon,
+ on_clicked=lambda *_: self.client.toggle_power(),
+ )
+
+ self.client.connect(
+ "notify::enabled",
+ lambda *_: self.toggle_icon.set_label(
+ "bluetooth" if self.client.enabled else "bluetooth_disabled"
+ ),
+ )
+ self.client.connect(
+ "notify::scanning",
+ lambda *_: self.scan_icon.set_label(
+ "Stop" if self.client.scanning else "bluetooth_searching"
+ ),
+ )
+
+ self.paired_box = Box(spacing=2, orientation="vertical")
+ self.available_box = Box(spacing=2, orientation="vertical")
+
+ self.children = [
+ CenterBox(
+ name="bluetooth-header",
+ start_children=self.scan_button,
+ center_children=Label(name="bluetooth-text", label="Bluetooth Devices"),
+ end_children=self.toggle_button,
+ ),
+ Label(name="bluetooth-section", label="Paired"),
+ ScrolledWindow(
+ name="bluetooth-paired", v_expand=True, child=self.paired_box
+ ),
+ Label(name="bluetooth-section", label="Available"),
+ ScrolledWindow(
+ name="bluetooth-paired", v_expand=True, child=self.available_box
+ ),
+ ]
+
+ # to run notify closures thus display the status
+ # without having to wait until an actual change
+ self.client.notify("scanning")
+ self.client.notify("enabled")
+
+ def on_device_added(self, client: BluetoothClient, address: str):
+ if not (device := client.get_device(address)):
+ return
+ slot = BluetoothDeviceSlot(device)
+
+ if device.paired:
+ return self.paired_box.add(slot)
+ return self.available_box.add(slot)
diff --git a/config/modus/modules/launcher/components/cliphist.py b/config/modus/modules/launcher/components/cliphist.py
new file mode 100644
index 00000000..6ccf8630
--- /dev/null
+++ b/config/modus/modules/launcher/components/cliphist.py
@@ -0,0 +1,205 @@
+import os
+import subprocess
+from typing import List
+
+from fabric import Fabricator
+from fabric.utils import 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
+from snippets import MaterialIcon
+
+
+class Cliphist(Box):
+ def __init__(self, **kwargs):
+ super().__init__(
+ name="cliphist-launcher",
+ all_visible=False,
+ visible=False,
+ **kwargs,
+ )
+
+ self._arranger_handler = 0
+ self.cliphist_manager = CliphistManager(self)
+ self.viewport = None
+ self.launcher = kwargs["launcher"]
+
+ self.search_entry = Entry(
+ name="search-entry",
+ h_expand=True,
+ notify_text=lambda entry, *_: self.handle_search_input(entry.get_text()),
+ on_activate=lambda entry, *_: self.handle_search_input(entry.get_text()),
+ )
+
+ self.toggle_button = Button(
+ child=MaterialIcon("delete_forever"),
+ name="clear-launcher-button",
+ on_clicked=self.on_button_clicked,
+ )
+
+ self.header_box = Box(
+ name="header-box",
+ spacing=10,
+ orientation="h",
+ children=[self.search_entry, self.toggle_button],
+ )
+
+ self.launcher_box = Box(
+ name="cliphist-launcher-box",
+ spacing=10,
+ orientation="v",
+ h_expand=True,
+ children=[self.header_box],
+ )
+
+ self.add(self.launcher_box)
+
+ def on_button_clicked(self, *_):
+ GLib.spawn_command_line_async("cliphist wipe")
+ self.cliphist_manager.update_cliphist_history()
+
+ def open_launcher(self):
+ if not self.viewport:
+ self.viewport = Box(name="viewport", spacing=4, orientation="v")
+ self.scrolled_window = ScrolledWindow(
+ name="cliphist-history",
+ spacing=10,
+ h_scrollbar_policy="never",
+ child=self.viewport,
+ )
+ self.launcher_box.add(self.scrolled_window)
+
+ self.viewport.children = []
+ self.cliphist_manager.arrange_viewport()
+
+ self.viewport.show()
+ self.search_entry.grab_focus()
+
+ def close_launcher(self):
+ self.launcher.close()
+
+ def handle_search_input(self, text: str):
+ self.cliphist_manager.arrange_viewport(text)
+
+
+class CliphistManager:
+ def __init__(self, launcher):
+ self.launcher = launcher
+ self.cliphist_history = []
+ self.wl_paste_watcher = Fabricator(
+ poll_from="wl-paste --watch echo", stream=True, interval=-1
+ )
+ self.wl_paste_watcher.connect(
+ "changed", lambda *_: self.update_cliphist_history()
+ )
+
+ def get_clip_history(self) -> List[dict]:
+ try:
+ result = subprocess.run(
+ ["cliphist", "list"], capture_output=True, text=True, check=True
+ )
+ return self._parse_clip_history(result.stdout)
+ except subprocess.CalledProcessError as e:
+ print(f"Error fetching cliphist history: {e}")
+ return []
+
+ def _parse_clip_history(self, output: str) -> List[dict]:
+ items = []
+ for line in output.splitlines():
+ if line.strip():
+ parts = line.strip().split(maxsplit=1)
+ if len(parts) == 2:
+ items.append({"id": parts[0], "content": parts[1]})
+ return items
+
+ def copy_clip(self, clip_id: str):
+ try:
+ decode_result = subprocess.run(
+ ["cliphist", "decode", clip_id], capture_output=True, check=True
+ )
+ subprocess.run(["wl-copy"], input=decode_result.stdout, check=True)
+ self.launcher.close_launcher()
+ except subprocess.CalledProcessError as e:
+ print(f"Error copying clip {clip_id}: {e}")
+
+ def save_image_file(self, clip_id: str) -> str:
+ output_file = f"/tmp/cliphist-{clip_id}.png"
+ os.makedirs("/tmp", exist_ok=True)
+
+ try:
+ decode_result = subprocess.run(
+ ["cliphist", "decode", clip_id], capture_output=True, check=True
+ )
+
+ with open(output_file, "wb") as f:
+ f.write(decode_result.stdout)
+
+ return output_file
+ except (subprocess.CalledProcessError, IOError) as e:
+ print(f"Error saving image file for clip {clip_id}: {e}")
+ return ""
+
+ def query_clips(self, query: str = "") -> List[dict]:
+ history = self.get_clip_history()
+
+ if not query.strip():
+ return history
+
+ return [item for item in history if query.lower() in item["content"].lower()]
+
+ def bake_clip_slot(self, item: dict) -> Button:
+ if "[[ binary data" in item["content"].lower():
+ return self._create_image_button(item)
+ return self._create_text_button(item)
+
+ def _create_image_button(self, item: dict) -> Button:
+ output_file = self.save_image_file(item["id"])
+ if output_file and os.path.exists(output_file):
+ button = Button(
+ h_align="start",
+ name="clip-img-item",
+ on_clicked=lambda _, clip_id=item["id"]: self.copy_clip(clip_id),
+ )
+
+ button.set_style(
+ f"background-image: url('{output_file}'); background-size: cover; background-position: center;"
+ )
+ return button
+
+ return None
+
+ def _create_text_button(self, item: dict) -> Button:
+ return Button(
+ child=Label(
+ label=item["content"][:55]
+ + ("..." if len(item["content"]) > 55 else ""),
+ h_expand=True,
+ v_align="center",
+ h_align="start",
+ ),
+ on_clicked=lambda _, clip_id=item["id"]: self.copy_clip(clip_id),
+ name="clip-item",
+ )
+
+ def update_cliphist_history(self):
+ self.cliphist_history = self.get_clip_history()
+ if self.launcher.viewport:
+ GLib.idle_add(self.arrange_viewport)
+
+ def arrange_viewport(self, query: str = ""):
+ if not self.launcher.viewport:
+ return
+
+ if self.launcher._arranger_handler:
+ remove_handler(self.launcher._arranger_handler)
+
+ self.launcher.viewport.children = []
+ filtered_clips = self.query_clips(query)
+
+ for clip in filtered_clips:
+ button = self.bake_clip_slot(clip)
+ if button:
+ self.launcher.viewport.add(button)
diff --git a/config/modus/modules/launcher/components/emoji.py b/config/modus/modules/launcher/components/emoji.py
new file mode 100644
index 00000000..0f4d49a2
--- /dev/null
+++ b/config/modus/modules/launcher/components/emoji.py
@@ -0,0 +1,139 @@
+import os
+import subprocess
+from typing import Generator, List
+
+import ijson
+from fabric.utils import 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
+from snippets import MaterialIcon
+
+
+class Emoji(Box):
+ def __init__(self, **kwargs):
+ super().__init__(
+ name="emoji-launcher",
+ all_visible=False,
+ visible=False,
+ **kwargs,
+ )
+
+ self.launcher = kwargs["launcher"]
+ self._arranger_handler: int = 0
+ self.emoji_manager = EmojiManager(self)
+ self.viewport = None
+
+ self.search_entry = Entry(
+ name="search-entry",
+ h_expand=True,
+ notify_text=lambda entry, *_: self.handle_search_input(entry.get_text()),
+ on_activate=lambda entry, *_: self.handle_search_input(entry.get_text()),
+ )
+
+ self.header_box = Box(
+ name="header-box",
+ spacing=10,
+ orientation="h",
+ children=[
+ self.search_entry,
+ ],
+ )
+
+ self.launcher_box = Box(
+ spacing=10,
+ orientation="v",
+ h_expand=True,
+ children=[self.header_box],
+ )
+
+ self.add(self.launcher_box)
+
+ def open_launcher(self):
+ if not self.viewport:
+ self.viewport = Box(name="viewport", spacing=4, orientation="v")
+ self.scrolled_window = ScrolledWindow(
+ name="scrolled-window",
+ spacing=10,
+ h_scrollbar_policy="never",
+ v_scrollbar_policy="never",
+ child=self.viewport,
+ )
+ self.launcher_box.add(self.scrolled_window)
+
+ self.viewport.children = []
+ self.emoji_manager.arrange_viewport()
+
+ self.viewport.show()
+ self.search_entry.grab_focus()
+
+ def close_launcher(self):
+ self.launcher.close()
+
+ def handle_search_input(self, text: str):
+ self.emoji_manager.arrange_viewport(text)
+
+
+class EmojiManager:
+ def __init__(self, launcher):
+ self.launcher = launcher
+ self.emoji_file_path = os.path.expanduser("~/modus/assets/emoji.json")
+
+ def load_emojis(self) -> Generator[tuple, None, None]:
+ if not os.path.exists(self.emoji_file_path):
+ print(f"Emoji file not found: {self.emoji_file_path}")
+ return
+ try:
+ with open(self.emoji_file_path, "r") as file:
+ for emoji_str, item in ijson.kvitems(file, ""):
+ yield emoji_str, item["name"], item["slug"], item["group"]
+ except (ijson.JSONError, KeyError, OSError) as e:
+ print(f"Error loading emojis: {e}")
+ return
+
+ def query_emojis(self, query: str) -> List[tuple]:
+ query = query.lower()
+ return [
+ (emoji_str, name, slug, group)
+ for emoji_str, name, slug, group in self.load_emojis()
+ if query in name.lower() or query in slug.lower() or query in group.lower()
+ ][:48]
+
+ def copy_emoji(self, emoji: tuple):
+ subprocess.run(["wl-copy"], input=emoji[0].encode(), check=True)
+ self.launcher.close_launcher()
+
+ def bake_emoji_slot(self, emoji: tuple, **kwargs) -> Button:
+ return Button(
+ name="emoji-item",
+ child=Label(label=emoji[0], h_align="center"),
+ tooltip_text=emoji[1],
+ on_clicked=lambda *_: self.copy_emoji(emoji),
+ **kwargs,
+ )
+
+ def arrange_viewport(self, query: str = ""):
+ if not self.launcher.viewport:
+ return
+
+ (
+ remove_handler(self.launcher._arranger_handler)
+ if self.launcher._arranger_handler
+ else None
+ )
+ self.launcher.viewport.children = []
+
+ filtered_emojis = self.query_emojis(query)
+
+ row = Box(name="emoji-row", spacing=10, orientation="h")
+ for emoji in filtered_emojis:
+ row.add(self.bake_emoji_slot(emoji))
+ if len(row.children) >= 12:
+ self.launcher.viewport.add(row)
+ row = Box(name="emoji-row", spacing=10, orientation="h")
+
+ if row.children:
+ self.launcher.viewport.add(row)
diff --git a/config/modus/modules/launcher/components/power.py b/config/modus/modules/launcher/components/power.py
new file mode 100644
index 00000000..e00efa13
--- /dev/null
+++ b/config/modus/modules/launcher/components/power.py
@@ -0,0 +1,88 @@
+from fabric.widgets.box import Box
+from fabric.widgets.button import Button
+from gi.repository import GLib
+
+from snippets import MaterialIcon
+
+
+class PowerMenu(Box):
+ def __init__(self, **kwargs):
+ super().__init__(
+ name="powermenu",
+ orientation="h",
+ spacing=10,
+ v_align="center",
+ h_align="center",
+ v_expand=True,
+ h_expand=True,
+ visible=True,
+ **kwargs,
+ )
+
+ self.launcher = kwargs["launcher"]
+
+ self.btn_lock = Button(
+ name="powermenu-button",
+ child=MaterialIcon("lock", 45),
+ on_clicked=self.lock,
+ )
+
+ self.btn_suspend = Button(
+ name="powermenu-button",
+ child=MaterialIcon("sleep", 45),
+ on_clicked=self.suspend,
+ )
+
+ self.btn_logout = Button(
+ name="powermenu-button",
+ child=MaterialIcon("logout", 45),
+ on_clicked=self.logout,
+ )
+
+ self.btn_reboot = Button(
+ name="powermenu-button",
+ child=MaterialIcon("restart_alt", 45),
+ on_clicked=self.reboot,
+ )
+
+ self.btn_shutdown = Button(
+ name="powermenu-button",
+ child=MaterialIcon("power_settings_new", 45),
+ on_clicked=self.poweroff,
+ )
+
+ self.buttons = [
+ self.btn_lock,
+ self.btn_suspend,
+ self.btn_logout,
+ self.btn_reboot,
+ self.btn_shutdown,
+ ]
+
+ for button in self.buttons:
+ self.add(button)
+
+ self.show_all()
+
+ def close_menu(self):
+ self.launcher.close()
+
+ def lock(self, *_):
+ GLib.spawn_command_line_async("hyprlock --immediate")
+ self.close_menu()
+
+ def suspend(self, *_):
+ GLib.spawn_command_line_async("systemctl suspend")
+ self.close_menu()
+
+ def logout(self, *_):
+ GLib.spawn_command_line_async("hyprctl dispatch exit")
+ self.close_menu()
+
+ def reboot(self, *_):
+ GLib.spawn_command_line_async("systemctl reboot")
+ self.close_menu()
+
+ def poweroff(self, *_):
+ GLib.spawn_command_line_async("systemctl poweroff")
+ self.close_menu()
diff --git a/config/modus/modules/launcher/components/sh.py b/config/modus/modules/launcher/components/sh.py
new file mode 100644
index 00000000..5992ec8f
--- /dev/null
+++ b/config/modus/modules/launcher/components/sh.py
@@ -0,0 +1,138 @@
+import os
+import subprocess
+from typing import List
+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 snippets import MaterialIcon
+
+CACHE_DIR = os.getenv(
+ "XDG_CACHE_HOME", os.path.join(os.path.expanduser("~"), ".cache", "fabric")
+)
+BINS = os.path.join(CACHE_DIR, "binaries")
+
+
+class Sh(Box):
+ def __init__(self, **kwargs):
+ super().__init__(
+ all_visible=False,
+ visible=False,
+ **kwargs,
+ )
+
+ self.launcher = kwargs["launcher"]
+ self._arranger_handler: int = 0
+ self.shell_command_manager = ShellCommandManager(self)
+ self.viewport = None
+
+ self.search_entry = Entry(
+ name="search-entry",
+ h_expand=True,
+ notify_text=lambda entry, *_: self.handle_search_input(entry.get_text()),
+ on_activate=lambda entry, *_: self.handle_search_input(entry.get_text()),
+ )
+
+ self.header_box = Box(
+ spacing=10,
+ orientation="h",
+ children=[self.search_entry, MaterialIcon("terminal")],
+ )
+
+ self.launcher_box = Box(
+ spacing=10,
+ orientation="v",
+ h_expand=True,
+ children=[self.header_box],
+ )
+
+ self.add(self.launcher_box)
+
+ def open_launcher(self):
+ if not self.viewport:
+ self.viewport = Box(name="viewport", spacing=10, orientation="v")
+ self.scrolled_window = ScrolledWindow(
+ spacing=10,
+ h_scrollbar_policy="never",
+ v_scrollbar_policy="never",
+ child=self.viewport,
+ )
+ self.launcher_box.add(self.scrolled_window)
+
+ self.viewport.children = []
+ self.shell_command_manager.show_shell_commands(self.viewport, "")
+
+ self.viewport.show()
+ self.search_entry.grab_focus()
+
+ def handle_search_input(self, text: str):
+ self.shell_command_manager.show_shell_commands(self.viewport, text)
+
+
+class ShellCommandManager:
+ def __init__(self, launcher):
+ self.launcher = launcher
+ self.binaries = set()
+ self.reload_binaries()
+
+ def reload_binaries(self):
+ paths = os.getenv("PATH", "").split(":")
+ self.binaries = set()
+
+ for path in paths:
+ self.binaries.update(self.list_binaries_in_path(path))
+
+ with open(BINS, "w") as f:
+ f.write("\n".join(self.binaries))
+
+ def list_binaries_in_path(self, path):
+ if not os.path.exists(path):
+ return []
+ try:
+ return [
+ entry
+ for entry in os.listdir(path)
+ if os.access(os.path.join(path, entry), os.X_OK)
+ ]
+ except OSError:
+ return []
+
+ def show_shell_commands(self, viewport, search_query: str):
+ if not search_query:
+ return
+
+ viewport.children = []
+
+ results = self.query_binaries(search_query)
+ self.display_results(viewport, results)
+
+ def query_binaries(self, filter_str: str) -> List[str]:
+ filter_str = filter_str.lower()
+ filtered_bins = (cmd for cmd in self.binaries if filter_str in cmd)
+ return list(dict.fromkeys(filtered_bins))[:16]
+
+ def display_results(self, viewport, results: List[str]):
+ for command in results:
+ button = Button(
+ child=Label(
+ label=command,
+ v_align="center",
+ h_align="start",
+ ),
+ on_clicked=lambda _, cmd=command: self.execute_command(cmd),
+ name="sh-item",
+ )
+ viewport.add(button)
+
+ def close_menu(self):
+ self.launcher.close()
+
+ def execute_command(self, cmd: str):
+ try:
+ output = subprocess.check_output(cmd, shell=True, text=True)
+ print(output)
+ except subprocess.CalledProcessError as e:
+ print(e.output)
+ finally:
+ self.close_menu()
diff --git a/config/modus/modules/launcher/components/todo.py b/config/modus/modules/launcher/components/todo.py
new file mode 100644
index 00000000..7cc569b4
--- /dev/null
+++ b/config/modus/modules/launcher/components/todo.py
@@ -0,0 +1,168 @@
+import json
+import os
+
+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 snippets import MaterialIcon
+
+
+class TodoManager(Box):
+ def __init__(self, **kwargs):
+ super().__init__(
+ name="todo-launcher",
+ all_visible=False,
+ visible=False,
+ **kwargs,
+ )
+
+ self._arranger_handler = 0
+ self.todo_manager = TodoListManager(self)
+ self.viewport = None
+
+ self.todo_entry = Entry(
+ name="todo-entry",
+ h_expand=True,
+ on_activate=lambda entry, *_: self.handle_add_todo(entry.get_text()),
+ )
+
+ self.header_box = Box(
+ name="header-box",
+ spacing=10,
+ orientation="h",
+ children=[
+ self.todo_entry,
+ Button(
+ name="add-button",
+ child=MaterialIcon("add"),
+ tooltip_text="Add Todo",
+ on_clicked=lambda *_: self.handle_add_todo(
+ self.todo_entry.get_text()
+ ),
+ ),
+ ],
+ )
+
+ self.launcher_box = Box(
+ name="todo-launcher-box",
+ spacing=10,
+ orientation="v",
+ h_expand=True,
+ children=[self.header_box],
+ )
+
+ self.add(self.launcher_box)
+
+ def open_launcher(self):
+ if not self.viewport:
+ self.viewport = Box(name="viewport", spacing=4, orientation="v")
+ self.scrolled_window = ScrolledWindow(
+ name="todo-content",
+ spacing=10,
+ h_scrollbar_policy="never",
+ child=self.viewport,
+ )
+ self.launcher_box.add(self.scrolled_window)
+
+ self.viewport.children = []
+ self.todo_manager.arrange_viewport()
+
+ self.viewport.show()
+ self.todo_entry.grab_focus()
+
+ def handle_add_todo(self, text: str):
+ if text.strip():
+ self.todo_manager.add_todo(text)
+ self.todo_entry.set_text("")
+
+
+class TodoListManager:
+ def __init__(self, launcher):
+ self.launcher = launcher
+ self.todos = []
+ self.todo_file = os.path.expanduser("~/.local/share/fabric/todos.json")
+ self.load_todos()
+
+ def load_todos(self):
+ os.makedirs(os.path.dirname(self.todo_file), exist_ok=True)
+ try:
+ if os.path.exists(self.todo_file):
+ with open(self.todo_file, "r") as f:
+ self.todos = json.load(f)
+ except Exception as e:
+ print(f"Error loading todos: {e}")
+ self.todos = []
+
+ def save_todos(self):
+ try:
+ with open(self.todo_file, "w") as f:
+ json.dump(self.todos, f)
+ except Exception as e:
+ print(f"Error saving todos: {e}")
+
+ def add_todo(self, content: str):
+ todo = {"content": content, "completed": False, "id": len(self.todos)}
+ self.todos.append(todo)
+ self.save_todos()
+ self.arrange_viewport()
+
+ def toggle_todo(self, todo_id: int):
+ for todo in self.todos:
+ if todo["id"] == todo_id:
+ todo["completed"] = not todo["completed"]
+ break
+ self.save_todos()
+ self.arrange_viewport()
+
+ def delete_todo(self, todo_id: int):
+ self.todos = [todo for todo in self.todos if todo["id"] != todo_id]
+ self.save_todos()
+ self.arrange_viewport()
+
+ def bake_todo_slot(self, todo: dict) -> Box:
+ todo_box = Box(
+ name="todo-item",
+ spacing=10,
+ orientation="h",
+ h_expand=True,
+ )
+
+ checkbox = Button(
+ name="todo-checkbox",
+ child=MaterialIcon(
+ "check_box" if todo["completed"] else "check_box_outline_blank"
+ ),
+ on_clicked=lambda _, todo_id=todo["id"]: self.toggle_todo(todo_id),
+ )
+
+ label = Label(
+ label=todo["content"],
+ h_expand=True,
+ v_align="center",
+ h_align="start",
+ name="todo-label-completed" if todo["completed"] else "todo-label",
+ )
+
+ delete_button = Button(
+ name="delete-button",
+ child=MaterialIcon("delete"),
+ on_clicked=lambda _, todo_id=todo["id"]: self.delete_todo(todo_id),
+ )
+
+ todo_box.add(checkbox)
+ todo_box.add(label)
+ todo_box.add(delete_button)
+
+ return todo_box
+
+ def arrange_viewport(self):
+ if not self.launcher.viewport:
+ return
+
+ self.launcher.viewport.children = []
+
+ for todo in self.todos:
+ todo_slot = self.bake_todo_slot(todo)
+ self.launcher.viewport.add(todo_slot)
diff --git a/config/modus/modules/launcher/components/wallpapers.py b/config/modus/modules/launcher/components/wallpapers.py
new file mode 100644
index 00000000..61820c05
--- /dev/null
+++ b/config/modus/modules/launcher/components/wallpapers.py
@@ -0,0 +1,257 @@
+import hashlib
+import json
+import os
+from PIL import Image
+from fabric.widgets.box import Box
+from fabric.widgets.button import Button
+from fabric.widgets.entry import Entry
+from fabric.widgets.scrolledwindow import ScrolledWindow
+from gi.repository import GdkPixbuf, GLib, Gtk, Gio
+from snippets import MaterialIcon
+from fabric.utils import exec_shell_command, get_relative_path
+import concurrent.futures
+from concurrent.futures import ThreadPoolExecutor
+
+
+class WallpaperSelector(Box):
+ CACHE_DIR = os.path.expanduser("~/.cache/fabric/wallpapers")
+ SETTINGS_FILE = os.path.expanduser("~/dotfiles/.settings/settings.json")
+
+ SCHEMES = {
+ "TonalSpot": "tonalSpot",
+ "Expressive": "expressive",
+ "FruitSalad": "fruitSalad",
+ "Monochrome": "monochrome",
+ "Rainbow": "rainbow",
+ "Vibrant": "vibrant",
+ "Neutral": "neutral",
+ "Fidelity": "fidelity",
+ "Content": "content",
+ }
+
+ def __init__(self, **kwargs):
+ super().__init__(name="wallpapers", spacing=4, orientation="v", **kwargs)
+ self.launcher = kwargs["launcher"]
+
+ self.wallpapers_dir = os.path.expanduser("~/Pictures/wallpapers")
+ os.makedirs(self.CACHE_DIR, exist_ok=True)
+
+ self.files = [f for f in os.listdir(self.wallpapers_dir) if self._is_image(f)]
+ self.thumbnails = []
+ self.thumbnail_queue = []
+ self.executor = ThreadPoolExecutor(max_workers=4) # Shared executor
+
+ self.viewport = Gtk.IconView()
+ self.viewport.set_model(Gtk.ListStore(GdkPixbuf.Pixbuf, str))
+ self.viewport.set_pixbuf_column(0)
+ self.viewport.set_text_column(1)
+ self.viewport.set_item_width(0)
+ self.viewport.connect("item-activated", self.on_wallpaper_selected)
+
+ self.scrolled_window = ScrolledWindow(
+ name="scrolled-window",
+ spacing=10,
+ h_expand=True,
+ v_expand=True,
+ child=self.viewport,
+ )
+
+ self.search_entry = Entry(
+ name="search-entry",
+ h_expand=True,
+ notify_text=lambda entry, *_: self.arrange_viewport(entry.get_text()),
+ )
+
+ self.scheme_dropdown = Gtk.ComboBoxText()
+ self.scheme_dropdown.set_name("scheme-dropdown")
+ self.scheme_dropdown.set_tooltip_text("Select color scheme")
+
+ for display_name, scheme_id in sorted(self.SCHEMES.items()):
+ self.scheme_dropdown.append(scheme_id, display_name)
+
+ self.scheme_dropdown.set_active_id("tonalSpot")
+ self.scheme_dropdown.connect("changed", self.on_scheme_changed)
+
+ initial_icon = "light_mode" if not self.check_dark_mode_state() else "dark_mode"
+ self.toggle_button = Button(
+ child=MaterialIcon(initial_icon),
+ name="toggle-launcher-button",
+ on_clicked=self.toggle_dark_mode,
+ )
+
+ self.dropdown_box = Box(
+ name="dropdown-box",
+ orientation="h",
+ children=[
+ self.scheme_dropdown,
+ MaterialIcon("keyboard_arrow_down"),
+ ],
+ )
+
+ self.header_box = Box(
+ name="header-box",
+ spacing=10,
+ orientation="h",
+ children=[self.search_entry, self.dropdown_box, self.toggle_button],
+ )
+
+ self.add(self.header_box)
+ self.add(self.scrolled_window)
+ self._start_thumbnail_thread()
+ self.setup_file_monitor()
+ self.show_all()
+
+ def setup_file_monitor(self):
+ gfile = Gio.File.new_for_path(self.wallpapers_dir)
+ self.file_monitor = gfile.monitor_directory(Gio.FileMonitorFlags.NONE, None)
+ self.file_monitor.connect("changed", self.on_directory_changed)
+
+ def on_directory_changed(self, monitor, file, other_file, event_type):
+ file_name = file.get_basename()
+ if event_type == Gio.FileMonitorEvent.DELETED:
+ if file_name in self.files:
+ self.files.remove(file_name)
+ cache_path = self._get_cache_path(file_name)
+ if os.path.exists(cache_path):
+ try:
+ os.remove(cache_path)
+ except Exception as e:
+ print(f"Error deleting cache {cache_path}: {e}")
+ self.thumbnails = [(p, n) for p, n in self.thumbnails if n != file_name]
+ GLib.idle_add(self.arrange_viewport, self.search_entry.get_text())
+ elif event_type == Gio.FileMonitorEvent.CREATED:
+ if self._is_image(file_name) and file_name not in self.files:
+ self.files.append(file_name)
+ self.files.sort()
+ self.executor.submit(self._process_file, file_name)
+ elif event_type == Gio.FileMonitorEvent.CHANGED:
+ if self._is_image(file_name) and file_name in self.files:
+ cache_path = self._get_cache_path(file_name)
+ if os.path.exists(cache_path):
+ try:
+ os.remove(cache_path)
+ except Exception as e:
+ print(f"Error deleting cache for changed file {file_name}: {e}")
+ self.executor.submit(self._process_file, file_name)
+
+ def close_selector(self):
+ self.launcher.close()
+
+ def arrange_viewport(self, query: str = ""):
+ self.viewport.get_model().clear()
+ filtered_thumbnails = [
+ (thumb, name)
+ for thumb, name in self.thumbnails
+ if query.casefold() in name.casefold()
+ ]
+
+ filtered_thumbnails.sort(key=lambda x: x[1].lower())
+
+ for pixbuf, file_name in filtered_thumbnails:
+ self.viewport.get_model().append([pixbuf, file_name])
+
+ def toggle_dark_mode(self, *_):
+ GLib.spawn_command_line_async(
+ f"bash {get_relative_path('../../../assets/scripts/dark-theme.sh --toggle')}"
+ )
+ icon_name = "dark_mode" if not self.check_dark_mode_state() else "light_mode"
+ if self.toggle_button.get_child():
+ self.toggle_button.remove(self.toggle_button.get_child())
+ self.toggle_button.add(MaterialIcon(icon_name))
+ self.toggle_button.show_all()
+
+ def check_dark_mode_state(self):
+ result = exec_shell_command(
+ "gsettings get org.gnome.desktop.interface color-scheme"
+ )
+ return result.strip().replace("'", "") == "prefer-dark"
+
+ def on_wallpaper_selected(self, iconview, path):
+ model = iconview.get_model()
+ file_name = model[path][1]
+ full_path = os.path.join(self.wallpapers_dir, file_name)
+ selected_scheme = self.scheme_dropdown.get_active_id()
+ home_dir = GLib.get_home_dir()
+ command = (
+ f"python -O {home_dir}/dotfiles/hypr/scripts/wallpaper.py -I {full_path}"
+ )
+ GLib.spawn_command_line_async(command)
+ self.update_scheme(selected_scheme)
+
+ def on_scheme_changed(self, combo):
+ scheme_id = combo.get_active_id()
+ display_name = next(
+ name for name, id in self.SCHEMES.items() if id == scheme_id
+ )
+ print(f"Color scheme selected: {display_name} ({scheme_id})")
+ self.update_scheme(scheme_id)
+
+ home_dir = GLib.get_home_dir()
+ color_generator = os.path.join(home_dir, "dotfiles/material-colors/generate.py")
+ try:
+ command = f'python -O {color_generator} -R --scheme "{scheme_id}"'
+ GLib.spawn_command_line_async(command)
+ print(f"Applied color scheme: {display_name}")
+ except Exception as e:
+ print(f"Failed to apply color scheme: {e}")
+
+ def update_scheme(self, scheme: str):
+ try:
+ with open(self.SETTINGS_FILE, "r") as f:
+ settings = json.loads(f.read())
+
+ settings["generation-scheme"] = scheme
+
+ with open(self.SETTINGS_FILE, "w") as f:
+ json.dump(settings, f, indent=2)
+ except Exception as error:
+ print(f"Failed to update generation-scheme in settings.json: {error}")
+
+ def _start_thumbnail_thread(self):
+ thread = GLib.Thread.new("thumbnail-loader", self._preload_thumbnails, None)
+
+ def _preload_thumbnails(self, _data):
+ futures = [
+ self.executor.submit(self._process_file, file_name)
+ for file_name in self.files
+ ]
+ concurrent.futures.wait(futures)
+ GLib.idle_add(self._process_batch)
+
+ def _process_file(self, file_name):
+ full_path = os.path.join(self.wallpapers_dir, file_name)
+ cache_path = self._get_cache_path(file_name)
+ if not os.path.exists(cache_path):
+ try:
+ with Image.open(full_path) as img:
+ img.thumbnail((96, 96), Image.Resampling.BILINEAR)
+ img.save(cache_path, "PNG")
+ except Exception as e:
+ print(f"Error processing {file_name}: {e}")
+ return
+ self.thumbnail_queue.append((cache_path, file_name))
+ GLib.idle_add(self._process_batch)
+
+ def _process_batch(self):
+ batch = self.thumbnail_queue[:10]
+ del self.thumbnail_queue[:10]
+ for cache_path, file_name in batch:
+ try:
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file(cache_path)
+ self.thumbnails.append((pixbuf, file_name))
+ self.viewport.get_model().append([pixbuf, file_name])
+ except Exception as e:
+ print(f"Error loading thumbnail {cache_path}: {e}")
+ if self.thumbnail_queue:
+ GLib.idle_add(self._process_batch)
+ return False
+
+ def _get_cache_path(self, file_name: str) -> str:
+ file_hash = hashlib.md5(file_name.encode("utf-8")).hexdigest()
+ return os.path.join(self.CACHE_DIR, f"{file_hash}.png")
+
+ @staticmethod
+ def _is_image(file_name: str) -> bool:
+ return file_name.lower().endswith(
+ (".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp")
+ )
diff --git a/config/modus/modules/launcher/launcher.py b/config/modus/modules/launcher/launcher.py
new file mode 100644
index 00000000..409d1ea9
--- /dev/null
+++ b/config/modus/modules/launcher/launcher.py
@@ -0,0 +1,158 @@
+from fabric.widgets.centerbox import CenterBox
+from fabric.widgets.stack import Stack
+from fabric.widgets.wayland import WaylandWindow as Window
+from modules.launcher.components import (
+ AppLauncher,
+ BluetoothConnections,
+ Cliphist,
+ Emoji,
+ PowerMenu,
+ Sh,
+ TodoManager,
+ WallpaperSelector,
+)
+
+
+class Launcher(Window):
+ def __init__(self, **kwargs):
+ super().__init__(
+ layer="top",
+ anchor="center",
+ visible=False,
+ all_visible=False,
+ **kwargs,
+ )
+
+ self.launcher = AppLauncher(launcher=self)
+ self.wallpapers = WallpaperSelector(launcher=self)
+ self.power = PowerMenu(launcher=self)
+ self.emoji = Emoji(launcher=self)
+ self.cliphist = Cliphist(launcher=self)
+ self.todo = TodoManager()
+ self.bluetooth = BluetoothConnections()
+ self.sh = Sh(launcher=self)
+
+ self.stack = Stack(
+ name="launcher-content",
+ v_expand=True,
+ h_expand=True,
+ transition_type="crossfade",
+ transition_duration=100,
+ children=[
+ self.launcher,
+ self.wallpapers,
+ self.power,
+ self.emoji,
+ self.cliphist,
+ self.todo,
+ self.bluetooth,
+ self.sh,
+ ],
+ )
+
+ self.launcher_box = CenterBox(
+ name="launcher",
+ orientation="v",
+ start_children=self.stack,
+ )
+
+ self.add(self.launcher_box)
+ self.show_all()
+ self.hide()
+ self.wallpapers.viewport.hide()
+ self.add_keybinding("Escape", lambda *_: self.close())
+
+ def close(self):
+ self.set_keyboard_mode("none")
+ self.hide()
+
+ for widget in [
+ self.launcher,
+ self.wallpapers,
+ self.power,
+ self.emoji,
+ self.cliphist,
+ self.todo,
+ self.bluetooth,
+ self.sh,
+ ]:
+ if widget == self.wallpapers:
+ self.wallpapers.viewport.hide()
+ self.wallpapers.viewport.set_property("name", None)
+
+ if hasattr(widget, "viewport") and widget.viewport:
+ widget.viewport.hide()
+
+ for style in [
+ "launcher",
+ "wallpapers",
+ "power",
+ "emoji",
+ "cliphist",
+ "todo",
+ "bluetooth",
+ "sh",
+ ]:
+ self.stack.remove_style_class(style)
+
+ return True
+
+ def open(self, widget):
+ self.set_keyboard_mode("exclusive")
+ self.show()
+
+ widgets = {
+ "launcher": self.launcher,
+ "wallpapers": self.wallpapers,
+ "power": self.power,
+ "emoji": self.emoji,
+ "cliphist": self.cliphist,
+ "todo": self.todo,
+ "bluetooth": self.bluetooth,
+ "sh": self.sh,
+ }
+
+ for w in widgets.values():
+ w.hide()
+ for style in widgets.keys():
+ self.stack.remove_style_class(style)
+
+ if widget in widgets:
+ self.stack.get_style_context().add_class(widget)
+ self.stack.set_visible_child(widgets[widget])
+ widgets[widget].show()
+
+ if widget != "wallpapers":
+ self.wallpapers.viewport.hide()
+ self.wallpapers.viewport.set_property("name", None)
+
+ if widget == "launcher":
+ self.launcher.open_launcher()
+ self.launcher.search_entry.set_text("")
+ self.launcher.search_entry.grab_focus()
+
+ elif widget == "wallpapers":
+ self.wallpapers.search_entry.set_text("")
+ self.wallpapers.search_entry.grab_focus()
+ self.wallpapers.viewport.show()
+ self.wallpapers.viewport.set_property("name", "wallpaper-icons")
+
+ elif widget == "emoji":
+ self.emoji.open_launcher()
+ self.emoji.search_entry.set_text("")
+ self.emoji.search_entry.grab_focus()
+
+ elif widget == "cliphist":
+ self.cliphist.open_launcher()
+ self.cliphist.search_entry.set_text("")
+ self.cliphist.search_entry.grab_focus()
+
+ elif widget == "todo":
+ self.todo.open_launcher()
+ self.todo.todo_entry.set_text("")
+ self.todo.todo_entry.grab_focus()
+
+ elif widget == "sh":
+ self.sh.open_launcher()
+ self.sh.search_entry.set_text("")
+ self.sh.search_entry.grab_focus()
diff --git a/config/fabric/modules/notification_popup.py b/config/modus/modules/notification_popup.py
similarity index 97%
rename from config/fabric/modules/notification_popup.py
rename to config/modus/modules/notification_popup.py
index ff60e3a9..8835778c 100644
--- a/config/fabric/modules/notification_popup.py
+++ b/config/modus/modules/notification_popup.py
@@ -24,7 +24,6 @@ from snippets import Animator, CustomImage
class AnimatedCircularProgressBar(CircularProgressBar):
-
def __init__(self, duration=0.6, bezier_curve=(0.34, 1.56, 0.64, 1.0), **kwargs):
super().__init__(**kwargs)
@@ -139,7 +138,6 @@ class NotificationWidget(Box):
body_container = Box(spacing=4, orientation="h")
- # Use provided image if available, otherwise use "notification-symbolic" icon
if image_pixbuf := self._notification.image_pixbuf:
body_container.add(
Box(
@@ -214,13 +212,11 @@ class NotificationWidget(Box):
self._timer = None
def get_icon(self, app_icon, app_name, size) -> Image:
- # Normalize app_name
app_name = (
app_name.lower().replace(" ", "-")
if isinstance(app_name, str)
else app_name
)
- # Attempt to load file-based icons
if isinstance(app_icon, str) and app_icon.strip():
if app_icon.startswith("file://") or app_icon.startswith("/"):
file_path = app_icon[7:] if app_icon.startswith("file://") else app_icon
@@ -240,7 +236,6 @@ class NotificationWidget(Box):
else:
icon_name = "dialog-information-symbolic"
- # Return a symbolic icon as fallback
return Image(name="notification-icon", icon_name=icon_name, icon_size=size)
def on_button_press(self, _, event):
diff --git a/config/fabric/modules/osd.py b/config/modus/modules/osd.py
similarity index 95%
rename from config/fabric/modules/osd.py
rename to config/modus/modules/osd.py
index 47e82493..bdd2ef9d 100644
--- a/config/fabric/modules/osd.py
+++ b/config/modus/modules/osd.py
@@ -1,14 +1,13 @@
import time
from typing import ClassVar, Literal
-
-from fabric.audio import Audio
+from fabric.utils import invoke_repeater
from fabric.widgets.box import Box
from fabric.widgets.revealer import Revealer
from fabric.widgets.scale import Scale, ScaleMark
from fabric.widgets.wayland import WaylandWindow as Window
-from gi.repository import GLib, GObject
-from services.brightness import Brightness
+from gi.repository import GObject
from snippets import Animator, MaterialIcon
+from services import brightness, audio
class AnimatedScale(Scale):
@@ -35,7 +34,7 @@ class AnimatedScale(Scale):
class BrightnessOSDContainer(Box):
def __init__(self, **kwargs):
super().__init__(**kwargs, orientation="h", spacing=12, name="osd")
- self.brightness_service = Brightness()
+ self.brightness_service = brightness
self.icon = MaterialIcon(icon_name="brightness_7", size=28)
self.scale = AnimatedScale(
marks=(ScaleMark(value=i) for i in range(0, 101, 10)),
@@ -101,7 +100,7 @@ class AudioOSDContainer(Box):
def __init__(self, **kwargs):
super().__init__(**kwargs, orientation="h", spacing=13, name="osd")
- self.audio = Audio()
+ self.audio = audio
self.icon = MaterialIcon(icon_name="volume_up", size=28)
self.scale = AnimatedScale(
marks=(ScaleMark(value=i) for i in range(1, 100, 10)),
@@ -169,8 +168,8 @@ class OSDContainer(Window):
self.timeout = 1000
self.revealer = Revealer(
- transition_type="slide-up",
- transition_duration=100,
+ transition_type="slide-right",
+ transition_duration=200,
child_revealed=False,
)
@@ -198,7 +197,7 @@ class OSDContainer(Window):
)
self.audio_container.connect("volume-changed", self.show_audio)
- GLib.timeout_add(100, self.check_inactivity)
+ invoke_repeater(100, self.check_inactivity, initial_call=True)
def show_audio(self, *_):
self.show_box(box_to_show="audio")
diff --git a/config/modus/services/__init__.py b/config/modus/services/__init__.py
new file mode 100644
index 00000000..b464ce63
--- /dev/null
+++ b/config/modus/services/__init__.py
@@ -0,0 +1,9 @@
+from fabric.audio import Audio
+from .brightness import Brightness
+from .screen_record import ScreenRecorder
+from .wifi import *
+
+
+brightness = Brightness()
+audio = Audio()
+sc = ScreenRecorder()
diff --git a/config/fabric/services/brightness.py b/config/modus/services/brightness.py
similarity index 100%
rename from config/fabric/services/brightness.py
rename to config/modus/services/brightness.py
diff --git a/config/fabric/services/screen_record.py b/config/modus/services/screen_record.py
similarity index 92%
rename from config/fabric/services/screen_record.py
rename to config/modus/services/screen_record.py
index 5f2f12c1..7fbf6d5b 100644
--- a/config/fabric/services/screen_record.py
+++ b/config/modus/services/screen_record.py
@@ -7,14 +7,13 @@ from gi.repository import Gio, GLib
from loguru import logger
-
class ScreenRecorder(Service):
@Signal
def recording(self, value: bool) -> None: ...
- def __init__(self, **kwargs):
+ def __init__(self, **kwargs):
self.screenshot_path = GLib.get_home_dir() + "/Pictures/Screenshots/"
- self.screenrecord_path = GLib.get_home_dir() + "/Videos/Screenrecords/"
+ self.screenrecord_path = GLib.get_home_dir() + "/Videos/Screencasting/"
super().__init__(**kwargs)
@@ -24,16 +23,16 @@ class ScreenRecorder(Service):
command = (
["grimblast", "copysave", "screen", file_path]
if save_copy
- else ["grimblast", "copy" "screen"]
+ else ["grimblast", "copyscreen"]
)
if not fullscreen:
- command[3] = "area"
+ command[2] = "area"
try:
subprocess.run(command, check=True)
self.send_screenshot_notification(
file_path=file_path if file_path else None,
)
- except Exception:
+ except Exception as e:
logger.error(f"[SCREENSHOT] Failed to run command: {command}")
def screencast_start(self, fullscreen=False):
@@ -44,7 +43,6 @@ class ScreenRecorder(Service):
return
time = datetime.datetime.today().strftime("%Y-%m-%d_%H-%M-%S")
file_path = self.screenrecord_path + str(time) + ".mp4"
-
self._current_screencast_path = file_path
area = "" if fullscreen else f"-g '{exec_shell_command('slurp')}'"
command = f"wf-recorder --file={file_path} --pixel-format yuv420p {area}"
@@ -57,6 +55,9 @@ class ScreenRecorder(Service):
self.send_screencast_notification(self._current_screencast_path)
def send_screencast_notification(self, file_path):
+ # TODO: Generate a thumbnail
+ # exec_shell_command_async(f"totem-video-thumbnailer {file_path} {FABRIC_CACHE}")
+
cmd = ["notify-send"]
cmd.extend(
[
@@ -138,5 +139,4 @@ class ScreenRecorder(Service):
@Property(bool, "readable", default_value=False)
def is_recording(self):
- return len(exec_shell_command("pidof wf-recorder")) != 0
-
+ return False if len(exec_shell_command("pidof wf-recorder")) == 0 else True
diff --git a/config/fabric/services/wifi.py b/config/modus/services/wifi.py
similarity index 70%
rename from config/fabric/services/wifi.py
rename to config/modus/services/wifi.py
index b7ec7b27..b048f230 100644
--- a/config/fabric/services/wifi.py
+++ b/config/modus/services/wifi.py
@@ -1,11 +1,14 @@
-from typing import List, Literal
-
+from typing import Any, List, Literal
import gi
from fabric.core.service import Property, Service, Signal
-from fabric.utils import bulk_connect, exec_shell_command_async
+from fabric.utils import bulk_connect
from gi.repository import Gio
from loguru import logger
+from fabric.utils import exec_shell_command_async
+
+from gi.repository.NM import DeviceEthernet, DeviceWifi
+
try:
gi.require_version("NM", "1.0")
from gi.repository import NM
@@ -146,11 +149,9 @@ class Wifi(Service):
"bssid": ap.get_bssid(),
# "address": ap.get_
"last_seen": ap.get_last_seen(),
- "ssid": (
- NM.utils_ssid_to_utf8(ap.get_ssid().get_data())
- if ap.get_ssid()
- else "Unknown"
- ),
+ "ssid": NM.utils_ssid_to_utf8(ap.get_ssid().get_data())
+ if ap.get_ssid()
+ else "Unknown",
"active-ap": self._ap,
"strength": ap.get_strength(),
"frequency": ap.get_frequency(),
@@ -193,6 +194,64 @@ class Wifi(Service):
}.get(self._device.get_state(), "unknown")
+class Ethernet(Service):
+ @Signal
+ def changed(self) -> None: ...
+
+ @Signal
+ def enabled(self) -> bool: ...
+
+ @Property(int, "readable")
+ def speed(self) -> int:
+ return self._device.get_speed()
+
+ @Property(str, "readable")
+ def internet(self) -> str:
+ return {
+ NM.ActiveConnectionState.ACTIVATED: "activated",
+ NM.ActiveConnectionState.ACTIVATING: "activating",
+ NM.ActiveConnectionState.DEACTIVATING: "deactivating",
+ NM.ActiveConnectionState.DEACTIVATED: "deactivated",
+ }.get(
+ self._device.get_active_connection().get_state(),
+ "disconnected",
+ )
+
+ @Property(str, "readable")
+ def icon_name(self) -> str:
+ network = self.internet
+ if network == "activated":
+ return "network-wired-symbolic"
+
+ elif network == "activating":
+ return "network-wired-acquiring-symbolic"
+
+ elif self._device.get_connectivity != NM.ConnectivityState.FULL:
+ return "network-wired-no-route-symbolic"
+
+ return "network-wired-disconnected-symbolic"
+
+ def __init__(self, client: NM.Client, device: NM.DeviceEthernet, **kwargs) -> None:
+ super().__init__(**kwargs)
+ self._client: NM.Client = client
+ self._device: NM.DeviceEthernet = device
+
+ for pn in (
+ "active-connection",
+ "icon-name",
+ "internet",
+ "speed",
+ "state",
+ ):
+ self._device.connect(f"notify::{pn}", lambda *_: self.notifier(pn))
+
+ self._device.connect("notify::speed", lambda *_: print(_))
+
+ def notifier(self, pn):
+ self.notify(pn)
+ self.emit("changed")
+
+
class NetworkClient(Service):
@Signal
def device_ready(self) -> None: ...
@@ -200,6 +259,7 @@ class NetworkClient(Service):
def __init__(self, **kwargs):
self._client: NM.Client | None = None
self.wifi_device: Wifi | None = None
+ self.ethernet_device: Ethernet | None = None
super().__init__(**kwargs)
NM.Client.new_async(
cancellable=None,
@@ -209,33 +269,44 @@ class NetworkClient(Service):
def _init_network_client(self, client: NM.Client, task: Gio.Task, **kwargs):
self._client = client
- wifi_device: NM.DeviceWifi = self._get_device(NM.DeviceType.WIFI) # type: ignore
- # eth_device: NM.DeviceEthernet = self._get_device(NM.DeviceType.ETHERNET) # type: ignore
+ wifi_device: NM.DeviceWifi | None = self._get_device(NM.DeviceType.WIFI) # type: ignore
+ ethernet_device: NM.DeviceEthernet | None = self._get_device(
+ NM.DeviceType.ETHERNET
+ )
if wifi_device:
self.wifi_device = Wifi(self._client, wifi_device)
self.emit("device-ready")
- # if eth_device:
- # self.eth_device = Ethernet(self._client, eth_device)
+ if ethernet_device:
+ self.ethernet_device = Ethernet(client=self._client, device=ethernet_device)
+ self.emit("device-ready")
- def _get_device(self, device_type) -> NM.Device | None:
+ self.notify("primary-device")
+
+ def _get_device(self, device_type) -> Any:
devices: List[NM.Device] = self._client.get_devices() # type: ignore
- return next((x for x in devices if x.get_device_type() == device_type), None)
+ return next(
+ (
+ x
+ for x in devices
+ if x.get_device_type() == device_type
+ and x.get_active_connection() != None
+ ),
+ None,
+ )
- def get_primary_device(self) -> Literal["wifi", "wired"] | None:
+ def _get_primary_device(self) -> Literal["wifi", "wired"] | None:
if not self._client:
return None
return (
"wifi"
if "wireless"
in str(self._client.get_primary_connection().get_connection_type())
- else (
- "wired"
- if "ethernet"
- in str(self._client.get_primary_connection().get_connection_type())
- else None
- )
+ else "wired"
+ if "ethernet"
+ in str(self._client.get_primary_connection().get_connection_type())
+ else None
)
def connect_wifi_bssid(self, bssid):
@@ -246,4 +317,5 @@ class NetworkClient(Service):
@Property(str, "readable")
def primary_device(self) -> Literal["wifi", "wired"] | None:
- return self.get_primary_device()
+ return self._get_primary_device()
+
diff --git a/config/modus/snippets/__init__.py b/config/modus/snippets/__init__.py
new file mode 100644
index 00000000..04d199ed
--- /dev/null
+++ b/config/modus/snippets/__init__.py
@@ -0,0 +1,15 @@
+from .animator import *
+from .custom_image import *
+from .icon import *
+import json
+from gi.repository import GLib
+
+
+def read_config():
+ home_dir = GLib.get_home_dir()
+ config_path = f"{home_dir}/dotfiles/modus/assets/config.json"
+
+ with open(config_path, "r") as file:
+ # Load JSON data into a Python dictionary
+ data = json.load(file)
+ return data
diff --git a/config/fabric/snippets/animator.py b/config/modus/snippets/animator.py
similarity index 100%
rename from config/fabric/snippets/animator.py
rename to config/modus/snippets/animator.py
diff --git a/config/fabric/snippets/custom_image.py b/config/modus/snippets/custom_image.py
similarity index 100%
rename from config/fabric/snippets/custom_image.py
rename to config/modus/snippets/custom_image.py
diff --git a/config/fabric/snippets/icon.py b/config/modus/snippets/icon.py
similarity index 100%
rename from config/fabric/snippets/icon.py
rename to config/modus/snippets/icon.py
diff --git a/config/fabric/styles/bar.css b/config/modus/styles/bar.css
similarity index 87%
rename from config/fabric/styles/bar.css
rename to config/modus/styles/bar.css
index 1e3d4137..361e6866 100644
--- a/config/fabric/styles/bar.css
+++ b/config/modus/styles/bar.css
@@ -1,14 +1,37 @@
+#recording-indicator {
+ animation: error 0.8s linear infinite alternate;
+}
+
+@keyframes error {
+ to {
+ background-color: @onError;
+ }
+}
+
+#recording-indicator {
+ padding: 6px 12px 6px 12px;
+ border-radius: 99px;
+}
+
#bar {
background-color: @surface;
padding: 3px;
+ opacity: 1;
}
#bar label {
font-weight: bold;
}
+#bar.hidden {
+ opacity: 0;
+ padding: 3px;
+ margin-bottom: -52px;
+ transition: all 0.5s cubic-bezier(0.5, 0.25, 0, 1);
+}
+
/*
- * ── bar moudles ───────────────────────────────────────────────────────
+ * ── bar modules ───────────────────────────────────────────────────────
*/
#start-container,
@@ -86,20 +109,25 @@
}
menu {
+ border: solid 1px @outlineVariant;
+ border-radius: 16px;
background-color: @surfaceContainer;
+ padding: 6px;
}
menu > menuitem {
- border-radius: 12px;
- padding: 10px;
- margin-left: 2px;
- margin-right: 2px;
+ border-radius: 10px;
+ padding: 6px 10px;
}
menu > menuitem:hover {
background-color: mix(@onSurface, @surface, 0.85);
}
+menu > menuitem:hover > label {
+ color: @onSurface;
+}
+
/*
* ── applets ───────────────────────────────────────────────────────────
*/
@@ -147,6 +175,7 @@ menu > menuitem:hover {
border-radius: 100px;
border: 0px;
}
+
#taskbar > button:last-child {
margin-right: 0px;
}
diff --git a/config/modus/styles/launcher.css b/config/modus/styles/launcher.css
new file mode 100644
index 00000000..77fd4e2c
--- /dev/null
+++ b/config/modus/styles/launcher.css
@@ -0,0 +1,359 @@
+#switcher {
+ background-color: @background;
+ border: solid 1px @surfaceVariant;
+ padding: 12px;
+ border-radius: 16px;
+}
+
+.switcher-button {
+ border-radius: 16px;
+ border: 1px solid @surfaceVariant;
+ padding: 4px;
+ margin: 4px;
+}
+
+.switcher-button button:active {
+ background-color: @primaryContainer;
+ border-radius: 11px;
+ box-shadow: inset 0 0 0 1px rgba(158, 142, 130, 0.04);
+}
+
+.switcher-button:hover,
+.switcher-button:focus {
+ background-color: mix(@onSurface, @surface, 0.85);
+}
+
+.switcher-button:hover image,
+.switcher-button:focus image {
+ -gtk-icon-shadow: 2px 2px @primary;
+}
+
+.switcher-button:hover #title,
+.switcher-button:focus #title {
+ color: @primary;
+}
+
+/*
+ * ── launcher ──────────────────────────────────────────────────────────
+*/
+
+#launcher {
+ margin: 18px;
+ border: 1px solid @outlineVariant;
+ background-color: @surface;
+ border-radius: 24px;
+ padding: 18px;
+ transition: all 0.5s cubic-bezier(0.5, 0.25, 0, 1);
+}
+
+#launcher entry {
+ transition: all 0.1s ease;
+ border-radius: 11px;
+ padding: 10px;
+ margin: 12px;
+ box-shadow: inset 0 0 0 1px @outlineVariant;
+}
+
+#launcher-content.wallpapers {
+ padding: 16px;
+ min-height: 420px;
+ min-width: 620px;
+}
+
+#launcer-content.cliphist {
+ min-height: 420px;
+}
+
+#launcher-content.bluetooth {
+ min-height: 464px;
+}
+
+#launcher-content.power {
+ min-height: 52px;
+}
+
+#launcher-content {
+ min-width: 420px;
+}
+
+#app-launcher,
+#wallpapers,
+#todo,
+#bluetooth,
+#sh,
+#cliphist,
+#emoji,
+#powermenu {
+ opacity: 1;
+ transition: all 0.25s cubic-bezier(0.5, 0.25, 0, 1);
+}
+
+#toggle-launcher-button {
+ background-color: @secondaryContainer;
+ color: @onSecondaryContainer;
+ margin: 11px;
+ margin-left: 0px;
+ min-width: 54px;
+ min-height: 44px;
+ border-radius: 100%;
+}
+
+#clear-launcher-button {
+ background-color: @secondaryContainer;
+ color: @onSecondaryContainer;
+ margin: 11px;
+ margin-left: 0px;
+ min-width: 44px;
+ min-height: 44px;
+ border-radius: 100%;
+}
+
+/*
+ * ── applauncher ───────────────────────────────────────────────────────
+*/
+
+#launcher-app {
+ border-radius: 16px;
+ padding: 16px;
+ transition: padding 0.25s cubic-bezier(0.5, 0.25, 0, 1);
+}
+
+#launcher-app:hover image,
+#launcher-app:active image,
+#launcher-app:selected image,
+#launcher-app.selected image,
+#launcher-app:focus image {
+ -gtk-icon-shadow: 2px 2px @primary;
+}
+
+#launcher-app:hover,
+#launcher-app:active,
+#launcher-app.selected,
+#launcher-app:selected,
+#launcher-app:focus {
+ text-shadow: 2pt 2pt 2pt @primary;
+}
+
+#launcher-app-icon {
+ margin-right: 8px;
+}
+
+/*
+ * ── wallpaper ─────────────────────────────────────────────────────────
+*/
+
+#wallpaper-icons:hover {
+ background-color: @surfaceBright;
+ border-radius: 8px;
+}
+
+#wallpaper-icons:selected {
+ background-color: @surfaceBright;
+ border-radius: 8px;
+}
+
+#dropdown-box {
+ background-color: @surface;
+ box-shadow: inset 0 0 0 1px @outlineVariant;
+ border-radius: 11px;
+ padding: 10px;
+ margin: 12px;
+}
+
+#scheme-dropdown {
+ font-weight: bold;
+}
+
+/*
+ * ── emoji ─────────────────────────────────────────────────────────────
+*/
+
+#launcher button#emoji-item {
+ border-radius: 11px;
+ background-color: transparent;
+ background-image: none;
+ box-shadow: none;
+ padding: 0px;
+}
+
+#launcher button#emoji-item label {
+ font-size: 24px;
+}
+
+#launcher button#emoji-item:hover,
+#launcher button#emoji-item:focus {
+ text-shadow: 2px 2px 2px @primary;
+}
+
+/*
+ * ── powermenu ─────────────────────────────────────────────────────────
+*/
+
+#powermenu-button {
+ border-radius: 20px;
+ padding: 20px;
+}
+
+#powermenu-button:hover,
+#powermenu-button:focus {
+ background-color: mix(@onSurface, @surface, 0.8);
+}
+
+#powermenu-button:active {
+ background-image: radial-gradient(
+ circle,
+ mix(@onSurfaceVariant, transparent, 0.7) 10%,
+ transparent 0%
+ );
+}
+
+/*
+ * ── cliphist ──────────────────────────────────────────────────────────
+*/
+#cliphist-history {
+ min-height: 420px;
+}
+
+#launcher button#clip-img-item {
+ background-size: cover;
+ background-position: center;
+ background-repeat: no-repeat;
+ border-radius: 8px;
+ min-width: 70px;
+ min-height: 70px;
+}
+
+#launcher button#clip-img-item:hover,
+#launcher button#clip-img-item:focus {
+ box-shadow: 2px 2px 2px @primary;
+}
+
+#launcher button#clip-item {
+ border-radius: 11px;
+ background-color: transparent;
+ background-image: none;
+ box-shadow: none;
+ padding: 6px;
+}
+
+#launcher button#clip-item {
+ font-size: 30px;
+}
+
+#launcher button#clip-item:hover,
+#launcher button#clip-item:focus {
+ text-shadow: 2px 2px 2px @primary;
+}
+
+/*
+ * ── todo ──────────────────────────────────────────────────────────────
+*/
+#todo-content {
+ min-height: 250px;
+}
+
+#todo-launcher {
+ background-color: @surface;
+ padding: 10px;
+ border-radius: 8px;
+}
+
+#todo-item {
+ padding: 8px;
+ border-radius: 4px;
+ background-color: alpha(@surface, 0.8);
+}
+
+#todo-label {
+ color: @primary;
+}
+
+#todo-label-completed {
+ color: alpha(@outlineVariant, 0.5);
+ text-decoration: line-through;
+}
+
+#delete-button {
+ color: @error;
+}
+
+/*
+ * ── sh runner ─────────────────────────────────────────────────────────
+*/
+
+#launcher button#sh-item {
+ border-radius: 11px;
+ background-color: transparent;
+ background-image: none;
+ box-shadow: none;
+ padding: 0px;
+}
+
+#launcher button#sh-item {
+ font-size: 24px;
+}
+
+#launcher button#sh-item:hover,
+#launcher button#sh-item:focus {
+ text-shadow: 2px 2px 2px @primary;
+}
+
+/*
+ * ── bluetooth ─────────────────────────────────────────────────────────
+*/
+
+#bluetooth-device {
+ background-color: @secondaryContainer;
+ border-radius: 16px;
+ padding: 4px;
+ margin-bottom: 4px;
+}
+
+#bluetooth-header {
+ padding: 4px;
+}
+
+#bluetooth-scan,
+#bluetooth-toggle {
+ background-color: @secondaryContainer;
+ color: @onSecondaryContainer;
+ margin: 11px;
+ margin-left: 0px;
+ min-width: 44px;
+ min-height: 44px;
+ border-radius: 100%;
+}
+
+#bluetooth-scan:hover,
+#bluetooth-toggle:hover {
+ background-color: @surfaceBright;
+}
+
+#bluetooth-scan label,
+#bluetooth-toggle label {
+ font-weight: bold;
+}
+
+#bluetooth-text,
+#bluetooth-section {
+ font-weight: bold;
+}
+
+#bluetooth-connection {
+ font-size: 20px;
+}
+
+#bluetooth-connect {
+ background-color: @shadow;
+ border-radius: 16px;
+ padding: 8px 16px;
+}
+
+#bluetooth-connect:hover {
+ background-color: @surfaceBright;
+}
+
+#bluetooth-paired,
+#bluetooth-available {
+ padding: 4px;
+}
diff --git a/config/fabric/styles/main.css b/config/modus/styles/main.css
similarity index 85%
rename from config/fabric/styles/main.css
rename to config/modus/styles/main.css
index e99c6262..8ce90039 100644
--- a/config/fabric/styles/main.css
+++ b/config/modus/styles/main.css
@@ -1,8 +1,8 @@
-@import url(/home/sankalp/.cache/material/colors.css);
-@import "./launcher.css";
+@import url(../../.cache/material/colors.css);
@import "./bar.css";
@import "./notification.css";
@import "./osd.css";
+@import "./launcher.css";
* {
all: unset;
@@ -12,6 +12,16 @@
sans-serif;
}
+#corner {
+ background-color: @surface;
+ border-radius: 0;
+}
+
+#corner-container {
+ min-width: 20px;
+ min-height: 20px;
+}
+
/*
* ── tooltip ───────────────────────────────────────────────────────────
*/
diff --git a/config/fabric/styles/notification.css b/config/modus/styles/notification.css
similarity index 100%
rename from config/fabric/styles/notification.css
rename to config/modus/styles/notification.css
diff --git a/config/fabric/styles/osd.css b/config/modus/styles/osd.css
similarity index 100%
rename from config/fabric/styles/osd.css
rename to config/modus/styles/osd.css