Polybar: keyboard switch module
This commit is contained in:
parent
44c5ba23a7
commit
ddb0264e62
2 changed files with 20 additions and 5 deletions
|
|
@ -20,12 +20,12 @@ writeShellScriptBin "keyboard-switch" ''
|
|||
fi
|
||||
|
||||
if [ "$var" = "disabled" ]; then
|
||||
notify-send "Enabling keyboard..." \ "ON - Keyboard connected !";
|
||||
notify-send "Enabling keyboard..." \ "Keyboard connected !";
|
||||
echo "enable keyboard..."
|
||||
xinput enable "${keyboard_name}"
|
||||
echo "enabled" > $fconfig
|
||||
elif [ "$var" = "enabled" ]; then
|
||||
notify-send "Disabling Keyboard" \ "OFF - Keyboard disconnected";
|
||||
notify-send "Disabling Keyboard" \ "Keyboard disconnected";
|
||||
echo "disable keyboard"
|
||||
xinput disable "${keyboard_name}"
|
||||
echo 'disabled' > $fconfig
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@ let
|
|||
PATH=$PATH:"${lib.makeBinPath [ pkgs.dbus ]}"
|
||||
${dunstctl} set-paused toggle
|
||||
'';
|
||||
keyboardStatus = pkgs.writeShellScript "keyboardStatus" ''
|
||||
PATH=$PATH:"${lib.makeBinPath [ pkgs.coreutils ]}"
|
||||
if [[ `cat ~/.local/share/keyboard-switch.state` == "disabled" ]]; then echo ; else echo ; fi
|
||||
'';
|
||||
keyboardToggle = pkgs.writeShellScript "keyboardToggle" ''
|
||||
PATH=$PATH:"${lib.makeBinPath [ pkgs.keyboard-switch ]}"
|
||||
keyboard-switch
|
||||
'';
|
||||
notificationHistory = pkgs.writeShellScript "notificationToggle" ''
|
||||
PATH=$PATH:"${lib.makeBinPath [ pkgs.dbus ]}"
|
||||
${dunstctl} set-paused false
|
||||
|
|
@ -148,7 +156,7 @@ in
|
|||
modules-left = "bspwm";
|
||||
# modules-center =
|
||||
modules-right =
|
||||
"player pulseaudio temperature cpu memory battery notifications powermenu date";
|
||||
"player pulseaudio temperature cpu memory battery keyboard-switch notifications powermenu date";
|
||||
tray = {
|
||||
position = "right";
|
||||
padding = 1;
|
||||
|
|
@ -159,7 +167,7 @@ in
|
|||
modules-left = "bspwm";
|
||||
# modules-center =
|
||||
modules-right =
|
||||
"player pulseaudio temperature cpu memory battery notifications powermenu date";
|
||||
"player pulseaudio temperature cpu memory battery keyboard-switch notifications powermenu date";
|
||||
};
|
||||
|
||||
"module/battery" = {
|
||||
|
|
@ -359,7 +367,14 @@ in
|
|||
interval = 0.5;
|
||||
# tail = 1;
|
||||
};
|
||||
|
||||
"module/keyboard-switch" = {
|
||||
type = "custom/script";
|
||||
format = recursiveUpdate colors.normal { padding = 0; };
|
||||
exec = "${keyboardStatus}";
|
||||
click.left = "${keyboardToggle}";
|
||||
interval = 1;
|
||||
# tail = 1;
|
||||
};
|
||||
"module/player" = {
|
||||
type = "custom/script";
|
||||
format = colors.normal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue