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