9 Commits

Author SHA1 Message Date
kenji 4a0bd16dd5 added steam toggle 2025-07-16 17:40:50 -05:00
kenji f737ed6cc4 changed btop class to kitty for sysmon toggle 2025-07-16 17:37:01 -05:00
kenji dca14f0fa9 fixed 2025-07-16 16:38:47 -05:00
kenji 9ad953214f Revert "added steam toggle"
This reverts commit e71b0fe41f.
2025-07-16 16:34:49 -05:00
kenji 92d52e5602 Revert "changed hypr.dispatch"
This reverts commit 525cab74fe.
2025-07-16 16:33:29 -05:00
kenji 525cab74fe changed hypr.dispatch 2025-07-16 16:18:46 -05:00
kenji e71b0fe41f added steam toggle 2025-07-16 09:12:06 -05:00
kenji 6cf5d2bd02 add sleep 2025-07-16 08:56:35 -05:00
kenji e5f1231749 changed foot to kitty 2025-07-16 08:40:47 -05:00
3 changed files with 166 additions and 49 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ complete -c caelestia -n "$seen shell && $seen wallpaper && $seen set" -F
complete -c caelestia -n "$seen shell && $seen notifs && not $seen clear" -a 'clear' -d 'Clear popup notifications'
# Toggles
set -l commands communication music specialws sysmon todo
set -l commands communication music specialws sysmon todo steam
complete -c caelestia -n "$seen toggle && not $seen drawers && not $seen $commands" -a "$commands" -d 'toggle'
# Scheme
+136 -39
View File
@@ -1,27 +1,52 @@
import argparse
from caelestia.subcommands import clipboard, emoji, pip, record, scheme, screenshot, shell, toggle, wallpaper
from caelestia.subcommands import (
clipboard,
emoji,
pip,
record,
scheme,
screenshot,
shell,
toggle,
wallpaper,
)
from caelestia.utils.paths import wallpapers_dir
from caelestia.utils.scheme import get_scheme_names, scheme_variants
from caelestia.utils.wallpaper import get_wallpaper
def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
parser = argparse.ArgumentParser(prog="caelestia", description="Main control script for the Caelestia dotfiles")
parser.add_argument("-v", "--version", action="store_true", help="print the current version")
parser = argparse.ArgumentParser(
prog="caelestia", description="Main control script for the Caelestia dotfiles"
)
parser.add_argument(
"-v", "--version", action="store_true", help="print the current version"
)
# Add subcommand parsers
command_parser = parser.add_subparsers(
title="subcommands", description="valid subcommands", metavar="COMMAND", help="the subcommand to run"
title="subcommands",
description="valid subcommands",
metavar="COMMAND",
help="the subcommand to run",
)
# Create parser for shell opts
shell_parser = command_parser.add_parser("shell", help="start or message the shell")
shell_parser.set_defaults(cls=shell.Command)
shell_parser.add_argument("message", nargs="*", help="a message to send to the shell")
shell_parser.add_argument("-d", "--daemon", action="store_true", help="start the shell detached")
shell_parser.add_argument("-s", "--show", action="store_true", help="print all shell IPC commands")
shell_parser.add_argument("-l", "--log", action="store_true", help="print the shell log")
shell_parser.add_argument(
"message", nargs="*", help="a message to send to the shell"
)
shell_parser.add_argument(
"-d", "--daemon", action="store_true", help="start the shell detached"
)
shell_parser.add_argument(
"-s", "--show", action="store_true", help="print all shell IPC commands"
)
shell_parser.add_argument(
"-l", "--log", action="store_true", help="print the shell log"
)
shell_parser.add_argument(
"--log-rules",
default="quickshell.dbus.properties.warning=false;quickshell.dbus.dbusmenu.warning=false;quickshell.service.notifications.warning=false;quickshell.service.sni.host.warning=false;qt.qpa.wayland.textinput.warning=false",
@@ -30,75 +55,145 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
)
# Create parser for toggle opts
toggle_parser = command_parser.add_parser("toggle", help="toggle a special workspace")
toggle_parser = command_parser.add_parser(
"toggle", help="toggle a special workspace"
)
toggle_parser.set_defaults(cls=toggle.Command)
toggle_parser.add_argument(
"workspace", choices=["communication", "music", "sysmon", "specialws", "todo"], help="the workspace to toggle"
"workspace",
choices=["communication", "music", "sysmon", "specialws", "todo", "steam"],
help="the workspace to toggle",
)
# Create parser for scheme opts
scheme_parser = command_parser.add_parser("scheme", help="manage the colour scheme")
scheme_command_parser = scheme_parser.add_subparsers(title="subcommands")
list_parser = scheme_command_parser.add_parser("list", help="list available schemes")
list_parser = scheme_command_parser.add_parser(
"list", help="list available schemes"
)
list_parser.set_defaults(cls=scheme.List)
list_parser.add_argument("-n", "--names", action="store_true", help="list scheme names")
list_parser.add_argument("-f", "--flavours", action="store_true", help="list scheme flavours")
list_parser.add_argument("-m", "--modes", action="store_true", help="list scheme modes")
list_parser.add_argument("-v", "--variants", action="store_true", help="list scheme variants")
list_parser.add_argument(
"-n", "--names", action="store_true", help="list scheme names"
)
list_parser.add_argument(
"-f", "--flavours", action="store_true", help="list scheme flavours"
)
list_parser.add_argument(
"-m", "--modes", action="store_true", help="list scheme modes"
)
list_parser.add_argument(
"-v", "--variants", action="store_true", help="list scheme variants"
)
get_parser = scheme_command_parser.add_parser("get", help="get scheme properties")
get_parser.set_defaults(cls=scheme.Get)
get_parser.add_argument("-n", "--name", action="store_true", help="print the current scheme name")
get_parser.add_argument("-f", "--flavour", action="store_true", help="print the current scheme flavour")
get_parser.add_argument("-m", "--mode", action="store_true", help="print the current scheme mode")
get_parser.add_argument("-v", "--variant", action="store_true", help="print the current scheme variant")
get_parser.add_argument(
"-n", "--name", action="store_true", help="print the current scheme name"
)
get_parser.add_argument(
"-f", "--flavour", action="store_true", help="print the current scheme flavour"
)
get_parser.add_argument(
"-m", "--mode", action="store_true", help="print the current scheme mode"
)
get_parser.add_argument(
"-v", "--variant", action="store_true", help="print the current scheme variant"
)
set_parser = scheme_command_parser.add_parser("set", help="set the current scheme")
set_parser.set_defaults(cls=scheme.Set)
set_parser.add_argument("--notify", action="store_true", help="send a notification on error")
set_parser.add_argument("-r", "--random", action="store_true", help="switch to a random scheme")
set_parser.add_argument("-n", "--name", choices=get_scheme_names(), help="the name of the scheme to switch to")
set_parser.add_argument(
"--notify", action="store_true", help="send a notification on error"
)
set_parser.add_argument(
"-r", "--random", action="store_true", help="switch to a random scheme"
)
set_parser.add_argument(
"-n",
"--name",
choices=get_scheme_names(),
help="the name of the scheme to switch to",
)
set_parser.add_argument("-f", "--flavour", help="the flavour to switch to")
set_parser.add_argument("-m", "--mode", choices=["dark", "light"], help="the mode to switch to")
set_parser.add_argument("-v", "--variant", choices=scheme_variants, help="the variant to switch to")
set_parser.add_argument(
"-m", "--mode", choices=["dark", "light"], help="the mode to switch to"
)
set_parser.add_argument(
"-v", "--variant", choices=scheme_variants, help="the variant to switch to"
)
# Create parser for screenshot opts
screenshot_parser = command_parser.add_parser("screenshot", help="take a screenshot")
screenshot_parser = command_parser.add_parser(
"screenshot", help="take a screenshot"
)
screenshot_parser.set_defaults(cls=screenshot.Command)
screenshot_parser.add_argument("-r", "--region", nargs="?", const="slurp", help="take a screenshot of a region")
screenshot_parser.add_argument(
"-f", "--freeze", action="store_true", help="freeze the screen while selecting a region"
"-r", "--region", nargs="?", const="slurp", help="take a screenshot of a region"
)
screenshot_parser.add_argument(
"-f",
"--freeze",
action="store_true",
help="freeze the screen while selecting a region",
)
# Create parser for record opts
record_parser = command_parser.add_parser("record", help="start a screen recording")
record_parser.set_defaults(cls=record.Command)
record_parser.add_argument("-r", "--region", nargs="?", const="slurp", help="record a region")
record_parser.add_argument("-s", "--sound", action="store_true", help="record audio")
record_parser.add_argument(
"-r", "--region", nargs="?", const="slurp", help="record a region"
)
record_parser.add_argument(
"-s", "--sound", action="store_true", help="record audio"
)
# Create parser for clipboard opts
clipboard_parser = command_parser.add_parser("clipboard", help="open clipboard history")
clipboard_parser = command_parser.add_parser(
"clipboard", help="open clipboard history"
)
clipboard_parser.set_defaults(cls=clipboard.Command)
clipboard_parser.add_argument("-d", "--delete", action="store_true", help="delete from clipboard history")
clipboard_parser.add_argument(
"-d", "--delete", action="store_true", help="delete from clipboard history"
)
# Create parser for emoji-picker opts
emoji_parser = command_parser.add_parser("emoji", help="emoji/glyph utilities")
emoji_parser.set_defaults(cls=emoji.Command)
emoji_parser.add_argument("-p", "--picker", action="store_true", help="open the emoji/glyph picker")
emoji_parser.add_argument("-f", "--fetch", action="store_true", help="fetch emoji/glyph data from remote")
emoji_parser.add_argument(
"-p", "--picker", action="store_true", help="open the emoji/glyph picker"
)
emoji_parser.add_argument(
"-f", "--fetch", action="store_true", help="fetch emoji/glyph data from remote"
)
# Create parser for wallpaper opts
wallpaper_parser = command_parser.add_parser("wallpaper", help="manage the wallpaper")
wallpaper_parser = command_parser.add_parser(
"wallpaper", help="manage the wallpaper"
)
wallpaper_parser.set_defaults(cls=wallpaper.Command)
wallpaper_parser.add_argument(
"-p", "--print", nargs="?", const=get_wallpaper(), metavar="PATH", help="print the scheme for a wallpaper"
"-p",
"--print",
nargs="?",
const=get_wallpaper(),
metavar="PATH",
help="print the scheme for a wallpaper",
)
wallpaper_parser.add_argument(
"-r", "--random", nargs="?", const=wallpapers_dir, metavar="DIR", help="switch to a random wallpaper"
"-r",
"--random",
nargs="?",
const=wallpapers_dir,
metavar="DIR",
help="switch to a random wallpaper",
)
wallpaper_parser.add_argument(
"-f", "--file", help="the path to the wallpaper to switch to"
)
wallpaper_parser.add_argument(
"-n", "--no-filter", action="store_true", help="do not filter by size"
)
wallpaper_parser.add_argument("-f", "--file", help="the path to the wallpaper to switch to")
wallpaper_parser.add_argument("-n", "--no-filter", action="store_true", help="do not filter by size")
wallpaper_parser.add_argument(
"-t",
"--threshold",
@@ -115,6 +210,8 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
# Create parser for pip opts
pip_parser = command_parser.add_parser("pip", help="picture in picture utilities")
pip_parser.set_defaults(cls=pip.Command)
pip_parser.add_argument("-d", "--daemon", action="store_true", help="start the daemon")
pip_parser.add_argument(
"-d", "--daemon", action="store_true", help="start the daemon"
)
return parser, parser.parse_args()
+29 -9
View File
@@ -23,7 +23,10 @@ class Command:
def move_client(self, selector: callable, workspace: str) -> None:
for client in self.get_clients():
if selector(client):
hypr.dispatch("movetoworkspacesilent", f"special:{workspace},address:{client['address']}")
hypr.dispatch(
"movetoworkspacesilent",
f"special:{workspace},address:{client['address']}",
)
def spawn_client(self, selector: callable, spawn: list[str]) -> bool:
exists = any(selector(client) for client in self.get_clients())
@@ -33,18 +36,24 @@ class Command:
return not exists
def spawn_or_move(self, selector: callable, spawn: list[str], workspace: str) -> None:
def spawn_or_move(
self, selector: callable, spawn: list[str], workspace: str
) -> None:
if not self.spawn_client(selector, spawn):
self.move_client(selector, workspace)
def communication(self) -> None:
self.spawn_or_move(lambda c: c["class"] == "discord", ["discord"], "communication")
self.spawn_or_move(
lambda c: c["class"] == "discord", ["discord"], "communication"
)
self.move_client(lambda c: c["class"] == "whatsapp", "communication")
hypr.dispatch("togglespecialworkspace", "communication")
def music(self) -> None:
self.spawn_or_move(
lambda c: c["class"] == "Spotify" or c["initialTitle"] == "Spotify" or c["initialTitle"] == "Spotify Free",
lambda c: c["class"] == "Spotify"
or c["initialTitle"] == "Spotify"
or c["initialTitle"] == "Spotify Free",
["spicetify", "watch", "-s"],
"music",
)
@@ -52,15 +61,26 @@ class Command:
hypr.dispatch("togglespecialworkspace", "music")
def sysmon(self) -> None:
self.spawn_client(
lambda c: c["class"] == "btop" and c["title"] == "btop" and c["workspace"]["name"] == "special:sysmon",
["foot", "-a", "btop", "-T", "btop", "fish", "-C", "exec btop"],
)
hypr.dispatch("togglespecialworkspace", "sysmon")
self.spawn_client(
lambda c: c["class"] == "kitty"
and c["title"] == "btop"
and c["workspace"]["name"] == "special:sysmon",
# ["foot", "-a", "btop", "-T", "btop", "fish", "-C", "exec btop"],
["kitty", "--detach", "-T", "btop", "fish", "-C", "btop"],
)
def steam(self) -> None:
self.spawn_or_move(
lambda c: c["class"] == "steam" or c["initialTitle"] == "Steam",
["steam"],
"steam",
)
hypr.dispatch("togglespecialworkspace", "steam")
def todo(self) -> None:
self.spawn_or_move(lambda c: c["class"] == "Todoist", ["todoist"], "todo")
hypr.dispatch("togglespecialworkspace", "todo")
self.spawn_or_move(lambda c: c["class"] == "Todoist", ["todoist"], "todo")
def specialws(self) -> None:
workspaces = hypr.message("workspaces")