feat: cpu frequency control bind

This commit is contained in:
2025-07-11 14:05:41 +03:00
parent 498aab443a
commit f00849e66a
5 changed files with 63 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=eDP-1, 1920x1080, 0x0, 1
monitor=HDMI-A-1, 1920x1080, 0x-1080, 1
monitor=HDMI-A-1, 1920x1080, -1920x0, 1
###################
### MY PROGRAMS ###
@@ -17,8 +17,9 @@ $terminal = kitty
$fastTerminal = kitty --single-instance
$fileManager = thunar
$menu = $HOME/.config/rofi-wayland/launchers/type-6/launcher.sh
$browser = zen-browser
$privateBrowser = zen-browser --private-window
$browser = env GTK_THEME=Adwaita:light zen-browser
$privateBrowser = env GTK_THEME=Adwaita:light zen-browser --private-window
$passwordManager = keepassxc
#################
### AUTOSTART ###
@@ -296,6 +297,7 @@ bind = $mainMod, Q, exec, $browser
bind = $mainMod SHIFT, Q, exec, $privateBrowser
bind = $mainMod, Backslash, exec, $fastTerminal
bind = $mainMod, Space, exec, $menu
bind = $mainMod, X, exec, $passwordManager
# Open floating terminal
bind = $mainMod SHIFT, Return, exec, [float; size 800 600; move center] $fastTerminal --class kitty-float
@@ -442,6 +444,9 @@ bind = $mainMod CTRL, L, layoutmsg, preselect r
bind = $mainMod CTRL, J, layoutmsg, preselect d
bind = $mainMod CTRL, K, layoutmsg, preselect u
# Toggle layout type
bind = $mainMod SHIFT, X, exec, hyprctl keyword general:layout "$(hyprctl getoption general:layout | grep -q 'dwindle' && echo 'master' || echo 'dwindle')"
# Window grouping
bind = $mainMod CTRL ALT, M, togglegroup
bind = $mainMod, comma, changegroupactive, b
@@ -465,12 +470,18 @@ bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous
# Toggle waybar
bind = $mainMod SHIFT, B, exec, ~/.config/hypr/scripts/toggle_waybar.sh
# Toggle grayscale mode
bind = $mainMod CTRL, G, exec, ~/.config/hypr/scripts/grayscale-toggle.sh
# Game mode
bind = $mainMod SHIFT, G, exec, ~/.config/hypr/scripts/gamemode.sh
# Cycle cpu frequency mode
bind = $mainMod CTRL, C, exec, ~/.config/hypr/scripts/cpufreq.sh
# Pin window
bind = $mainMod CTRL, Y, pin, active

View File

@@ -1,4 +1,4 @@
wallpaper = eDP-1,/home/greg/Pictures/Wallpapers/current/art-sakura-sea-volcano-red.jpg
wallpaper = HDMI-A-1,/home/greg/Pictures/Wallpapers/current/art-sakura-sea-volcano-red.jpg
wallpaper = eDP-1,/home/greg/Pictures/Wallpapers/current/japan_red_bridge2.jpg
wallpaper = HDMI-A-1,/home/greg/Pictures/Wallpapers/current/japan_red_bridge2.jpg
ipc = on

38
hypr/scripts/cpufreq.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
CURRENT=$(sudo cpupower frequency-info | grep 'current policy: frequency should be within 400 MHz and' | awk '{printf "%.2f%s", $10, substr($11, 1, length($11)-1)}')
echo Current freq is $CURRENT
set_cmd() {
sudo cpupower frequency-set --max $1MHz
notify-send -t 800 "$1MHz CPU Power"
}
if [ $CURRENT = "400.00MHz" ]; then
set_cmd 600
exit 0
fi
if [ $CURRENT = "600.00MHz" ]; then
set_cmd 1000
exit 0
fi
if [ $CURRENT = "1000.00MHz" ]; then
set_cmd 2000
exit 0
fi
if [ $CURRENT = "2.00GHz" ]; then
set_cmd 4200
exit 0
fi
if [ $CURRENT = "4.20GHz" ]; then
set_cmd 400
exit 0
fi
notify-send CPU-Power Error: value is $CURRENT
exit 1

View File

@@ -5,8 +5,6 @@ if [ "$HYPRGAMEMODE" = 1 ] ; then
keyword animations:enabled 0;\
keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\
keyword general:gaps_in 0;\
keyword general:gaps_out 0;\
keyword general:border_size 1;\
keyword decoration:rounding 0"
exit

9
hypr/scripts/toggle_waybar.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
PROGRAM="waybar"
if pgrep -x "$PROGRAM" > /dev/null; then
pkill -x $PROGRAM
else
$PROGRAM &
fi