From d16051dada8ff661a5aa62f5cdb5a77b4250c51f Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 24 Jun 2023 12:35:40 +0200 Subject: [PATCH] TODO: put all this in nixos configs --- .gitignore | 10 ++++++- hypr/hyprland.conf | 2 +- hypr/main.conf | 12 ++++---- hypr/scripts/autorotate.sh | 46 ++++++++++++++++++++++++++++++ hypr/scripts/tablet/laptop-mode.sh | 4 +-- hypr/scripts/tablet/tablet-mode.sh | 2 +- lisgd/config | 17 +++++++++++ 7 files changed, 82 insertions(+), 11 deletions(-) create mode 100755 hypr/scripts/autorotate.sh create mode 100755 lisgd/config diff --git a/.gitignore b/.gitignore index 23351eb1..e5cf986a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,12 @@ -cef_user_data/ +okularrc +user-dirs.dirs +.gsd-keyboard.settings-ported +arkrc +evolution/ +fontconfig/ +gnome-initial-setup-done +kcharselectrc +user-dirs.locale GalaxyBudsClient/ baloofilerc Zeal/ diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index f989d87e..880d6157 120000 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -1 +1 @@ -/nix/store/jxgghqpkcr60pfn4bixazpzihx4aqsi5-home-manager-files/.config/hypr/hyprland.conf \ No newline at end of file +/nix/store/nsxbpm07iq9gr8h9pd6vvmj139nlm2gd-home-manager-files/.config/hypr/hyprland.conf \ No newline at end of file diff --git a/hypr/main.conf b/hypr/main.conf index 98f80ee5..77c51209 100644 --- a/hypr/main.conf +++ b/hypr/main.conf @@ -13,8 +13,7 @@ monitor=eDP-1,1920x1200@60,0x0,1 $menu = "$HOME/.config/rofi/launcher.sh" $scripts = "$HOME/.config/hypr/scripts" -bind =, edge:d:u, exec, bash -c "busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true" -exec-once = lisgd -d /dev/input/by-path/platform-AMDI0010\:00-event -o 0 -t 125 -r 25 -m 3200 -g "1,UD,B,*,R,bash -c 'busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false'" +exec-once = $HOME/.config/lisgd/config & # See https://wiki.hyprland.org/Configuring/Keywords/ for more @@ -84,6 +83,7 @@ general { misc { disable_hyprland_logo = true disable_splash_rendering = true + vfr = true } decoration { @@ -95,10 +95,10 @@ decoration { blur_passes = 1 blur_new_optimizations = on - drop_shadow = yes - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) + drop_shadow = false + #shadow_range = 4 + #shadow_render_power = 3 + #col.shadow = rgba(1a1a1aee) } animations { diff --git a/hypr/scripts/autorotate.sh b/hypr/scripts/autorotate.sh new file mode 100755 index 00000000..5c12ed73 --- /dev/null +++ b/hypr/scripts/autorotate.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# This script was forked from https://gitlab.com/snippets/1793649 by Fishonadish + + +SCREEN="eDP-1" +WAYLANDINPUT=("wacom-hid-52eb-finger" + "wacom-hid-52eb-pen") + + +function rotate_ms { + case $1 in + "normal") + rotate 0 + ;; + "right-up") + rotate 3 + ;; + "bottom-up") + rotate 2 + ;; + "left-up") + rotate 1 + ;; + esac +} + +function rotate { + TARGET_ORIENTATION=$1 + + echo "Rotating to" $TARGET_ORIENTATION + + hyprctl keyword monitor $SCREEN,transform,$TARGET_ORIENTATION + + for i in "${WAYLANDINPUT[@]}" + do + hyprctl keyword device:"$i":transform $TARGET_ORIENTATION + done + + /home/matt/.config/lisgd/config & +} + +while IFS='$\n' read -r line; do + rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")" + [[ ! -z $rotation ]] && rotate_ms $rotation +done < <(stdbuf -oL monitor-sensor) diff --git a/hypr/scripts/tablet/laptop-mode.sh b/hypr/scripts/tablet/laptop-mode.sh index bedf1441..f70860ed 100755 --- a/hypr/scripts/tablet/laptop-mode.sh +++ b/hypr/scripts/tablet/laptop-mode.sh @@ -5,5 +5,5 @@ gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false brightnessctl -d tpacpi::kbd_backlight s 2 -killall iio-hyprland -killall evtest +killall -r autorotate.sh +killall -r evtest diff --git a/hypr/scripts/tablet/tablet-mode.sh b/hypr/scripts/tablet/tablet-mode.sh index 66146198..62a67e18 100755 --- a/hypr/scripts/tablet/tablet-mode.sh +++ b/hypr/scripts/tablet/tablet-mode.sh @@ -6,7 +6,7 @@ gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true brightnessctl -d tpacpi::kbd_backlight s 0 -$HOME/.local/bin/iio-hyprland & +$HOME/.config/hypr/scripts/autorotate.sh & evtest --grab "/dev/input/by-path/platform-i8042-serio-0-event-kbd" & evtest --grab "/dev/input/by-path/platform-i8042-serio-1-event-mouse" & diff --git a/lisgd/config b/lisgd/config new file mode 100755 index 00000000..5148c037 --- /dev/null +++ b/lisgd/config @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +## https://www.reddit.com/r/swaywm/comments/ocec7k/comment/i93s0ma/ +## https://git.sr.ht/~mil/lisgd/tree/0.3.7/item/config.def.h + +function gestures { + lisgd -d /dev/input/by-path/platform-AMDI0010\:00-event -o 0 -t 125 -r 25 -m 3200 \ + -g "1,UD,B,*,R,bash -c 'busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false'" \ + -g "1,DU,B,*,R,bash -c 'busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true'" +} + +if pgrep lisgd ; then + killall -r lisgd + gestures +else + gestures +fi