rc.lua: Move some keys and apps auto start to config

This commit is contained in:
Alice Gaudon 2019-08-13 21:57:54 +02:00
parent c9c5755a26
commit 6d26491560
4 changed files with 530 additions and 405 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# IDEs
.idea/

View File

@ -6,11 +6,91 @@ local naughty = require("naughty")
local config = {} 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 -- Theme
-- 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
@ -18,8 +98,6 @@ config.theme = awful.util.getdir("config") .. "/default_theme.lua"
-- Screenshot utility -- Screenshot utility
config.screenshot_utility_command = "flameshot gui" config.screenshot_utility_command = "flameshot gui"
config.screenshot_utility_auto_start = true
config.screenshot_utility_auto_start_command = "flameshot"
-- Keyboard layout -- Keyboard layout
config.kbSwitchCmd = "setxkbmap" config.kbSwitchCmd = "setxkbmap"

View File

@ -1,9 +1,13 @@
--
-- Control playing music/media and sound volume -- Control playing music/media and sound volume
-- Currently supports : -- Currently supports :
-- - playerctl -- - playerctl
-- - Spotify -- - Spotify
--
--
-- DEBUG -- DEBUG
--
local inspect = require("debug/inspect") local inspect = require("debug/inspect")
local awful = require("awful") local awful = require("awful")
@ -34,6 +38,7 @@ function getVolume()
handle:close() handle:close()
return volume return volume
end end
function isMuted() function isMuted()
local handle = io.popen("amixer -D pulse sget Master | awk -F\"[][]\" '/[onf]{2,3}/ { print $4 }' | head -n -1", "r") 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" local muted = string.gsub(handle:read("*a"), "[\n]+", "") == "off"
@ -56,7 +61,7 @@ function getVolumeImage(volume)
end end
local volumeWibox = wibox({ local volumeWibox = wibox({
ontop=true, ontop = true,
bg = beautiful.volume_osd_bg, bg = beautiful.volume_osd_bg,
border_width = beautiful.volume_osd_border_width, border_width = beautiful.volume_osd_border_width,
border_color = beautiful.volume_osd_border_color, border_color = beautiful.volume_osd_border_color,
@ -152,7 +157,7 @@ local displayVolume = function()
end end
timer = gears.timer { timer = gears.timer {
timeout = config.volume_osd_timeout, timeout = config.volume_osd_timeout,
callback = function() callback = function()
volumeWibox.visible = false volumeWibox.visible = false
timer:stop() timer:stop()
timer = nil timer = nil
@ -175,11 +180,25 @@ local toggleMute = function()
end 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 { return {
playPause = playPause, getKeys = getKeys,
nextTrack = nextTrack,
previousTrack = previousTrack,
raiseVolume = raiseVolume,
lowerVolume = lowerVolume,
toggleMute = toggleMute
} }

808
rc.lua

File diff suppressed because it is too large Load Diff