Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awesome v4 config #10

Merged
merged 64 commits into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
794d5c8
Start porting config to awesome 4
Feb 27, 2017
c089cfb
Replace old spawn function
Mar 4, 2017
f67300c
Port several configs to awesome4
Mar 27, 2017
7aca477
Add editorconfig
Mar 27, 2017
20193b4
Fix launcher for awesome4
Mar 27, 2017
d52bd27
Remove commented code
Mar 27, 2017
decce6f
Use floating via property instead of awful.client.floating
Mar 28, 2017
46c90f6
Refactor launcher config
Mar 28, 2017
dc4970a
Dirty fix for systray to work again
Mar 28, 2017
44e1bbf
Add lunaconf.utils.spawn that writes stdout/err to logfile
Mar 28, 2017
add8ffa
Remove unused code
Mar 28, 2017
ad31121
Remove old pidign/mail tags
Mar 28, 2017
cb01af1
Cleanup and refactor functions
Mar 28, 2017
536ab21
Use client.floating instead of awful.client.floating
Mar 30, 2017
48b76fd
Fix moving clients between screens
Mar 30, 2017
b3f04a8
Remove svgbox
Mar 30, 2017
5fdaba4
Use new directory methods
Apr 7, 2017
b09663d
Fix run_once method
Apr 7, 2017
68c6f88
Replace deprecated awful.mouse.client.snap
Apr 7, 2017
4da0abe
Only start compton if no composite manager is running
Apr 7, 2017
56a0c35
Add notify utilities to lunaconf
Apr 11, 2017
670b611
Use lunaconf.notify for keyboard switch
Apr 11, 2017
55a2ed5
Add rounded corners for notifications
timroes Apr 12, 2017
74d4460
Add icon to dex missing warning
timroes Apr 13, 2017
044dc3a
Add documentation to compositor config
timroes Apr 15, 2017
94082a1
Replace awful.util.pread in screensaver widget
timroes Apr 15, 2017
85d8c20
Fix badge layout
timroes Apr 15, 2017
9b64a2c
Create lunaconf.tags module
timroes Apr 15, 2017
f0e7409
Replace awful.util.table.join by gears
timroes Apr 15, 2017
d6c7626
Allow hiding of clients
timroes Apr 15, 2017
b459a40
Make hidden tag deactivated
timroes Apr 15, 2017
9d3f09e
Remove functions.lua
timroes Apr 16, 2017
95a26ec
Create infolay and add hidden clients view
timroes Apr 16, 2017
ebbbf14
Refactor wallpaper setting
timroes Apr 16, 2017
6b398e7
Only use replace_text if icon hasn't changed
timroes Apr 16, 2017
b649df1
Refactor the audio hotkeys
timroes Apr 17, 2017
1cb5385
Center pop-up windows
timroes Apr 17, 2017
a328180
Remove lunaconf.clients.set_attr/get_attr
Apr 18, 2017
d072eb4
Replace awful.util.table with gears.table
Apr 18, 2017
2ecb468
Update notification screen when primary changes
May 11, 2017
ff88513
Make bars work when screens change without restart
May 11, 2017
a366874
Also reset wallpaper if screen geometry changes
May 11, 2017
13f22e5
Delete bars if screen is removed
May 11, 2017
b78d2b5
Refactor screen tags
May 11, 2017
20e4f25
Restore hidden clients on their previous screen
May 11, 2017
9d53c22
Place dialogs and pop-ups centered
May 11, 2017
89614d9
Remove unneeded old popup centering
May 11, 2017
99ea4e0
Allow jumping to urgent clients via MOD + \
May 11, 2017
8df1c25
Removed TODOs and unused functions
May 15, 2017
c3d5b06
Remove unused variable 'restart'
May 15, 2017
fad4092
Add alternative mic mute button
timroes May 16, 2017
e94e2af
Add comment about required alsa-utils
timroes May 16, 2017
dc92084
Replace deprecated tag functions
timroes May 16, 2017
e3f3b57
Rename variables in rc.lua
timroes May 16, 2017
15e8566
Use gears.filesystem for get_configuration_dir
timroes May 16, 2017
bdbc253
Create lunaconf.utils.scriptpath()
timroes May 16, 2017
4a51ca0
Don't make awful global in rc.lua
timroes May 16, 2017
f429b4e
Remove old unmoveable clients code
timroes May 16, 2017
8a8118d
Start refactoring infolayer
timroes May 20, 2017
0517900
Fix screensaver widget wrong scriptpath
timroes May 20, 2017
a727e53
Merge branch 'awesome4' of github.com:timroes/awesome-config into awe…
timroes May 20, 2017
e3bd4cf
Add DND widget and hotkey
timroes May 20, 2017
b751ee4
Increase margin around DND widget
timroes May 20, 2017
21cda96
Add dnd widget to config.sample.yml
timroes May 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*.lua]
indent_style = tab
charset = utf-8
end_of_line = lf
insert_final_newline = true
9 changes: 7 additions & 2 deletions conf.d/00compositor.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
local lunaconf = require('lunaconf')
local awful = require('awful')
local gears = require('gears')

