move scripts from xinit to cli

This commit is contained in:
Anish Lakhwara 2023-01-02 19:58:34 +10:00
parent 2236734ded
commit 90db0af0ec
2 changed files with 43 additions and 38 deletions

View file

@ -83,6 +83,40 @@
#!/usr/bin/env bash #!/usr/bin/env bash
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix 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 = { programs.zsh = {
@ -99,15 +133,15 @@
TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo"; # Needed to run home-manager switch on non-nixOS TERMINFO_DIRS = "${pkgs.kitty.terminfo.outPath}/share/terminfo"; # Needed to run home-manager switch on non-nixOS
}; };
plugins = [ plugins = [
# { {
# name = "zsh-autocomplete"; name = "zsh-autocomplete";
# src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
# owner = "marlonrichert"; owner = "marlonrichert";
# repo = "zsh-autocomplete"; repo = "zsh-autocomplete";
# rev = "22.01.21"; rev = "22.01.21";
# sha256 = "+UziTYsjgpiumSulrLojuqHtDrgvuG91+XNiaMD7wIs="; sha256 = "+UziTYsjgpiumSulrLojuqHtDrgvuG91+XNiaMD7wIs=";
# }; };
# } }
{ {
name = "zsh-autopair"; name = "zsh-autopair";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {

View file

@ -166,35 +166,6 @@ in
*.color240: #6272a4 *.color240: #6272a4
*.color241: #b6b6b2 *.color241: #b6b6b2
EOF 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 = { lightdm = {
enable = true; enable = true;