delta
f42a3a2cc9
add new icons, switch over to using stylesheets instead of gears.color.recolor_image, add a music widget to the panel, optimize services in common.lua, fix the application lense filtering and increase the update rate of services in common.lua Signed-off-by: delta <darkussdelta@gmail.com>
293 lines
8.2 KiB
Lua
293 lines
8.2 KiB
Lua
local awful = require "awful"
|
|
local beautiful = require "beautiful"
|
|
local cfg = require "misc.cfg"
|
|
local fresnel = require "ui.fresnel"
|
|
local gtimer = require "gears.timer"
|
|
local insightful = require "ui.insightful"
|
|
local naughty = require "naughty"
|
|
local playerctl = require "services.playerctl"
|
|
local qbind = require "quarrel.bind"
|
|
local qvars = require "quarrel.vars"
|
|
|
|
local recording = { false, "" }
|
|
|
|
client.connect_signal("request::default_mousebindings", function()
|
|
awful.mouse.append_client_mousebindings {
|
|
qbind:new {
|
|
triggers = qvars.btns.left,
|
|
press = function(c)
|
|
c:activate {
|
|
context = "mouse_click"
|
|
}
|
|
end,
|
|
group = "client",
|
|
desc = "raise client"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = qvars.btns.left,
|
|
press = function(c)
|
|
c:activate {
|
|
context = "mouse_click",
|
|
action = "mouse_move"
|
|
}
|
|
end,
|
|
group = "client",
|
|
desc = "move client"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = qvars.btns.right,
|
|
press = function(c)
|
|
c:activate {
|
|
context = "mouse_click",
|
|
action = "mouse_resize"
|
|
}
|
|
end,
|
|
group = "client",
|
|
desc = "resize client"
|
|
}
|
|
}
|
|
end)
|
|
|
|
client.connect_signal("request::default_keybindings", function()
|
|
awful.keyboard.append_client_keybindings {
|
|
qbind:new {
|
|
mods = qvars.mods.MC,
|
|
triggers = "q",
|
|
press = function(c)
|
|
c:kill()
|
|
end,
|
|
group = "client",
|
|
desc = "close"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "m",
|
|
press = function(c)
|
|
c.maximized = not c.maximized
|
|
end,
|
|
group = "client",
|
|
desc = "(un)maximize"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "n",
|
|
press = function(c)
|
|
gtimer.delayed_call(function()
|
|
c.minimized = true
|
|
end)
|
|
end,
|
|
group = "client",
|
|
desc = "minimize"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "f",
|
|
press = function(c)
|
|
c.fullscreen = not c.fullscreen
|
|
end,
|
|
group = "client",
|
|
desc = "toggle fullscreen"
|
|
}
|
|
}
|
|
end)
|
|
|
|
awful.keyboard.append_global_keybindings {
|
|
qbind:new {
|
|
mods = qvars.mods.MC,
|
|
triggers = "r",
|
|
press = awesome.restart,
|
|
group = "awesome",
|
|
desc = "restart awesome"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "F1",
|
|
press = function()
|
|
insightful:toggle()
|
|
end,
|
|
group = "awesome",
|
|
desc = "toggle insightful"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "space",
|
|
press = function()
|
|
fresnel:show()
|
|
end,
|
|
group = "awesome",
|
|
desc = "toggle fresnel"
|
|
},
|
|
|
|
qbind:new {
|
|
triggers = "XF86AudioMute",
|
|
press = function()
|
|
awful.spawn("wpctl set-mute @DEFAULT_SINK@ toggle")
|
|
end,
|
|
group = "audio",
|
|
desc = "mute"
|
|
},
|
|
qbind:new {
|
|
triggers = {
|
|
{ "XF86AudioRaiseVolume", true },
|
|
{ "XF86AudioLowerVolume", false }
|
|
},
|
|
press = function(up)
|
|
if up then
|
|
awful.spawn("wpctl set-volume @DEFAULT_SINK@ 5%+")
|
|
else
|
|
awful.spawn("wpctl set-volume @DEFAULT_SINK@ 5%-")
|
|
end
|
|
end,
|
|
group = "audio",
|
|
desc = "increase/decrease volume"
|
|
},
|
|
qbind:new {
|
|
triggers = {
|
|
{ "XF86AudioNext", true },
|
|
{ "XF86AudioPrev", false }
|
|
},
|
|
press = function(next)
|
|
if next then
|
|
playerctl:next()
|
|
else
|
|
playerctl:previous()
|
|
end
|
|
end,
|
|
group = "audio",
|
|
desc = "previous/next song"
|
|
},
|
|
qbind:new {
|
|
triggers = "XF86AudioPlay",
|
|
press = function()
|
|
playerctl:play_pause()
|
|
end,
|
|
group = "audio",
|
|
desc = "(un)pause song"
|
|
},
|
|
|
|
qbind:new {
|
|
triggers = {
|
|
{ "XF86MonBrightnessUp", true },
|
|
{ "XF86MonBrightnessDown", false }
|
|
},
|
|
press = function(up)
|
|
if up then
|
|
awful.spawn("brightnessctl set +51")
|
|
else
|
|
awful.spawn("brightnessctl set 51-")
|
|
end
|
|
end,
|
|
group = "brightness",
|
|
desc = "increase/decrease brightness"
|
|
},
|
|
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "Return",
|
|
press = function()
|
|
awful.spawn(cfg.terminal)
|
|
end,
|
|
group = "launcher",
|
|
desc = "launch terminal"
|
|
},
|
|
|
|
qbind:new {
|
|
triggers = "Print",
|
|
press = function()
|
|
local date = os.date("%Y%m%d_%H%M%S")
|
|
local path = os.getenv("HOME") .. "/Pictures/" .. date .. ".png"
|
|
|
|
-- Can't use naughty.notification cause it gets in the screenshot
|
|
-- Also can't use easy_async_with_shell cause it's buggy
|
|
awful.spawn.with_shell("maim --hidecursor " .. path .. " && xclip -selection clipboard -t image/png " .. path .. [[ && notify-send -a "Maim" "Screenshot taken" "Saved at ]] .. path .. [["]])
|
|
end,
|
|
group = "screenshot",
|
|
desc = "take fullscreen screenshot"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.S,
|
|
triggers = "Print",
|
|
press = function()
|
|
local date = os.date("%Y%m%d_%H%M%S")
|
|
local path = os.getenv("HOME") .. "/Pictures/" .. date .. ".png"
|
|
|
|
awful.spawn.with_shell("maim --hidecursor -s " .. path .. " && xclip -selection clipboard -t image/png " .. path .. [[ && notify-send -a "Maim" "Screenshot taken" "Saved at ]] .. path .. [["]])
|
|
end,
|
|
group = "screenshot",
|
|
desc = "take region screenshot"
|
|
},
|
|
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "Print",
|
|
press = function()
|
|
if recording[1] then
|
|
awful.spawn("giph --stop")
|
|
naughty.notification {
|
|
app_name = "Giph",
|
|
title = "Recording stopped",
|
|
message = "Saved at " .. recording[2]
|
|
}
|
|
recording[1] = false
|
|
recording[2] = ""
|
|
else
|
|
recording[1] = true
|
|
recording[2] = os.getenv("HOME") .. "/Videos/" .. os.date("%Y%m%d_%H%M%S") .. ".mp4"
|
|
awful.spawn("giph --format mp4 --framerate 30 " .. recording[2])
|
|
naughty.notification {
|
|
app_name = "Giph",
|
|
title = "Recording started"
|
|
}
|
|
end
|
|
end,
|
|
group = "video",
|
|
desc = "toggle recording"
|
|
},
|
|
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "k",
|
|
press = function()
|
|
awful.spawn("xkblayout-state set +1")
|
|
end,
|
|
group = "keyboard",
|
|
desc = "next keyboard layout"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.MS,
|
|
triggers = "k",
|
|
press = function()
|
|
awful.spawn("xkblayout-state set -1")
|
|
end,
|
|
group = "keyboard",
|
|
desc = "previous keyboard layout"
|
|
},
|
|
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "Up",
|
|
press = awful.tag.viewprev,
|
|
group = "tag",
|
|
desc = "switch to previous"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.M,
|
|
triggers = "Down",
|
|
press = awful.tag.viewnext,
|
|
group = "tag",
|
|
desc = "switch to next"
|
|
},
|
|
qbind:new {
|
|
mods = qvars.mods.MC,
|
|
triggers = "x",
|
|
press = function()
|
|
local tag = awful.screen.focused().selected_tag
|
|
tag.master_width_factor = cfg.tags[tonumber(tag.name)].master_width_factor or beautiful.master_width_factor
|
|
end,
|
|
group = "tag",
|
|
desc = "reset master width"
|
|
}
|
|
}
|