if not lunaconf.config.get('disable_compositor', false) then
local function set_shadow_hint(c)
local no_shadow
if awful.client.floating.get(c) then
if c.floating then
no_shadow = 0
else
no_shadow = 1
Expand All @@ -13,11 +14,15 @@ if not lunaconf.config.get('disable_compositor', false) then
end

-- Shadow handling of compton
-- Disable shadows (set _COMPTON_NO_SHADOW xproperty) on all non floating windows
-- so they won't leave ugly shadows on the screen bar(s).
awesome.register_xproperty("_COMPTON_NO_SHADOW", "number")
client.connect_signal("manage", function(c, startup)
set_shadow_hint(c)
c:connect_signal("property::floating", set_shadow_hint)
end)

lunaconf.utils.run_once('compton --config ' .. awful.util.getdir('config') .. '/compton.conf -b')
if not awesome.composite_manager_running then
lunaconf.utils.run_once('compton --config ' .. gears.filesystem.get_configuration_dir() .. '/compton.conf -b')
end
end
62 changes: 28 additions & 34 deletions conf.d/01clients.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
local awful = require("awful")
local lunaconf = require("lunaconf")
local gears = require('gears')

local MOD = lunaconf.config.MOD

local move_client = function(c, direction)
-- If client is unmoveable don't do anything
if awful.client.property.get(c, "client::unmoveable") then
return
end

local cur_tag = awful.tag.selected(c.screen)
local cur_tag = c.screen.selected_tag

-- Only allow window move for windows on not named tags
if #cur_tag.name <= 1 then
local new_screen = ((c.screen - 1 + direction) % screen.count()) + 1
local new_tag = default_tag_for_screen(new_screen)
awful.client.movetotag(new_tag, c)
if cur_tag.is_primary then
local new_screen = c.screen:get_next_in_direction(direction)
if new_screen then
c:move_to_tag(new_screen.primary_tag)
end
end
end

