Feat: brightness script, and refactor info script

This commit is contained in:
coolnsx
2024-03-08 16:08:44 +05:30
parent 80de39466a
commit e6aaf4139d
11 changed files with 123 additions and 40 deletions

1
.gitignore vendored
View File

@@ -21,3 +21,4 @@ epdfview
btop btop
xpra xpra
psysh psysh
zoom*

View File

@@ -7,9 +7,11 @@ round_corners=0
background_alpha=0.6 background_alpha=0.6
background_color=000000 background_color=000000
font_size=20 font_size=22
text_color=FFFFFF text_color=FFFFFF
position=top-left position=top-left
toggle_hud=Shift_R+F12
table_columns=4 table_columns=4
gpu_text=780M gpu_text=780M
gpu_stats gpu_stats
@@ -27,15 +29,18 @@ ram
ram_color=C26693 ram_color=C26693
fps fps
fps_limit_method=late fps_limit_method=late
toggle_fps_limit=Shift_L+F1
fps_limit=0 fps_limit=0
vsync=0 vsync=3
gl_vsync=0 gl_vsync=-1
af=0 af=0
picmip=0 picmip=0
output_folder=/home/tanveer output_folder=/home/tanveer
log_duration=30 log_duration=30
autostart_log=0 autostart_log=0
log_interval=100 log_interval=100
toggle_logging==Shift_L+F2

View File

@@ -66,7 +66,7 @@
.lyrics { .lyrics {
color: #EBCB8B; color: #EBCB8B;
margin : -10px 0px 0px 0px; margin : -10px 0px 0px 0px;
font-family: IBM Plex Sans Text; font-family: IBM Plex Sans;
font-size : 18px; font-size : 18px;
} }
.music_bar { .music_bar {

View File

@@ -43,7 +43,7 @@
:y "50" :y "50"
:width "30%" :width "30%"
:height "40px" :height "40px"
:anchor "bottom left") :anchor "bottom right")
:stacking "bg" :stacking "bg"
:reserve (struts :distance "10px" :side "bottom") :reserve (struts :distance "10px" :side "bottom")
:windowtype "dock" :windowtype "dock"
@@ -56,7 +56,7 @@
:y "50" :y "50"
:width "30%" :width "30%"
:height "40px" :height "40px"
:anchor "bottom left") :anchor "bottomleft")
:stacking "bg" :stacking "bg"
:reserve (struts :distance "10px" :side "bottom") :reserve (struts :distance "10px" :side "bottom")
:windowtype "dock" :windowtype "dock"
@@ -70,9 +70,7 @@
(defwidget music [] (defwidget music []
(box :class "genwin" :orientation "h" :spacing 50 :space-evenly "false" :vexpand "false" :hexpand "false" (box :class "genwin" :orientation "h" :spacing 50 :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "box_art" :vexpand "false" :hexpand "false"
(circular-progress :class "music_bar" :value CURRENT :thickness 10 :clockwise true :start-at "${(CURRENT+75)%100}"
(image :path "${song.cover}" :image-height 270 :image-width 270)))
(box :orientation "v" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false" (box :orientation "v" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :tooltip "${song.name}" :halign "center" :class "song" :wrap "false" :limit-width 32 :text "${song.name}") (label :tooltip "${song.name}" :halign "center" :class "song" :wrap "false" :limit-width 32 :text "${song.name}")
(label :halign "center" :class "artist" :wrap "false" :limit-width 20 :text "${song.artist}") (label :halign "center" :class "artist" :wrap "false" :limit-width 20 :text "${song.artist}")
@@ -82,4 +80,7 @@
(button :class "btn_play" :onclick "./script play_toggle" STATUS) (button :class "btn_play" :onclick "./script play_toggle" STATUS)
(button :class "btn_controls" :tooltip "Seek +1%" :onclick "./script seek '1'" "") (button :class "btn_controls" :tooltip "Seek +1%" :onclick "./script seek '1'" "")
(button :class "btn_controls" :tooltip "Upcoming : ${song.next}" :onclick "./script next" "󰒭")) (button :class "btn_controls" :tooltip "Upcoming : ${song.next}" :onclick "./script next" "󰒭"))
(label :wrap "true" :class "lyrics" :text LYRICS)))) (label :wrap "true" :class "lyrics" :text LYRICS))
(box :class "box_art" :vexpand "false" :hexpand "false"
(circular-progress :class "music_bar" :value CURRENT :thickness 10 :clockwise true :start-at "${(CURRENT+75)%100}"
(image :path "${song.cover}" :image-height 270 :image-width 270)))))

52
hypr/brightness Executable file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
##########################################################################################
# NOTE: you need to be member of "video" group or maybe "input" group for this to work.. #
##########################################################################################
########
# MAIN #
########
# dir where the backlight component resides..
root_dir="/sys/class/backlight"
#########################################################################
# brighness directory can be different per device, check above root_dir #
#########################################################################
#for intel
#backlight_dir="intel_backlight0"
#for acpi (generic)
#backlight_dir="acpi_backlight0"
#for amd
backlight_dir="amdgpu_bl1"
#file read
brightness_file="$root_dir/$backlight_dir/brightness"
current=$(cat "$brightness_file")
max=$(cat "$root_dir/$backlight_dir/max_brightness")
#runtime values
opr=$1 # [+|-], required
increment=${2:-5} # [ default:5, optional] "around 2% brightness"
#shellcheck disable=SC2004
[ "$opr" = "s" ] && printf "%s" "$((${current}00/${max}))" && exit 0
#validation
(! printf '%s' "$opr" | grep -qE '[+-]') && notify-send -u critical "Unknown Operator, use only + or -" && exit 1
#shellcheck disable=SC2086,SC1102
new="$(( $current $opr $increment ))"
#constraints
[ "$new" -ge "$max" ] && new=$max
[ "$new" -le 0 ] && new=0
#new brightness value
printf '%s' "$new" > "$brightness_file"
#shellcheck disable=SC2004
notify-send -i "lol" "☀️ $((${new}00/${max}))" -t 1000 -h "string:x-canonical-private-synchronous:${0##*/}"

View File

