From 9a31da851da6ac09716883d34f1eb5ce424cef6a Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Tue, 3 Aug 2021 09:06:16 +0200 Subject: [PATCH] add keyboard layout widget --- .gitignore | 1 + install-deps.sh | 1 + rc.lua | 34 ++++++++++++++++++++++++++-------- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 486fb59..5a6c133 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ battery-widget +keyboard-layout-indicator diff --git a/install-deps.sh b/install-deps.sh index ae4a34e..ec37c2b 100644 --- a/install-deps.sh +++ b/install-deps.sh @@ -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 diff --git a/rc.lua b/rc.lua index 476cc20..3c56446 100644 --- a/rc.lua +++ b/rc.lua @@ -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") -- }}}