Skip to content

Commit

Permalink
feat: hyprland utils
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 26, 2024
1 parent 20ee6d8 commit dfc436c
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 36 deletions.
34 changes: 34 additions & 0 deletions config/hypr/hypridle.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
general {
lock_cmd = pidof hyprlock || hyprlock # avoid starting multiple hyprlock instances.
before_sleep_cmd = loginctl lock-session # lock before suspend.
after_sleep_cmd = hyprctl dispatch dpms on # to avoid having to press a key twice to turn on the display.
}

listener {
timeout = 150 # 2.5min.
on-timeout = brightnessctl -s set 10 # set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = brightnessctl -r # monitor backlight restore.
}

# turn off keyboard backlight, comment out this section if you dont have a keyboard backlight.
listener {
timeout = 150 # 2.5min.
on-timeout = brightnessctl -sd dell::kbd_backlight set 0 # turn off keyboard backlight.
on-resume = brightnessctl -rd dell::kbd_backlight # turn on keyboard backlight.
}

listener {
timeout = 300 # 5min
on-timeout = loginctl lock-session # lock screen when timeout has passed
}

listener {
timeout = 330 # 5.5min
on-timeout = hyprctl dispatch dpms off # screen off when timeout has passed
on-resume = hyprctl dispatch dpms on # screen on when activity is detected after timeout has fired.
}

listener {
timeout = 1800 # 30min
on-timeout = systemctl suspend # suspend pc
}
34 changes: 17 additions & 17 deletions config/hypr/hyprland.conf
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
# Environment variables
# env = GTK_THEME,Arc
env = GDK_BACKEND=,wayland
env = QT_QPA_PLATFORM,wayland
env = GDK_SCALE,1
env = GDK_DPI_SCALE,1
env = SDL_VIDEODRIVER,wayland
env = CLUTTER_BACKEND,wayland
env = GDK_BACKEND,wayland.x11,*
env = GDK_DPI_SCALE,1
env = GDK_SCALE,1
env = GTK_THEME,Arc
env = HYPRCURSOR_SIZE,24
env = HYPRCURSOR_THEME,Adwaita
env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
env = QT_QPA_PLATFORM,wayland;xcb
env = QT_QPA_PLATFORMTHEME,qt5ct
env = XCURSOR_THEME,Adwaita
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
env = SDL_VIDEODRIVER,wayland
env = XCURSOR_SIZE,24
exec-once=hyprctl setcursor Adwaita 24
env = XCURSOR_THEME,Adwaita

exec-once = hyprpaper
exec-once = hypridle

exec = pkill swaybg; swaybg -m fill -i ~/Pictures/wall.png
exec-once = wl-clipboard-history -t
# exec-once = ~/.autostart
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XAUTHORITY
exec-once = systemctl --user import-environment
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = gnome-keyring-daemon --start
exec-once = xhost si:localuser:root
# exec = sleep 1; pgrep jamesdsp || nohup jamesdsp -t & disown
# exec = sleep 1; pgrep easyeffects || nohup easyeffects --gapplication-service & disown
exec = pkill swayidle; swayidle -w
# exec-once = sway-audio-idle-inhibit
# exec-once = wlsunset
exec = sleep 1; pgrep easyeffects || nohup easyeffects --gapplication-service & disown
exec = nm-applet --indicator
exec = blueman-applet
exec = pkill waybar; waybar
# exec = pgrep gammastep || gammastep-indicator
exec = hyprshade auto
exec = pgrep safeeyes || safeeyes -e
exec-once = avizo-service
exec-once = wl-clip-persist --clipboard regular
exec-once = wl-paste --watch cliphist store
exec-once = microsoft-edge-dev

Expand Down Expand Up @@ -134,6 +132,7 @@ animations {
animation = fade, 1, 10, smoothIn
animation = fadeDim, 1, 10, smoothIn
animation = workspaces, 1, 6, default
animation = specialWorkspace, 1, 4, default, slidevert
}

