hardware: remove controller hacks
This commit is contained in:
		
							parent
							
								
									b18d3b52c2
								
							
						
					
					
						commit
						630660afcf
					
				
					 5 changed files with 1 additions and 60 deletions
				
			
		| 
						 | 
					@ -1,27 +0,0 @@
 | 
				
			||||||
#!/bin/sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
list_paired_controllers() {
 | 
					 | 
				
			||||||
    bluetoothctl devices Paired | grep 'Controller' | cut -d' ' -f2
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
count_connected_controllers() {
 | 
					 | 
				
			||||||
    bluetoothctl devices Connected | grep 'Controller' | wc -l
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
try_to_connect_to_all_controllers() {
 | 
					 | 
				
			||||||
    list_paired_controllers | while read paired_controller; do
 | 
					 | 
				
			||||||
        echo "Trying to connect to controller $paired_controller"
 | 
					 | 
				
			||||||
        bluetoothctl connect "$paired_controller"
 | 
					 | 
				
			||||||
    done
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
while true; do
 | 
					 | 
				
			||||||
    echo "looping"
 | 
					 | 
				
			||||||
    if test "$(count_connected_controllers)" -ne 0 ; then
 | 
					 | 
				
			||||||
        echo "there is a controller connected, not attempting to connect to any other"
 | 
					 | 
				
			||||||
        sleep 10s
 | 
					 | 
				
			||||||
        continue
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    sleep 1s
 | 
					 | 
				
			||||||
    try_to_connect_to_all_controllers
 | 
					 | 
				
			||||||
done
 | 
					 | 
				
			||||||
| 
						 | 
					@ -124,11 +124,6 @@
 | 
				
			||||||
      zbar
 | 
					      zbar
 | 
				
			||||||
      wl-clipboard
 | 
					      wl-clipboard
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
    auto_connect_gamepad = [
 | 
					 | 
				
			||||||
      bluez
 | 
					 | 
				
			||||||
      coreutils
 | 
					 | 
				
			||||||
      gnugrep
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
    powerplay-led-idle = [
 | 
					    powerplay-led-idle = [
 | 
				
			||||||
      bash
 | 
					      bash
 | 
				
			||||||
      libinput
 | 
					      libinput
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
    settings = {
 | 
					    settings = {
 | 
				
			||||||
      General = {
 | 
					      General = {
 | 
				
			||||||
        DiscoverableTimeout = 0;
 | 
					        DiscoverableTimeout = 0;
 | 
				
			||||||
        # Discoverable = true;
 | 
					        Discoverable = true;
 | 
				
			||||||
        AlwaysPairable = true;
 | 
					        AlwaysPairable = true;
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
      Policy = {
 | 
					      Policy = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,26 +0,0 @@
 | 
				
			||||||
{ pkgs, lib, ... }:
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  systemd.user.services = {
 | 
					 | 
				
			||||||
    autoconnect-gamepad = {
 | 
					 | 
				
			||||||
      Unit = {
 | 
					 | 
				
			||||||
        Description = "Attempt to connect to game controllers";
 | 
					 | 
				
			||||||
        PartOf = [ "graphical-session.target" ];
 | 
					 | 
				
			||||||
        After = [ "graphical-session.target" ];
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
      Service = {
 | 
					 | 
				
			||||||
        ExecStart = lib.getExe pkgs.auto_connect_gamepad;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
      Install = {
 | 
					 | 
				
			||||||
        WantedBy = [ "sway-session.target" ];
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  xdg.desktopEntries = {
 | 
					 | 
				
			||||||
    disconnect-controller = {
 | 
					 | 
				
			||||||
      name = "Disconnect Controller";
 | 
					 | 
				
			||||||
      exec = "bluetoothctl disconnect 84:30:95:97:1A:79";
 | 
					 | 
				
			||||||
      terminal = false;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,6 @@
 | 
				
			||||||
}:
 | 
					}:
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    ./controller.nix
 | 
					 | 
				
			||||||
    ./waybar
 | 
					    ./waybar
 | 
				
			||||||
    ./helix.nix
 | 
					    ./helix.nix
 | 
				
			||||||
    ./kakoune
 | 
					    ./kakoune
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue