#!/bin/bash
if solaar config 1 | grep -q 'True'
then solaar config 1 fn-swap 'false'
else solaar config 1 fn-swap 'true'
fi
I’m running this in terminal using the script:
#!/bin/bash
commands () {
~/Admin/fn-swap.sh
$SHELL # keep the terminal open after the previous commands are executed
}
export -f commands
konsole -e “bash -c ‘commands’”
I bound the sw.sh to the pause/break key - switches every time… so then I bound the fn-swap.sh and it switches without popping up terminal, it just takes a few seconds to take effect maybe due to the errors.
I would have tried to store the state of fn-swap into a variable “myvariable” myvariable=$(command to get the state of fn-swap)
But I don’t understand where that fn-swap state is coming from. Is solaar config 1 a file you’re reading from?
solaar config 1 is not a file to read; is a command of the executable solaar which in this case tell you the configuration of the device 1 (hint: is also possible to use the device’s name given by such command, instead of “1”.)
Wow, my new Samsung 860 EVO failed - had to reinstall to my old SanDisk for now, nice to have this to copy.
Lots of fun with hooks… you can solve a lot by totally deleting your fstab content. So now with no swap, had to edit /etc/default/grub (remove the wrong UUID resume) and regenerate grub, remove ‘resume’ from mkinitcpio.conf and ‘sudo mkinitcpio -P’, and also nano /etc/default/grub and basically just delete everything except my T3/T4 storage entries.
Annoyingly lost quite a bit of work there… only backed up hidden home files this week… after answering a thread I though I had done it right.