move scripts from xinit to cli
This commit is contained in:
		
							parent
							
								
									2236734ded
								
							
						
					
					
						commit
						90db0af0ec
					
				|  | @ -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 { | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue