mirror of https://github.com/ericonr/dotfiles.git
Add keyboard layout to waybar.
This commit is contained in:
parent
89ebdb0baa
commit
c5cf5dc9e3
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# prints the current keyboard layout and then any layout changes
|
||||
# taken from https://github.com/Alexays/Waybar/pull/85
|
||||
|
||||
swaymsg --type get_inputs --raw | \
|
||||
jq --raw-output \
|
||||
'[
|
||||
.[] |
|
||||
select(.type == "keyboard") |
|
||||
.xkb_active_layout_name |
|
||||
select(contains("English \\(US\\)") | not)
|
||||
] |
|
||||
first |
|
||||
sub("English \\(US\\)"; "us") | sub("Portuguese \\(Brazil\\)"; "br")
|
||||
'
|
||||
|
||||
swaymsg --type subscribe --monitor --raw '["input"]' | \
|
||||
jq --raw-output --unbuffered \
|
||||
'
|
||||
select(.change == "xkb_layout") |
|
||||
.input.xkb_active_layout_name |
|
||||
sub("English \\(US\\)"; "us") | sub("Portuguese \\(Brazil\\)"; "br")
|
||||
'
|
||||
|
|
@ -42,10 +42,8 @@ bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut.
|
|||
set $keyboard "1:1:AT_Translated_Set_2_keyboard"
|
||||
input $keyboard {
|
||||
xkb_layout "us,br"
|
||||
xkb_options grp:win_space_toggle
|
||||
}
|
||||
#TODO: make script that automatically switches inputs
|
||||
bindsym $mod+Space input $keyboard xkb_switch_layout 0
|
||||
bindsym $mod+Shift+Space input $keyboard xkb_switch_layout 1
|
||||
# Touchpad
|
||||
set $touchpad "1739:31251:SYNA2393:00_06CB:7A13_Touchpad"
|
||||
input $touchpad {
|
||||
|
@ -227,9 +225,9 @@ assign [title="CubeMX"] $wsn
|
|||
exec swaymsg 'workspace pdf; layout tabbed'
|
||||
assign [class="okular"] $wsp
|
||||
# Return to first workspace
|
||||
exec swaymsg 'workspace 1'
|
||||
exec swaymsg 'workspace 1;'
|
||||
|
||||
## Application specific settings
|
||||
for_window [class="krunner"] floating enable;
|
||||
for_window [class="konsole"] floating enable;
|
||||
for_window [class="pavucontrol"] floating enable;
|
||||
for_window [class="pavucontrol"] floating enable;
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
"height": 25, // Waybar height (to be removed for auto height)
|
||||
// "width": 1280, // Waybar width
|
||||
// Choose the order of the modules
|
||||
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
|
||||
"modules-left": ["sway/workspaces", "sway/mode", "custom/media", "tray"],
|
||||
"modules-center": ["sway/window"],
|
||||
"modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"],
|
||||
"modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "battery", "custom/keyboard_layout", "clock"],
|
||||
// Modules configuration
|
||||
// "sway/workspaces": {
|
||||
// "disable-scroll": true,
|
||||
|
@ -142,5 +142,9 @@
|
|||
"escape": true,
|
||||
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
|
||||
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
|
||||
},
|
||||
"custom/keyboard_layout": {
|
||||
"format": "🎹 {}", // piano keyboard. Normal keyboard: ⌨️
|
||||
"exec": "keyboard_layout_monitor"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,12 +75,18 @@ window#waybar.chromium {
|
|||
#custom-media,
|
||||
#tray,
|
||||
#mode,
|
||||
#idle_inhibitor {
|
||||
#idle_inhibitor,
|
||||
#custom-keyboard_layout {
|
||||
padding: 0 10px;
|
||||
margin: 0 4px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#custom-keyboard_layout {
|
||||
background-color: #b190b1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#clock {
|
||||
background-color: #64727D;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue