Keyboard-switch script
This commit is contained in:
parent
7a9d3d7adb
commit
7cd692a86b
4 changed files with 38 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ let
|
|||
sddm-sugar-dark = pkgs.callPackage ./sddm-sugar-dark { };
|
||||
update-background = pkgs.callPackage ./update-background { };
|
||||
vital-synth = pkgs.callPackage ./vital-synth { };
|
||||
keyboard-switch = pkgs.callPackage ./keyboard-switch { };
|
||||
};
|
||||
in
|
||||
self
|
||||
|
|
|
|||
35
custom/keyboard-switch/default.nix
Normal file
35
custom/keyboard-switch/default.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ writeShellScriptBin
|
||||
, lib
|
||||
, xorg
|
||||
, libnotify
|
||||
, coreutils
|
||||
, keyboard_name ? "AT Translated Set 2 keyboard"
|
||||
}:
|
||||
writeShellScriptBin "keyboard-switch" ''
|
||||
config_folder=''${XDG_DATA_HOME:-~/.local/share}
|
||||
fconfig="$config_folder/keyboard-switch.state"
|
||||
PATH=$PATH:"${lib.makeBinPath [ coreutils xorg.xinput libnotify ]}"
|
||||
if [ ! -f $fconfig ]; then
|
||||
echo "Creating config file"
|
||||
mkdir -p $config_folder
|
||||
echo "enabled" > $fconfig
|
||||
var="enabled"
|
||||
else
|
||||
read -r var< $fconfig
|
||||
echo "keyboard is : ${keyboard_name}"
|
||||
fi
|
||||
|
||||
if [ "$var" = "disabled" ]; then
|
||||
notify-send "Enabling keyboard..." \ "ON - Keyboard connected !";
|
||||
echo "enable keyboard..."
|
||||
xinput enable "${keyboard_name}"
|
||||
echo "enabled" > $fconfig
|
||||
elif [ "$var" = "enabled" ]; then
|
||||
notify-send "Disabling Keyboard" \ "OFF - Keyboard disconnected";
|
||||
echo "disable keyboard"
|
||||
xinput disable "${keyboard_name}"
|
||||
echo 'disabled' > $fconfig
|
||||
fi
|
||||
''
|
||||
|
||||
|
||||
|
|
@ -40,6 +40,7 @@
|
|||
update-background = self.callPackage ./custom/update-background { backgrounds_directory = "$HOME/Immagini/Sfondi/1080+/1440+"; };
|
||||
lockscreen = self.callPackage ./custom/lockscreen { palette = self.rice.colorPalette; font = self.rice.font.normal; };
|
||||
sddm-theme-clairvoyance = self.callPackage ./custom/sddm-theme-clairvoyance { wallpaper = ./wallpapers/background.jpg; };
|
||||
keyboard-switch = self.callPackage ./custom/keyboard-switch { };
|
||||
sddm-sugar-dark = self.callPackage ./custom/sddm-sugar-dark { };
|
||||
google-chrome = self.google-chrome.override { commandLineArgs = [ "--password-store=gnome" "--force-dark-mode" ]; };
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
# slack
|
||||
# wineFull
|
||||
arandr authy bitwarden cava discord dmenu droidcam easyeffects evince
|
||||
gallery-dl gucharmap handbrake httpie inkscape krita meld openvpn p7zip
|
||||
gallery-dl gucharmap handbrake httpie inkscape keyboard-switch krita meld openvpn p7zip
|
||||
pavucontrol pentablet-driver postman procps pulseaudio retroarchFull
|
||||
shotwell skypeforlinux spotify tdesktop teams thunderbird transmission-gtk
|
||||
virt-manager virt-viewer wireguard-tools xournalpp zoom-us;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue