From 7d77deac49b883ec92d1903fba606cfe6a654500 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Thu, 29 Apr 2021 14:54:54 +0200 Subject: [PATCH] fchange: now automatically toggles 1 and 0 --- .local/bin/etc/fchange | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.local/bin/etc/fchange b/.local/bin/etc/fchange index 185ad5a..0efd82f 100755 --- a/.local/bin/etc/fchange +++ b/.local/bin/etc/fchange @@ -1,3 +1,14 @@ #!/bin/sh -vim /sys/module/hid_apple/parameters/fnmode +## Toggle the state of the fnmode. +## Useful for using keyboards with different fn functionality. + +curr=$(cat /sys/module/hid_apple/parameters/fnmode) + +if [ "$curr" = "1" ] +then + echo "0" | sudo tee -a /sys/module/hid_apple/parameters/fnmode > /dev/null +elif [ "$curr" = "0" ] +then + echo "1" | sudo tee -a /sys/module/hid_apple/parameters/fnmode > /dev/null +fi