From 4c16d744a45693f61e6d15d5335a4b1d534c66ce Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Tue, 15 Oct 2024 11:31:33 -0500 Subject: [PATCH] make the phone xorg experience better --- .config/sxhkd/phone | 18 +++++++++++++ .config/sxhkd/phonemouse | 43 ++++++++++++++++++++++++++++++++ boxes/phone/out-of-tree/Makefile | 3 ++- builds/st/config.h | 5 ++++ builds/utils/disp | 6 +++++ 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .config/sxhkd/phone create mode 100644 .config/sxhkd/phonemouse diff --git a/.config/sxhkd/phone b/.config/sxhkd/phone new file mode 100644 index 0000000..ee14aa4 --- /dev/null +++ b/.config/sxhkd/phone @@ -0,0 +1,18 @@ +# essentially the same thing as sxhkdrc, but super is replaced with ctrl + b and all shortcuts are chorded +ctrl + b; c + st + +ctrl + b; q + bspc node -c + +ctrl + b; {_,shift + } {1-9,0} + bspc {desktop -f,node -d} '{1-9,10}' + +ctrl + b; {_,ctrl +,shift + }{h,j,k,l} + bspc node -{f,p,s} {west,south,north,east} + +ctrl + b; d + tmenu_run + +ctrl + b; m + mode phonemouse diff --git a/.config/sxhkd/phonemouse b/.config/sxhkd/phonemouse new file mode 100644 index 0000000..3215f79 --- /dev/null +++ b/.config/sxhkd/phonemouse @@ -0,0 +1,43 @@ +# exit mouse mode +w + mode phone + +# move left +{ctrl +,shift +,_} h + xdotool mousemove_relative -- {-5,-50,-20} 0 + +# move down +{ctrl +,shift +,_} j + xdotool mousemove_relative -- 0 {5,50,20} + +# move up +{ctrl +,shift +,_} k + xdotool mousemove_relative -- 0 {-5,-50,-20} + +# move right +{ctrl +,shift +,_} l + xdotool mousemove_relative -- {5,50,20} 0 + +# left, middle, right click +{ctrl +,_} {a,s,d} + xdotool {mousedown,click} {1,2,3} + +# let go of clicked button +q + xdotool mouseup 1; xdotool mouseup 2; xdotool mouseup 3 + +# move the mouse to the top of the window +g ; g + mousehelper top + +# ditto for bottom +G + mousehelper bottom + +# ditto for left +0 + mousehelper left + +# ditto for right +dollar + mousehelper right diff --git a/boxes/phone/out-of-tree/Makefile b/boxes/phone/out-of-tree/Makefile index 2acae8c..ad3cecf 100644 --- a/boxes/phone/out-of-tree/Makefile +++ b/boxes/phone/out-of-tree/Makefile @@ -1,7 +1,7 @@ termux: termux-pkgs termux-dots utils-sh st st: - cd ../../../builds/st/ && CC=clang make && cp st ~/.local/bin/st + cd ../../../builds/st/ && CFLAGS="-DIS_PHONE" CC=clang make && cp st ~/.local/bin/st utils-sh: cp ../../../builds/utils/* ~/.local/bin @@ -9,6 +9,7 @@ utils-sh: termux-pkgs: pkg install \ neovim \ + xdotool \ git \ tig \ tigervnc \ diff --git a/builds/st/config.h b/builds/st/config.h index b1f9552..6721eb9 100644 --- a/builds/st/config.h +++ b/builds/st/config.h @@ -3,7 +3,12 @@ /* * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ +#ifdef IS_PHONE +static char *font = "Monospace:pixelsize=34:antialias=true:autohint=true"; +#else static char *font = "Fantasque Sans Mono:pixelsize=14:antialias=true:autohint=true"; +#endif + static int borderpx = 2; /* diff --git a/builds/utils/disp b/builds/utils/disp index f89e066..5954f38 100755 --- a/builds/utils/disp +++ b/builds/utils/disp @@ -186,6 +186,12 @@ case "$(hostname)" in dunst & disown phone pair & disown ;; + "localhost") # phone in termux + pkill sxhkd + sxhkd -c ~/.config/sxhkd/phone & disown + + xrandr --output VNC-0 --mode 1920x1080 + bspc monitor VNC-0 -d 1 2 3 4 5 6 7 8 9 esac # initial post-wm setup