From 90db0af0ecda9adcf9276408231a8a168456a2b8 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 2 Jan 2023 19:58:34 +1000 Subject: [PATCH] move scripts from xinit to cli --- home/profiles/cli/default.nix | 52 ++++++++++++++++++++++++------ hosts/profiles/desktop/default.nix | 29 ----------------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index bacd36fb..e97861f5 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -83,6 +83,40 @@ #!/usr/bin/env bash manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix '') + (pkgs.writeScriptBin "monitor" '' + # hotplug + connect() { + # Turn it on if it was off + xrandr --output HDMI-2 --auto + xrandr --output HDMI-2 --same-as eDP-1 + } + + disconnect() { + xrandr --output HDMI-2 --off + } + + xrandr | grep "HDMI-2 connected" &>>/dev/null && connect || disconnect + '') + (pkgs.writeScriptBin "disconnect-keyboard" '' + # keyboard on curve is busted + get_keyboard_id() { + xinput list | grep 'AT Translated Set' | cut -f2 | cut -d'=' -f2 | xinput float + } + + disconnect_keyboard() { + id=$(get_keyboard_id) + xinput float $id + unset id + } + + attach_keyboard() { + id=$(get_keyboard_id) + xinput reattach $id 3 + unset id + } + + disconnect_keyboard + '') ]; programs.zsh = { @@ -99,15 +133,15 @@ TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo"; # Needed to run home-manager switch on non-nixOS }; plugins = [ - # { - # name = "zsh-autocomplete"; - # src = pkgs.fetchFromGitHub { - # owner = "marlonrichert"; - # repo = "zsh-autocomplete"; - # rev = "22.01.21"; - # sha256 = "+UziTYsjgpiumSulrLojuqHtDrgvuG91+XNiaMD7wIs="; - # }; - # } + { + name = "zsh-autocomplete"; + src = pkgs.fetchFromGitHub { + owner = "marlonrichert"; + repo = "zsh-autocomplete"; + rev = "22.01.21"; + sha256 = "+UziTYsjgpiumSulrLojuqHtDrgvuG91+XNiaMD7wIs="; + }; + } { name = "zsh-autopair"; src = pkgs.fetchFromGitHub { diff --git a/hosts/profiles/desktop/default.nix b/hosts/profiles/desktop/default.nix index 71d7a4bc..6ee4437e 100644 --- a/hosts/profiles/desktop/default.nix +++ b/hosts/profiles/desktop/default.nix @@ -166,35 +166,6 @@ in *.color240: #6272a4 *.color241: #b6b6b2 EOF - - # hotplug - connect() { - xrandr --output HDMI-2 --same-as eDP-1 - } - - disconnect() { - xrandr --output HDMI-2 --off - } - - xrandr | grep "HDMI-2 connected" &>>/dev/null && connect || disconnect - - # keyboard on curve is busted - get_keyboard_id() { - xinput list | grep 'AT Translated Set' | cut -f2 | cut -d'=' -f2 | xinput float - } - - disconnect_keyboard() { - id=$(get_keyboard_id) - xinput float $id - unset id - } - - attach_keyboard() { - id=$(get_keyboard_id) - xinput reattach $id 3 - } - - disconnect_keyboard ''; lightdm = { enable = true;