From 1afec9ef1a6ae6e5bc30cda3822f414517067f38 Mon Sep 17 00:00:00 2001 From: flick0 Date: Thu, 2 Nov 2023 19:23:50 +0000 Subject: [PATCH] init --- .gitignore | 9 + binds.conf | 13 ++ colors | 19 ++ components/ags/assets/nier-border.svg | 20 ++ components/ags/assets/nier-pointer-white.svg | 15 ++ components/ags/assets/nier-pointer.svg | 12 ++ components/ags/config.js | 101 ++++++++++ components/ags/imports.js | 19 ++ components/ags/nier/buttons.js | 135 +++++++++++++ components/ags/style/color.scss | 6 + components/ags/style/data.scss | 0 components/ags/style/nier.scss | 1 + components/ags/style/nier/longbutton.scss | 113 +++++++++++ components/ags/style/style.css | 190 +++++++++++++++++++ components/ags/style/style.scss | 7 + components/ags/style/widgets/workspace.scss | 78 ++++++++ components/ags/util.js | 48 +++++ components/ags/widgets/workspace.js | 167 ++++++++++++++++ deps | 5 + readme.md | 1 + scripts/apply.sh | 19 ++ scripts/apply_wall | 132 +++++++++++++ scripts/cover2bg | 68 +++++++ scripts/pywal_set | 171 +++++++++++++++++ scripts/workspace_switch | 6 + starship.toml | 16 ++ theme.conf | 29 +++ 27 files changed, 1400 insertions(+) create mode 100644 .gitignore create mode 100644 binds.conf create mode 100644 colors create mode 100644 components/ags/assets/nier-border.svg create mode 100644 components/ags/assets/nier-pointer-white.svg create mode 100644 components/ags/assets/nier-pointer.svg create mode 100644 components/ags/config.js create mode 100644 components/ags/imports.js create mode 100644 components/ags/nier/buttons.js create mode 100644 components/ags/style/color.scss create mode 100644 components/ags/style/data.scss create mode 100644 components/ags/style/nier.scss create mode 100644 components/ags/style/nier/longbutton.scss create mode 100644 components/ags/style/style.css create mode 100644 components/ags/style/style.scss create mode 100644 components/ags/style/widgets/workspace.scss create mode 100644 components/ags/util.js create mode 100644 components/ags/widgets/workspace.js create mode 100644 deps create mode 100644 readme.md create mode 100755 scripts/apply.sh create mode 100755 scripts/apply_wall create mode 100755 scripts/cover2bg create mode 100755 scripts/pywal_set create mode 100644 scripts/workspace_switch create mode 100644 starship.toml create mode 100644 theme.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..575ce6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +cover.png +current_wall +argparse +cv2 +json +np +os +pywal +subprocess \ No newline at end of file diff --git a/binds.conf b/binds.conf new file mode 100644 index 0000000..4199ddc --- /dev/null +++ b/binds.conf @@ -0,0 +1,13 @@ +$MOD1=SUPER +$MOD2=ALT + +bind=$MOD1,1,exec,$THEME/scripts/workspace_switch 1 +bind=$MOD1,2,exec,$THEME/scripts/workspace_switch 2 +bind=$MOD1,3,exec,$THEME/scripts/workspace_switch 3 +bind=$MOD1,4,exec,$THEME/scripts/workspace_switch 4 +bind=$MOD1,5,exec,$THEME/scripts/workspace_switch 5 +bind=$MOD1,6,exec,$THEME/scripts/workspace_switch 6 +bind=$MOD1,7,exec,$THEME/scripts/workspace_switch 7 +bind=$MOD1,8,exec,$THEME/scripts/workspace_switch 8 +bind=$MOD1,9,exec,$THEME/scripts/workspace_switch 9 +bind=$MOD1,0,exec,$THEME/scripts/workspace_switch 10 \ No newline at end of file diff --git a/colors b/colors new file mode 100644 index 0000000..a979f58 --- /dev/null +++ b/colors @@ -0,0 +1,19 @@ +0: #1b3c46 +1: #9DBAD8 +2: #DABAC8 +3: #B2C2DE +4: #B4C6E3 +5: #D5C7DA +6: #E6C9D5 +7: #dedde8 +8: #9b9aa2 +9: #9DBAD8 +10: #DABAC8 +11: #B2C2DE +12: #B4C6E3 +13: #D5C7DA +14: #E6C9D5 +15: #dedde8 +background: #1b3c46 +foreground: #dedde8 +cursor: #dedde8 diff --git a/components/ags/assets/nier-border.svg b/components/ags/assets/nier-border.svg new file mode 100644 index 0000000..147a894 --- /dev/null +++ b/components/ags/assets/nier-border.svg @@ -0,0 +1,20 @@ + + + + + + + + + + \ No newline at end of file diff --git a/components/ags/assets/nier-pointer-white.svg b/components/ags/assets/nier-pointer-white.svg new file mode 100644 index 0000000..57fe483 --- /dev/null +++ b/components/ags/assets/nier-pointer-white.svg @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/components/ags/assets/nier-pointer.svg b/components/ags/assets/nier-pointer.svg new file mode 100644 index 0000000..ecd3af0 --- /dev/null +++ b/components/ags/assets/nier-pointer.svg @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/components/ags/config.js b/components/ags/config.js new file mode 100644 index 0000000..b4d97f1 --- /dev/null +++ b/components/ags/config.js @@ -0,0 +1,101 @@ +// importing +import { + Hyprland, + Notifications, + Mpris, + Audio, + Battery, + SystemTray, + App, + Widget, + Utils, + Variable, +} from "./imports.js"; + +import { + NierLongButton, + NierLongButtonGroup, + NierToggle, +} from "./nier/buttons.js"; + +import { css, scss } from "./util.js"; +import { Workspaces } from "./widgets/workspace.js"; + +Utils.exec(`sassc ${scss} ${css}`); + +Utils.subprocess( + [ + "inotifywait", + "--recursive", + "--event", + "create,modify", + "-m", + App.configDir + "/style", + ], + () => { + Utils.exec(`sassc ${scss} ${css}`); + App.resetCss(); + App.applyCss(css); + } +); + +// const Workspaces = () => +// Widget.Box({ +// className: "workspaces", + +// children: Array.from({ length: 10 }, (_, i) => i + 1).map((i) => +// Widget.EventBox({ +// className: [`${i}`], +// child: NierToggle({ +// name: `workspace-${i}`, +// className: [`${i}`], +// label: `${i}`, +// size: 80, +// }), +// onPrimaryClick: (self) => { +// Utils.execAsync(`hyprctl dispatch workspace ${i}`); +// }, +// }) +// ), +// connections: [ +// [ +// Hyprland, +// (box) => { +// //loop through children +// for (const element of box.children) { +// console.log(element.className, Hyprland.active.workspace.id); +// if (element.className.includes(`${Hyprland.active.workspace.id}`)) { +// element.child.className = ["nier-toggle-on", "workspace"]; +// } else { +// element.child.className = ["nier-toggle-off"]; +// } +// } +// }, +// ], +// ], +// }); + +const Bar = ({ monitor } = {}) => { + return Widget.Window({ + name: `bar-${monitor}`, // name has to be unique + className: "bar", + monitor, + margin: [50, 50], + anchor: ["top", "left", "right"], + exclusive: true, + layer: "top", + child: Widget.Box({ + children: [Workspaces()], + }), + }); +}; +export default { + style: css, + windows: [ + // BottomBar() + Bar(), + // you can call it, for each monitor + // Bar({ monitor: 0 }), + // Bar({ monitor: 1 }) + ], +}; diff --git a/components/ags/imports.js b/components/ags/imports.js new file mode 100644 index 0000000..1d981b4 --- /dev/null +++ b/components/ags/imports.js @@ -0,0 +1,19 @@ +const resource = (file) => `resource:///com/github/Aylur/ags/${file}.js`; +const require = async (file) => (await import(resource(file))).default; +const service = async (file) => await require(`service/${file}`); + +export const App = await require("app"); +export const Widget = await require("widget"); +export const Service = await require("service"); +export const Variable = await require("variable"); +export const Utils = await import(resource("utils")); + +export const Applications = await service("applications"); +export const Audio = await service("audio"); +export const Battery = await service("battery"); +export const Bluetooth = await service("bluetooth"); +export const Hyprland = await service("hyprland"); +export const Mpris = await service("mpris"); +export const Network = await service("network"); +export const Notifications = await service("notifications"); +export const SystemTray = await service("systemtray"); diff --git a/components/ags/nier/buttons.js b/components/ags/nier/buttons.js new file mode 100644 index 0000000..00ff5df --- /dev/null +++ b/components/ags/nier/buttons.js @@ -0,0 +1,135 @@ +import { Widget, App } from "../imports.js"; +import { arradd, arrremove } from "../util.js"; +const { Button, Label, Overlay, EventBox, Box, Scrollable, Icon } = Widget; + +export const NierLongButtonGroup = ({ + heading = "", + scrollable = false, + className = [], + buttons = [], + horizontal = false, + min_scale = 200, + ...props +}) => { + let inner = Box({ + children: [ + Box({ + className: ["nier-long-button-group-ruler"], + }), + Box({ + vertical: !horizontal, + className: [ + horizontal + ? "nier-long-button-group" + : "nier-long-button-group-vertical", + ...className, + ], + children: [...buttons], + }), + ], + ...props, + }); + if (scrollable) { + return Scrollable({ + hscroll: horizontal ? "always" : "never", + vscroll: horizontal ? "never" : "always", + style: `${horizontal ? "min-width" : "min-height"}: ${min_scale}px;`, + child: inner, + }); + } else { + return inner; + } +}; + +export const NierLongButton = ({ + name = "", + className = [], + containerClassName = [], + containerConnections = [], + label = "", + toggled = false, + tab_style = false, + dat = "", + passedOnHoverLost = async (self) => {}, + passedOnHover = async (self) => {}, + + ...props +}) => + Box({ + className: ["nier-long-button-container", ...containerClassName], + connections: [...containerConnections], + children: [ + Icon({ + icon: App.configDir + "/assets/nier-pointer.svg", + size: 37, + className: [ + "nier-long-button-hover-icon", + "nier-long-button-hover-icon-hidden", + ], + }), + Button({ + name, + child: Label({ + label: "⬛ " + label, + xalign: 0, + justification: "left", + }), + onHover: (self) => { + passedOnHover(self); + self.className = arradd(self.className, "nier-long-button-hover"); + self.parent.children[0].className = [ + "nier-long-button-hover-icon", + "nier-long-button-hover-icon-visible", + ]; + }, + onHoverLost: (self) => { + passedOnHoverLost(self); + self.className = arrremove(self.className, "nier-long-button-hover"); + self.parent.children[0].className = [ + "nier-long-button-hover-icon", + "nier-long-button-hover-icon-hidden", + ]; + }, + className: ["nier-long-button", ...className], + ...props, + }), + ], + }); + +export const NierShortButton = ({ name, className, label, ...props }) => + Button({ + name, + className: ["nier-short-button", ...className], + ...props, + }); + +export const NierToggle = ({ + name, + className, + label, + _value = "", + state = false, + size = 70, + ...props +}) => + Button({ + name, + className: ["nier-toggle", ...className], + child: Icon({ + icon: App.configDir + "/assets/nier-border.svg", + size: size, + }), + // onClicked: (self) => { + // console.log(state, self.className); + // if (state) { + // self.className = arradd(self.className, "nier-toggle-off"); + // self.className = arrremove(self.className, "nier-toggle-on"); + // state = false; + // } else { + // self.className = arrremove(self.className, "nier-toggle-off"); + // self.className = arradd(self.className, "nier-toggle-on"); + // state = true; + // } + // }, + ...props, + }); diff --git a/components/ags/style/color.scss b/components/ags/style/color.scss new file mode 100644 index 0000000..3613143 --- /dev/null +++ b/components/ags/style/color.scss @@ -0,0 +1,6 @@ +$tan: rgba(194, 189, 166, 1); +$brown: rgba(72, 70, 61, 1); +$brown25: rgba(72, 70, 61, .25); +$brown15: rgba(72, 70, 61, .15); +$brown025: rgba(72, 70, 61, .025); +$darkBrown: rgba(69, 67, 58, 1); \ No newline at end of file diff --git a/components/ags/style/data.scss b/components/ags/style/data.scss new file mode 100644 index 0000000..e69de29 diff --git a/components/ags/style/nier.scss b/components/ags/style/nier.scss new file mode 100644 index 0000000..f2a14ae --- /dev/null +++ b/components/ags/style/nier.scss @@ -0,0 +1 @@ +@import "nier/longbutton"; diff --git a/components/ags/style/nier/longbutton.scss b/components/ags/style/nier/longbutton.scss new file mode 100644 index 0000000..acb3d4b --- /dev/null +++ b/components/ags/style/nier/longbutton.scss @@ -0,0 +1,113 @@ +@import "../color"; + +$accent_border: 3px; +$accent_border_dist: 4px; +$button_dist_from_ruler: 14px; +$button_spacing_vertical: 10px; +$button_spacing_horizontal: 5px; + +@mixin long-button-hover { + border-top: $brown $accent_border solid; + border-bottom: $brown $accent_border solid; + padding-top: $accent_border_dist; + padding-bottom: $accent_border_dist; + label { + padding-top: calc(8px - #{$accent_border_dist}); + padding-bottom: calc(7px - #{$accent_border_dist}); + background-position: -100%; + color: $tan; + } +} + +@mixin long-button { + border: none; + border-top: transparent $accent_border solid; + border-bottom: transparent $accent_border solid; + min-width: 200px; +} + +.nier-toggle { + // border: blue 2px solid; +} + +.nier-toggle-on { + opacity: 1; + transition: opacity 0.3s ease-in-out; +} + +.nier-toggle-off { + opacity: 0.3; + transition: opacity 0.3s ease-in-out; +} + +// the actual button looking thing ( is actuaally a label :0 ) +.nier-long-button label { + font-size: 2rem; + background: linear-gradient( + 90deg, + $brown25 0%, + $brown25 50%, + $brown 50%, + $brown 100% + ); + background-size: 200%; + color: $brown; + padding: 8px 8px 7px; + transition: background 0.1s cubic-bezier(0.15, 0.79, 0, 1), + border-color 0.3s ease-in-out, color 0.3s ease-in-out, + box-shadow 0.4s ease-in-out; +} + +//.nier-long-button-container = pointer + buttons +.nier-long-button-group-vertical .nier-long-button-container { + margin-bottom: $button_spacing_vertical; + &:last-child { + margin-bottom: 0; + } +} +// same but horizontal +.nier-long-button-group .nier-long-button-container { + margin-right: $button_spacing_horizontal; + &:last-child { + margin-right: 0; + } +} + +// top and bottom borders +.nier-long-button { + @include long-button; + transition: border 0.3s ease-in-out; +} +.nier-long-button-hover { + @include long-button-hover; + label { + transition: background 1s cubic-bezier(0.15, 0.79, 0, 1); + } +} + +.nier-long-button-group-ruler { + margin-top: 5px; + background: linear-gradient( + 90deg, + $brown25 7px, + transparent 0px, + transparent 13px, + $brown25 13px, + transparent 18px + ); + min-width: 20px; +} + +// pointer thing +.nier-long-button-hover-icon { + margin-left: -14px; + margin-right: $button_dist_from_ruler; +} +.nier-long-button-hover-icon-visible { + opacity: 1; + transition: opacity 0.3s ease-in-out; +} +.nier-long-button-hover-icon-hidden { + opacity: 0; + transition: opacity 0.3s ease-in-out; +} diff --git a/components/ags/style/style.css b/components/ags/style/style.css new file mode 100644 index 0000000..f5738e4 --- /dev/null +++ b/components/ags/style/style.css @@ -0,0 +1,190 @@ +* { + all: unset; } + +.nier-toggle-on { + opacity: 1; + transition: opacity 0.3s ease-in-out; } + +.nier-toggle-off { + opacity: 0.3; + transition: opacity 0.3s ease-in-out; } + +.nier-long-button label { + font-size: 2rem; + background: linear-gradient(90deg, rgba(72, 70, 61, 0.25) 0%, rgba(72, 70, 61, 0.25) 50%, #48463d 50%, #48463d 100%); + background-size: 200%; + color: #48463d; + padding: 8px 8px 7px; + transition: background 0.1s cubic-bezier(0.15, 0.79, 0, 1), border-color 0.3s ease-in-out, color 0.3s ease-in-out, box-shadow 0.4s ease-in-out; } + +.nier-long-button-group-vertical .nier-long-button-container { + margin-bottom: 10px; } + .nier-long-button-group-vertical .nier-long-button-container:last-child { + margin-bottom: 0; } + +.nier-long-button-group .nier-long-button-container { + margin-right: 5px; } + .nier-long-button-group .nier-long-button-container:last-child { + margin-right: 0; } + +.nier-long-button { + border: none; + border-top: transparent 3px solid; + border-bottom: transparent 3px solid; + min-width: 200px; + transition: border 0.3s ease-in-out; } + +.nier-long-button-hover { + border-top: #48463d 3px solid; + border-bottom: #48463d 3px solid; + padding-top: 4px; + padding-bottom: 4px; } + .nier-long-button-hover label { + padding-top: calc(8px - 4px); + padding-bottom: calc(7px - 4px); + background-position: -100%; + color: #c2bda6; } + .nier-long-button-hover label { + transition: background 1s cubic-bezier(0.15, 0.79, 0, 1); } + +.nier-long-button-group-ruler { + margin-top: 5px; + background: linear-gradient(90deg, rgba(72, 70, 61, 0.25) 7px, transparent 0px, transparent 13px, rgba(72, 70, 61, 0.25) 13px, transparent 18px); + min-width: 20px; } + +.nier-long-button-hover-icon { + margin-left: -14px; + margin-right: 14px; } + +.nier-long-button-hover-icon-visible { + opacity: 1; + transition: opacity 0.3s ease-in-out; } + +.nier-long-button-hover-icon-hidden { + opacity: 0; + transition: opacity 0.3s ease-in-out; } + +.nier-toggle-on { + opacity: 1; + transition: opacity 0.3s ease-in-out; } + +.nier-toggle-off { + opacity: 0.3; + transition: opacity 0.3s ease-in-out; } + +.nier-long-button label { + font-size: 2rem; + background: linear-gradient(90deg, rgba(72, 70, 61, 0.25) 0%, rgba(72, 70, 61, 0.25) 50%, #48463d 50%, #48463d 100%); + background-size: 200%; + color: #48463d; + padding: 8px 8px 7px; + transition: background 0.1s cubic-bezier(0.15, 0.79, 0, 1), border-color 0.3s ease-in-out, color 0.3s ease-in-out, box-shadow 0.4s ease-in-out; } + +.nier-long-button-group-vertical .nier-long-button-container { + margin-bottom: 10px; } + .nier-long-button-group-vertical .nier-long-button-container:last-child { + margin-bottom: 0; } + +.nier-long-button-group .nier-long-button-container { + margin-right: 5px; } + .nier-long-button-group .nier-long-button-container:last-child { + margin-right: 0; } + +.nier-long-button { + border: none; + border-top: transparent 3px solid; + border-bottom: transparent 3px solid; + min-width: 200px; + transition: border 0.3s ease-in-out; } + +.nier-long-button-hover { + border-top: #48463d 3px solid; + border-bottom: #48463d 3px solid; + padding-top: 4px; + padding-bottom: 4px; } + .nier-long-button-hover label { + padding-top: calc(8px - 4px); + padding-bottom: calc(7px - 4px); + background-position: -100%; + color: #c2bda6; } + .nier-long-button-hover label { + transition: background 1s cubic-bezier(0.15, 0.79, 0, 1); } + +.nier-long-button-group-ruler { + margin-top: 5px; + background: linear-gradient(90deg, rgba(72, 70, 61, 0.25) 7px, transparent 0px, transparent 13px, rgba(72, 70, 61, 0.25) 13px, transparent 18px); + min-width: 20px; } + +.nier-long-button-hover-icon { + margin-left: -14px; + margin-right: 14px; } + +.nier-long-button-hover-icon-visible { + opacity: 1; + transition: opacity 0.3s ease-in-out; } + +.nier-long-button-hover-icon-hidden { + opacity: 0; + transition: opacity 0.3s ease-in-out; } + +.workspace-button-container.active-no-hover .nier-long-button { + border-top: #48463d 3px solid; + border-bottom: #48463d 3px solid; + padding-top: 4px; + padding-bottom: 4px; + animation: active 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; + animation-delay: 0.3s; } + .workspace-button-container.active-no-hover .nier-long-button label { + padding-top: calc(8px - 4px); + padding-bottom: calc(7px - 4px); + background-position: -100%; + color: #c2bda6; } + .workspace-button-container.active-no-hover .nier-long-button label { + transition: background 0.3s cubic-bezier(0.15, 0.79, 0, 1); + animation: active-label 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; + animation-delay: 0.3s; } + +.workspace-button-container.active .nier-long-button { + animation: active 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; } + .workspace-button-container.active .nier-long-button label { + transition: background 0.3s cubic-bezier(0.15, 0.79, 0, 1); + animation: active-label 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; } + +.active-on-hold .nier-long-button-hover-icon, +.active-no-hover-on-hold .nier-long-button-hover-icon { + opacity: 1; } + +.under-workspaces { + margin-top: -8px; + margin-right: 120px; } + +.workspace-button { + margin-bottom: 20px; + transition: border 0.3s cubic-bezier(0.15, 0.79, 0, 1); } + +.workspace-button-container .nier-long-button-hover-icon { + margin-bottom: 20px; } + +.workspace-button-container .nier-long-button { + transition: margin 0.1s cubic-bezier(0.15, 0.79, 0, 1); } + +.workspace-button-container.active .nier-long-button-hover-icon, +.workspace-button-container.active-no-hover .nier-long-button-hover-icon { + opacity: 1; } + +@keyframes active-label { + 0% { + padding-bottom: 8px; } + 100% { + padding-bottom: 20px; } } + +@keyframes active { + 0% { + margin-bottom: 20px; + border: transparent 0px; } + 100% { + margin-bottom: 0px; + border: none; + border-top: transparent 3px solid; + border-bottom: transparent 3px solid; + min-width: 200px; } } diff --git a/components/ags/style/style.scss b/components/ags/style/style.scss new file mode 100644 index 0000000..e4b10df --- /dev/null +++ b/components/ags/style/style.scss @@ -0,0 +1,7 @@ +* { + all: unset; +} + +@import "nier"; + +@import "widgets/workspace.scss"; diff --git a/components/ags/style/widgets/workspace.scss b/components/ags/style/widgets/workspace.scss new file mode 100644 index 0000000..1563e76 --- /dev/null +++ b/components/ags/style/widgets/workspace.scss @@ -0,0 +1,78 @@ +@import "../color"; +@import "../nier/longbutton.scss"; + +.workspace-button-container.active-no-hover { + .nier-long-button { + @include long-button-hover; + label { + transition: background 0.3s cubic-bezier(0.15, 0.79, 0, 1); + animation: active-label 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; + animation-delay: 0.3s; + } + animation: active 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; + animation-delay: 0.3s; + } +} + +.workspace-button-container.active { + .nier-long-button { + label { + transition: background 0.3s cubic-bezier(0.15, 0.79, 0, 1); + animation: active-label 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; + } + animation: active 0.5s cubic-bezier(0.15, 0.79, 0, 1) forwards; + } +} + +.active-on-hold, +.active-no-hover-on-hold { + .nier-long-button-hover-icon { + opacity: 1; + } +} + +.under-workspaces { + margin-top: -8px; + margin-right: 120px; +} + +.workspace-button { + margin-bottom: 20px; + transition: border 0.3s cubic-bezier(0.15, 0.79, 0, 1); +} + +.workspace-button-container { + .nier-long-button-hover-icon { + margin-bottom: 20px; + } + .nier-long-button { + transition: margin 0.1s cubic-bezier(0.15, 0.79, 0, 1); + } +} + +.workspace-button-container.active, +.workspace-button-container.active-no-hover { + .nier-long-button-hover-icon { + opacity: 1; + } +} + +@keyframes active-label { + 0% { + padding-bottom: 8px; + } + 100% { + padding-bottom: 20px; + } +} + +@keyframes active { + 0% { + margin-bottom: 20px; + border: transparent 0px; + } + 100% { + margin-bottom: 0px; + @include long-button; + } +} diff --git a/components/ags/util.js b/components/ags/util.js new file mode 100644 index 0000000..d65dae1 --- /dev/null +++ b/components/ags/util.js @@ -0,0 +1,48 @@ +import { App, Utils } from "./imports.js"; + +function arrremove(arr, value) { + return arr.filter(function (ele) { + return ele != value; + }); +} + +function arradd(arr, value) { + if (arr.includes(value)) { + return arr; + } + arr.push(value); + return arr; +} + +const home = `/home/${Utils.exec("whoami")}`; +const themedir = App.configDir.split("/").slice(0, -2).join("/"); + +const scss = App.configDir + "/style/style.scss"; +const css = App.configDir + "/style/style.css"; +const { execAsync } = Utils; + +const { exec } = Utils; +const SCREEN_WIDTH = Number( + exec( + `bash -c "xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1 | head -1"` + ) +); +const SCREEN_HEIGHT = Number( + exec( + `bash -c "xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2 | head -1"` + ) +); +globalThis["SCREEN_WIDTH"] = SCREEN_WIDTH; +globalThis["SCREEN_HEIGHT"] = SCREEN_HEIGHT; + +export { + arradd, + arrremove, + home, + themedir, + scss, + css, + SCREEN_HEIGHT, + SCREEN_WIDTH, + zoom_out, +}; diff --git a/components/ags/widgets/workspace.js b/components/ags/widgets/workspace.js new file mode 100644 index 0000000..f50d937 --- /dev/null +++ b/components/ags/widgets/workspace.js @@ -0,0 +1,167 @@ +// importing +import { + Hyprland, + Notifications, + Mpris, + Audio, + Battery, + SystemTray, + App, + Widget, + Utils, + Variable, +} from "../imports.js"; +import { + NierLongButton, + NierLongButtonGroup, + NierToggle, +} from "../nier/buttons.js"; + +import { SCREEN_HEIGHT, SCREEN_WIDTH, arradd, arrremove } from "../util.js"; + +const { Box, Label } = Widget; +const { execAsync } = Utils; + +let HOVERING = false; +let REALLY_HOVERING = false; +export const Workspaces = () => + Box({ + vertical: true, + children: [ + NierLongButtonGroup({ + horizontal: true, + min_scale: SCREEN_WIDTH, + className: ["workspaces"], + buttons: Array.from({ length: 10 }, (_, i) => i + 1).map((i) => { + return NierLongButton({ + className: ["workspace-button"], + containerClassName: [ + "workspace-button-container", + `workspace-button-${i}`, + ], + label: `${i}`, + onClicked: () => { + execAsync(`hyprctl dispatch workspace ${i}`); + }, + passedOnHover: async (self) => { + if ( + !( + self.parent.className.includes("active") || + self.parent.className.includes("active-no-hover") + ) + ) { + HOVERING = true; + REALLY_HOVERING = true; + } + if (HOVERING) { + for (let button of self.parent.parent.children) { + if ( + button.className.includes("active") || + button.className.includes("active-no-hover") + ) { + button.className = arrremove( + button.className, + "active-no-hover" + ); + button.className = arrremove(button.className, "active"); + button.className = arradd( + button.className, + "active-no-hover-on-hold" + ); + } + } + } + }, + passedOnHoverLost: async (self) => { + if (!self.className.includes("active")) { + HOVERING = false; + await new Promise((r) => setTimeout(r, 300)); + if (!HOVERING && REALLY_HOVERING) { + REALLY_HOVERING = false; + } + } + if (!HOVERING) { + for (let button of self.parent.parent.children) { + if (button.className.includes("active-on-hold")) { + button.className = arrremove( + button.className, + "active-on-hold" + ); + button.className = arradd(button.className, "active"); + } + if (button.className.includes("active-no-hover-on-hold")) { + button.className = arrremove( + button.className, + "active-no-hover-on-hold" + ); + button.className = arradd( + button.className, + "active-no-hover" + ); + } + } + } + }, + containerConnections: [ + [ + Hyprland.active.workspace, + + async (self) => { + console.log( + "workspacec changed to :: ", + Hyprland.active.workspace.id + ); + if ( + !self.className.includes( + `workspace-button-${Hyprland.active.workspace.id}` + ) + ) { + self.className = arrremove( + self.className, + "active-on-hold" + ); + self.className = arrremove( + self.className, + "active-no-hover-on-hold" + ); + self.className = arrremove(self.className, "active"); + self.className = arrremove( + self.className, + "active-no-hover" + ); + self.children[0].icon = + App.configDir + "/assets/nier-pointer.svg"; + } else { + if ( + !self.children[1].className.includes( + "nier-long-button-hover" + ) + ) { + self.className = arradd( + self.className, + "active-no-hover" + ); + } else { + self.children[1].className = arrremove( + self.children[1].className, + "nier-long-button-hover" + ); + self.className = arradd(self.className, "active"); + } + await new Promise((r) => setTimeout(r, 300)); + self.children[0].icon = + App.configDir + "/assets/nier-pointer-white.svg"; + } + }, + ], + ], + }); + }), + }), + Box({ + className: ["under-workspaces"], + style: `background: url("${App.configDir}/assets/nier-border.svg") repeat-x;`, + child: Label(""), + }), + ], + }); diff --git a/deps b/deps new file mode 100644 index 0000000..4d3ea07 --- /dev/null +++ b/deps @@ -0,0 +1,5 @@ +aylurs-gtk-shell +cava +python +python-colorz +pywal diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..129d379 --- /dev/null +++ b/readme.md @@ -0,0 +1 @@ +:0 \ No newline at end of file diff --git a/scripts/apply.sh b/scripts/apply.sh new file mode 100755 index 0000000..3cb00d8 --- /dev/null +++ b/scripts/apply.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env fish + +set -Ux STARSHIP_CONFIG $argv[1]/starship.toml +set -Ux HYPRLAND_THEME $argv[1] +set color ~/.config/hypr/scripts/color + +pkill dunst & +pkill -USR2 fish & + +swww init & + +#TODO: add a check for asusctl +asusctl led-mode static -c "$($color cursor -n)" & + +python $argv[1]/scripts/pywal_set.py 1 & + +ags -c ~/rice/themes/aurora/components/ags/config.js & + + diff --git a/scripts/apply_wall b/scripts/apply_wall new file mode 100755 index 0000000..14a00a0 --- /dev/null +++ b/scripts/apply_wall @@ -0,0 +1,132 @@ +#!/usr/bin/env python +import subprocess +import os +import pywal +import numpy as np +import matplotlib as mpl +import time + + +def colormix(c1, c2, mix=0): + # get np arrays c1 and c2 from hex + c1 = np.array(mpl.colors.to_rgb(c1)) + c2 = np.array(mpl.colors.to_rgb(c2)) + return mpl.colors.to_hex((1 - mix) * c1 + mix * c2) + + +def alpha(c1, a): + c1 = np.array(mpl.colors.to_rgb(c1)) + return mpl.colors.to_hex(c1 + (1 - c1) * a) + + +def apply(pre=None, wallpaper=None): + if not pre: + colors = pywal.colors.get(wallpaper, backend="wal") + else: + colors = pre + print(wallpaper) + print("colors::::: ", colors) + + cmd = f"swww img '{wallpaper}' --transition-type grow --transition-step 1 --transition-duration 1 --transition-pos 0.5,1.0" + subprocess.run(cmd, shell=True) + + with open(os.path.expanduser("~/.config/hypr/themes/colors_base"), "r") as cr: + raw = cr.read() + new_colors = {} + + for line in raw.split("\n"): + if line and not line.startswith("#"): + color, value = line.split(":") + if color.isnumeric(): + new_colors[color.strip()] = colormix( + value.strip(), + colors["colors"]["color" + color.strip()], + mix=0.8, + ) + + for color, value in colors["special"].items(): + new_colors[color] = value + + with open(os.path.expanduser("~/.config/hypr/themes/colors"), "w") as f: + for color, value in new_colors.items(): + f.write(f"{color}: {value}\n") + + with open(os.path.expanduser("~/.config/hypr/themes/uicolors"), "w") as f: + for color, value in colors["colors"].items(): + f.write(f"{color[5:]}: {value}\n") + for color, value in colors["special"].items(): + f.write(f"{color}: {value}\n") + + subprocess.run("touch ~/.config/hypr/themes/uicolors", shell=True) + + # active borders + gradient = "" + for color, value in colors["colors"].items(): + gradient += f"rgba({value[1:]}ff) " + gradient += " 45deg" + cmd = f"hyprctl keyword general:col.active_border '{gradient}'" + print(cmd) + subprocess.run(cmd, shell=True) + + # inactive borders + gradient = "" + for color, value in colors["colors"].items(): + gradient += f"rgba({value[1:]}44) " + gradient += " 0deg" + cmd = f"hyprctl keyword general:col.inactive_border '{gradient}'" + print(cmd) + subprocess.run(cmd, shell=True) + + cmd = ( + f"hyprctl keyword decoration:col.shadow '0x33{colors['colors']['color5'][1:]}'" + ) + print(cmd) + subprocess.run(cmd, shell=True) + + cmd = f"hyprctl keyword decoration:col.shadow_inactive '0x22{colors['special']['background'][1:]}'" + print(cmd) + subprocess.run(cmd, shell=True) + + # keyboard + cmd = f"asusctl led-mode static -c '{colors['colors']['color0'][1:]}'" + print(cmd) + subprocess.run(cmd, shell=True) + + # cava + with open(os.path.expanduser("~/.config/cava/config"), "r") as f: + conf = f.read() + + conf = conf.split("#--- cover2bg.py ---")[0] + + conf += ( + "\n#--- cover2bg.py ---\n" + + f""" +[color] +background = '{colors["special"]["background"]}' + +gradient = 1 + +gradient_color_1 = '{colors["colors"]["color0"]}' +gradient_color_2 = '{colors["colors"]["color1"]}' +gradient_color_3 = '{colors["colors"]["color2"]}' +gradient_color_4 = '{colors["colors"]["color3"]}' +gradient_color_5 = '{colors["colors"]["color4"]}' +gradient_color_6 = '{colors["colors"]["color5"]}' +gradient_color_7 = '{colors["colors"]["color6"]}' +gradient_color_8 = '{colors["colors"]["color7"]}' +""" + ) + with open(os.path.expanduser("~/.config/cava/config"), "w") as f: + f.write(conf) + + time.sleep(0.5) + subprocess.run("pkill -USR2 cava", shell=True) + subprocess.run("pkill -USR2 fish", shell=True) + + +def main(): + apply(wallpaper="/tmp/bg.png") + + +if __name__ == "__main__": + main() diff --git a/scripts/cover2bg b/scripts/cover2bg new file mode 100755 index 0000000..ef5bc7c --- /dev/null +++ b/scripts/cover2bg @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +HQ=0 + +if [ -z "$1" ]; then + echo "Please provide an image" + exit 1 +fi +if [ ! -f "$1" ]; then + echo "Image does not exist" + exit 1 +fi +if ! file "$1" | grep -qE 'image|bitmap'; then + echo "Image is not a valid image" + exit 1 +fi + +# get json from hyprctl +json=$(hyprctl monitors -j) +json=$(echo $json | jq '.[0]') +width=$(echo $json | jq '.width') +height=$(echo $json | jq '.height') + +if [ -f /tmp/prev_bg.png ]; then + if cmp -s "$1" /tmp/prev_bg.png; then + echo "Image is the same" + exit 0 + fi +fi + +cp "$1" /tmp/prev_bg.png + +echo "Image is different" + +cp "$1" /tmp/bg.png + +magick mogrify -fuzz 4% -trim +repage -shave 7x7 -format png /tmp/bg.png + +#if HQ == 1 +if [ $HQ -eq 1 ]; then + convert /tmp/bg.png -resize $((width))x$((height))^ -gravity center -extent $((width))x$((height)) /tmp/bg.png +else + convert /tmp/bg.png -resize $((width / 2))x$((height / 2))^ -gravity center -extent $((width / 2))x$((height / 2)) /tmp/bg.png +fi + +img_width=$(identify -format "%w" /tmp/bg.png) +img_height=$(identify -format "%h" /tmp/bg.png) + +convert /tmp/bg.png -blur 0x40 /tmp/bg.png + +color=$(convert /tmp/bg.png -gravity center -crop 1x1+0+0 +repage txt:- | grep -m 1 -o '#[0-9A-F]\{6\}') +convert -size ${width}x$((height / 3)) gradient:$color-transparent /tmp/gradient.png +convert /tmp/bg.png /tmp/gradient.png -gravity north -composite /tmp/bg.png + +# if /tmp/texture.png is not a file +if [ ! -f /tmp/texture.png ]; then + echo "texture not found" + convert -size ${img_width}x${img_height} xc:gray +noise Random -channel A -threshold 90% /tmp/texture.png +fi +# convert -size ${img_width}x${img_height} xc:gray +noise Random -channel A -threshold 90% /tmp/texture.png +convert /tmp/texture.png -alpha set -channel A -evaluate set 5% /tmp/texture.png +convert /tmp/bg.png /tmp/texture.png -gravity center -compose overlay -composite /tmp/bg.png + +ags -r "dominant_color.value = '$color';" + +$HYPRLAND_THEME/scripts/apply_wall /tmp/bg.png + + diff --git a/scripts/pywal_set b/scripts/pywal_set new file mode 100755 index 0000000..fa6f3ed --- /dev/null +++ b/scripts/pywal_set @@ -0,0 +1,171 @@ +#!/usr/bin/env python + +import pywal +import argparse +import os +import subprocess +import numpy as np +import matplotlib as mpl +import time + +THEME_DIR = os.environ.get("HYPRLAND_THEME") +print(THEME_DIR) + + +def colormix(c1, c2, mix=0): + # get np arrays c1 and c2 from hex + c1 = np.array(mpl.colors.to_rgb(c1)) + c2 = np.array(mpl.colors.to_rgb(c2)) + return mpl.colors.to_hex((1 - mix) * c1 + mix * c2) + + +def alpha(c1, a): + c1 = np.array(mpl.colors.to_rgb(c1)) + return mpl.colors.to_hex(c1 + (1 - c1) * a) + + +def apply(pre=None, wallpaper=None): + if not pre: + colors = pywal.colors.get(wallpaper, backend="wal") + else: + colors = pre + print(wallpaper) + print("colors::::: ", colors) + + cmd = f"swww img '{wallpaper}' --transition-type outer --transition-step 1 --transition-duration 1 --transition-pos 0.5,1.0" + subprocess.run(cmd, shell=True) + + with open(os.path.expanduser("~/.config/hypr/themes/colors_base"), "r") as cr: + raw = cr.read() + new_colors = {} + + for line in raw.split("\n"): + if line and not line.startswith("#"): + color, value = line.split(":") + if color.isnumeric(): + new_colors[color.strip()] = colormix( + value.strip(), + colors["colors"]["color" + color.strip()], + mix=0.75, + ) + + for color, value in colors["special"].items(): + new_colors[color] = value + + with open(os.path.expanduser("~/.config/hypr/themes/colors"), "w") as f: + for color, value in new_colors.items(): + f.write(f"{color}: {value}\n") + + with open(os.path.expanduser("~/.config/hypr/themes/uicolors"), "w") as f: + for color, value in colors["colors"].items(): + f.write(f"{color[5:]}: {value}\n") + for color, value in colors["special"].items(): + f.write(f"{color}: {value}\n") + + subprocess.run("touch ~/.config/hypr/themes/uicolors", shell=True) + + # active borders + gradient = "" + for color, value in colors["colors"].items(): + gradient += f"rgba({value[1:]}ff) " + gradient += " 45deg" + cmd = f"hyprctl keyword general:col.active_border '{gradient}'" + print(cmd) + subprocess.run(cmd, shell=True) + + # inactive borders + gradient = "" + for color, value in colors["colors"].items(): + gradient += f"rgba({value[1:]}44) " + gradient += " 0deg" + cmd = f"hyprctl keyword general:col.inactive_border '{gradient}'" + print(cmd) + subprocess.run(cmd, shell=True) + + cmd = ( + f"hyprctl keyword decoration:col.shadow '0x33{colors['colors']['color5'][1:]}'" + ) + print(cmd) + subprocess.run(cmd, shell=True) + + cmd = f"hyprctl keyword decoration:col.shadow_inactive '0x22{colors['special']['background'][1:]}'" + print(cmd) + subprocess.run(cmd, shell=True) + + # keyboard + cmd = f"asusctl led-mode static -c '{colors['colors']['color0'][1:]}'" + print(cmd) + subprocess.run(cmd, shell=True) + + # cava + with open(os.path.expanduser("~/.config/cava/config"), "r") as f: + conf = f.read() + + conf = conf.split("#--- cover2bg.py ---")[0] + + conf += ( + "\n#--- cover2bg.py ---\n" + + f""" +[color] +background = '{colors["special"]["background"]}' + +gradient = 1 + +gradient_color_1 = '{colors["colors"]["color0"]}' +gradient_color_2 = '{colors["colors"]["color1"]}' +gradient_color_3 = '{colors["colors"]["color2"]}' +gradient_color_4 = '{colors["colors"]["color3"]}' +gradient_color_5 = '{colors["colors"]["color4"]}' +gradient_color_6 = '{colors["colors"]["color5"]}' +gradient_color_7 = '{colors["colors"]["color6"]}' +gradient_color_8 = '{colors["colors"]["color7"]}' +""" + ) + with open(os.path.expanduser("~/.config/cava/config"), "w") as f: + f.write(conf) + + time.sleep(0.5) + subprocess.run("pkill -USR2 cava", shell=True) + subprocess.run("pkill -USR2 fish", shell=True) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--index", help="wallpaper index") + parser.add_argument( + "--nosave", + help="to save wallpaper to `currentwall` or not", + action="store_true", + ) + parser.add_argument( + "--reset", help="to set wallpaper in `currentwall`", action="store_true" + ) + # parser.add_argument("cycle", help="cycle wall", required=False) + args = parser.parse_args() + + if args.reset: + with open(os.path.join(THEME_DIR, "currentwall"), "r") as f: + index = f.read() + args.index = index + + if args.index and args.index.isdigit(): + index = int(args.index) + wallpaper = os.listdir(os.path.join(THEME_DIR, "wallpapers"))[index - 1] + wallpaper = os.path.join(os.path.join(THEME_DIR, "wallpapers"), wallpaper) + else: + wallpaper = os.path.expanduser(args.index) + + if not args.nosave: + with open(os.path.join(THEME_DIR, "currentwall"), "w") as f: + f.write(str(args.index)) + + try: + apply(wallpaper=wallpaper) + except Exception: + wallpaper = os.listdir(os.path.join(THEME_DIR, "wallpapers"))[0] + wallpaper = os.path.join(os.path.join(THEME_DIR, "wallpapers"), wallpaper) + apply(wallpaper=wallpaper) + + +if __name__ == "__main__": + main() diff --git a/scripts/workspace_switch b/scripts/workspace_switch new file mode 100644 index 0000000..2dfd7a5 --- /dev/null +++ b/scripts/workspace_switch @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +hyprctl keyword monitor "eDP-1,addreserved,50,50,50,50" +sleep 0.1 +hyprctl dispatch workspace $1 +sleep 0.1 +hyprctl keyword monitor "eDP-1,addreserved,0,0,0,0" \ No newline at end of file diff --git a/starship.toml b/starship.toml new file mode 100644 index 0000000..e1d3d66 --- /dev/null +++ b/starship.toml @@ -0,0 +1,16 @@ +# Use custom format: +format="$directory$git_branch$character" + +# Prompt symbols +[character] +success_symbol = "[🞈](bright-green bold)" +error_symbol = "[🞈](bright-red)" +vicmd_symbol = "[🞈](bright-yellow)" + +[directory] +format = "[]($style)[(bg:white fg:black)$path](bg:white fg:black)[ ]($style)" +style = "bg:background fg:white" + +[git_branch] +format = "[]($style)[[ ](bg:white fg:black bold)$branch](bg:white fg:black)[ ]($style)" +style = "bg:background fg:white" \ No newline at end of file diff --git a/theme.conf b/theme.conf new file mode 100644 index 0000000..8bf1980 --- /dev/null +++ b/theme.conf @@ -0,0 +1,29 @@ +exec=cp $THEME/colors $HOME/.config/hypr/themes/colors +exec=$THEME/scripts/apply.sh $THEME + +decoration { + drop_shadow = true + shadow_range=100 + shadow_render_power=2 + col.shadow= 0x33D5C7DA + col.shadow_inactive=0x221b3c46 + rounding=15 +} + +general { + col.active_border=rgba(cba6f7ff) rgba(89b4faff) rgba(94e2d5ff) 10deg + col.inactive_border=0xff45475a + border_size=5 +} + +animations { + enabled=1 + # bezier=overshot,0.05,0.9,0.1,1.1 + bezier=overshot,0.13,0.99,0.29,1.1 + bezier = linear, 0.0, 0.0, 1.0, 1.0 + animation=windows,1,4,overshot,slide + animation=border,1,10,default + animation=fade,1,10,default + animation=workspaces,1,6,overshot,slide + animation = borderangle, 1, 100, linear, loop +} \ No newline at end of file