Initial commit
This commit is contained in:
1 parent
ed88af090f
commit
05c9c7fc71
448 files changed
+46802
No files matched your search
@@ -0,0 +1,37 @@
|
||||
local awful = require('awful')
|
||||
local modkey = require('configuration.keys.mod').mod_key
|
||||
|
||||
return awful.util.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function(c)
|
||||
c:emit_signal('request::activate')
|
||||
c:raise()
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{modkey},
|
||||
1,
|
||||
awful.mouse.client.move
|
||||
),
|
||||
awful.button(
|
||||
{modkey},
|
||||
3,
|
||||
awful.mouse.client.resize
|
||||
),
|
||||
awful.button(
|
||||
{modkey},
|
||||
4,
|
||||
function()
|
||||
awful.layout.inc(1)
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{modkey},
|
||||
5,
|
||||
function()
|
||||
awful.layout.inc(-1)
|
||||
end
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,2 @@
|
||||
require('configuration.client.rules')
|
||||
require('configuration.client.signals')
|
||||
@@ -0,0 +1,216 @@
|
||||
local awful = require('awful')
|
||||
local gears = require('gears')
|
||||
local dpi = require('beautiful').xresources.apply_dpi
|
||||
require('awful.autofocus')
|
||||
local modkey = require('configuration.keys.mod').mod_key
|
||||
local altkey = require('configuration.keys.mod').alt_key
|
||||
|
||||
local client_keys = awful.util.table.join(
|
||||
awful.key(
|
||||
{modkey},
|
||||
'f',
|
||||
function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{description = 'toggle fullscreen', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'q',
|
||||
function(c)
|
||||
c:kill()
|
||||
end,
|
||||
{description = 'close', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'd',
|
||||
function()
|
||||
awful.client.focus.byidx(1)
|
||||
end,
|
||||
{description = 'focus next by index', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'a',
|
||||
function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end,
|
||||
{description = 'focus previous by index', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, 'Shift' },
|
||||
'd',
|
||||
function ()
|
||||
awful.client.swap.byidx(1)
|
||||
end,
|
||||
{description = 'swap with next client by index', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, 'Shift' },
|
||||
'a',
|
||||
function ()
|
||||
awful.client.swap.byidx(-1)
|
||||
end,
|
||||
{description = 'swap with next client by index', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'u',
|
||||
awful.client.urgent.jumpto,
|
||||
{description = 'jump to urgent client', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'Tab',
|
||||
function()
|
||||
awful.client.focus.history.previous()
|
||||
if client.focus then
|
||||
client.focus:raise()
|
||||
end
|
||||
end,
|
||||
{description = 'go back', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'n',
|
||||
function(c)
|
||||
c.minimized = true
|
||||
end,
|
||||
{description = 'minimize client', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, 'Shift' },
|
||||
'c',
|
||||
function(c)
|
||||
local focused = awful.screen.focused()
|
||||
|
||||
awful.placement.centered(c, {
|
||||
honor_workarea = true
|
||||
})
|
||||
end,
|
||||
{description = 'align a client to the center of the focused screen', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'c',
|
||||
function(c)
|
||||
c.fullscreen = false
|
||||
c.maximized = false
|
||||
c.floating = not c.floating
|
||||
c:raise()
|
||||
end,
|
||||
{description = 'toggle floating', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'Up',
|
||||
function(c)
|
||||
c:relative_move(0, dpi(-10), 0, 0)
|
||||
end,
|
||||
{description = 'move floating client up by 10 px', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'Down',
|
||||
function(c)
|
||||
c:relative_move(0, dpi(10), 0, 0)
|
||||
end,
|
||||
{description = 'move floating client down by 10 px', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'Left',
|
||||
function(c)
|
||||
c:relative_move(dpi(-10), 0, 0, 0)
|
||||
end,
|
||||
{description = 'move floating client to the left by 10 px', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey},
|
||||
'Right',
|
||||
function(c)
|
||||
c:relative_move(dpi(10), 0, 0, 0)
|
||||
end,
|
||||
{description = 'move floating client to the right by 10 px', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Shift'},
|
||||
'Up',
|
||||
function(c)
|
||||
c:relative_move(0, dpi(-10), 0, dpi(10))
|
||||
end,
|
||||
{description = 'increase floating client size vertically by 10 px up', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Shift'},
|
||||
'Down',
|
||||
function(c)
|
||||
c:relative_move(0, 0, 0, dpi(10))
|
||||
end,
|
||||
{description = 'increase floating client size vertically by 10 px down', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Shift'},
|
||||
'Left',
|
||||
function(c)
|
||||
c:relative_move(dpi(-10), 0, dpi(10), 0)
|
||||
end,
|
||||
{description = 'increase floating client size horizontally by 10 px left', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Shift'},
|
||||
'Right',
|
||||
function(c)
|
||||
c:relative_move(0, 0, dpi(10), 0)
|
||||
end,
|
||||
{description = 'increase floating client size horizontally by 10 px right', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Control'},
|
||||
'Up',
|
||||
function(c)
|
||||
if c.height > 10 then
|
||||
c:relative_move(0, 0, 0, dpi(-10))
|
||||
end
|
||||
end,
|
||||
{description = 'decrease floating client size vertically by 10 px up', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Control'},
|
||||
'Down',
|
||||
function(c)
|
||||
local c_height = c.height
|
||||
c:relative_move(0, 0, 0, dpi(-10))
|
||||
if c.height ~= c_height and c.height > 10 then
|
||||
c:relative_move(0, dpi(10), 0, 0)
|
||||
end
|
||||
end,
|
||||
{description = 'decrease floating client size vertically by 10 px down', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Control'},
|
||||
'Left',
|
||||
function(c)
|
||||
if c.width > 10 then
|
||||
c:relative_move(0, 0, dpi(-10), 0)
|
||||
end
|
||||
end,
|
||||
{description = 'decrease floating client size horizontally by 10 px left', group = 'client'}
|
||||
),
|
||||
awful.key(
|
||||
{modkey, 'Control'},
|
||||
'Right',
|
||||
function(c)
|
||||
local c_width = c.width
|
||||
c:relative_move(0, 0, dpi(-10), 0)
|
||||
if c.width ~= c_width and c.width > 10 then
|
||||
c:relative_move(dpi(10), 0 , 0, 0)
|
||||
end
|
||||
end,
|
||||
{description = 'decrease floating client size horizontally by 10 px right', group = 'client'}
|
||||
)
|
||||
)
|
||||
|
||||
return client_keys
|
||||
@@ -0,0 +1,393 @@
|
||||
local awful = require('awful')
|
||||
local gears = require('gears')
|
||||
local ruled = require('ruled')
|
||||
local beautiful = require('beautiful')
|
||||
local client_keys = require('configuration.client.keys')
|
||||
local client_buttons = require('configuration.client.buttons')
|
||||
|
||||
ruled.client.connect_signal(
|
||||
'request::rules',
|
||||
function()
|
||||
-- All clients will match this rule.
|
||||
ruled.client.append_rule {
|
||||
id = 'global',
|
||||
rule = {},
|
||||
properties = {
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
floating = false,
|
||||
maximized = false,
|
||||
above = false,
|
||||
below = false,
|
||||
ontop = false,
|
||||
sticky = false,
|
||||
maximized_horizontal = false,
|
||||
maximized_vertical = false,
|
||||
keys = client_keys,
|
||||
buttons = client_buttons,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen
|
||||
}
|
||||
}
|
||||
|
||||
ruled.client.append_rule {
|
||||
id = 'round_clients',
|
||||
rule_any = {
|
||||
type = {
|
||||
'normal',
|
||||
'dialog'
|
||||
}
|
||||
},
|
||||
except_any = {
|
||||
name = {'Discord Updater'}
|
||||
},
|
||||
properties = {
|
||||
round_corners = true,
|
||||
shape = beautiful.client_shape_rounded
|
||||
}
|
||||
}
|
||||
|
||||
-- Titlebar rules
|
||||
ruled.client.append_rule {
|
||||
id = 'titlebars',
|
||||
rule_any = {
|
||||
type = {
|
||||
'normal',
|
||||
'dialog',
|
||||
'modal',
|
||||
'utility'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
-- Dialogs
|
||||
ruled.client.append_rule {
|
||||
id = 'dialog',
|
||||
rule_any = {
|
||||
type = {'dialog'},
|
||||
class = {'Wicd-client.py', 'calendar.google.com'}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = true,
|
||||
floating = true,
|
||||
above = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Modals
|
||||
ruled.client.append_rule {
|
||||
id = 'modal',
|
||||
rule_any = {
|
||||
type = {'modal'}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = true,
|
||||
floating = true,
|
||||
above = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Utilities
|
||||
ruled.client.append_rule {
|
||||
id = 'utility',
|
||||
rule_any = {
|
||||
type = {'utility'}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = false,
|
||||
floating = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Splash
|
||||
ruled.client.append_rule {
|
||||
id = 'splash',
|
||||
rule_any = {
|
||||
type = {'splash'},
|
||||
name = {'Discord Updater'}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = false,
|
||||
round_corners = false,
|
||||
floating = true,
|
||||
above = true,
|
||||
skip_decoration = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Terminal emulators
|
||||
ruled.client.append_rule {
|
||||
id = 'terminals',
|
||||
rule_any = {
|
||||
class = {
|
||||
'URxvt',
|
||||
'XTerm',
|
||||
'UXTerm',
|
||||
'kitty',
|
||||
'K3rmit'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '1',
|
||||
switch_to_tags = true,
|
||||
size_hints_honor = false,
|
||||
titlebars_enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
-- Browsers and chats
|
||||
ruled.client.append_rule {
|
||||
id = 'internet',
|
||||
rule_any = {
|
||||
class = {
|
||||
'firefox',
|
||||
'Tor Browser',
|
||||
'discord',
|
||||
'Chromium',
|
||||
'Google-chrome',
|
||||
'TelegramDesktop'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '2'
|
||||
}
|
||||
}
|
||||
|
||||
-- Text editors and word processing
|
||||
ruled.client.append_rule {
|
||||
id = 'text',
|
||||
rule_any = {
|
||||
class = {
|
||||
'Geany',
|
||||
'Atom',
|
||||
'Subl3',
|
||||
'code-oss'
|
||||
},
|
||||
name = {
|
||||
'LibreOffice',
|
||||
'libreoffice'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '3'
|
||||
}
|
||||
}
|
||||
|
||||
-- File managers
|
||||
ruled.client.append_rule {
|
||||
id = 'files',
|
||||
rule_any = {
|
||||
class = {
|
||||
'dolphin',
|
||||
'ark',
|
||||
'Nemo',
|
||||
'File-roller'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '4',
|
||||
switch_to_tags = true
|
||||
}
|
||||
}
|
||||
|
||||
-- Multimedia
|
||||
ruled.client.append_rule {
|
||||
id = 'multimedia',
|
||||
rule_any = {
|
||||
class = {
|
||||
'vlc',
|
||||
'Spotify'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '5',
|
||||
switch_to_tags = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Gaming
|
||||
ruled.client.append_rule {
|
||||
id = 'gaming',
|
||||
rule_any = {
|
||||
class = {
|
||||
'Wine',
|
||||
'dolphin-emu',
|
||||
'Steam',
|
||||
'Citra',
|
||||
'supertuxkart'
|
||||
},
|
||||
name = {'Steam'}
|
||||
},
|
||||
properties = {
|
||||
tag = '6',
|
||||
skip_decoration = true,
|
||||
switch_to_tags = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Multimedia Editing
|
||||
ruled.client.append_rule {
|
||||
id = 'graphics',
|
||||
rule_any = {
|
||||
class = {
|
||||
'Gimp-2.10',
|
||||
'Inkscape',
|
||||
'Flowblade'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '7'
|
||||
}
|
||||
}
|
||||
|
||||
-- Sandboxes and VMs
|
||||
ruled.client.append_rule {
|
||||
id = 'sandbox',
|
||||
rule_any = {
|
||||
class = {
|
||||
'VirtualBox Manage',
|
||||
'VirtualBox Machine',
|
||||
'Gnome-boxes',
|
||||
'Virt-manager'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '8'
|
||||
}
|
||||
}
|
||||
|
||||
-- IDEs and Tools
|
||||
ruled.client.append_rule {
|
||||
id = 'development',
|
||||
rule_any = {
|
||||
class = {
|
||||
'Oomox',
|
||||
'Unity',
|
||||
'UnityHub',
|
||||
'jetbrains-studio',
|
||||
'Ettercap',
|
||||
'scrcpy'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
tag = '9',
|
||||
skip_decoration = true
|
||||
}
|
||||
}
|
||||
|
||||
-- Image viewers
|
||||
ruled.client.append_rule {
|
||||
id = 'image_viewers',
|
||||
rule_any = {
|
||||
class = {
|
||||
'feh',
|
||||
'Pqiv',
|
||||
'Sxiv'
|
||||
},
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = true,
|
||||
skip_decoration = true,
|
||||
floating = true,
|
||||
ontop = true,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
|
||||
-- Floating
|
||||
ruled.client.append_rule {
|
||||
id = 'floating',
|
||||
rule_any = {
|
||||
instance = {
|
||||
'file_progress',
|
||||
'Popup',
|
||||
'nm-connection-editor',
|
||||
},
|
||||
class = {
|
||||
'scrcpy',
|
||||
'Mugshot',
|
||||
'Pulseeffects'
|
||||
},
|
||||
role = {
|
||||
'AlarmWindow',
|
||||
'ConfigManager',
|
||||
'pop-up'
|
||||
}
|
||||
},
|
||||
properties = {
|
||||
titlebars_enabled = true,
|
||||
skip_decoration = true,
|
||||
ontop = true,
|
||||
floating = true,
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
keys = client_keys,
|
||||
buttons = client_buttons,
|
||||
placement = awful.placement.centered
|
||||
}
|
||||
}
|
||||
end
|
||||
)
|
||||
|
||||
-- Normally we'd do this with a rule, but some program like spotify doesn't set its class or name
|
||||
-- until after it starts up, so we need to catch that signal.
|
||||
client.connect_signal(
|
||||
'property::class',
|
||||
function(c)
|
||||
if c.class == 'Spotify' then
|
||||
local window_mode = false
|
||||
|
||||
-- Check if fullscreen or window mode
|
||||
if c.fullscreen then
|
||||
window_mode = false
|
||||
c.fullscreen = false
|
||||
else
|
||||
window_mode = true
|
||||
end
|
||||
|
||||
-- Check if Spotify is already open
|
||||
local app = function (c)
|
||||
return ruled.client.match(c, {class = 'Spotify'})
|
||||
end
|
||||
|
||||
local app_count = 0
|
||||
for c in awful.client.iterate(app) do
|
||||
app_count = app_count + 1
|
||||
end
|
||||
|
||||
-- If Spotify is already open, don't open a new instance
|
||||
if app_count > 1 then
|
||||
c:kill()
|
||||
-- Switch to previous instance
|
||||
for c in awful.client.iterate(app) do
|
||||
c:jump_to(false)
|
||||
end
|
||||
else
|
||||
-- Move the instance to specified tag on this screen
|
||||
local t = awful.tag.find_by_name(awful.screen.focused(), '5')
|
||||
c:move_to_tag(t)
|
||||
t:view_only()
|
||||
|
||||
-- Fullscreen mode if not window mode
|
||||
if not window_mode then
|
||||
c.fullscreen = true
|
||||
else
|
||||
c.floating = true
|
||||
awful.placement.centered(c, {honor_workarea = true})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -0,0 +1,115 @@
|
||||
local awful = require('awful')
|
||||
local gears = require('gears')
|
||||
local beautiful = require('beautiful')
|
||||
|
||||
local update_client = function(c)
|
||||
-- Set client's shape based on its tag's layout and status (floating, maximized, etc.)
|
||||
local current_layout = awful.tag.getproperty(c.first_tag, 'layout')
|
||||
if current_layout == awful.layout.suit.max and (not c.floating) then
|
||||
c.shape = beautiful.client_shape_rectangle
|
||||
elseif c.maximized or c.fullscreen then
|
||||
c.shape = beautiful.client_shape_rectangle
|
||||
elseif (not c.round_corners) then
|
||||
c.shape = beautiful.client_shape_rectangle
|
||||
else
|
||||
c.shape = beautiful.client_shape_rounded
|
||||
end
|
||||
end
|
||||
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.connect_signal(
|
||||
'manage',
|
||||
function(c)
|
||||
-- Focus, raise and activate
|
||||
c:emit_signal(
|
||||
'request::activate',
|
||||
'mouse_enter',
|
||||
{
|
||||
raise = true
|
||||
}
|
||||
)
|
||||
|
||||
-- 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
|
||||
|
||||
if awesome.startup and not c.size_hints.user_position and
|
||||
not c.size_hints.program_position then
|
||||
-- Prevent clients from being unreachable after screen count changes.
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
|
||||
-- Update client shape
|
||||
update_client(c)
|
||||
end
|
||||
)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse then raises it.
|
||||
client.connect_signal(
|
||||
'mouse::enter',
|
||||
function(c)
|
||||
c:emit_signal(
|
||||
'request::activate',
|
||||
'mouse_enter',
|
||||
{
|
||||
raise = true
|
||||
}
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
'focus',
|
||||
function(c)
|
||||
c.border_color = beautiful.border_focus
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
'unfocus',
|
||||
function(c)
|
||||
c.border_color = beautiful.border_normal
|
||||
end
|
||||
)
|
||||
|
||||
-- Manipulate client shape on fullscreen/non-fullscreen
|
||||
client.connect_signal(
|
||||
'property::fullscreen',
|
||||
function(c)
|
||||
if c.fullscreen then
|
||||
c.shape = beautiful.client_shape_rectangle
|
||||
else
|
||||
update_client(c)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
-- Manipulate client shape on maximized
|
||||
client.connect_signal(
|
||||
'property::maximized',
|
||||
function(c)
|
||||
local current_layout = awful.tag.getproperty(c.first_tag, 'layout')
|
||||
if c.maximized then
|
||||
c.shape = beautiful.client_shape_rectangle
|
||||
else
|
||||
update_client(c)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
-- Manipulate client shape on floating
|
||||
client.connect_signal(
|
||||
'property::floating',
|
||||
function(c)
|
||||
local current_layout = awful.tag.getproperty(c.first_tag, 'layout')
|
||||
if c.floating and not c.maximized then
|
||||
c.shape = beautiful.client_shape_rounded
|
||||
else
|
||||
if current_layout == awful.layout.suit.max then
|
||||
c.shape = beautiful.client_shape_rectangle
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
Reference in new issue
Block a user