dwindle {
Expand Down Expand Up @@ -210,6 +209,7 @@ windowrulev2 = float,class:quake
windowrulev2 = center,class:quake
windowrulev2 = dimaround,class:quake
windowrulev2 = size 1600 1000,class:quake
# windowrulev2 = pin,class:quake
#windowrulev2 = stayfocused,class:quake
windowrulev2 = idleinhibit fullscreen,class:microsoft-edge
windowrulev2 = idleinhibit fullscreen,class:Brave-browser
Expand Down
61 changes: 61 additions & 0 deletions config/hypr/hyprlock.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

# BACKGROUND
background {
monitor =
path = ~/Pictures/wall.png
blur_passes = 3
contrast = 0.8916
brightness = 0.8172
vibrancy = 0.1696
vibrancy_darkness = 0.0
}

# GENERAL
general {
# no_fade_in = false
grace = 5
# disable_loading_bar = true
pam_module = sudo
}

# INPUT FIELD
input-field {
monitor =
size = 280, 80
outline_thickness = 2
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true
outer_color = rgba(0, 0, 0, 0)
inner_color = rgba(0, 0, 0, 0.5)
font_color = rgb(200, 200, 200)
fade_on_empty = false
placeholder_text = <i><span foreground="##cdd6f4">Password...</span></i>
hide_input = false
position = 0, -120
halign = center
valign = center
}

# TIME
label {
monitor =
text = cmd[update:1000] echo "$(date +"%-I:%M%p")"
font_size = 120
font_family = Maple Mono Bold
position = 0, -300
halign = center
valign = top
}

# USER
label {
monitor =
text = Hi there, $USER
font_size = 25
font_family = Maple Mono
position = 0, -40
halign = center
valign = center
}

2 changes: 2 additions & 0 deletions config/hypr/hyprpaper.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
preload = ~/Pictures/wall.png
wallpaper = ,~/Pictures/wall.png
45 changes: 27 additions & 18 deletions config/hypr/scripts/quake
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,39 @@ WORKSPACE=$(hyprctl clients -j | jq -rec '.[] | select(.class == "quake") | .wor
TERM_CMD="wezterm --config window_background_opacity=0.9 start --class quake"
# TERM_CMD="kitty -1 --class quake -o background_opacity=0.90 -o hide_window_decorations=yes -o remember_window_size=no"

# hyprctl --batch '
# keyword windowrulev2 float,class:quake ;
# keyword windowrulev2 center,class:quake ;
# keyword windowrulev2 dimaround,class:quake ;
# keyword windowrulev2 size 1600 1000,class:quake ;
# keyword windowrulev2 pin,class:quake ;
# '
echo "WORKSPACE: $WORKSPACE"

if [ -z "$WORKSPACE" ]; then
echo "start"
# hyprctl dispatch -- exec "[float;size 1600 1000;center] $TERM_CMD"
hyprctl dispatch -- exec "$TERM_CMD"
echo "start"
# hyprctl dispatch -- exec "[float;size 1600 1000;center] $TERM_CMD"
hyprctl dispatch -- exec "$TERM_CMD"
elif [ "$WORKSPACE" == "special:quake" ]; then
echo "show"
echo "show"

# Store the current active window address
hyprctl activewindow | head -n1 | cut -f2 -d ' ' >/tmp/hypr-quake-address
# Store the current active window address
hyprctl activewindow | head -n1 | cut -f2 -d ' ' >/tmp/hypr-quake-address

# If the current active window is fullscreen, unfullscreen it
hyprctl activewindow | rg "fullscreen: 1" && hyprctl dispatch fullscreen
# If the current active window is fullscreen, unfullscreen it
hyprctl activewindow | rg "fullscreen: 1" && hyprctl dispatch fullscreen

# Move the quake window to the current workspace, focus it, and bring it to the top
hyprctl dispatch movetoworkspacesilent "+0,^(quake)\$"
hyprctl dispatch focuswindow "^(quake)\$"
hyprctl dispatch bringactivetotop
# Move the quake window to the current workspace, focus it, and bring it to the top
hyprctl dispatch movetoworkspacesilent "+0,^(quake)\$"
hyprctl dispatch focuswindow "^(quake)\$"
hyprctl dispatch bringactivetotop
else
echo "hide"
echo "hide"

# Move the quake window to the special workspace
hyprctl dispatch movetoworkspacesilent "special:quake,^(quake)\$"
# Move the quake window to the special workspace
hyprctl dispatch movetoworkspacesilent "special:quake,^(quake)\$"

# Focus the previously active window and bring it to the top
hyprctl dispatch focuswindow "address:0x$(cat /tmp/hypr-quake-address)"
hyprctl dispatch bringactivetotop
# Focus the previously active window and bring it to the top
hyprctl dispatch focuswindow "address:0x$(cat /tmp/hypr-quake-address)"
hyprctl dispatch bringactivetotop
fi
2 changes: 1 addition & 1 deletion config/waybar/config
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
]
},
"on-click": "pavucontrol",
"on-click-right": "blueman-manager"
"on-click-right": "easyeffects"
},
"custom/power_profile": {
"exec": "sleep 0.3; $HOME/.config/waybar/scripts/power-profile",
Expand Down
4 changes: 4 additions & 0 deletions pacman.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ hub
hwdetect
hwinfo
hyperfine
hypridle
hyprland
hyprlock-git
hyprpaper
hyprshade
imv-git
inetutils
Expand Down Expand Up @@ -454,6 +457,7 @@ whitesur-gtk-theme
whitesur-icon-theme-git
wireguard-tools
wireplumber
wl-clip-persist
wl-clipboard
wlogout
wlr-randr
Expand Down

0 comments on commit dfc436c

Please sign in to comment.