diff --git a/main.tsx b/main.tsx index 3212fca..e4eab78 100644 --- a/main.tsx +++ b/main.tsx @@ -1,10 +1,8 @@ import { For, This, createBinding } from "ags"; import app from "ags/gtk4/app"; import { Bar } from "./widgets/bar"; -import { Launcher } from "./widgets/launcher"; import { Notifications } from "./widgets/notifications"; import { ControlCenter } from "./widgets/control-center"; -import { WallpaperManager } from "./widgets/wallpaper-manager"; export const Main = () => { const monitors = createBinding(app, "monitors"); @@ -14,10 +12,8 @@ export const Main = () => { {(monitor) => ( - - )} diff --git a/style/_launcher.scss b/style/_launcher.scss deleted file mode 100644 index d0f7aad..0000000 --- a/style/_launcher.scss +++ /dev/null @@ -1,40 +0,0 @@ -@use "./_variable.scss" as *; - -window.launcher { - background: $bg-color; - border-radius: $rounded; - padding: 10px; - font-size: $font-size; - - .search { - min-width: 300px; - padding: 10px; - color: rgba($fg-color, 0.5); - } - - separator { - border: 1px solid rgba($inactive-color, 0.5); - } - - .list { - background: $bg-color; - } - - .button { - border-radius: $rounded; - padding: 10px; - - &:hover, - &:focus { - background: $inactive-color; - } - - image { - -gtk-icon-size: 1.5rem; - } - } - - .name { - color: $fg-color; - } -} diff --git a/style/_wallpaper-manager.scss b/style/_wallpaper-manager.scss deleted file mode 100644 index f019b69..0000000 --- a/style/_wallpaper-manager.scss +++ /dev/null @@ -1,30 +0,0 @@ -@use "./_variable.scss" as *; -@use "sass:math"; -@use "sass:list"; - -window.wallpaper-manager { - background: $bg-color; - color: $fg-color; - min-width: 400px; - margin: 10px; - padding: 20px; - border-radius: $rounded; - - .button { - border-radius: $rounded; - opacity: 0.5; - - &:hover, - &:focus { - opacity: 1; - } - } - - picture { - border-radius: $rounded; - - &:hover { - background: $inactive-color; - } - } -} diff --git a/style/main.scss b/style/main.scss index 3ae50cd..f09c210 100644 --- a/style/main.scss +++ b/style/main.scss @@ -4,14 +4,8 @@ // bar @use "./_bar.scss"; -// launcher -@use "./_launcher.scss"; - // notifications @use "./_notification.scss"; // control center @use "./_control-center.scss"; - -// wallpaper manager -@use "./_wallpaper-manager.scss"; diff --git a/widgets/bar/index.tsx b/widgets/bar/index.tsx index 110c87e..d05f87f 100644 --- a/widgets/bar/index.tsx +++ b/widgets/bar/index.tsx @@ -9,6 +9,7 @@ import { WorkspaceButton } from "./workspace"; import { Bluetooth } from "./bluetooth"; import { Cava } from "./cava"; import { onCleanup } from "gnim"; +import { execAsync } from "ags/process"; export const WINDOW_NAME = "bar"; @@ -29,7 +30,10 @@ export const Bar = ({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) => { > - + execAsync("vicinae toggle")} + /> @@ -44,7 +48,10 @@ export const Bar = ({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) => { diff --git a/widgets/bar/launcher.tsx b/widgets/bar/launcher.tsx index c6a7042..39e6240 100644 --- a/widgets/bar/launcher.tsx +++ b/widgets/bar/launcher.tsx @@ -1,20 +1,15 @@ -import { Gdk } from "ags/gtk4"; -import app from "ags/gtk4/app"; -import { WINDOW_NAME as APP_LAUNCHER_WINDOW_NAME } from "../launcher"; -import { WINDOW_NAME as CONTROL_CENTER_WINDOW_NAME } from "../control-center"; +import { Gdk, Gtk } from "ags/gtk4"; type Props = { icon: string; - windowName: - | typeof APP_LAUNCHER_WINDOW_NAME - | typeof CONTROL_CENTER_WINDOW_NAME; + onClicked?: ((source: Gtk.Button) => void) | undefined; }; -export const Launcher = ({ icon, windowName }: Props) => { +export const Launcher = ({ icon, onClicked }: Props) => { return ( - ); -}; - -const AppList = () => { - const appList = searchText((text) => apps.fuzzy_query(text)); - - return ( - - - {(app) => } - - - ); -}; - -const AppSearch = () => { - return ( - (searchEntry = ref)} - cssClasses={["search"]} - text={searchText} - placeholderText="Search..." - onNotifyText={({ text }) => setSearchText(text)} - /> - ); -}; - -export const Launcher = ({ gdkmonitor }: { gdkmonitor: Gdk.Monitor }) => { - return ( - { - if (visible) searchEntry.grab_focus(); - else searchEntry.set_text(""); - }} - $={(self) => onCleanup(() => self.destroy())} - > - - - - - - - - - ); -}; - -const onKey = ( - _e: Gtk.EventControllerKey, - keyval: number, - _: number, - mod: number, -) => { - if (keyval === Gdk.KEY_Escape) { - app.toggle_window(WINDOW_NAME); - return; - } -}; diff --git a/widgets/wallpaper-manager/index.tsx b/widgets/wallpaper-manager/index.tsx deleted file mode 100644 index bbad0e8..0000000 --- a/widgets/wallpaper-manager/index.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { onCleanup } from "ags"; -import { Astal, Gdk, Gtk } from "ags/gtk4"; -import app from "ags/gtk4/app"; -import { exec } from "ags/process"; -import Gio from "gi://Gio"; -import GLib from "gi://GLib"; - -export const WINDOW_NAME = "wallpaper-manager"; - -// @TODO wallpaper cache -const wallpaperPath = `/home/tux/Wallpapers/new`; -const imageFormats = [".jpeg", ".jpg", ".webp", ".png"]; - -export const WallpaperManager = ({ - gdkmonitor, -}: { - gdkmonitor: Gdk.Monitor; -}) => { - const { TOP, BOTTOM, LEFT } = Astal.WindowAnchor; - const { VERTICAL } = Gtk.Orientation; - const wallpaperList = getWallpaperList(wallpaperPath); - - return ( - onCleanup(() => self.destroy())} - > - - - - {wallpaperList.map((wall) => ( - - ))} - - - - ); -}; - -const onKey = ( - _e: Gtk.EventControllerKey, - keyval: number, - _: number, - mod: number, -) => { - if (keyval === Gdk.KEY_Escape) { - app.toggle_window(WINDOW_NAME); - return; - } -}; - -function getWallpaperList(path: string) { - const dir = Gio.file_new_for_path(path); - const fileEnum = dir.enumerate_children( - "standard::name", - Gio.FileQueryInfoFlags.NONE, - null, - ); - - const files: string[] = []; - let i = fileEnum.next_file(null); - while (i) { - let fileName = i.get_name(); - if (imageFormats.some((fmt) => fileName.endsWith(fmt))) { - files.push(fileName); - } - i = fileEnum.next_file(null); - } - return files; -} - -const setWallpaper = (name: string) => { - const hyprctl = GLib.find_program_in_path("hyprctl"); - const imagePath = `${wallpaperPath}/${name}`; - - if (!hyprctl) return; - - exec([hyprctl, "hyprpaper", "wallpaper", `,${imagePath},`]); - - app.toggle_window(WINDOW_NAME); -};