-- Define buttons for every client
buttons = awful.util.table.join(
buttons = gears.table.join(
awful.button({ }, 1, function(c) client.focus = c; c:raise() end),
awful.button({ MOD }, 1, function(c)
lunaconf.clients.smart_move(c)
end),
awful.button({ MOD }, 2, function(c) c:kill() end),
awful.button({ MOD }, 3, function(c)
-- Resizing of clients on modifier + right mouse button
if string.starts(awful.layout.get(c.screen).name, "tile") then
if lunaconf.strings.starts_with(awful.layout.get(c.screen).name, "tile") then
-- If client on a split screen is tried to rescale we modify the split factor instead
mousegrabber.run(function(ev)
local s = screen[c.screen] -- current screen
Expand All @@ -45,8 +42,8 @@ buttons = awful.util.table.join(
end, "sb_h_double_arrow")
else
-- On any non tiling screen we make the client floating and start resize mode
if not lunaconf.clients.get_attr(c, 'unresizeable', false) then
awful.client.floating.set(c, true)
if not c.unresizeable then
c.floating = true
awful.mouse.client.resize(c)
end
end
Expand All @@ -56,17 +53,16 @@ buttons = awful.util.table.join(
-- Define keys for every client
-- Keys depending on direct tag access (Mod + .. + Number) are
-- defined in the tags configuration file
keys = awful.util.table.join(
keys = gears.table.join(
-- close client
awful.key({ MOD }, "q", function(c) c:kill() end),
awful.key({ "Mod1" }, "F4", function(c) c:kill() end),

-- move client to other screen/tag
awful.key({ MOD }, "Right", function(c) move_client(c, 1) end),
awful.key({ MOD }, "Left", function(c) move_client(c, -1) end),

-- Minimize current window
awful.key({ MOD }, "Down", function(c) c.minimized = true end),
awful.key({ MOD }, "Right", function(c) move_client(c, 'right') end),
awful.key({ MOD }, "Left", function(c) move_client(c, 'left') end),
awful.key({ MOD }, "Down", function(c) move_client(c, 'down') end),
awful.key({ MOD }, "Up", function(c) move_client(c, 'up') end),

-- swap clients into direction (only works in split mode (see tags.lua))
awful.key({ MOD, "Control" }, "Right", function(c) awful.client.swap.bydirection("right") end),
Expand All @@ -76,7 +72,7 @@ keys = awful.util.table.join(

-- toggle client floating state
awful.key({ MOD }, "Return", function(c)
if not lunaconf.clients.get_attr(c, 'unresizeable', false) then
if not c.unresizeable then
awful.client.floating.toggle(c)
end
end),
Expand All @@ -100,11 +96,13 @@ awful.rules.rules = {
properties = {
floating = true,
}
},{
rule = { type = "dialog" },
callback = function(c)
awful.placement.centered(c,nil)
end
},
{
rule_any = { type = { 'dialog' }, role = { 'pop-up' } },
properties = {
floating = true,
placement = awful.placement.centered
}
}
}

Expand All @@ -124,7 +122,7 @@ client.connect_signal("manage", function(c, startup)
-- out a tab, so make it floating, so chromium can control its position
-- while we drag it to its final position
if under_mouse and under_mouse.pid == c.pid then
awful.client.floating.set(c, true)
c.floating = true
end
end

Expand All @@ -135,25 +133,21 @@ client.connect_signal("manage", function(c, startup)
c.maximized_vertical = false
c.maximized_horizontal = false

if c.role == "pop-up" then
awful.client.floating.set(c, true)
end

if c.size_hints then
local sh = c.size_hints
local wa = screen[c.screen].workarea
if sh.user_size and sh.user_size.width ~= wa.width and sh.user_size.height ~= wa.height then
-- If the user size hint is set, make the window floating and give it the specific size
-- unless the size matches exactly the size of the workarea, in this case leave it fullscreen.
awful.client.floating.set(c, true)
c.floating = true
c:geometry(sh.user_size)
awful.placement.centered(c, nil)
elseif sh.max_height and sh.max_width and sh.max_height == sh.min_height and sh.min_width == sh.max_width then
-- Check if the client has a program set minimum and maximum size, that are equal
-- If so, treat this client as a dialog window (center it and make it floating)
-- Also make it unresizeable (also meaning it cannot be unfloated)
lunaconf.clients.set_attr(c, 'unresizeable', true)
awful.client.floating.set(c, true)
c.unresizeable = true
c.floating = true
awful.placement.centered(c, nil)
end
end
Expand Down
15 changes: 7 additions & 8 deletions conf.d/02keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ local MOD = lunaconf.config.MOD
lunaconf.keys.globals(
-- System shortcuts
awful.key({ MOD, "Control"}, "Delete", function()
restart = true
awesome.restart()
end),

-- Start programs
awful.key({ MOD }, "z", function() awful.util.spawn_with_shell("xdg-open $HOME") end),
awful.key({ MOD }, "z", function() lunaconf.utils.spawn("xdg-open $HOME") end),

-- Screenshots
awful.key({ 'Mod1' }, "Print", function() awful.util.spawn(scriptpath .. "screenshot win") end),
awful.key({ MOD }, "Print", function() awful.util.spawn(scriptpath .. "screenshot scr") end),
awful.key({ 'Mod1' }, "Print", function() awful.spawn.spawn(lunaconf.utils.scriptpath() .. "screenshot win") end),
awful.key({ MOD }, "Print", function() awful.spawn.spawn(lunaconf.utils.scriptpath() .. "screenshot scr") end),

-- Brightness Control
awful.key({}, 'XF86MonBrightnessUp', function() awful.util.spawn(scriptpath .. "brightness.sh up") end),
awful.key({ 'Shift' }, 'XF86MonBrightnessUp', function() awful.util.spawn(scriptpath .. "brightness.sh up small") end),
awful.key({}, 'XF86MonBrightnessDown', function() awful.util.spawn(scriptpath .. "brightness.sh down") end),
awful.key({ 'Shift' }, 'XF86MonBrightnessDown', function() awful.util.spawn(scriptpath .. "brightness.sh down small") end),
awful.key({}, 'XF86MonBrightnessUp', function() awful.spawn.spawn(lunaconf.utils.scriptpath() .. "brightness.sh up") end),
awful.key({ 'Shift' }, 'XF86MonBrightnessUp', function() awful.spawn.spawn(lunaconf.utils.scriptpath() .. "brightness.sh up small") end),
awful.key({}, 'XF86MonBrightnessDown', function() awful.spawn.spawn(lunaconf.utils.scriptpath() .. "brightness.sh down") end),
awful.key({ 'Shift' }, 'XF86MonBrightnessDown', function() awful.spawn.spawn(lunaconf.utils.scriptpath() .. "brightness.sh down small") end),

-- MOD + PageUp/PageDown switches through clients on current tag and screen
awful.key({ MOD }, "Page_Up", function()
Expand Down
17 changes: 17 additions & 0 deletions conf.d/03urgent.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- This configuration handles urgent clients (clients with demands_attention hint).

local awful = require('awful')
local lunaconf = require('lunaconf')

local function jump_to_urgent()
local next_urgent = awful.client.urgent.get()
if next_urgent then
client.focus = next_urgent
next_urgent:raise()
end
end

-- On MOD + backslash jump to next window that has the urgent hint set
lunaconf.keys.globals(
awful.key({ lunaconf.config.MOD }, '\\', jump_to_urgent)
)
93 changes: 54 additions & 39 deletions conf.d/04tags.lua
Original file line number Diff line number Diff line change
@@ -1,62 +1,77 @@
local awful = require("awful")
local config = require("lunaconf.config")
local awful = require('awful')
local lunaconf = require('lunaconf')

local layouts = {
awful.layout.suit.max,
awful.layout.suit.tile.right
}

tags = {}
tag_keys = root.keys()
local screens_in_order = {}

for s = 1, screen.count() do
-- Get name for screen tag (horizontal position of screen)
local tagname = screen_position(s)
-- Create tag for that name and select it
local tag = awful.tag.add(tagname, { screen = s, layout = layouts[1], screen_tag = true })
tag.selected = true
-- Create the primary tag on each screen
awful.screen.connect_for_each_screen(function(s)
-- Create the new primary tag for this screen (leave it's name empty yet)
-- since the screen.list signal will take care renaming it in a moment
local tag = awful.tag.add('-', {
screen = s, -- Set the screen to the current
layout = layouts[1], -- Set its layout to the default layout
is_primary = true, -- Add a custom flag to mark it as the primary for this screen
selected = true
})
-- Attach the tag as the primary tag to the given screen
s.primary_tag = tag
end)

-- Switch to tag
local tagFocus = function()
if client.focus and client.focus.screen == s and awful.tag.selected(s) == tag then
--- Iterate over all screens and give their primary tag the name of their screen
--- position. Also save this renamed order in screens_in_order, which will be
--- used to lookup the screens in hotkeys.
local function rename_screen_tags()
screens_in_order = {}
lunaconf.screens.iterate_in_order(function(pos, s)
screens_in_order[pos] = s
s.primary_tag.name = tostring(pos)
end)
end

-- Rename screen tags if screen list changes or if the geometry of a screen changes
screen.connect_signal('list', rename_screen_tags)
screen.connect_signal('property::geometry', rename_screen_tags)
rename_screen_tags()

local function focus_tag(screen_position)
local s = screens_in_order[screen_position]
-- Ignore key presses if there is no screen with that position
if s then
if client.focus and client.focus.screen == s and s.selected_tag == s.primary_tag then
-- If screen is already focused switch to next client
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
else
if not tag.selected then
awful.tag.viewmore({ tag }, s)
if not s.primary_tag.selected then
awful.tag.viewmore({ s.primary_tag }, s)
end
-- Focus last focused client on this tag
local focus = awful.client.focus.history.get(s, 0)
if focus then client.focus = focus end
end
end
-- Move to tag
local moveToTag = function()
if not client.focus then return end
awful.client.movetotag(tag, client.focus)
end
end

-- Assign key shortcuts for every tag
tag_keys = awful.util.table.join(tag_keys,
-- Switch to tag
awful.key({ config.MOD }, "#" .. tagname + 9, tagFocus), -- Numbers
awful.key({ config.MOD }, "#" .. tagname + 86, tagFocus), -- Numpad keys
-- Move client to tag
awful.key({ config.MOD, "Control" }, "#" .. tagname + 9, moveToTag),
awful.key({ config.MOD, "Control" }, "#" .. tagname + 86, moveToTag)
)
-- Add hotkeys to navigate to screens between 1 and 9
for i = 1, 9 do
local key = awful.key({ lunaconf.config.MOD }, '#' .. i + 9, function()
focus_tag(i)
end)
lunaconf.keys.globals(key)
end

tag_keys = awful.util.table.join(tag_keys,
-- Switch layouts for the current screen
awful.key({ config.MOD }, "s", function()
-- Only allow split screen on regular (screen) tags
local cur_tag = awful.tag.selected(client.focus.screen)
if #cur_tag.name <= 1 then
awful.layout.inc(layouts, 1, client.focus.screen)
end
end)
)
local switch_layout = awful.key({ lunaconf.config.MOD }, "s", function()
-- Only allow split screen on screen tags
local cur_tag = client.focus.screen.selected_tag
if cur_tag.is_primary then
awful.layout.inc(layouts, 1, client.focus.screen)
end
end)

root.keys(tag_keys)
lunaconf.keys.globals(switch_layout)
Loading