From a0a4fbb33e9fc990b7a6a931428c154e98aa3fa3 Mon Sep 17 00:00:00 2001 From: nomadics9 Date: Fri, 4 Oct 2024 05:52:05 +0300 Subject: [PATCH] scripts --- scripts/brightness | 18 ++++++++++++++++++ scripts/screenHz.sh | 18 ++++++++++++++++++ scripts/volume | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100755 scripts/brightness create mode 100755 scripts/screenHz.sh create mode 100755 scripts/volume diff --git a/scripts/brightness b/scripts/brightness new file mode 100755 index 0000000..8238513 --- /dev/null +++ b/scripts/brightness @@ -0,0 +1,18 @@ +#!/bin/sh + +down() { +brightnessctl set 5%- +brightnessctl=$(brightnessctl | grep -oP "(\d+(\.\d+)?(?=%))") +dunstify -a "Brightness" "Decreasing to $brightnessctl%" -h int:value:"$brightnessctl" -i ~/icons/brightness.png -r 2593 -u normal +} + +up() { +brightnessctl set 5%+ +brightnessctl=$(brightnessctl | grep -oP "(\d+(\.\d+)?(?=%))") +dunstify -a "BRightness" "Increasing to $brightnessctl%" -h int:value:"$brightnessctl" -i ~/icons/brightness.png -r 2593 -u normal +} + +case "$1" in + up) up;; + down) down;; +esac diff --git a/scripts/screenHz.sh b/scripts/screenHz.sh new file mode 100755 index 0000000..9901bbd --- /dev/null +++ b/scripts/screenHz.sh @@ -0,0 +1,18 @@ +if hyprctl monitors | grep '2560x1600@120.00000'; then + json='{"text": "60", "tooltip": "Frequency", "class": "custom/power-menu", "percentage": 60 }' + echo -e $json >~/.config/hypr/scripts/hz.json + hyprctl keyword monitor eDP-1,2560x1600@60,0x0,1.25 && dunstify "Set to 60Hz" -a "Monitor" -u "low" -i "/home/nomad/icons/desktop.png" -r "123" + exit +fi +if hyprctl monitors | grep '2560x1600@90.00000'; then + json='{"text": "120", "tooltip": "Frequency", "class": "custom/power-menu", "percentage": 120 }' + echo -e $json >~/.config/hypr/scripts/hz.json + hyprctl keyword monitor eDP-1,2560x1600@120,0x0,1.25 && dunstify "Set to 120Hz" -a "Monitor" -u "low" -i "/home/nomad/icons/desktop.png" -r "123" + exit +fi +if hyprctl monitors | grep '2560x1600@60.00200'; then + json='{"text": "90", "tooltip": "Frequency", "class": "custom/power-menu", "percentage": 90 }' + echo -e $json >~/.config/hypr/scripts/hz.json + hyprctl keyword monitor eDP-1,2560x1600@90,0x0,1.25 && dunstify "Set to 90Hz" -a "Monitor" -u "low" -i "/home/nomad/icons/desktop.png" -r "123" + exit +fi diff --git a/scripts/volume b/scripts/volume new file mode 100755 index 0000000..4eabac8 --- /dev/null +++ b/scripts/volume @@ -0,0 +1,34 @@ +#!/bin/sh + +down() { +pamixer -d 2 +volume=$(pamixer --get-volume) +[$volume -gt 0 ] && volume=`expr $volume` +dunstify -a "Volume" "Decreasing to $volume%" -h int:value:"$volume" -i ~/icons/low-volume.png -r 2593 -u normal +canberra-gtk-play -i audio-volume-change -d "changevolume" +} + +up() { +pamixer -i 2 +volume=$(pamixer --get-volume) +[ $volume -lt 1000 ] && volume=`expr $volume` +dunstify -a "Volume" "Increasing to $volume%" -h int:value:"$volume" -i ~/icons/high-volume.png -r 2593 -u normal +canberra-gtk-play -i audio-volume-change -d "changevolume" +} + +mute() { +muted="$(pamixer --get-mute)" +if $muted; then + pamixer -u + dunstify -a "VOLUME" "UNMUTED" -i ~/.config/dunst/assets/ui/volume_high.svg -r 2593 -u normal +else + pamixer -m + dunstify -a "VOLUME" "MUTED" -i ~/.config/dunst/assets/ui/volume_muted.svg -r 2593 -u normal +fi +} + +case "$1" in + up) up;; + down) down;; + mute) mute;; +esac