From 5257f4b46ad4378cbbe51a82ea67fe307b230672 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Wed, 20 Mar 2024 07:40:03 -0500 Subject: [PATCH] refactor(hypr): update to match upstream breaking changes --- .../hypr/conf/application/gromit-mpx.conf | 4 ++-- dots/.config/hypr/conf/core/bindings.conf | 10 ++++---- dots/.config/hypr/conf/core/general.conf | 2 +- dots/.config/hypr/conf/core/monitors.conf | 2 -- dots/.config/hypr/conf/init.conf | 4 ++-- .../hypr/scripts/disable-laptop-screen.bash | 2 +- .../scripts/launchers/events-monitor.bash | 24 +++++++++++++++++-- 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/dots/.config/hypr/conf/application/gromit-mpx.conf b/dots/.config/hypr/conf/application/gromit-mpx.conf index f9e878c0..510da5fa 100644 --- a/dots/.config/hypr/conf/application/gromit-mpx.conf +++ b/dots/.config/hypr/conf/application/gromit-mpx.conf @@ -1,9 +1,9 @@ -### GROMIT-MPX ### +# --- GROMIT-MPX --- workspace = special:gromit,gapsin:0,gapsout:0,decorate:false,border:false,on-created-empty:gromit-mpx -a windowrulev2 = noblur,class:^(Gromit-mpx)$ windowrulev2 = opacity 1 override, 1 override,class:^(Gromit-mpx)$ windowrulev2 = noshadow,class:^(Gromit-mpx)$ -windowrulev2 = nofullscreenrequest,class:^(Gromit-mpx)$ +windowrulev2 = suppressevent fullscreen,class:^(Gromit-mpx)$ windowrulev2 = noanim,class:^(Gromit-mpx)$ windowrulev2 = size 100% 100%,class:^(Gromit-mpx)$ diff --git a/dots/.config/hypr/conf/core/bindings.conf b/dots/.config/hypr/conf/core/bindings.conf index a6b5fb4a..89c1a644 100644 --- a/dots/.config/hypr/conf/core/bindings.conf +++ b/dots/.config/hypr/conf/core/bindings.conf @@ -17,11 +17,11 @@ gestures { workspace_swipe_fingers = 3 } -### MOUSE ### +# --- MOUSE --- bindm = SUPER,mouse:272,movewindow bindm = SUPER,mouse:273,resizewindow -### RESIZE ### +# --- RESIZE --- bind = SUPER,R,submap,resize # will switch to a submap called resize submap = resize # will start a submap called "resize" @@ -39,7 +39,7 @@ binde = ,j,resizeactive,0 50 bind = ,escape,submap,reset # use reset to go back to the global submap submap = reset # will reset the submap, meaning end the current one and return to the global one. -### Move Window ### +# --- Move Window --- bind = SUPER,M,submap,move_window submap = move_window @@ -69,7 +69,7 @@ bind = SUPER,D,exec,makoctl dismiss -a bind = SUPERSHIFT,Q,exec,swaylock bind = SUPERSHIFT,M,exit -### Screen Captures ### +# --- Screen Captures --- # May be videos or screenshots bind = SUPER,S,exec,grim -g "$(slurp)" - | swappy -f - bind = CTRLSUPER,S,exec,grim -g "$(slurp)" - | wl-copy --type image/png @@ -96,7 +96,7 @@ bind = SUPER,l,movefocus,r bind = SUPER,k,movefocus,u bind = SUPER,j,movefocus,d -### Workspaces ### +# --- Workspaces --- bind = SUPERSHIFT,left,exec,~/.config/hypr/scripts/focus-workspace-mon.bash $(( $(hyprctl monitors -j | jq -c '.[] | select(.focused) | .activeWorkspace.id') - 1 )) bind = SUPERSHIFT,right,exec,~/.config/hypr/scripts/focus-workspace-mon.bash $(( $(hyprctl monitors -j | jq -c '.[] | select(.focused) | .activeWorkspace.id') + 1 )) diff --git a/dots/.config/hypr/conf/core/general.conf b/dots/.config/hypr/conf/core/general.conf index 6657f99f..de5e3195 100644 --- a/dots/.config/hypr/conf/core/general.conf +++ b/dots/.config/hypr/conf/core/general.conf @@ -1,6 +1,6 @@ source = ./colors.conf -### General Configuration ### +# --- General Configuration --- general { gaps_in = 5 gaps_out = 10 diff --git a/dots/.config/hypr/conf/core/monitors.conf b/dots/.config/hypr/conf/core/monitors.conf index 2aaa076b..3f26e09a 100644 --- a/dots/.config/hypr/conf/core/monitors.conf +++ b/dots/.config/hypr/conf/core/monitors.conf @@ -1,4 +1,2 @@ monitor = , preferred, auto, 1 monitor=eDP-1,preferred,auto,1.35 -bindl=,switch:off:Lid Switch,exec,hyprctl keyword monitor "eDP-1, preferred, auto, 1" -bindl=,switch:on:Lid Switch,exec,~/.config/hypr/scripts/disable-laptop-screen.bash diff --git a/dots/.config/hypr/conf/init.conf b/dots/.config/hypr/conf/init.conf index 34f1c990..8157880c 100644 --- a/dots/.config/hypr/conf/init.conf +++ b/dots/.config/hypr/conf/init.conf @@ -1,6 +1,6 @@ $configDir = ~/.config/hypr/conf -### Core Config ### +# --- Core Config --- source = $configDir/core/env.conf source = $configDir/core/general.conf source = $configDir/core/bindings.conf @@ -8,5 +8,5 @@ source = $configDir/core/appearance.conf source = $configDir/core/monitors.conf source = $configDir/core/window-rules.conf -### Application Specific ### +# --- Application Specific --- source = $configDir/application/gromit-mpx.conf diff --git a/dots/.config/hypr/scripts/disable-laptop-screen.bash b/dots/.config/hypr/scripts/disable-laptop-screen.bash index 15f81f9f..9791fedf 100755 --- a/dots/.config/hypr/scripts/disable-laptop-screen.bash +++ b/dots/.config/hypr/scripts/disable-laptop-screen.bash @@ -4,7 +4,7 @@ main() { local mon_count mon_count="$(hyprctl monitors -j | jq length)" if ((mon_count > 1)); then - hyprctl keyword monitor "eDP-1, disable" + hyprctl dpms off eDP-1 fi } diff --git a/dots/.config/hypr/scripts/launchers/events-monitor.bash b/dots/.config/hypr/scripts/launchers/events-monitor.bash index c1837408..fc00614b 100755 --- a/dots/.config/hypr/scripts/launchers/events-monitor.bash +++ b/dots/.config/hypr/scripts/launchers/events-monitor.bash @@ -40,15 +40,36 @@ monitor-ssid() { monitor-laptop-lid() { local laptop_lid_state + local laptop_lid_last_state while :; do + sleep 1 laptop_lid_state="$(/dev/null; then + printf "Laptop screen was opened, attempting to enable it...\n" + if hyprctl dispatch dpms on eDP-1; then + laptop_lid_last_state="${laptop_lid_state}" + local msg="Laptop screen successfully enabled" + log "Laptop Clamshell" "${msg}" + notify-send "Laptop Clamshell" "${msg}" -a "Laptop Clamshell" + else + local msg="Received an error when enabling the laptop screen!\n" + log "Laptop Clamshell" "${msg}" + notify-send "Laptop Clamshell Error" "${msg}" -a "Laptop Clamshell" + fi + fi + ;; "CLOSED") if hyprctl monitors -j | jq -er '.[] | select(.name=="eDP-1") | .name' >/dev/null; then printf "Laptop screen was shut, attempting to disable it...\n" - if hyprctl keyword monitor "eDP-1, disable"; then + if hyprctl dispatch dpms off eDP-1; then + laptop_lid_last_state="${laptop_lid_state}" local msg="Laptop screen successfully disabled" log "Laptop Clamshell" "${msg}" notify-send "Laptop Clamshell" "${msg}" -a "Laptop Clamshell" @@ -60,7 +81,6 @@ monitor-laptop-lid() { fi ;; esac - sleep 1 done } monitor-ssid &