add keyboard layout widget

This commit is contained in:
Roland Schneider 2021-08-03 09:06:16 +02:00
parent f1e8c2b9e8
commit 9a31da851d
3 changed files with 28 additions and 8 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
battery-widget
keyboard-layout-indicator

View File

@ -1,2 +1,3 @@
git clone https://github.com/deficient/battery-widget.git
git clone https://github.com/deficient/keyboard-layout-indicator.git
sudo apt-get install acpid

34
rc.lua
View File

@ -14,6 +14,7 @@ local hotkeys_popup = require("awful.hotkeys_popup").widget
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
local battery_widget = require("battery-widget")
local keyboard_layout_indicator = require("keyboard-layout-indicator")
-- Load Debian menu entries
local debian = require("debian.menu")
@ -190,14 +191,30 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
-- mytextclock = wibox.widget.textclock()
mytextclock = wibox.widget.textclock("%Y-%m-%d, %a, %H:%M:%S",1)
mytextclock = wibox.widget.textclock("%y-%m-%d %a %H:%M:%S",1)
mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC", widget_font = wibar_font }
mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC", widget_font = wibar_font
, battery_prefix = "🔋"
, ac_prefix = "🔌"
}
mykeyboardindicatorwidget = keyboard_layout_indicator({
layouts = {
{name="🇭🇺", layout="hu", variant=nil},
{name="🇦🇹", layout="de", variant=nil},
{name="🇬🇧", layout="us", variant=nil}
},
-- optionally, specify commands to be executed after changing layout:
post_set_hooks = {
"xmodmap ~/.Xmodmap",
"setxkbmap -option caps:escape"
}
})
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
@ -303,14 +320,15 @@ end
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
d_sep,
-- mykeyboardlayout,
-- d_sep,
wibox.widget.systray(),
d_sep,
mytextclock,
l_sep,
d_sep,
mybatterywidget,
r_sep,
d_sep,
mykeyboardindicatorwidget,
d_sep,
s.mylayoutbox,
},
@ -767,5 +785,5 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
-- }}}
--
-- {{{ autostart
awful.spawn.with_shell("~/.config/awesome/autorun.sh")
-- awful.spawn.with_shell("~/.config/awesome/autorun.sh")
-- }}}