From b54468d17a8f8341893326810bc5810482e17bbb Mon Sep 17 00:00:00 2001 From: Keyoonz Date: Sun, 29 Dec 2024 21:17:59 +0100 Subject: [PATCH] eww osd and battery warning --- .config/eww/battery.yuck | 28 ++++++ .config/eww/brightness.yuck | 23 +++++ .config/eww/colors.scss | 105 ++++++++++++++++++++++ .config/eww/eww.scss | 120 ++++++++++++++++++++++++++ .config/eww/eww.yuck | 3 + .config/eww/volume.yuck | 36 ++++++++ .config/hypr/apps.conf | 2 + .config/hypr/hyprland.conf | 2 + .config/hypr/keybinds.conf | 10 +-- .config/matugen/config.toml | 4 + .config/matugen/templates/colors.scss | 7 ++ .config/nvim/lazy-lock.json | 29 ++++--- .config/nvim/lua/plugins/yuck.lua | 1 + .config/scripts/batteryWarning.sh | 11 +++ .config/scripts/osd.sh | 44 ++++++++++ 15 files changed, 406 insertions(+), 19 deletions(-) create mode 100644 .config/eww/battery.yuck create mode 100644 .config/eww/brightness.yuck create mode 100644 .config/eww/colors.scss create mode 100644 .config/eww/eww.scss create mode 100644 .config/eww/eww.yuck create mode 100644 .config/eww/volume.yuck create mode 100644 .config/matugen/templates/colors.scss create mode 100644 .config/nvim/lua/plugins/yuck.lua create mode 100755 .config/scripts/batteryWarning.sh create mode 100755 .config/scripts/osd.sh diff --git a/.config/eww/battery.yuck b/.config/eww/battery.yuck new file mode 100644 index 0000000..a3e5e20 --- /dev/null +++ b/.config/eww/battery.yuck @@ -0,0 +1,28 @@ +(defwindow batteryLow + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "top center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + (button + :onclick "eww close batteryLow" + "Battery Low")) + + +(defwindow batteryCritical + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "top center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + (button + :onclick "eww close batteryCritical" + "Battery Critical")) diff --git a/.config/eww/brightness.yuck b/.config/eww/brightness.yuck new file mode 100644 index 0000000..7853cab --- /dev/null +++ b/.config/eww/brightness.yuck @@ -0,0 +1,23 @@ +(defwindow brightnessUp + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "bottom center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + "brightness up") + +(defwindow brightnessDown + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "bottom center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + "brightness down") diff --git a/.config/eww/colors.scss b/.config/eww/colors.scss new file mode 100644 index 0000000..277c9a0 --- /dev/null +++ b/.config/eww/colors.scss @@ -0,0 +1,105 @@ +/* +* Css Colors +* Generated with Matugen +*/ + +$background: #151218; + +$error: #ffb4ab; + +$error_container: #93000a; + +$inverse_on_surface: #322f35; + +$inverse_primary: #6a538c; + +$inverse_surface: #e7e0e8; + +$on_background: #e7e0e8; + +$on_error: #690005; + +$on_error_container: #ffdad6; + +$on_primary: #3b255b; + +$on_primary_container: #eddcff; + +$on_primary_fixed: #250e44; + +$on_primary_fixed_variant: #523c73; + +$on_secondary: #352d40; + +$on_secondary_container: #ebddf7; + +$on_secondary_fixed: #1f182a; + +$on_secondary_fixed_variant: #4c4357; + +$on_surface: #e7e0e8; + +$on_surface_variant: #cbc4cf; + +$on_tertiary: #4b252e; + +$on_tertiary_container: #ffd9df; + +$on_tertiary_fixed: #321019; + +$on_tertiary_fixed_variant: #643b44; + +$outline: #958e99; + +$outline_variant: #4a454e; + +$primary: #d6bbfb; + +$primary_container: #523c73; + +$primary_fixed: #eddcff; + +$primary_fixed_dim: #d6bbfb; + +$scrim: #000000; + +$secondary: #cec2db; + +$secondary_container: #4c4357; + +$secondary_fixed: #ebddf7; + +$secondary_fixed_dim: #cec2db; + +$shadow: #000000; + +$source_color: #6f22cd; + +$surface: #151218; + +$surface_bright: #3b383e; + +$surface_container: #211e24; + +$surface_container_high: #2c292f; + +$surface_container_highest: #37333a; + +$surface_container_low: #1d1a20; + +$surface_container_lowest: #100d12; + +$surface_dim: #151218; + +$surface_tint: #d6bbfb; + +$surface_variant: #4a454e; + +$tertiary: #f1b7c2; + +$tertiary_container: #643b44; + +$tertiary_fixed: #ffd9df; + +$tertiary_fixed_dim: #f1b7c2; + diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss new file mode 100644 index 0000000..99f890b --- /dev/null +++ b/.config/eww/eww.scss @@ -0,0 +1,120 @@ +@import 'colors.scss'; + +.batteryLow { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} + +.batteryCritical { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} + +.volumeUp { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} + +.volumeDown { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} + +.volumeToggle { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} + +.brightnessUp { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} + +.brightnessDown { + border: 0.3em solid $primary; + border-radius: 2.5em; + color: $primary; + padding: 0; + + label { + border-radius: 2.3em; + background-color: $background; + } + + &:hover { + border-color: $tertiary; + color: $tertiary; + } +} diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck new file mode 100644 index 0000000..ecdcb8e --- /dev/null +++ b/.config/eww/eww.yuck @@ -0,0 +1,3 @@ +(include "battery.yuck") +(include "volume.yuck") +(include "brightness.yuck") diff --git a/.config/eww/volume.yuck b/.config/eww/volume.yuck new file mode 100644 index 0000000..84c7a9c --- /dev/null +++ b/.config/eww/volume.yuck @@ -0,0 +1,36 @@ +(defwindow volumeUp + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "bottom center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + "volume up") + +(defwindow volumeDown + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "bottom center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + "volume down") + +(defvar ismuted "") +(defwindow volumeToggle + :monitor 0 + :geometry (geometry + :y "5%" + :width "10%" + :height "8%" + :anchor "bottom center") + :stacking "overlay" + :exclusive "false" + :focusable "false" + "volume ${ismuted}muted") diff --git a/.config/hypr/apps.conf b/.config/hypr/apps.conf index 2e8d082..2586ce0 100644 --- a/.config/hypr/apps.conf +++ b/.config/hypr/apps.conf @@ -12,3 +12,5 @@ $bluetooth-tray = blueman-applet $clipboardManager = cliphist $clipboardManagerOptions = list | $appMenu -dmenu | cliphist decode | wl-copy $themeSwitcher = ~/.config/scripts/rofiSelectWallpaper.sh +$osd = ~/.config/scripts/osd.sh +$batteryWarning = ~/.config/scripts/batteryWarning.sh diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index 9e3e5da..5a5703f 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -32,6 +32,8 @@ source = ~/.config/hypr/variables.conf exec-once = swaync & exec-once = swww-daemon & exec-once = hypridle & +exec-once = eww daemon +exec-once = $batteryWarning exec-once=systemctl --user start plasma-polkit-agent & source = ~/.config/hypr/lastWallpaper.conf diff --git a/.config/hypr/keybinds.conf b/.config/hypr/keybinds.conf index 407864f..09cc660 100644 --- a/.config/hypr/keybinds.conf +++ b/.config/hypr/keybinds.conf @@ -1,8 +1,8 @@ -binde=,XF86MonBrightnessDown,exec,brightnessctl set 10%- -binde=,XF86MonBrightnessUp,exec,brightnessctl set +10% -binde = , XF86AudioRaiseVolume, exec, amixer set Master 5%+ -binde = , XF86AudioLowerVolume, exec, amixer set Master 5%- -bind =, XF86AudioMute, exec, amixer set Master toggle +binde=,XF86MonBrightnessDown,exec,$osd --brightness-down +binde=,XF86MonBrightnessUp,exec,$osd --brightness-up +binde = , XF86AudioRaiseVolume, exec, $osd --volume-up +binde = , XF86AudioLowerVolume, exec, $osd --volume-down +bind =, XF86AudioMute, exec,$osd --volume-toggle bind = $mainMod, N, exec, $notifications bind = $mainMod, T, exec, $terminal diff --git a/.config/matugen/config.toml b/.config/matugen/config.toml index 756f95a..d90e63b 100644 --- a/.config/matugen/config.toml +++ b/.config/matugen/config.toml @@ -34,3 +34,7 @@ output_path = '~/.config/wlogout/colors.css' input_path = './templates/config.omp.json' output_path = '~/.config/oh-my-posh/config.omp.json' post_hook = 'sed -i "s/|/{/g" ~/.config/oh-my-posh/config.omp.json && sed -i "s/°/}/g" ~/.config/oh-my-posh/config.omp.json' + +[templates.eww] +input_path = './templates/colors.scss' +output_path = '~/.config/eww/colors.scss' diff --git a/.config/matugen/templates/colors.scss b/.config/matugen/templates/colors.scss new file mode 100644 index 0000000..de883e3 --- /dev/null +++ b/.config/matugen/templates/colors.scss @@ -0,0 +1,7 @@ +/* +* Css Colors +* Generated with Matugen +*/ +<* for name, value in colors *> +${{name}}: {{value.default.hex}}; +<* endfor *> diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index a6edee7..533e2da 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,45 +1,46 @@ { "LazyVim": { "branch": "main", "commit": "d0c366e4d861b848bdc710696d5311dca2c6d540" }, - "blink.cmp": { "branch": "main", "commit": "a9a0f96c6a1029884e37dfd74a88a075b40366dd" }, + "blink.cmp": { "branch": "main", "commit": "5f442681df24fe705d1ee7ce5b4d435aa4b4dee4" }, "bufferline.nvim": { "branch": "main", "commit": "261a72b90d6db4ed8014f7bda976bcdc9dd7ce76" }, - "catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" }, + "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, "clangd_extensions.nvim": { "branch": "main", "commit": "8f7b72100883e0e34400d9518d40a03f21e4d0a6" }, - "conform.nvim": { "branch": "master", "commit": "339b3e4519ec49312d34fcfa275aa15bfaa67025" }, + "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf-lua": { "branch": "main", "commit": "a4f1644efaa0e3be884096711fcd5f7bf90c494c" }, + "fzf-lua": { "branch": "main", "commit": "dbc5bd14e72ba680df44906e957b0a821121726b" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, - "grug-far.nvim": { "branch": "main", "commit": "11d0fbd6fff6f4e394af95319deeaab4ef88ce97" }, + "grug-far.nvim": { "branch": "main", "commit": "c88435b825a35bfa468b47159709b3221976ecd1" }, "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" }, "mini.icons": { "branch": "main", "commit": "44c0160526f7ae17ca8e8eab9ab235d047fcf7a6" }, "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, - "neo-tree.nvim": { "branch": "main", "commit": "2d4094b885ea642f590997e92ffe6415fdc60185" }, + "neo-tree.nvim": { "branch": "main", "commit": "a9f8943b4c31f8460d25c71e0f463d65e9775f1c" }, "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, - "nvim-dap": { "branch": "master", "commit": "a6070b4e9e9a8ff1bc513c3748eff27080b0f44a" }, - "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, + "nvim-dap": { "branch": "master", "commit": "665d3569a86395fe0dab85efbdb26d7d2ee57e49" }, + "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-lint": { "branch": "master", "commit": "1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55" }, - "nvim-lspconfig": { "branch": "master", "commit": "b54abeb8b90af1cb4592ce937ee95ed8cb457801" }, + "nvim-lspconfig": { "branch": "master", "commit": "57154fd9a24e76907e3b0bdba4677ef42c88d91c" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-treesitter": { "branch": "master", "commit": "8119950998196021648eb140d58060038ae67afd" }, + "nvim-treesitter": { "branch": "master", "commit": "5d18ef22dc63624e90aa7b6dbc17f2c3856ae716" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, "one-small-step-for-vimkind": { "branch": "main", "commit": "5d2edc8937978585881d97a8fec4c2903fa4d72c" }, "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "render-markdown.nvim": { "branch": "main", "commit": "0022a579ac7355966be5ade77699b88c76b6a549" }, + "render-markdown.nvim": { "branch": "main", "commit": "ba6253d9673daf0cf394b87b2c2ecb7630944c7d" }, "snacks.nvim": { "branch": "main", "commit": "98df370703b3c47a297988f3e55ce99628639590" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, "tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" }, "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, "ts-comments.nvim": { "branch": "main", "commit": "872dcfa0418f4a33b7437fb4d9f4e89f2f000d74" }, - "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } + "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" }, + "yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" } } diff --git a/.config/nvim/lua/plugins/yuck.lua b/.config/nvim/lua/plugins/yuck.lua new file mode 100644 index 0000000..224e173 --- /dev/null +++ b/.config/nvim/lua/plugins/yuck.lua @@ -0,0 +1 @@ +return { "elkowar/yuck.vim" } diff --git a/.config/scripts/batteryWarning.sh b/.config/scripts/batteryWarning.sh new file mode 100755 index 0000000..64cab3b --- /dev/null +++ b/.config/scripts/batteryWarning.sh @@ -0,0 +1,11 @@ +prevbattery=$(cat /sys/class/power_supply/BAT*/capacity) +while [[ true ]]; do + battery=$(cat /sys/class/power_supply/BAT*/capacity) + if (($battery <= 20 && $prevbattery > 20)); then + eww open batteryLow + elif (($battery <= 10 && $prevbattery > 10)); then + eww open batteryCritical + fi + prevbattery=$battery + sleep 60 +done diff --git a/.config/scripts/osd.sh b/.config/scripts/osd.sh new file mode 100755 index 0000000..85bf2a1 --- /dev/null +++ b/.config/scripts/osd.sh @@ -0,0 +1,44 @@ +if [[ $1 = "--volume-up" ]]; then # Volume + volume=$(amixer get Master | grep % | head -n 1 | sed "s/.*\[\(\w*\)%\].*/\1/") + if [[ $volume != "100" ]]; then + amixer set Master 5%+ + eww open volumeUp + sleep 0.5 + eww close volumeUp + fi +elif [[ $1 = "--volume-down" ]]; then + volume=$(amixer get Master | grep % | head -n 1 | sed "s/.*\[\(\w*\)%\].*/\1/") + if [[ $volume != "0" ]]; then + amixer set Master 5%- + eww open volumeDown + sleep 0.5 + eww close volumeDown + fi +elif [[ $1 = "--volume-toggle" ]]; then + amixer set Master toggle + ismuted=$(amixer get Master | grep off) + if [[ -z $ismuted ]]; then + eww update ismuted="un" + else + eww update ismuted="" + fi + eww open volumeToggle + sleep 0.5 + eww close volumeToggle +elif [[ $1 = "--brightness-up" ]]; then + brightness=$(brightnessctl | grep % | sed "s/.*(\(\w*\)%)/\1/") + if [[ $brightness != "100" ]]; then + brightnessctl set +10% + eww open brightnessUp + sleep 0.5 + eww close brightnessUp + fi +elif [[ $1 = "--brightness-down" ]]; then + brightness=$(brightnessctl | grep % | sed "s/.*(\(\w*\)%)/\1/") + if [[ $brightness != "0" ]]; then + brightnessctl set 10%- + eww open brightnessDown + sleep 0.5 + eww close brightnessDown + fi +fi