From e7e75d747c23eb5097975ee5675a38d60951b99a Mon Sep 17 00:00:00 2001 From: stupidcomputer Date: Sat, 15 Jun 2024 20:19:11 -0500 Subject: [PATCH] add a "solo" option for mlg I'm on vacation, so it now makes sense for mlg to be solo, instead of being forevermore plugged into a dock. Now, you can type `disp solo` and make it configure DP-0 for working, instead of trying to configure DP-1-1 and DP-1-2. Additionally, this commit also introduces DISP_ACCESS_IP, to remotely specify the access IP of `x230t`. This is because the wifi I'm using right now: - doesn't have the right subnet - not the right network prefix - no static ip assignment - etc. --- builds/utils.nix | 6 ++---- builds/utils/sh/disp | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/builds/utils.nix b/builds/utils.nix index c84a2f2..da53dba 100644 --- a/builds/utils.nix +++ b/builds/utils.nix @@ -13,7 +13,6 @@ , figlet , curl , ytfzf -, herbe , xrandr , xrectsel , ffcast @@ -21,7 +20,6 @@ , xkbset , rbw , xclip -, libsForQt5 }: stdenv.mkDerivation rec { @@ -31,7 +29,7 @@ stdenv.mkDerivation rec { src = ./utils; nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ bash feh xrandr jq curl fzy ytfzf sshuttle svkbd scrcpy xkbset rbw xclip ffcast libsForQt5.kolourpaint ]; + buildInputs = [ bash feh xrandr jq curl fzy ytfzf sshuttle svkbd scrcpy rbw xclip ffcast xkbset ]; installPhase = '' mkdir -p $out/bin @@ -39,7 +37,7 @@ stdenv.mkDerivation rec { for i in $(ls $src/sh); do cp $src/sh/$i $out/bin ln -sf $out/bin/tmenu_run $out/bin/regenerate - wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ytfzf herbe sshuttle svkbd scrcpy libsForQt5.kolourpaint xrectsel ffcast ]} + wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy xkbset ytfzf sshuttle svkbd scrcpy xrectsel ffcast ]} done ''; } diff --git a/builds/utils/sh/disp b/builds/utils/sh/disp index 9b35d8d..62735f2 100755 --- a/builds/utils/sh/disp +++ b/builds/utils/sh/disp @@ -3,6 +3,8 @@ set -x +[ "$1" = "-h" ] && echo "use DISP_ACCESS_IP to control sshfs conn ip" && exit 0 + set_walls() { for i in $(xrandr | grep ' connected' | cut -d' ' -f1); do xwallpaper --output $i --zoom ~/.local/share/pape.jpg @@ -62,6 +64,9 @@ case "$(hostname)" in bspc monitor DP-1-1 -d 1 3 5 7 bspc monitor DP-1-2 -d 2 4 6 8 ;; + "solo") + bspc monitor DP-0 -d 1 2 3 4 5 6 7 8 9 + ;; *) xrandr \ --output DP-0 --off \ @@ -74,27 +79,34 @@ case "$(hostname)" in xinput set-prop 'INSTANT USB GAMING MOUSE ' 'libinput Accel Speed' -1 # setup synchronization + # check if we have another IP defined + if [ ! -z "$DISP_ACCESS_IP" ]; then + target="$DISP_ACCESS_IP" + else + target=x230t + fi + pkill sshfs rm $HOME/doc # this is safe, as doc is a dir if it mattered, # but it's just a link, so it's a regular file. # in conclusion, good either way mkdir -p $HOME/.cache/mount_point - sshfs usr@x230t:/home/usr/doc $HOME/.cache/mount_point + sshfs "usr@$target:/home/usr/doc" $HOME/.cache/mount_point -o ConnectTimeout=1 ln -sf $HOME/.cache/mount_point $HOME/doc rm $HOME/.thunderbird # see previous comment mkdir -p $HOME/.cache/mount_point3 - sshfs usr@x230t:/home/usr/.thunderbird $HOME/.cache/mount_point3 + sshfs "usr@$target:/home/usr/.thunderbird" $HOME/.cache/mount_point3 -o ConnectTimeout=1 ln -sf $HOME/.cache/mount_point3 $HOME/.thunderbird rm $HOME/Mail mkdir -p $HOME/.cache/mount_point4 - sshfs usr@x230t:/home/usr/Mail $HOME/.cache/mount_point4 + sshfs "usr@$target:/home/usr/Mail" $HOME/.cache/mount_point4 -o ConnectTimeout=1 ln -sf $HOME/.cache/mount_point4 $HOME/Mail rm $HOME/vdir mkdir -p $HOME/.cache/mount_point5 - sshfs usr@x230t:/home/usr/vdir $HOME/.cache/mount_point5 + sshfs "usr@$target:/home/usr/vdir" $HOME/.cache/mount_point5 -o ConnectTimeout=1 ln -sf $HOME/.cache/mount_point5 $HOME/vdir ;;