@@ -1,15 +1,32 @@
# See https://wiki.hyprland.org/Configuring/Monitors/ # See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,highrr,auto,1.6,bitdepth,10 monitor=,highrr,auto,1.5,bitdepth,10
#monitor=,2880x1800@120,auto,1.6,bitdepth,10 #monitor=,2880x1800@120.000999,auto,1.5,bitdepth,10
$hypr_dir="$HOME/.config/hypr" $hypr_dir="$HOME/.config/hypr"
$accent=D81860 $accent=D81860
#envs #envs
env = XDG_SESSION_TYPE,wayland env = BROWSER,google-chrome-stable
env = WLR_NO_HARDWARE_CURSORS,1 env = EDITOR,nvim
env = GDK_BACKEND,wayland,x11
env = GDK_SCALE,2 #xwayland fractional scaling
env = GTK_THEME,Materia-dark
env = GLOBAL_ACCENT,$accent env = GLOBAL_ACCENT,$accent
env = IMAGE,nsxiv
env = LIBSEAT_BACKEND,logind
env = MOZ_ENABLE_WAYLAND,1
env = OPENER,xdg-open
env = QT_QPA_PLATFORMTHEME,qt5ct
env = QT_QPA_PLATFORM,wayland
env = SDL_VIDEODRIVER,wayland
env = TERMINAL,foot
env = VIDEO,mpv
env = VISUAL,nvim
env = WLR_NO_HARDWARE_CURSORS,1
env = WM,hyprland
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ # For all categories, see https://wiki.hyprland.org/Configuring/Variables/
@@ -87,6 +104,11 @@ gestures {
misc { misc {
force_default_wallpaper = 0 force_default_wallpaper = 0
vfr = 1 vfr = 1
vrr = 2
}
xwayland {
force_zero_scaling = false
} }
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
@@ -164,11 +186,11 @@ binde=, XF86AudioRaiseVolume, exec, pamixer --set-limit 140 --allow-boost -i 2 &
binde=, XF86AudioMute, exec, pamixer --set-limit 140 --allow-boost -t && $hypr_dir/volume binde=, XF86AudioMute, exec, pamixer --set-limit 140 --allow-boost -t && $hypr_dir/volume
binde=, XF86AudioPlay, exec, echo cycle pause | socat - "/tmp/yt-music/yt-music-mpvsocket" binde=, XF86AudioPlay, exec, echo cycle pause | socat - "/tmp/yt-music/yt-music-mpvsocket"
binde=, XF86AudioPause, exec, echo cycle pause | socat - "/tmp/yt-music/yt-music-mpvsocket" binde=, XF86AudioPause, exec, echo cycle pause | socat - "/tmp/yt-music/yt-music-mpvsocket"
binde=$mainMod, F10, exec, $HOME/repos_scripts/yt-music search_play binde= $mainMod, F10, exec, $HOME/repos_scripts/yt-music search_play
binde=, XF86AudioNext, exec, $HOME/repos_scripts/yt-music play_next binde=, XF86AudioNext, exec, $HOME/repos_scripts/yt-music play_next
binde=, XF86AudioPrev, exec, $HOME/repos_scripts/yt-music play_next menu binde=, XF86AudioPrev, exec, $HOME/repos_scripts/yt-music play_next menu
binde=, XF86MonBrightnessDown, exec, light -U 2 && notify-send -i "lol" "☀️ $(light -G | cut -d'.' -f1)" -t 1000 -h "string:x-canonical-private-synchronous:brightness" binde=, XF86MonBrightnessUp, exec, $hypr_dir/brightness '+'
binde=, XF86MonBrightnessUp, exec, light -A 2 && notify-send -i "lol" "☀️ $(light -G | cut -d'.' -f1)" -t 1000 -h "string:x-canonical-private-synchronous:brightness" binde=, XF86MonBrightnessDown, exec, $hypr_dir/brightness '-'
#windows rules #windows rules
windowrulev2=workspace 1,class:^(google-chrome)$ windowrulev2=workspace 1,class:^(google-chrome)$
@@ -179,16 +201,19 @@ windowrulev2=workspace 4,class:^(pavucontrol)$
windowrulev2=workspace 4,class:^(org.freedesktop.Xwayland)$ windowrulev2=workspace 4,class:^(org.freedesktop.Xwayland)$
windowrulev2=fullscreen,class:^(org.freedesktop.Xwayland)$ windowrulev2=fullscreen,class:^(org.freedesktop.Xwayland)$
windowrulev2=workspace 4,class:^(virt-manager)$ windowrulev2=workspace 4,class:^(virt-manager)$
windowrulev2 = bordercolor rgba(64f2a4FF), xwayland: 1 windowrulev2=bordercolor rgba(64f2a4FF), xwayland: 1
#workspace rules
workspace = 1, on-created-empty:google-chrome-stable
workspace = 2, on-created-empty:foot
#startup applications #startup applications
exec-once=dbus-update-activation-environment --systemd --all exec-once=dbus-update-activation-environment --systemd --all
exec-once=ssh-agent exec-once=ssh-agent
exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once=node $HOME/github/arrpc/src > /tmp/arrpc-log exec-once=node $HOME/github/arrpc/src > /tmp/arrpc-log
exec-once=swaybg -i $HOME/.config/wall/9.png exec-once=swaybg -i $HOME/.config/wall/19.jpg -m fill
exec-once=xrdb -merge $HOME/.config/.Xresource exec-once=xrdb -merge $HOME/.config/.Xresource
exec-once=$hypr_dir/workspace 'focus' exec-once=$hypr_dir/workspace 'focus'
exec-once=$hypr_dir/battery exec-once=$hypr_dir/battery
#exec-once=sleep 2 && $hypr_dir/workspace #exec-once=sleep 2 && $hypr_dir/workspace
exec-once=google-chrome-stable

View File

@@ -1,20 +1,19 @@
#!/bin/sh #!/bin/sh
i=1 top -ibn5 -d1 | while read -r line;do
mem_total=$(sed -nE 's_.*MemTotal:[[:space:]]*(.*) kB_\1_p' /proc/meminfo) new_cpu=$(printf "%s" "$line" | sed -nE 's_%Cpu\(s\):[[:space:]]*(.*) us,.*_\1 %_p')
mem_total_mb=$((mem_total / 1024)) new_mem=$(printf "%s" "$line" | sed -nE 's_MiB Mem :[[:space:]]*(.*) total,.*,[[:space:]]*(.*) used,.*_\2 MB / \1 MB_p')
while [ $i -le 5 ]; do cpu=${new_cpu:-$cpu}
mem=$(sed -nE 's_.*Active:[[:space:]]*(.*) kB_\1_p' /proc/meminfo) mem=${new_mem:-$mem}
mem="$((mem / 1024))" if [ -n "$new_mem" ];then
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
temp=$((temp / 1000)) temp=$(cat /sys/class/thermal/thermal_zone0/temp)
bat_stats=$(cat /sys/class/power_supply/BAT0/status) : $((temp /= 1000))
vol_stats=$(pamixer --get-mute) bat_stats=$(cat /sys/class/power_supply/BAT0/status)
charge=$(cat /sys/class/power_supply/BAT*/capacity) vol_stats=$(pamixer --get-volume-human)
[ "$bat_stats" = "Discharging" ] && bat_icon=🔋 || bat_icon=🔌 charge=$(cat /sys/class/power_supply/BAT0/capacity)
[ "$bat_stats" = "Discharging" ] && [ "$charge" -lt 20 ] && bat_icon="🪫" [ "$bat_stats" = "Discharging" ] && { [ "$charge" -lt 20 ] && bat_icon=🪫 || bat_icon=🔋 ;} || bat_icon=🔌
[ "$vol_stats" = "true" ] && vol_icon=🔇 || vol_icon=🔊 [ "$vol_stats" = "muted" ] && vol_icon=🔇 || vol_icon=🔊
notify-send -i "lol" "<----------(STATS)---------->" "🧠 CPU usage : $(top -ibn1 | sed -nE 's_%Cpu\(s\):(.*)us.*_\1_p' | cut -d' ' -f2-3) %\n🌡 Cpu Temp : $temp °C\n🔳 RAM : $mem MB / $mem_total_mb MB\n$bat_icon Battery : $charge (${bat_stats})\n☀ Brightness : $(light -G | cut -d'.' -f1)%\n$vol_icon Volume : $(pamixer --get-volume-human)\n🎵 $(pgrep -af mpvsocket >/dev/null && cut -d ">" -f1 /tmp/yt-music/current | cut -d":" -f2)" -h "string:x-canonical-private-synchronous:${0##*/}" -t 1500 & notify-send -i "lol" "<----------(STATS)---------->" "🧠 CPU usage : $cpu\n🌡 Cpu Temp : $temp °C\n🔳 RAM : $mem\n$bat_icon Battery : $charge (${bat_stats})\n☀ Brightness : $("$(dirname "$0")"/brightness s)%\n$vol_icon Volume : $vol_stats\n🎵 $(cut -d ">" -f1 /tmp/yt-music/current 2>/dev/null | cut -d":" -f2)" -h "string:x-canonical-private-synchronous:${0##*/}" -t 1500 &
: $((i += 1)) fi
sleep 1
done done

View File

@@ -12,4 +12,4 @@ gamename=$(basename "$game")
notify-send -h "string:x-canonical-private-synchronous:${0##*/}" -i "wine" "Launching $gamename" notify-send -h "string:x-canonical-private-synchronous:${0##*/}" -i "wine" "Launching $gamename"
RADV_PERFTEST=gpl DXVK_ASYNC=1 gamemoderun mangohud wine "$gamename" WINEFSYNC=1 WINEESYNC=1 MANGOHUD=1 gamemoderun wine "$gamename"

View File

@@ -1,4 +1,4 @@
#hwdec=auto hwdec=auto
profile=gpu-hq profile=gpu-hq
gpu-context=wayland gpu-context=wayland
input-ipc-server=/tmp/mpvsocket input-ipc-server=/tmp/mpvsocket

BIN
wall/19.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 KiB

BIN
wall/9.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 6.1 MiB