♻️ refactor(awesome): Small fixes
This commit is contained in:
parent
aa883fbe22
commit
59016fb63b
9 changed files with 113 additions and 45 deletions
|
@ -7,7 +7,7 @@ M.keys = {
|
||||||
|
|
||||||
M.apps = {
|
M.apps = {
|
||||||
terminal = "wezterm",
|
terminal = "wezterm",
|
||||||
launcher = "rofi -no-lazy-grab -show drun -theme ~/.config/rofi/launcher.rasi",
|
launcher = "rofi -show drun -theme ~/.config/rofi/launcher.rasi",
|
||||||
browser = "firefox",
|
browser = "firefox",
|
||||||
file_manager = "thunar",
|
file_manager = "thunar",
|
||||||
editor = os.getenv("EDITOR") or "nvim",
|
editor = os.getenv("EDITOR") or "nvim",
|
||||||
|
|
|
@ -7,10 +7,14 @@ local capi = { mouse = mouse }
|
||||||
|
|
||||||
local _ui = {}
|
local _ui = {}
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.colorize_text(text, color)
|
function _ui.colorize_text(text, color)
|
||||||
return "<span foreground='" .. color .. "'>" .. text .. "</span>"
|
return "<span foreground='" .. color .. "'>" .. text .. "</span>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.add_hover_cursor(w, hover_cursor)
|
function _ui.add_hover_cursor(w, hover_cursor)
|
||||||
local original_cursor = "left_ptr"
|
local original_cursor = "left_ptr"
|
||||||
|
|
||||||
|
@ -29,6 +33,8 @@ function _ui.add_hover_cursor(w, hover_cursor)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.vertical_pad(height)
|
function _ui.vertical_pad(height)
|
||||||
return wibox.widget({
|
return wibox.widget({
|
||||||
forced_height = height,
|
forced_height = height,
|
||||||
|
@ -36,6 +42,8 @@ function _ui.vertical_pad(height)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.horizontal_pad(width)
|
function _ui.horizontal_pad(width)
|
||||||
return wibox.widget({
|
return wibox.widget({
|
||||||
forced_width = width,
|
forced_width = width,
|
||||||
|
@ -43,6 +51,8 @@ function _ui.horizontal_pad(width)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.rrect(radius)
|
function _ui.rrect(radius)
|
||||||
return function(cr, width, height)
|
return function(cr, width, height)
|
||||||
gshape.rounded_rect(cr, width, height, radius)
|
gshape.rounded_rect(cr, width, height, radius)
|
||||||
|
@ -55,18 +65,24 @@ function _ui.pie(width, height, start_angle, end_angle, radius)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.prgram(height, base)
|
function _ui.prgram(height, base)
|
||||||
return function(cr, width)
|
return function(cr, width)
|
||||||
gshape.parallelogram(cr, width, height, base)
|
gshape.parallelogram(cr, width, height, base)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.prrect(radius, tl, tr, br, bl)
|
function _ui.prrect(radius, tl, tr, br, bl)
|
||||||
return function(cr, width, height)
|
return function(cr, width, height)
|
||||||
gshape.partially_rounded_rect(cr, width, height, tl, tr, br, bl, radius)
|
gshape.partially_rounded_rect(cr, width, height, tl, tr, br, bl, radius)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.custom_shape(cr, width, height)
|
function _ui.custom_shape(cr, width, height)
|
||||||
cr:move_to(0, height / 25)
|
cr:move_to(0, height / 25)
|
||||||
cr:line_to(height / 25, 0)
|
cr:line_to(height / 25, 0)
|
||||||
|
@ -77,6 +93,8 @@ function _ui.custom_shape(cr, width, height)
|
||||||
cr:close_path()
|
cr:close_path()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
local function _get_widget_geometry(_hierarchy, widget)
|
local function _get_widget_geometry(_hierarchy, widget)
|
||||||
local width, height = _hierarchy:get_size()
|
local width, height = _hierarchy:get_size()
|
||||||
if _hierarchy:get_widget() == widget then
|
if _hierarchy:get_widget() == widget then
|
||||||
|
@ -97,6 +115,8 @@ function _ui.get_widget_geometry(_wibox, widget)
|
||||||
return _get_widget_geometry(_wibox._drawable._widget_hierarchy, widget)
|
return _get_widget_geometry(_wibox._drawable._widget_hierarchy, widget)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.screen_mask(s, bg)
|
function _ui.screen_mask(s, bg)
|
||||||
local mask = wibox({
|
local mask = wibox({
|
||||||
visible = false,
|
visible = false,
|
||||||
|
@ -109,6 +129,8 @@ function _ui.screen_mask(s, bg)
|
||||||
return mask
|
return mask
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
function _ui.grouping_widget(w1, w2, dpi1)
|
function _ui.grouping_widget(w1, w2, dpi1)
|
||||||
local container = wibox.widget({
|
local container = wibox.widget({
|
||||||
w1,
|
w1,
|
||||||
|
@ -125,4 +147,6 @@ function _ui.grouping_widget(w1, w2, dpi1)
|
||||||
return container
|
return container
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
return _ui
|
return _ui
|
||||||
|
|
|
@ -63,18 +63,10 @@ local instance = nil
|
||||||
|
|
||||||
local ANIMATION_FRAME_DELAY = 5
|
local ANIMATION_FRAME_DELAY = 5
|
||||||
|
|
||||||
local function micro_to_milli(micro)
|
|
||||||
return micro / 1000
|
|
||||||
end
|
|
||||||
|
|
||||||
local function second_to_micro(sec)
|
local function second_to_micro(sec)
|
||||||
return sec * 1000000
|
return sec * 1000000
|
||||||
end
|
end
|
||||||
|
|
||||||
local function second_to_milli(sec)
|
|
||||||
return sec * 1000
|
|
||||||
end
|
|
||||||
|
|
||||||
function animation:start(args)
|
function animation:start(args)
|
||||||
args = args or {}
|
args = args or {}
|
||||||
|
|
||||||
|
@ -122,8 +114,8 @@ function animation:stop()
|
||||||
self:emit_signal("stopped")
|
self:emit_signal("stopped")
|
||||||
end
|
end
|
||||||
|
|
||||||
function animation:abort(reset)
|
function animation:abort()
|
||||||
animation:stop(reset)
|
animation:stop()
|
||||||
self:emit_signal("aborted")
|
self:emit_signal("aborted")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -183,6 +175,7 @@ local function new()
|
||||||
ret._private.instant = false
|
ret._private.instant = false
|
||||||
|
|
||||||
GLib.timeout_add(GLib.PRIORITY_DEFAULT, ANIMATION_FRAME_DELAY, function()
|
GLib.timeout_add(GLib.PRIORITY_DEFAULT, ANIMATION_FRAME_DELAY, function()
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
for index, animation in ipairs(ret._private.animations) do
|
for index, animation in ipairs(ret._private.animations) do
|
||||||
if animation.state == true then
|
if animation.state == true then
|
||||||
-- compute delta time
|
-- compute delta time
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local beautiful = require("beautiful").get()
|
local beautiful = require("beautiful")
|
||||||
local dpi = require("beautiful.xresources").apply_dpi
|
|
||||||
local helpers = require("helpers")
|
local helpers = require("helpers")
|
||||||
|
|
||||||
|
local dpi = beautiful.xresources.apply_dpi
|
||||||
|
local theme = beautiful.get()
|
||||||
|
|
||||||
--- Minimalist Exit Screen
|
--- Minimalist Exit Screen
|
||||||
--- ~~~~~~~~~~~~~~~~~~~~~~
|
--- ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
--- Icons
|
--- Icons
|
||||||
local icon_font = beautiful.font_name .. "bold 45"
|
local icon_font = theme.font_name .. "bold 45"
|
||||||
local poweroff_text_icon = ""
|
local poweroff_text_icon = ""
|
||||||
local reboot_text_icon = ""
|
local reboot_text_icon = ""
|
||||||
local suspend_text_icon = ""
|
local suspend_text_icon = ""
|
||||||
local exit_text_icon = ""
|
local exit_text_icon = ""
|
||||||
local lock_text_icon = ""
|
local lock_text_icon = ""
|
||||||
|
|
||||||
local button_bg = beautiful.xcolorbase
|
local button_bg = theme.xcolorbase
|
||||||
local button_size = dpi(120)
|
local button_size = dpi(120)
|
||||||
|
|
||||||
--- Commands
|
--- Commands
|
||||||
|
@ -50,7 +52,7 @@ local create_button = function(symbol, hover_color, _, command)
|
||||||
align = "center",
|
align = "center",
|
||||||
valign = "center",
|
valign = "center",
|
||||||
font = icon_font,
|
font = icon_font,
|
||||||
markup = helpers.ui.colorize_text(symbol, beautiful.xcolorS0),
|
markup = helpers.ui.colorize_text(symbol, theme.xcolorS0),
|
||||||
widget = wibox.widget.textbox(),
|
widget = wibox.widget.textbox(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -64,8 +66,8 @@ local create_button = function(symbol, hover_color, _, command)
|
||||||
forced_height = button_size,
|
forced_height = button_size,
|
||||||
forced_width = button_size,
|
forced_width = button_size,
|
||||||
border_width = dpi(8),
|
border_width = dpi(8),
|
||||||
border_color = beautiful.xcolorS0,
|
border_color = theme.xcolorS0,
|
||||||
shape = helpers.ui.rrect(beautiful.border_width * 2),
|
shape = helpers.ui.rrect(theme.border_width * 2),
|
||||||
bg = button_bg,
|
bg = button_bg,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
})
|
})
|
||||||
|
@ -79,8 +81,8 @@ local create_button = function(symbol, hover_color, _, command)
|
||||||
button.border_color = hover_color
|
button.border_color = hover_color
|
||||||
end)
|
end)
|
||||||
button:connect_signal("mouse::leave", function()
|
button:connect_signal("mouse::leave", function()
|
||||||
icon.markup = helpers.ui.colorize_text(icon.text, beautiful.xcolorS0)
|
icon.markup = helpers.ui.colorize_text(icon.text, theme.xcolorS0)
|
||||||
button.border_color = beautiful.xcolorS0
|
button.border_color = theme.xcolorS0
|
||||||
end)
|
end)
|
||||||
|
|
||||||
helpers.ui.add_hover_cursor(button, "hand1")
|
helpers.ui.add_hover_cursor(button, "hand1")
|
||||||
|
@ -89,11 +91,11 @@ local create_button = function(symbol, hover_color, _, command)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create the buttons
|
--- Create the buttons
|
||||||
local poweroff = create_button(poweroff_text_icon, beautiful.xcolor10, "Poweroff", poweroff_command)
|
local poweroff = create_button(poweroff_text_icon, theme.xcolor10, "Poweroff", poweroff_command)
|
||||||
local reboot = create_button(reboot_text_icon, beautiful.xcolor6, "Reboot", reboot_command)
|
local reboot = create_button(reboot_text_icon, theme.xcolor6, "Reboot", reboot_command)
|
||||||
local suspend = create_button(suspend_text_icon, beautiful.xcolor8, "Suspend", suspend_command)
|
local suspend = create_button(suspend_text_icon, theme.xcolor8, "Suspend", suspend_command)
|
||||||
local exit = create_button(exit_text_icon, beautiful.xcolor2, "Exit", exit_command)
|
local exit = create_button(exit_text_icon, theme.xcolor2, "Exit", exit_command)
|
||||||
local lock = create_button(lock_text_icon, beautiful.xcolor12, "Lock", lock_command)
|
local lock = create_button(lock_text_icon, theme.xcolor12, "Lock", lock_command)
|
||||||
|
|
||||||
local create_exit_screen = function(s)
|
local create_exit_screen = function(s)
|
||||||
s.exit_screen = wibox({
|
s.exit_screen = wibox({
|
||||||
|
@ -101,8 +103,8 @@ local create_exit_screen = function(s)
|
||||||
type = "splash",
|
type = "splash",
|
||||||
visible = false,
|
visible = false,
|
||||||
ontop = true,
|
ontop = true,
|
||||||
bg = beautiful.transparent,
|
bg = theme.transparent,
|
||||||
fg = beautiful.fg_normal,
|
fg = theme.fg_normal,
|
||||||
height = s.geometry.height,
|
height = s.geometry.height,
|
||||||
width = s.geometry.width,
|
width = s.geometry.width,
|
||||||
x = s.geometry.x,
|
x = s.geometry.x,
|
||||||
|
|
|
@ -11,7 +11,9 @@ local keys = config.keys
|
||||||
-- General awesome keybindings
|
-- General awesome keybindings
|
||||||
awful.keyboard.append_global_keybindings({
|
awful.keyboard.append_global_keybindings({
|
||||||
awful.key({ keys.mod, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
awful.key({ keys.mod, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
awful.key({ keys.mod, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control", "Shift" }, "x", function()
|
awful.key({ keys.mod, "Control", "Shift" }, "x", function()
|
||||||
awful.prompt.run({
|
awful.prompt.run({
|
||||||
prompt = "Run Lua code: ",
|
prompt = "Run Lua code: ",
|
||||||
|
@ -20,12 +22,15 @@ awful.keyboard.append_global_keybindings({
|
||||||
history_path = awful.util.get_cache_dir() .. "/history_eval",
|
history_path = awful.util.get_cache_dir() .. "/history_eval",
|
||||||
})
|
})
|
||||||
end, { description = "lua execute prompt", group = "awesome" }),
|
end, { description = "lua execute prompt", group = "awesome" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "Return", function()
|
awful.key({ keys.mod }, "Return", function()
|
||||||
awful.spawn(apps.terminal)
|
awful.spawn(apps.terminal)
|
||||||
end, { description = "open a terminal", group = "launcher" }),
|
end, { description = "open a terminal", group = "launcher" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Shift" }, "c", function()
|
awful.key({ keys.mod, "Shift" }, "c", function()
|
||||||
menu.mainmenu:show()
|
menu.mainmenu:show()
|
||||||
end, { description = "show main menu", group = "awesome" }),
|
end, { description = "show main menu", group = "awesome" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "p", function()
|
awful.key({ keys.mod }, "p", function()
|
||||||
menubar.show()
|
menubar.show()
|
||||||
end, { description = "show the menubar", group = "launcher" }),
|
end, { description = "show the menubar", group = "launcher" }),
|
||||||
|
@ -34,8 +39,11 @@ awful.keyboard.append_global_keybindings({
|
||||||
-- Tag bindings
|
-- Tag bindings
|
||||||
awful.keyboard.append_global_keybindings({
|
awful.keyboard.append_global_keybindings({
|
||||||
awful.key({ keys.mod, "Control" }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
|
awful.key({ keys.mod, "Control" }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
|
awful.key({ keys.mod }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
|
awful.key({ keys.mod }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "Tab", awful.tag.history.restore, { description = "go back", group = "tag" }),
|
awful.key({ keys.mod }, "Tab", awful.tag.history.restore, { description = "go back", group = "tag" }),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -53,6 +61,7 @@ awful.keyboard.append_global_keybindings({
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
awful.key({
|
awful.key({
|
||||||
modifiers = { keys.mod, "Control" },
|
modifiers = { keys.mod, "Control" },
|
||||||
keygroup = "numrow",
|
keygroup = "numrow",
|
||||||
|
@ -66,6 +75,7 @@ awful.keyboard.append_global_keybindings({
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
awful.key({
|
awful.key({
|
||||||
modifiers = { keys.mod, "Shift" },
|
modifiers = { keys.mod, "Shift" },
|
||||||
keygroup = "numrow",
|
keygroup = "numrow",
|
||||||
|
@ -80,6 +90,7 @@ awful.keyboard.append_global_keybindings({
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
awful.key({
|
awful.key({
|
||||||
modifiers = { keys.mod, "Control", "Shift" },
|
modifiers = { keys.mod, "Control", "Shift" },
|
||||||
keygroup = "numrow",
|
keygroup = "numrow",
|
||||||
|
@ -94,6 +105,7 @@ awful.keyboard.append_global_keybindings({
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
awful.key({
|
awful.key({
|
||||||
modifiers = { keys.mod },
|
modifiers = { keys.mod },
|
||||||
keygroup = "numpad",
|
keygroup = "numpad",
|
||||||
|
@ -113,21 +125,26 @@ awful.keyboard.append_global_keybindings({
|
||||||
awful.key({ keys.mod }, "c", function()
|
awful.key({ keys.mod }, "c", function()
|
||||||
awful.client.focus.byidx(1)
|
awful.client.focus.byidx(1)
|
||||||
end, { description = "focus next by index", group = "client" }),
|
end, { description = "focus next by index", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "x", function()
|
awful.key({ keys.mod }, "x", function()
|
||||||
awful.client.focus.byidx(-1)
|
awful.client.focus.byidx(-1)
|
||||||
end, { description = "focus previous by index", group = "client" }),
|
end, { description = "focus previous by index", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "Escape", function()
|
awful.key({ keys.mod }, "Escape", function()
|
||||||
awful.client.focus.history.previous()
|
awful.client.focus.history.previous()
|
||||||
if client.focus then
|
if client.focus then
|
||||||
client.focus:raise()
|
client.focus:raise()
|
||||||
end
|
end
|
||||||
end, { description = "go back", group = "client" }),
|
end, { description = "go back", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "j", function()
|
awful.key({ keys.mod, "Control" }, "j", function()
|
||||||
awful.screen.focus_relative(1)
|
awful.screen.focus_relative(1)
|
||||||
end, { description = "focus the next screen", group = "screen" }),
|
end, { description = "focus the next screen", group = "screen" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "k", function()
|
awful.key({ keys.mod, "Control" }, "k", function()
|
||||||
awful.screen.focus_relative(-1)
|
awful.screen.focus_relative(-1)
|
||||||
end, { description = "focus the previous screen", group = "screen" }),
|
end, { description = "focus the previous screen", group = "screen" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "n", function()
|
awful.key({ keys.mod, "Control" }, "n", function()
|
||||||
local c = awful.client.restore()
|
local c = awful.client.restore()
|
||||||
-- Focus restored client
|
-- Focus restored client
|
||||||
|
@ -142,36 +159,46 @@ awful.keyboard.append_global_keybindings({
|
||||||
awful.key({ keys.mod, "Shift" }, "j", function()
|
awful.key({ keys.mod, "Shift" }, "j", function()
|
||||||
awful.client.swap.byidx(1)
|
awful.client.swap.byidx(1)
|
||||||
end, { description = "swap with next client by index", group = "client" }),
|
end, { description = "swap with next client by index", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Shift" }, "k", function()
|
awful.key({ keys.mod, "Shift" }, "k", function()
|
||||||
awful.client.swap.byidx(-1)
|
awful.client.swap.byidx(-1)
|
||||||
end, { description = "swap with previous client by index", group = "client" }),
|
end, { description = "swap with previous client by index", group = "client" }),
|
||||||
|
|
||||||
awful.key(
|
awful.key(
|
||||||
{ keys.mod },
|
{ keys.mod },
|
||||||
"u",
|
"u",
|
||||||
awful.client.urgent.jumpto,
|
awful.client.urgent.jumpto,
|
||||||
{ description = "jump to urgent client", group = "client" }
|
{ description = "jump to urgent client", group = "client" }
|
||||||
),
|
),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "l", function()
|
awful.key({ keys.mod }, "l", function()
|
||||||
awful.tag.incmwfact(0.05)
|
awful.tag.incmwfact(0.05)
|
||||||
end, { description = "increase master width factor", group = "layout" }),
|
end, { description = "increase master width factor", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "h", function()
|
awful.key({ keys.mod }, "h", function()
|
||||||
awful.tag.incmwfact(-0.05)
|
awful.tag.incmwfact(-0.05)
|
||||||
end, { description = "decrease master width factor", group = "layout" }),
|
end, { description = "decrease master width factor", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Shift" }, "h", function()
|
awful.key({ keys.mod, "Shift" }, "h", function()
|
||||||
awful.tag.incnmaster(1, nil, true)
|
awful.tag.incnmaster(1, nil, true)
|
||||||
end, { description = "increase the number of master clients", group = "layout" }),
|
end, { description = "increase the number of master clients", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Shift" }, "l", function()
|
awful.key({ keys.mod, "Shift" }, "l", function()
|
||||||
awful.tag.incnmaster(-1, nil, true)
|
awful.tag.incnmaster(-1, nil, true)
|
||||||
end, { description = "decrease the number of master clients", group = "layout" }),
|
end, { description = "decrease the number of master clients", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "h", function()
|
awful.key({ keys.mod, "Control" }, "h", function()
|
||||||
awful.tag.incncol(1, nil, true)
|
awful.tag.incncol(1, nil, true)
|
||||||
end, { description = "increase the number of columns", group = "layout" }),
|
end, { description = "increase the number of columns", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "l", function()
|
awful.key({ keys.mod, "Control" }, "l", function()
|
||||||
awful.tag.incncol(-1, nil, true)
|
awful.tag.incncol(-1, nil, true)
|
||||||
end, { description = "decrease the number of columns", group = "layout" }),
|
end, { description = "decrease the number of columns", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "-", function()
|
awful.key({ keys.mod }, "-", function()
|
||||||
machi.default_editor.start_interactive()
|
machi.default_editor.start_interactive()
|
||||||
end, { description = "edit the current layout if it is a machi layout", group = "layout" }),
|
end, { description = "edit the current layout if it is a machi layout", group = "layout" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, ".", function()
|
awful.key({ keys.mod }, ".", function()
|
||||||
machi.switcher.start(client.focus)
|
machi.switcher.start(client.focus)
|
||||||
end, { description = "switch between windows for a machi layout", group = "layout" }),
|
end, { description = "switch between windows for a machi layout", group = "layout" }),
|
||||||
|
@ -184,37 +211,46 @@ client.connect_signal("request::default_keybindings", function()
|
||||||
c.fullscreen = not c.fullscreen
|
c.fullscreen = not c.fullscreen
|
||||||
c:raise()
|
c:raise()
|
||||||
end, { description = "toggle fullscreen", group = "client" }),
|
end, { description = "toggle fullscreen", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "w", function(c)
|
awful.key({ keys.mod }, "w", function(c)
|
||||||
c:kill()
|
c:kill()
|
||||||
end, { description = "close", group = "client" }),
|
end, { description = "close", group = "client" }),
|
||||||
|
|
||||||
awful.key(
|
awful.key(
|
||||||
{ keys.mod, "Control" },
|
{ keys.mod, "Control" },
|
||||||
"space",
|
"space",
|
||||||
awful.client.floating.toggle,
|
awful.client.floating.toggle,
|
||||||
{ description = "toggle floating", group = "client" }
|
{ description = "toggle floating", group = "client" }
|
||||||
),
|
),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "Return", function(c)
|
awful.key({ keys.mod, "Control" }, "Return", function(c)
|
||||||
c:swap(awful.client.getmaster())
|
c:swap(awful.client.getmaster())
|
||||||
end, { description = "move to master", group = "client" }),
|
end, { description = "move to master", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "o", function(c)
|
awful.key({ keys.mod }, "o", function(c)
|
||||||
c:move_to_screen()
|
c:move_to_screen()
|
||||||
end, { description = "move to screen", group = "client" }),
|
end, { description = "move to screen", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "t", function(c)
|
awful.key({ keys.mod }, "t", function(c)
|
||||||
c.ontop = not c.ontop
|
c.ontop = not c.ontop
|
||||||
end, { description = "toggle keep on top", group = "client" }),
|
end, { description = "toggle keep on top", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "n", function(c)
|
awful.key({ keys.mod }, "n", function(c)
|
||||||
-- The client currently has the input focus, so it cannot be
|
-- The client currently has the input focus, so it cannot be
|
||||||
-- minimized, since minimized clients can't have the focus.
|
-- minimized, since minimized clients can't have the focus.
|
||||||
c.minimized = true
|
c.minimized = true
|
||||||
end, { description = "minimize", group = "client" }),
|
end, { description = "minimize", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "m", function(c)
|
awful.key({ keys.mod }, "m", function(c)
|
||||||
c.maximized = not c.maximized
|
c.maximized = not c.maximized
|
||||||
c:raise()
|
c:raise()
|
||||||
end, { description = "(un)maximize", group = "client" }),
|
end, { description = "(un)maximize", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Control" }, "m", function(c)
|
awful.key({ keys.mod, "Control" }, "m", function(c)
|
||||||
c.maximized_vertical = not c.maximized_vertical
|
c.maximized_vertical = not c.maximized_vertical
|
||||||
c:raise()
|
c:raise()
|
||||||
end, { description = "(un)maximize vertically", group = "client" }),
|
end, { description = "(un)maximize vertically", group = "client" }),
|
||||||
|
|
||||||
awful.key({ keys.mod, "Shift" }, "m", function(c)
|
awful.key({ keys.mod, "Shift" }, "m", function(c)
|
||||||
c.maximized_horizontal = not c.maximized_horizontal
|
c.maximized_horizontal = not c.maximized_horizontal
|
||||||
c:raise()
|
c:raise()
|
||||||
|
@ -227,7 +263,9 @@ awful.mouse.append_global_mousebindings({
|
||||||
awful.button({}, 3, function()
|
awful.button({}, 3, function()
|
||||||
menu.mainmenu:toggle()
|
menu.mainmenu:toggle()
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.button({}, 4, awful.tag.viewprev),
|
awful.button({}, 4, awful.tag.viewprev),
|
||||||
|
|
||||||
awful.button({}, 5, awful.tag.viewnext),
|
awful.button({}, 5, awful.tag.viewnext),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -236,9 +274,11 @@ client.connect_signal("request::default_mousebindings", function()
|
||||||
awful.button({}, 1, function(c)
|
awful.button({}, 1, function(c)
|
||||||
c:activate({ context = "mouse_click" })
|
c:activate({ context = "mouse_click" })
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.button({ keys.mod }, 1, function(c)
|
awful.button({ keys.mod }, 1, function(c)
|
||||||
c:activate({ context = "mouse_click", action = "mouse_move" })
|
c:activate({ context = "mouse_click", action = "mouse_move" })
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.button({ keys.mod }, 3, function(c)
|
awful.button({ keys.mod }, 3, function(c)
|
||||||
c:activate({ context = "mouse_click", action = "mouse_resize" })
|
c:activate({ context = "mouse_click", action = "mouse_resize" })
|
||||||
end),
|
end),
|
||||||
|
|
|
@ -1,33 +1,41 @@
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local volume = require("ui.popups.volume")
|
local volume = require("ui.popups.volume")
|
||||||
local filesystem = require("gears.filesystem")
|
local filesystem = require("gears.filesystem")
|
||||||
|
local config = require("config")
|
||||||
|
|
||||||
|
local keys = config.keys
|
||||||
|
|
||||||
local config_dir = filesystem.get_configuration_dir()
|
local config_dir = filesystem.get_configuration_dir()
|
||||||
local utils_dir = config_dir .. "utilities/"
|
local utils_dir = config_dir .. "utilities/"
|
||||||
|
|
||||||
local keys = require("config").keys
|
|
||||||
|
|
||||||
local screenshot_area = utils_dir .. "screensht area"
|
local screenshot_area = utils_dir .. "screensht area"
|
||||||
local screenshot_full = utils_dir .. "screensht full"
|
local screenshot_full = utils_dir .. "screensht full"
|
||||||
|
|
||||||
awful.keyboard.append_global_keybindings({
|
awful.keyboard.append_global_keybindings({
|
||||||
awful.key({ keys.mod }, "r", function()
|
awful.key({ keys.mod }, "r", function()
|
||||||
awful.spawn("rofi -show drun -theme ~/.config/rofi/launcher.rasi")
|
awful.spawn(config.apps.launcher)
|
||||||
end, { description = "show rofi", group = "launcher" }),
|
end, { description = "show rofi", group = "launcher" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "Print", function()
|
awful.key({ keys.mod }, "Print", function()
|
||||||
awful.spawn.easy_async_with_shell(screenshot_area, function() end)
|
awful.spawn.easy_async_with_shell(screenshot_area, function() end)
|
||||||
end, { description = "take a area screenshot", group = "Utils" }),
|
end, { description = "take a area screenshot", group = "Utils" }),
|
||||||
|
|
||||||
awful.key({}, "Print", function()
|
awful.key({}, "Print", function()
|
||||||
awful.spawn.easy_async_with_shell(screenshot_full, function() end)
|
awful.spawn.easy_async_with_shell(screenshot_full, function() end)
|
||||||
end, { description = "take a full screenshot", group = "Utils" }),
|
end, { description = "take a full screenshot", group = "Utils" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "q", function()
|
awful.key({ keys.mod }, "q", function()
|
||||||
awesome.emit_signal("module::exit_screen:show")
|
awesome.emit_signal("module::exit_screen:show")
|
||||||
end, { description = "show Exit Screen", group = "Utils" }),
|
end, { description = "show Exit Screen", group = "Utils" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "s", function()
|
awful.key({ keys.mod }, "s", function()
|
||||||
awesome.emit_signal("scratchpad::toggle")
|
awesome.emit_signal("scratchpad::toggle")
|
||||||
end, { description = "show Scratchpad", group = "Utils" }),
|
end, { description = "show Scratchpad", group = "Utils" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "b", function()
|
awful.key({ keys.mod }, "b", function()
|
||||||
awful.spawn.easy_async_with_shell("headsetcontrol -l 0", function() end)
|
awful.spawn.easy_async_with_shell("headsetcontrol -l 0", function() end)
|
||||||
end, { description = "headsetcontrol", group = "Utils" }),
|
end, { description = "headsetcontrol", group = "Utils" }),
|
||||||
|
|
||||||
awful.key({ keys.mod }, "t", function()
|
awful.key({ keys.mod }, "t", function()
|
||||||
awful.titlebar.toggle(client.focus)
|
awful.titlebar.toggle(client.focus)
|
||||||
end, { description = "toggle titlebar for active client", group = "Utils" }), -- Toggle titlebar
|
end, { description = "toggle titlebar for active client", group = "Utils" }), -- Toggle titlebar
|
||||||
|
@ -40,11 +48,13 @@ awful.keyboard.append_global_keybindings({
|
||||||
awesome.emit_signal("widget::update_vol")
|
awesome.emit_signal("widget::update_vol")
|
||||||
awesome.emit_signal("module::volume_osd:show", true)
|
awesome.emit_signal("module::volume_osd:show", true)
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.key({}, "XF86AudioLowerVolume", function()
|
awful.key({}, "XF86AudioLowerVolume", function()
|
||||||
volume.decrease()
|
volume.decrease()
|
||||||
awesome.emit_signal("widget::update_vol")
|
awesome.emit_signal("widget::update_vol")
|
||||||
awesome.emit_signal("module::volume_osd:show", true)
|
awesome.emit_signal("module::volume_osd:show", true)
|
||||||
end),
|
end),
|
||||||
|
|
||||||
awful.key({}, "XF86AudioMute", function()
|
awful.key({}, "XF86AudioMute", function()
|
||||||
volume.mute()
|
volume.mute()
|
||||||
awesome.emit_signal("widget::update_vol")
|
awesome.emit_signal("widget::update_vol")
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
-- require("main.error_handling")
|
-- require("main.error_handling")
|
||||||
require("main.layout")
|
require(... .. ".layout")
|
||||||
require("main.menu")
|
require(... .. ".menu")
|
||||||
require("main.wallpaper")
|
require(... .. ".wallpaper")
|
||||||
require("main.bindings")
|
require(... .. ".bindings")
|
||||||
require("main.custom_bindings")
|
require(... .. ".custom_bindings")
|
||||||
require("main.rules")
|
require(... .. ".rules")
|
||||||
require("main.tags")
|
require(... .. ".tags")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---@diagnostic disable: undefined-global
|
|
||||||
local awful = require("awful")
|
local awful = require("awful")
|
||||||
local beautiful = require("beautiful").get()
|
local theme = require("beautiful").get()
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local helpers = require("helpers")
|
local helpers = require("helpers")
|
||||||
|
@ -16,7 +15,7 @@ rofi.timer = gears.timer({
|
||||||
timeout = 0.1,
|
timeout = 0.1,
|
||||||
single_shot = true,
|
single_shot = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
awful.spawn("rofi -show drun -theme ~/.config/rofi/launcher.rasi")
|
awful.spawn(apps.launcher)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -77,10 +76,10 @@ menu.mainmenu = awful.menu({
|
||||||
-- apply rounded corners to menus when picom isn't available, thanks to u/signalsourcesexy
|
-- apply rounded corners to menus when picom isn't available, thanks to u/signalsourcesexy
|
||||||
-- also applies antialiasing! - By me.
|
-- also applies antialiasing! - By me.
|
||||||
menu.mainmenu.wibox.shape = helpers.ui.rrect(10)
|
menu.mainmenu.wibox.shape = helpers.ui.rrect(10)
|
||||||
menu.mainmenu.wibox.bg = beautiful.bg_normal .. "00"
|
menu.mainmenu.wibox.bg = theme.bg_normal .. "00"
|
||||||
menu.mainmenu.wibox:set_widget(wibox.widget({
|
menu.mainmenu.wibox:set_widget(wibox.widget({
|
||||||
menu.mainmenu.wibox.widget,
|
menu.mainmenu.wibox.widget,
|
||||||
bg = beautiful.bg_normal,
|
bg = theme.bg_normal,
|
||||||
shape = helpers.ui.rrect(0),
|
shape = helpers.ui.rrect(0),
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
}))
|
}))
|
||||||
|
@ -94,11 +93,11 @@ function awful.menu.new(...)
|
||||||
local ret = awful.menu.original_new(...)
|
local ret = awful.menu.original_new(...)
|
||||||
|
|
||||||
ret.wibox.shape = helpers.ui.rrect(10)
|
ret.wibox.shape = helpers.ui.rrect(10)
|
||||||
ret.wibox.bg = beautiful.bg_normal .. "00"
|
ret.wibox.bg = theme.bg_normal .. "00"
|
||||||
ret.wibox:set_widget(wibox.widget({
|
ret.wibox:set_widget(wibox.widget({
|
||||||
ret.wibox.widget,
|
ret.wibox.widget,
|
||||||
widget = wibox.container.background,
|
widget = wibox.container.background,
|
||||||
bg = beautiful.xcolorbase,
|
bg = theme.xcolorbase,
|
||||||
shape = helpers.ui.rrect(0),
|
shape = helpers.ui.rrect(0),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ ruled.client.connect_signal("request::rules", function()
|
||||||
|
|
||||||
ruled.client.append_rule({
|
ruled.client.append_rule({
|
||||||
rule = { instance = "bf1.exe" },
|
rule = { instance = "bf1.exe" },
|
||||||
properties = { shape = helpers.ui.rrect(0), fullscreen = true, tag = "", switchtotag = true },
|
properties = { shape = helpers.ui.rrect(0), fullscreen = true, tag = "", switchtotag = true },
|
||||||
})
|
})
|
||||||
ruled.client.append_rule({
|
ruled.client.append_rule({
|
||||||
rule = { instance = "wine" },
|
rule = { instance = "wine" },
|
||||||
|
|
Loading…
Reference in a new issue