rc.lua: Move some keys and apps auto start to config
This commit is contained in:
parent
c9c5755a26
commit
6d26491560
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# IDEs
|
||||
.idea/
|
@ -6,11 +6,91 @@ local naughty = require("naughty")
|
||||
|
||||
local config = {}
|
||||
|
||||
-- General
|
||||
config.modkey = "Mod4"
|
||||
|
||||
-- Terminal
|
||||
config.terminal = "terminator"
|
||||
--
|
||||
-- Awesome WM
|
||||
--
|
||||
config.awesome = {
|
||||
-- Enable window autofocus on mouse hover
|
||||
autofocus = true,
|
||||
|
||||
-- Enable hotkeys help widget for VIM and other apps
|
||||
-- when client with a matching name is opened:
|
||||
hotkeys_popup = true,
|
||||
|
||||
-- Terminal
|
||||
terminal = "terminator",
|
||||
|
||||
-- Default terminal editor
|
||||
-- editor = "vi",
|
||||
editor = os.getenv("EDITOR") or "nano",
|
||||
editor_cmd = config.awesome.terminal .. " -e " .. config.awesome.editor,
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Keys / Hotkeys / Shortcuts
|
||||
--
|
||||
-- To disable a shortcut, simply remove it (tip: comment it out with a leading "--")
|
||||
--
|
||||
config.keys = {
|
||||
-- Main modifier key for meta hotkeys like moving windows or locking the session
|
||||
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||
modkey = "Mod4",
|
||||
|
||||
-- Hotkeys globally available (through the entire OS, regardless of what's focused)
|
||||
globalkeys = {
|
||||
media_control = {
|
||||
--
|
||||
-- Media and volume controls
|
||||
-- See media_control.lua
|
||||
--
|
||||
|
||||
-- Raise volume
|
||||
raiseVolume = "XF86AudioRaiseVolume",
|
||||
|
||||
-- Lower volume
|
||||
lowerVolume = "XF86AudioLowerVolume",
|
||||
|
||||
-- Toggle mute
|
||||
toggleMute = "XF86AudioMute",
|
||||
|
||||
-- Toggle Play / Pause
|
||||
playPause = "XF86AudioPlay",
|
||||
|
||||
-- Next track
|
||||
nextTrack = "XF86AudioNext",
|
||||
|
||||
-- Previous track
|
||||
previousTrack = "XF86AudioPrev",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Widgets
|
||||
--
|
||||
config.widgets = {
|
||||
-- Enable/disable the system resources monitoring widget
|
||||
system_resources = true,
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
-- Auto start custom applications
|
||||
--
|
||||
config.autostart = {
|
||||
-- Network manager widget
|
||||
{
|
||||
"nm-applet --help", -- Verification command that will be checked before spawning the next command
|
||||
"nm-applet", -- The app
|
||||
},
|
||||
|
||||
-- Screenshot utility
|
||||
"flameshot",
|
||||
}
|
||||
|
||||
|
||||
-- Theme
|
||||
-- Change to gears.filesystem.get_themes_dir() .. "default/theme.lua" to use default awesome theme
|
||||
@ -18,8 +98,6 @@ config.theme = awful.util.getdir("config") .. "/default_theme.lua"
|
||||
|
||||
-- Screenshot utility
|
||||
config.screenshot_utility_command = "flameshot gui"
|
||||
config.screenshot_utility_auto_start = true
|
||||
config.screenshot_utility_auto_start_command = "flameshot"
|
||||
|
||||
-- Keyboard layout
|
||||
config.kbSwitchCmd = "setxkbmap"
|
||||
|
@ -1,9 +1,13 @@
|
||||
--
|
||||
-- Control playing music/media and sound volume
|
||||
-- Currently supports :
|
||||
-- - playerctl
|
||||
-- - Spotify
|
||||
--
|
||||
|
||||
--
|
||||
-- DEBUG
|
||||
--
|
||||
local inspect = require("debug/inspect")
|
||||
|
||||
local awful = require("awful")
|
||||
@ -34,6 +38,7 @@ function getVolume()
|
||||
handle:close()
|
||||
return volume
|
||||
end
|
||||
|
||||
function isMuted()
|
||||
local handle = io.popen("amixer -D pulse sget Master | awk -F\"[][]\" '/[onf]{2,3}/ { print $4 }' | head -n -1", "r")
|
||||
local muted = string.gsub(handle:read("*a"), "[\n]+", "") == "off"
|
||||
@ -56,7 +61,7 @@ function getVolumeImage(volume)
|
||||
end
|
||||
|
||||
local volumeWibox = wibox({
|
||||
ontop=true,
|
||||
ontop = true,
|
||||
bg = beautiful.volume_osd_bg,
|
||||
border_width = beautiful.volume_osd_border_width,
|
||||
border_color = beautiful.volume_osd_border_color,
|
||||
@ -175,11 +180,25 @@ local toggleMute = function()
|
||||
end
|
||||
-- }}}
|
||||
|
||||
function getKeys(config)
|
||||
return
|
||||
-- Volume control
|
||||
config.raiseVolume ~= nil and awful.key({}, config.raiseVolume, raiseVolume,
|
||||
{ description = "Raise volume", group = "media control" }) or nil,
|
||||
config.lowerVolume ~= nil and awful.key({}, config.lowerVolume, lowerVolume,
|
||||
{ description = "Lower volume", group = "media control" }) or nil,
|
||||
config.toggleMute ~= nil and awful.key({}, config.toggleMute, toggleMute,
|
||||
{ description = "Toggle mute audio", group = "media control" }) or nil,
|
||||
|
||||
-- Media control
|
||||
config.playPause ~= nil and awful.key({}, config.playPause, playPause,
|
||||
{ description = "Toggle Play / Pause", group = "media control" }) or nil,
|
||||
config.nextTrack ~= nil and awful.key({}, config.nextTrack, nextTrack,
|
||||
{ description = "Next track", group = "media control" }) or nil,
|
||||
config.previousTrack ~= nil and awful.key({}, config.previousTrack, previousTrack,
|
||||
{ description = "Previous track", group = "media control" }) or nil
|
||||
end
|
||||
|
||||
return {
|
||||
playPause = playPause,
|
||||
nextTrack = nextTrack,
|
||||
previousTrack = previousTrack,
|
||||
raiseVolume = raiseVolume,
|
||||
lowerVolume = lowerVolume,
|
||||
toggleMute = toggleMute
|
||||
getKeys = getKeys,
|
||||
}
|
586
rc.lua
586
rc.lua
@ -1,93 +1,130 @@
|
||||
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||
pcall(require, "luarocks.loader")
|
||||
--
|
||||
-- Simple Awesome main file - By Arisu & Arkhist
|
||||
-- To configure Simple Awesome without losing your changes when updating, see the `config.lua` file.
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- DEBUG
|
||||
--
|
||||
local inspect = require("debug/inspect")
|
||||
|
||||
-- Standard awesome library
|
||||
local gears = require("gears")
|
||||
--
|
||||
-- Simple Awesome configuration
|
||||
--
|
||||
local config = require("config")
|
||||
|
||||
|
||||
--
|
||||
-- Awesome WM
|
||||
--
|
||||
local awful = require("awful")
|
||||
require("awful.autofocus")
|
||||
-- Widget and layout library
|
||||
local wibox = require("wibox")
|
||||
-- Theme handling library
|
||||
local beautiful = require("beautiful")
|
||||
-- Notification library
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local menubar = require("menubar")
|
||||
local wibox = require("wibox")
|
||||
|
||||
-- Widgets and layout components
|
||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||
-- Enable hotkeys help widget for VIM and other apps
|
||||
-- when client with a matching name is opened:
|
||||
require("awful.hotkeys_popup.keys")
|
||||
local menubar = require("menubar")
|
||||
|
||||
-- Window autofocus
|
||||
if config.awesome.autofocus then
|
||||
require("awful.autofocus")
|
||||
end
|
||||
|
||||
-- {{{ Error handling
|
||||
-- Check if awesome encountered an error during startup and fell back to
|
||||
-- another config (This code will only ever execute for the fallback config)
|
||||
if awesome.startup_errors then
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, there were errors during startup!",
|
||||
text = awesome.startup_errors })
|
||||
-- Hotkeys popup
|
||||
if hotkeys_popup then
|
||||
require("awful.hotkeys_popup.keys")
|
||||
end
|
||||
|
||||
|
||||
-- Handle runtime errors after startup
|
||||
--
|
||||
-- Error handling
|
||||
--
|
||||
|
||||
-- Startup errors
|
||||
if awesome.startup_errors then
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "Something went wrong while booting Awesome",
|
||||
text = awesome.startup_errors
|
||||
})
|
||||
end
|
||||
|
||||
-- Runtime errors handling routine
|
||||
do
|
||||
local in_error = false
|
||||
awesome.connect_signal("debug::error", function (err)
|
||||
awesome.connect_signal("debug::error", function(err)
|
||||
-- Make sure we don't go into an endless error loop
|
||||
if in_error then return end
|
||||
in_error = true
|
||||
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, an error happened!",
|
||||
text = tostring(err) })
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "An error happened during Awesome runtime",
|
||||
text = tostring(err)
|
||||
})
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
||||
|
||||
-- Simple awesome start
|
||||
local config = require("config")
|
||||
--
|
||||
-- Variables that need to be populated during the whole setup
|
||||
--
|
||||
|
||||
-- {{{ Variable definitions
|
||||
-- Themes define colours, icons, font and wallpapers.
|
||||
-- Hotkeys
|
||||
local globalkeys = {}
|
||||
function registerKeys(...)
|
||||
globalkeys = gears.table.join(globalkeys, ...)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Theme
|
||||
--
|
||||
beautiful.init(config.theme)
|
||||
|
||||
-- Media control
|
||||
local media_control = require("media_control")
|
||||
|
||||
-- System Resources widget
|
||||
local system_resources_widget = require("widgets/system_resources/system_resources")
|
||||
|
||||
--
|
||||
-- Tiling
|
||||
--
|
||||
local tiling = require("tiling")
|
||||
|
||||
-- Network widget
|
||||
if os.execute("nm-applet --help") == true then
|
||||
awful.spawn("nm-applet")
|
||||
else
|
||||
-- Support for more network managers should be requested via issues
|
||||
end
|
||||
|
||||
-- Screenshot auto launch
|
||||
if config.screenshot_utility_auto_start then
|
||||
awful.spawn(config.screenshot_utility_auto_start_command)
|
||||
--
|
||||
-- Media control keys and widget
|
||||
--
|
||||
local media_control = require("media_control")
|
||||
registerKeys(media_control.getKeys(config.keys.globalkeys.media_control))
|
||||
|
||||
|
||||
--
|
||||
-- Widgets
|
||||
--
|
||||
|
||||
-- System resources
|
||||
local system_resources_widget
|
||||
if config.widgets.system_resources then
|
||||
system_resources_widget = require("widgets/system_resources/system_resources")
|
||||
end
|
||||
|
||||
|
||||
-- This is used later as the default terminal and editor to run.
|
||||
editor = os.getenv("EDITOR") or "nano"
|
||||
editor_cmd = config.terminal .. " -e " .. editor
|
||||
--
|
||||
-- Auto start
|
||||
--
|
||||
for _, app in ipairs(config.autostart) do
|
||||
local type = type(app)
|
||||
if type == "table" then -- Has a verification command that checks if it exists on the system
|
||||
if os.execute(app[1]) == true then
|
||||
awful.spawn(app[2])
|
||||
end
|
||||
elseif type == "string" then -- Simple command
|
||||
awful.spawn(app)
|
||||
end
|
||||
end
|
||||
|
||||
-- Default modkey.
|
||||
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||
-- If you do not like this or do not have such a key,
|
||||
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
||||
-- However, you can use another modifier like Mod1, but it may interact with others.
|
||||
modkey = config.modkey
|
||||
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
awful.layout.layouts = {
|
||||
@ -114,22 +151,26 @@ awful.layout.layouts = {
|
||||
-- Create a launcher widget and a main menu
|
||||
myawesomemenu = {
|
||||
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
|
||||
{ "manual", config.terminal .. " -e man awesome" },
|
||||
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
||||
{ "manual", config.awesome.terminal .. " -e man awesome" },
|
||||
{ "edit config", config.awesome.editor_cmd .. " " .. awesome.conffile },
|
||||
{ "restart", awesome.restart },
|
||||
{ "quit", function() awesome.quit() end },
|
||||
}
|
||||
|
||||
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
{ "open terminal", config.terminal }
|
||||
mymainmenu = awful.menu({
|
||||
items = {
|
||||
{ "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
{ "open terminal", config.awesome.terminal }
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
||||
menu = mymainmenu })
|
||||
mylauncher = awful.widget.launcher({
|
||||
image = beautiful.awesome_icon,
|
||||
menu = mymainmenu
|
||||
})
|
||||
|
||||
-- Menubar configuration
|
||||
menubar.utils.terminal = config.terminal -- Set the terminal for applications that require it
|
||||
menubar.utils.terminal = config.awesome.terminal -- Set the terminal for applications that require it
|
||||
-- }}}
|
||||
|
||||
-- Keyboard map indicator and switcher
|
||||
@ -140,7 +181,7 @@ kbdlayout.cur = 1
|
||||
kbdlayout.switch = function()
|
||||
kbdlayout.cur = (kbdlayout.cur % #(config.kbLayouts)) + 1
|
||||
local t = config.kbLayouts[kbdlayout.cur]
|
||||
os.execute( config.kbSwitchCmd .. " " .. t )
|
||||
os.execute(config.kbSwitchCmd .. " " .. t)
|
||||
end
|
||||
|
||||
shutdown_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/power.svg")
|
||||
@ -149,30 +190,39 @@ logout_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/log-out.
|
||||
lock_icon = awesome.load_image(awful.util.getdir("config") .. "/icons/lock.svg")
|
||||
|
||||
shutdownMenu_items = {
|
||||
{ "Shutdown",
|
||||
{
|
||||
"Shutdown",
|
||||
function()
|
||||
os.execute('shutdown now')
|
||||
end,
|
||||
shutdown_icon },
|
||||
{ "Restart",
|
||||
shutdown_icon
|
||||
},
|
||||
{
|
||||
"Restart",
|
||||
function()
|
||||
os.execute('shutdown -r now')
|
||||
end,
|
||||
restart_icon },
|
||||
{ "Logout",
|
||||
restart_icon
|
||||
},
|
||||
{
|
||||
"Logout",
|
||||
function()
|
||||
awesome.quit()
|
||||
end,
|
||||
logout_icon },
|
||||
{ "Lock",
|
||||
logout_icon
|
||||
},
|
||||
{
|
||||
"Lock",
|
||||
function()
|
||||
awful.spawn("xscreensaver-command -lock")
|
||||
end,
|
||||
lock_icon }
|
||||
lock_icon
|
||||
}
|
||||
}
|
||||
shutdownMenu_launcher = awful.widget.launcher({
|
||||
image = beautiful.awesome_icon,
|
||||
menu = awful.menu({ items = shutdownMenu_items}) })
|
||||
menu = awful.menu({ items = shutdownMenu_items })
|
||||
})
|
||||
|
||||
|
||||
-- {{{ Wibar
|
||||
@ -180,42 +230,37 @@ shutdownMenu_launcher = awful.widget.launcher({
|
||||
mytextclock = wibox.widget.textclock()
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
local taglist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
awful.button({ modkey }, 1, function(t)
|
||||
local taglist_buttons = gears.table.join(awful.button({}, 1, function(t) t:view_only() end),
|
||||
awful.button({ config.keys.modkey }, 1, function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, function(t)
|
||||
awful.button({}, 3, awful.tag.viewtoggle),
|
||||
awful.button({ config.keys.modkey }, 3, function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
|
||||
)
|
||||
awful.button({}, 4, function(t) awful.tag.viewnext(t.screen) end),
|
||||
awful.button({}, 5, function(t) awful.tag.viewprev(t.screen) end))
|
||||
|
||||
local tasklist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
local tasklist_buttons = gears.table.join(awful.button({}, 1, function(c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
c:emit_signal(
|
||||
"request::activate",
|
||||
c:emit_signal("request::activate",
|
||||
"tasklist",
|
||||
{raise = true}
|
||||
)
|
||||
{ raise = true })
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, function()
|
||||
end),
|
||||
awful.button({}, 3, function()
|
||||
awful.menu.client_list({ theme = { width = 250 } })
|
||||
end),
|
||||
awful.button({ }, 4, function ()
|
||||
awful.button({}, 4, function()
|
||||
awful.client.focus.byidx(1)
|
||||
end),
|
||||
awful.button({ }, 5, function ()
|
||||
awful.button({}, 5, function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end))
|
||||
|
||||
@ -246,11 +291,10 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
|
||||
-- We need one layoutbox per screen.
|
||||
s.mylayoutbox = awful.widget.layoutbox(s)
|
||||
s.mylayoutbox:buttons(gears.table.join(
|
||||
awful.button({ }, 1, function () awful.layout.inc( 1) end),
|
||||
awful.button({ }, 3, function () awful.layout.inc(-1) end),
|
||||
awful.button({ }, 4, function () awful.layout.inc( 1) end),
|
||||
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
|
||||
s.mylayoutbox:buttons(gears.table.join(awful.button({}, 1, function() awful.layout.inc(1) end),
|
||||
awful.button({}, 3, function() awful.layout.inc(-1) end),
|
||||
awful.button({}, 4, function() awful.layout.inc(1) end),
|
||||
awful.button({}, 5, function() awful.layout.inc(-1) end)))
|
||||
-- Create a taglist widget
|
||||
s.mytaglist = awful.widget.taglist {
|
||||
screen = s,
|
||||
@ -312,14 +356,16 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
-- Add widgets to the wibox
|
||||
s.mywibox:setup {
|
||||
layout = wibox.layout.align.horizontal,
|
||||
{ -- Left widgets
|
||||
{
|
||||
-- Left widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
mylauncher,
|
||||
s.mytaglist,
|
||||
s.mypromptbox,
|
||||
},
|
||||
s.mytasklist, -- Middle widget
|
||||
{ -- Right widgets
|
||||
{
|
||||
-- Right widgets
|
||||
matchesScreen(config.system_resources_widget_screens) and system_resources_widget.widget or nil,
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
mykeyboardlayout,
|
||||
@ -333,49 +379,44 @@ end)
|
||||
-- }}}
|
||||
|
||||
-- {{{ Mouse bindings
|
||||
root.buttons(gears.table.join(
|
||||
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
||||
awful.button({ }, 4, awful.tag.viewnext),
|
||||
awful.button({ }, 5, awful.tag.viewprev)
|
||||
))
|
||||
root.buttons(gears.table.join(awful.button({}, 3, function() mymainmenu:toggle() end),
|
||||
awful.button({}, 4, awful.tag.viewnext),
|
||||
awful.button({}, 5, awful.tag.viewprev)))
|
||||
-- }}}
|
||||
|
||||
-- {{{ Key bindings
|
||||
globalkeys = gears.table.join(
|
||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||
{description="show help", group="awesome"}),
|
||||
globalkeys = gears.table.join(globalkeys, awful.key({ config.keys.modkey, }, "s", hotkeys_popup.show_help,
|
||||
{ description = "show help", group = "awesome" }),
|
||||
|
||||
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
|
||||
{description = "go back", group = "tag"}),
|
||||
awful.key({ config.keys.modkey, }, "Escape", awful.tag.history.restore,
|
||||
{ description = "go back", group = "tag" }),
|
||||
|
||||
awful.key({ modkey, }, "j",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
awful.key({ config.keys.modkey, }, "j",
|
||||
function()
|
||||
awful.client.focus.byidx(1)
|
||||
end,
|
||||
{description = "focus next by index", group = "client"}
|
||||
),
|
||||
awful.key({ modkey, }, "k",
|
||||
function ()
|
||||
{ description = "focus next by index", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "k",
|
||||
function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end,
|
||||
{description = "focus previous by index", group = "client"}
|
||||
),
|
||||
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
||||
{description = "show main menu", group = "awesome"}),
|
||||
{ description = "focus previous by index", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "w", function() mymainmenu:show() end,
|
||||
{ description = "show main menu", group = "awesome" }),
|
||||
|
||||
-- Layout manipulation
|
||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
|
||||
{description = "swap with next client by index", group = "client"}),
|
||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
||||
{description = "swap with previous client by index", group = "client"}),
|
||||
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
|
||||
{description = "focus the next screen", group = "screen"}),
|
||||
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
|
||||
{description = "focus the previous screen", group = "screen"}),
|
||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
||||
{description = "jump to urgent client", group = "client"}),
|
||||
awful.key({ modkey, }, "Tab",
|
||||
function ()
|
||||
awful.key({ config.keys.modkey, "Shift" }, "j", function() awful.client.swap.byidx(1) end,
|
||||
{ description = "swap with next client by index", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "k", function() awful.client.swap.byidx(-1) end,
|
||||
{ description = "swap with previous client by index", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "j", function() awful.screen.focus_relative(1) end,
|
||||
{ description = "focus the next screen", group = "screen" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "k", function() awful.screen.focus_relative(-1) end,
|
||||
{ description = "focus the previous screen", group = "screen" }),
|
||||
awful.key({ config.keys.modkey, }, "u", awful.client.urgent.jumpto,
|
||||
{ description = "jump to urgent client", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "Tab",
|
||||
function()
|
||||
if config.windowSwitcher == "" then
|
||||
awful.client.focus.history.previous()
|
||||
if client.focus then
|
||||
@ -385,51 +426,49 @@ globalkeys = gears.table.join(
|
||||
os.execute(config.windowSwitcher)
|
||||
end
|
||||
end,
|
||||
{description = "switch window", group = "client"}),
|
||||
{ description = "switch window", group = "client" }),
|
||||
|
||||
-- Standard program
|
||||
awful.key({ modkey, }, "Return", function () awful.spawn(config.terminal) end,
|
||||
{description = "open a terminal", group = "launcher"}),
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{description = "reload awesome", group = "awesome"}),
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||
{description = "quit awesome", group = "awesome"}),
|
||||
awful.key({ config.keys.modkey, }, "Return", function() awful.spawn(config.awesome.terminal) end,
|
||||
{ description = "open a terminal", group = "launcher" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "r", awesome.restart,
|
||||
{ description = "reload awesome", group = "awesome" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "q", awesome.quit,
|
||||
{ description = "quit awesome", group = "awesome" }),
|
||||
|
||||
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
|
||||
{description = "increase master width factor", group = "layout"}),
|
||||
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
|
||||
{description = "decrease master width factor", group = "layout"}),
|
||||
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
|
||||
{description = "increase the number of master clients", group = "layout"}),
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
|
||||
{description = "decrease the number of master clients", group = "layout"}),
|
||||
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
|
||||
{description = "increase the number of columns", group = "layout"}),
|
||||
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
|
||||
{description = "decrease the number of columns", group = "layout"}),
|
||||
awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
|
||||
{description = "select next", group = "layout"}),
|
||||
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
|
||||
{description = "select previous", group = "layout"}),
|
||||
awful.key({ config.keys.modkey, }, "l", function() awful.tag.incmwfact(0.05) end,
|
||||
{ description = "increase master width factor", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, }, "h", function() awful.tag.incmwfact(-0.05) end,
|
||||
{ description = "decrease master width factor", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "h", function() awful.tag.incnmaster(1, nil, true) end,
|
||||
{ description = "increase the number of master clients", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "l", function() awful.tag.incnmaster(-1, nil, true) end,
|
||||
{ description = "decrease the number of master clients", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "h", function() awful.tag.incncol(1, nil, true) end,
|
||||
{ description = "increase the number of columns", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "l", function() awful.tag.incncol(-1, nil, true) end,
|
||||
{ description = "decrease the number of columns", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, }, "space", function() awful.layout.inc(1) end,
|
||||
{ description = "select next", group = "layout" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "space", function() awful.layout.inc(-1) end,
|
||||
{ description = "select previous", group = "layout" }),
|
||||
|
||||
awful.key({ modkey, "Control" }, "n",
|
||||
function ()
|
||||
awful.key({ config.keys.modkey, "Control" }, "n",
|
||||
function()
|
||||
local c = awful.client.restore()
|
||||
-- Focus restored client
|
||||
if c then
|
||||
c:emit_signal(
|
||||
"request::activate", "key.unminimize", {raise = true}
|
||||
)
|
||||
c:emit_signal("request::activate", "key.unminimize", { raise = true })
|
||||
end
|
||||
end,
|
||||
{description = "restore minimized", group = "client"}),
|
||||
{ description = "restore minimized", group = "client" }),
|
||||
|
||||
-- Prompt
|
||||
awful.key({ modkey }, "r", function () os.execute(config.runMenu) end,
|
||||
{description = "show the run menu", group = "launcher"}),
|
||||
awful.key({ config.keys.modkey }, "r", function() os.execute(config.runMenu) end,
|
||||
{ description = "show the run menu", group = "launcher" }),
|
||||
|
||||
awful.key({ modkey }, "x",
|
||||
function ()
|
||||
awful.key({ config.keys.modkey }, "x",
|
||||
function()
|
||||
awful.prompt.run {
|
||||
prompt = "Run Lua code: ",
|
||||
textbox = awful.screen.focused().mypromptbox.widget,
|
||||
@ -437,95 +476,74 @@ globalkeys = gears.table.join(
|
||||
history_path = awful.util.get_cache_dir() .. "/history_eval"
|
||||
}
|
||||
end,
|
||||
{description = "lua execute prompt", group = "awesome"}),
|
||||
{ description = "lua execute prompt", group = "awesome" }),
|
||||
-- Menubar
|
||||
awful.key({ modkey }, "space", function() os.execute(config.runMenu) end,
|
||||
{description = "show the run menu", group = "launcher"}),
|
||||
awful.key({ config.keys.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"}),
|
||||
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(config.screenshot_utility_command) end,
|
||||
{description = "Take a screenshot using the screenshot utility", group="utilities"}),
|
||||
-- Media control
|
||||
awful.key({}, "XF86AudioPlay", media_control.playPause,
|
||||
{description = "Toggle Play / Pause", group="media control"}),
|
||||
awful.key({}, "XF86AudioNext", media_control.nextTrack,
|
||||
{description = "Next track", group="media control"}),
|
||||
awful.key({}, "XF86AudioPrev", media_control.previousTrack,
|
||||
{description = "Previous track", group="media control"}),
|
||||
-- Volume control
|
||||
awful.key({}, "XF86AudioRaiseVolume", media_control.raiseVolume,
|
||||
{description = "Raise volume", group="media control"}),
|
||||
awful.key({}, "XF86AudioLowerVolume", media_control.lowerVolume,
|
||||
{description = "Lower volume", group="media control"}),
|
||||
awful.key({}, "XF86AudioMute", media_control.toggleMute,
|
||||
{description = "Toggle mute audio", group="media control"})
|
||||
)
|
||||
awful.key({}, "Print", function() os.execute(config.screenshot_utility_command) end,
|
||||
{ description = "Take a screenshot using the screenshot utility", group = "utilities" }))
|
||||
|
||||
clientkeys = gears.table.join(
|
||||
-- tiling
|
||||
awful.key({modkey,}, "Right",
|
||||
clientkeys = gears.table.join(-- tiling
|
||||
awful.key({ config.keys.modkey, }, "Right",
|
||||
tiling.key.tileRight,
|
||||
{description = "Tile right", group = "tiling"}
|
||||
),
|
||||
awful.key({modkey,}, "Left",
|
||||
{ description = "Tile right", group = "tiling" }),
|
||||
awful.key({ config.keys.modkey, }, "Left",
|
||||
tiling.key.tileLeft,
|
||||
{description = "Tile left", group = "tiling"}
|
||||
),
|
||||
awful.key({modkey,}, "Up",
|
||||
{ description = "Tile left", group = "tiling" }),
|
||||
awful.key({ config.keys.modkey, }, "Up",
|
||||
tiling.key.toggleMaximized,
|
||||
{description = "Toggle maximized", group = "tiling"}
|
||||
),
|
||||
awful.key({modkey,}, "Down",
|
||||
{ description = "Toggle maximized", group = "tiling" }),
|
||||
awful.key({ config.keys.modkey, }, "Down",
|
||||
tiling.key.minimize,
|
||||
{description = "Lower", group = "tiling"}
|
||||
),
|
||||
{ description = "Lower", group = "tiling" }),
|
||||
|
||||
awful.key({ modkey, }, "f",
|
||||
function (c)
|
||||
awful.key({ config.keys.modkey, }, "f",
|
||||
function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{description = "toggle fullscreen", group = "client"}),
|
||||
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
|
||||
{description = "close", group = "client"}),
|
||||
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
|
||||
{description = "toggle floating", group = "client"}),
|
||||
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
|
||||
{description = "move to master", group = "client"}),
|
||||
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
|
||||
{description = "move to screen", group = "client"}),
|
||||
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
|
||||
{description = "toggle keep on top", group = "client"}),
|
||||
awful.key({ modkey, }, "n",
|
||||
function (c)
|
||||
{ description = "toggle fullscreen", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "c", function(c) c:kill() end,
|
||||
{ description = "close", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "space", awful.client.floating.toggle,
|
||||
{ description = "toggle floating", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end,
|
||||
{ description = "move to master", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "o", function(c) c:move_to_screen() end,
|
||||
{ description = "move to screen", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "t", function(c) c.ontop = not c.ontop end,
|
||||
{ description = "toggle keep on top", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "n",
|
||||
function(c)
|
||||
-- The client currently has the input focus, so it cannot be
|
||||
-- minimized, since minimized clients can't have the focus.
|
||||
c.minimized = true
|
||||
end ,
|
||||
{description = "minimize", group = "client"}),
|
||||
awful.key({ modkey, }, "m",
|
||||
function (c)
|
||||
end,
|
||||
{ description = "minimize", group = "client" }),
|
||||
awful.key({ config.keys.modkey, }, "m",
|
||||
function(c)
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize", group = "client"}),
|
||||
awful.key({ modkey, "Control" }, "m",
|
||||
function (c)
|
||||
end,
|
||||
{ description = "(un)maximize", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Control" }, "m",
|
||||
function(c)
|
||||
c.maximized_vertical = not c.maximized_vertical
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize vertically", group = "client"}),
|
||||
awful.key({ modkey, "Shift" }, "m",
|
||||
function (c)
|
||||
end,
|
||||
{ description = "(un)maximize vertically", group = "client" }),
|
||||
awful.key({ config.keys.modkey, "Shift" }, "m",
|
||||
function(c)
|
||||
c.maximized_horizontal = not c.maximized_horizontal
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize horizontally", group = "client"})
|
||||
)
|
||||
end,
|
||||
{ description = "(un)maximize horizontally", group = "client" }))
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
||||
@ -533,28 +551,28 @@ clientkeys = gears.table.join(
|
||||
for i = 1, 9 do
|
||||
globalkeys = gears.table.join(globalkeys,
|
||||
-- View tag only.
|
||||
awful.key({ modkey }, "#" .. i + 9,
|
||||
function ()
|
||||
awful.key({ config.keys.modkey }, "#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
end,
|
||||
{description = "view tag #"..i, group = "tag"}),
|
||||
{ description = "view tag #" .. i, group = "tag" }),
|
||||
-- Toggle tag display.
|
||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||
function ()
|
||||
awful.key({ config.keys.modkey, "Control" }, "#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
{description = "toggle tag #" .. i, group = "tag"}),
|
||||
{ description = "toggle tag #" .. i, group = "tag" }),
|
||||
-- Move client to tag.
|
||||
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
awful.key({ config.keys.modkey, "Shift" }, "#" .. i + 9,
|
||||
function()
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
@ -562,10 +580,10 @@ for i = 1, 9 do
|
||||
end
|
||||
end
|
||||
end,
|
||||
{description = "move focused client to tag #"..i, group = "tag"}),
|
||||
{ description = "move focused client to tag #" .. i, group = "tag" }),
|
||||
-- Toggle tag on focused client.
|
||||
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
awful.key({ config.keys.modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
function()
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
@ -573,23 +591,20 @@ for i = 1, 9 do
|
||||
end
|
||||
end
|
||||
end,
|
||||
{description = "toggle focused client on tag #" .. i, group = "tag"})
|
||||
)
|
||||
{ description = "toggle focused client on tag #" .. i, group = "tag" }))
|
||||
end
|
||||
|
||||
clientbuttons = gears.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||
end),
|
||||
awful.button({ modkey }, 1, function (c)
|
||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||
clientbuttons = gears.table.join(awful.button({}, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
end),
|
||||
awful.button({ config.keys.modkey }, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ modkey }, 3, function (c)
|
||||
c:emit_signal("request::activate", "mouse_click", {raise = true})
|
||||
awful.button({ config.keys.modkey }, 3, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
)
|
||||
end))
|
||||
|
||||
-- Set keys
|
||||
root.keys(globalkeys)
|
||||
@ -599,20 +614,23 @@ root.keys(globalkeys)
|
||||
-- Rules to apply to new clients (through the "manage" signal).
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{ rule = { },
|
||||
properties = { border_width = beautiful.border_width,
|
||||
{
|
||||
rule = {},
|
||||
properties = {
|
||||
border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
keys = clientkeys,
|
||||
buttons = clientbuttons,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap+awful.placement.no_offscreen
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen
|
||||
}
|
||||
},
|
||||
|
||||
-- Floating clients.
|
||||
{ rule_any = {
|
||||
{
|
||||
rule_any = {
|
||||
instance = {
|
||||
"DTA", -- Firefox addon DownThemAll.
|
||||
"copyq", -- Includes session name in class.
|
||||
@ -628,7 +646,8 @@ awful.rules.rules = {
|
||||
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
|
||||
"Wpa_gui",
|
||||
"veromix",
|
||||
"xtightvncviewer"},
|
||||
"xtightvncviewer"
|
||||
},
|
||||
|
||||
-- Note that the name property shown in xprop might be set slightly after creation of the client
|
||||
-- and the name shown there might not match defined rules here.
|
||||
@ -640,11 +659,16 @@ awful.rules.rules = {
|
||||
"ConfigManager", -- Thunderbird's about:config.
|
||||
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
|
||||
}
|
||||
}, properties = { floating = true }},
|
||||
},
|
||||
properties = { floating = true }
|
||||
},
|
||||
|
||||
-- Add titlebars to normal clients and dialogs
|
||||
{ rule_any = {type = { "normal", "dialog" }
|
||||
}, properties = { titlebars_enabled = true }
|
||||
{
|
||||
rule_any = {
|
||||
type = { "normal", "dialog" }
|
||||
},
|
||||
properties = { titlebars_enabled = true }
|
||||
},
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
@ -655,7 +679,7 @@ awful.rules.rules = {
|
||||
|
||||
-- {{{ Signals
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.connect_signal("manage", function (c)
|
||||
client.connect_signal("manage", function(c)
|
||||
-- Set the windows at the slave,
|
||||
-- i.e. put it at the end of others instead of setting it master.
|
||||
-- if not awesome.startup then awful.client.setslave(c) end
|
||||
@ -671,37 +695,39 @@ end)
|
||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||
client.connect_signal("request::titlebars", function(c)
|
||||
-- buttons for the titlebar
|
||||
local buttons = gears.table.join(
|
||||
awful.button({ }, 1, function()
|
||||
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||
local buttons = gears.table.join(awful.button({}, 1, function()
|
||||
c:emit_signal("request::activate", "titlebar", { raise = true })
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ }, 3, function()
|
||||
c:emit_signal("request::activate", "titlebar", {raise = true})
|
||||
awful.button({}, 3, function()
|
||||
c:emit_signal("request::activate", "titlebar", { raise = true })
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
)
|
||||
end))
|
||||
|
||||
awful.titlebar(c) : setup {
|
||||
{ -- Left
|
||||
awful.titlebar(c):setup {
|
||||
{
|
||||
-- Left
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
{ -- Middle
|
||||
{ -- Title
|
||||
{
|
||||
-- Middle
|
||||
{
|
||||
-- Title
|
||||
align = "center",
|
||||
widget = awful.titlebar.widget.titlewidget(c)
|
||||
},
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.flex.horizontal
|
||||
},
|
||||
{ -- Right
|
||||
awful.titlebar.widget.floatingbutton (c),
|
||||
{
|
||||
-- Right
|
||||
awful.titlebar.widget.floatingbutton(c),
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
awful.titlebar.widget.stickybutton (c),
|
||||
awful.titlebar.widget.ontopbutton (c),
|
||||
awful.titlebar.widget.closebutton (c),
|
||||
awful.titlebar.widget.stickybutton(c),
|
||||
awful.titlebar.widget.ontopbutton(c),
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
layout = wibox.layout.fixed.horizontal()
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
@ -710,7 +736,7 @@ end)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
client.connect_signal("mouse::enter", function(c)
|
||||
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
||||
c:emit_signal("request::activate", "mouse_enter", { raise = false })
|
||||
end)
|
||||
|
||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
|
Loading…
Reference in New Issue
Block a user