Add support for run menus and window switchers

This commit is contained in:
Arkhist 2019-07-23 15:38:02 +02:00
parent 5d3b7a08fa
commit 50483f49f9
3 changed files with 33 additions and 17 deletions

View File

@ -1,3 +1,11 @@
# Simple Awesome
As simple as it sounds
(not yet though)
## Dependencies
By default, Simple Awesome uses
- `rofi` for the launch bar/window switcher
- `flameshot` for making screenshots

View File

@ -10,5 +10,13 @@ local config = {}
-- Change to gears.filesystem.get_themes_dir() .. "default/theme.lua" to use default awesome theme
config.theme = awful.util.getdir("config") .. "/default_theme.lua"
config.screenshotCmd = "flameshot gui"
config.kbSwitchCmd = "setxkbmap"
config.kbLayouts = { "fr", "us" }
config.runMenu = "rofi -show run"
config.windowSwitcher = "rofi -show window"
return config

26
rc.lua
View File

@ -115,17 +115,13 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
mykeyboardlayout = awful.widget.keyboardlayout()
kbdlayout = {}
kbdlayout.cmd = "setxkbmap"
kbdlayout.layouts = { "fr", "us" }
kbdlayout.cur = 1
kbdlayout.switch = function()
kbdlayout.cur = (kbdlayout.cur % #(kbdlayout.layouts)) + 1
local t = kbdlayout.layouts[kbdlayout.cur]
os.execute( kbdlayout.cmd .. " " .. t )
kbdlayout.cur = (kbdlayout.cur % #(config.kbLayouts)) + 1
local t = config.kbLayouts[kbdlayout.cur]
os.execute( config.kbSwitchCmd .. " " .. t )
end
screenshotCmd = "flameshot gui"
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
@ -289,12 +285,16 @@ globalkeys = gears.table.join(
{description = "jump to urgent client", group = "client"}),
awful.key({ modkey, }, "Tab",
function ()
if config.windowSwitcher == "" then
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
else
os.execute(config.windowSwitcher)
end
end,
{description = "go back", group = "client"}),
{description = "switch window", group = "client"}),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
@ -334,8 +334,8 @@ globalkeys = gears.table.join(
{description = "restore minimized", group = "client"}),
-- Prompt
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "r", function () os.execute(config.runMenu) end,
{description = "show the run menu", group = "launcher"}),
awful.key({ modkey }, "x",
function ()
@ -348,15 +348,15 @@ globalkeys = gears.table.join(
end,
{description = "lua execute prompt", group = "awesome"}),
-- Menubar
awful.key({ modkey }, "p", function() menubar.show() end,
{description = "show the menubar", group = "launcher"}),
awful.key({ modkey }, "space", function() os.execute(config.runMenu) end,
{description = "show the run menu", group = "launcher"}),
-- Keyboard layout switch
awful.key({ "Mod1" }, "Shift_L", function () kbdlayout.switch() end,
{description = "switch keyboard layout"}),
awful.key({ "Shift" }, "Alt_L", function () kbdlayout.switch() end,
{description = "switch keyboard layout"}),
-- Flameshot
awful.key({}, "Print", function () os.execute( screenshotCmd ) end,
awful.key({}, "Print", function () os.execute( config.screenshotCmd ) end,
{description = "screenshot using the specified command"})
)