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,
|
||||
}
|
Loading…
Reference in New Issue
Block a user