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
|
fi
|
||||||
|
|
||||||
if [ "$var" = "disabled" ]; then
|
if [ "$var" = "disabled" ]; then
|
||||||
notify-send "Enabling keyboard..." \ "ON - Keyboard connected !";
|
notify-send "Enabling keyboard..." \ "Keyboard connected !";
|
||||||
echo "enable keyboard..."
|
echo "enable keyboard..."
|
||||||
xinput enable "${keyboard_name}"
|
xinput enable "${keyboard_name}"
|
||||||
echo "enabled" > $fconfig
|
echo "enabled" > $fconfig
|
||||||
elif [ "$var" = "enabled" ]; then
|
elif [ "$var" = "enabled" ]; then
|
||||||
notify-send "Disabling Keyboard" \ "OFF - Keyboard disconnected";
|
notify-send "Disabling Keyboard" \ "Keyboard disconnected";
|
||||||
echo "disable keyboard"
|
echo "disable keyboard"
|
||||||
xinput disable "${keyboard_name}"
|
xinput disable "${keyboard_name}"
|
||||||
echo 'disabled' > $fconfig
|
echo 'disabled' > $fconfig
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,14 @@ let
|
||||||
PATH=$PATH:"${lib.makeBinPath [ pkgs.dbus ]}"
|
PATH=$PATH:"${lib.makeBinPath [ pkgs.dbus ]}"
|
||||||
${dunstctl} set-paused toggle
|
${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" ''
|
notificationHistory = pkgs.writeShellScript "notificationToggle" ''
|
||||||
PATH=$PATH:"${lib.makeBinPath [ pkgs.dbus ]}"
|
PATH=$PATH:"${lib.makeBinPath [ pkgs.dbus ]}"
|
||||||
${dunstctl} set-paused false
|
${dunstctl} set-paused false
|
||||||
|
|
@ -148,7 +156,7 @@ in
|
||||||
modules-left = "bspwm";
|
modules-left = "bspwm";
|
||||||
# modules-center =
|
# modules-center =
|
||||||
modules-right =
|
modules-right =
|
||||||
"player pulseaudio temperature cpu memory battery notifications powermenu date";
|
"player pulseaudio temperature cpu memory battery keyboard-switch notifications powermenu date";
|
||||||
tray = {
|
tray = {
|
||||||
position = "right";
|
position = "right";
|
||||||
padding = 1;
|
padding = 1;
|
||||||
|
|
@ -159,7 +167,7 @@ in
|
||||||
modules-left = "bspwm";
|
modules-left = "bspwm";
|
||||||
# modules-center =
|
# modules-center =
|
||||||
modules-right =
|
modules-right =
|
||||||
"player pulseaudio temperature cpu memory battery notifications powermenu date";
|
"player pulseaudio temperature cpu memory battery keyboard-switch notifications powermenu date";
|
||||||
};
|
};
|
||||||
|
|
||||||
"module/battery" = {
|
"module/battery" = {
|
||||||
|
|
@ -359,7 +367,14 @@ in
|
||||||
interval = 0.5;
|
interval = 0.5;
|
||||||
# tail = 1;
|
# 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" = {
|
"module/player" = {
|
||||||
type = "custom/script";
|
type = "custom/script";
|
||||||
format = colors.normal;
|
format = colors.normal;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue