aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/misc
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/misc')
-rw-r--r--.config/awesome/misc/autostart.lua19
-rw-r--r--.config/awesome/misc/autostart/init.lua4
-rw-r--r--.config/awesome/misc/autostart/programs.sh22
-rw-r--r--.config/awesome/misc/helpers.lua121
-rw-r--r--.config/awesome/misc/init.lua2
-rw-r--r--.config/awesome/misc/keys.lua209
-rw-r--r--.config/awesome/misc/rules.lua5
-rw-r--r--.config/awesome/misc/setup.lua65
-rw-r--r--.config/awesome/misc/signals.lua89
-rw-r--r--.config/awesome/misc/vars.lua81
10 files changed, 116 insertions, 501 deletions
diff --git a/.config/awesome/misc/autostart.lua b/.config/awesome/misc/autostart.lua
new file mode 100644
index 0000000..8cf50b6
--- /dev/null
+++ b/.config/awesome/misc/autostart.lua
@@ -0,0 +1,19 @@
+local awful = require "awful"
+local quarrel = require "quarrel"
+
+if quarrel.is_restart() then return end
+
+local programs = {
+ "picom -b",
+ "sxhkd",
+ "clipcatd",
+ "wezterm",
+ "wezterm start --class code_term",
+ "firefox",
+ "discord",
+ "spotify"
+}
+
+for _, program in ipairs(programs) do
+ awful.spawn(program)
+end
diff --git a/.config/awesome/misc/autostart/init.lua b/.config/awesome/misc/autostart/init.lua
deleted file mode 100644
index e0d4efb..0000000
--- a/.config/awesome/misc/autostart/init.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-local awful = require "awful"
-local gfs = require "gears.filesystem"
-
-awful.spawn.once("bash " .. gfs.get_configuration_dir() .. "/misc/autostart/programs.sh")
diff --git a/.config/awesome/misc/autostart/programs.sh b/.config/awesome/misc/autostart/programs.sh
deleted file mode 100644
index dbafe44..0000000
--- a/.config/awesome/misc/autostart/programs.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-function exe () {
- local cmd=$@
- if ! pgrep -x $(echo $cmd | cut -d " " -f1); then
- $cmd &
- fi
-}
-
-function exe_lax () {
- local cmd=$@
- if ! pgrep $(echo $cmd | cut -d " " -f1); then
- $cmd &
- fi
-}
-
-exe "picom -b"
-exe sxhkd
-exe clipcatd
-exe_lax wezterm
-exe_lax "wezterm start --class code_term"
-exe firefox
-exe spotify
-exe discord
diff --git a/.config/awesome/misc/helpers.lua b/.config/awesome/misc/helpers.lua
deleted file mode 100644
index 132a4df..0000000
--- a/.config/awesome/misc/helpers.lua
+++ /dev/null
@@ -1,121 +0,0 @@
-local awful = require "awful"
-local gears = require "gears"
-local xresources = require "beautiful.xresources"
-local n = require "naughty".notification
-local dpi = xresources.apply_dpi
-local vars = require "misc.vars"
-local wibox = require "wibox"
-
-local h = {}
-
--- utils
-
-function h.debug(message)
- n { message = tostring(message) }
-end
-
-function h.map(t, f)
- local nt = {}
- for k,v in pairs(t) do
- nt[k] = f(v)
- end
- return nt
-end
-
-function h.filter(t, f, dict)
- local nt = {}
- for k,v in pairs(t) do
- if not f(v) then goto continue end
- if dict then
- nt[k] = v
- else
- table.insert(nt, v)
- end
- ::continue::
- end
- return nt
-end
-
--- This is taken from http://lua-users.org/wiki/SortedIteration
--- This version is stripped of comments and empty lines + some stuff is renamed
-
-local function __gen_oindex( t )
- local oindex = {}
- for key in pairs(t) do
- table.insert(oindex, key)
- end
- table.sort(oindex)
- return oindex
-end
-
-local function onext(t, state)
- local key = nil
- if state == nil then
- t.__oindex = __gen_oindex(t)
- key = t.__oindex[1]
- else
- for i = 1,#t.__oindex do
- if t.__oindex[i] == state then
- key = t.__oindex[i+1]
- end
- end
- end
- if key then
- return key, t[key]
- end
- t.__oindex = nil
-end
-
-function h.opairs(t)
- return onext, t, nil
-end
-
--- markup
-
-function h.markup_fg(color, text)
- return "<span color=\"" .. color .. "\">" .. text .. "</span>"
-end
-
-function h.markup_bg(color, text)
- return "<span bgcolor=\"" .. color .. "\">" .. text .. "</span>"
-end
-
--- ui
-
-function h.font(factor)
- return vars.text_font .. " " .. vars.font_size * (factor or 1)
-end
-
-function h.symbol_font(factor)
- return vars.symbol_font .. " " .. vars.font_size * (factor or 1)
-end
-
-function h.styled(target)
- return gears.table.crush({
- bg = vars.colors.bg,
- border_color = vars.colors.bright.black,
- border_width = vars.border_width,
- shape = vars.shape
- }, target)
-end
-
-function h.popup(args)
- args.widget = {
- widget = wibox.container.margin,
- margins = vars.big_padding,
- args.widget
- }
-
- return awful.popup(h.styled(args))
-end
-
-function h.tooltip(objects, callback)
- awful.tooltip(h.styled {
- objects = objects,
- timer_function = callback,
- margin_leftright = vars.padding,
- margin_topbottom = vars.padding
- })
-end
-
-return h
diff --git a/.config/awesome/misc/init.lua b/.config/awesome/misc/init.lua
index ce17c05..d3c36b2 100644
--- a/.config/awesome/misc/init.lua
+++ b/.config/awesome/misc/init.lua
@@ -1,5 +1,3 @@
-require "misc.setup"
-require "misc.signals"
require "misc.keys"
require "misc.rules"
require "misc.autostart"
diff --git a/.config/awesome/misc/keys.lua b/.config/awesome/misc/keys.lua
index 6d83ec4..94091af 100644
--- a/.config/awesome/misc/keys.lua
+++ b/.config/awesome/misc/keys.lua
@@ -1,20 +1,20 @@
local awful = require "awful"
-local gears = require "gears"
+local gtimer = require "gears.timer"
local naughty = require "naughty"
local cfg = require "misc.cfg"
+local qbind = require "quarrel.bind"
local insightful = require "ui.insightful"
local archaic = require "ui.archaic"
local fresnel = require "ui.fresnel"
-local vars = require "misc.vars"
-local btn = awful.button.names
+local flashy = require "ui.flashy"
+local qvars = require "quarrel.vars"
local recording = { false, "" }
client.connect_signal("request::default_mousebindings", function()
awful.mouse.append_client_mousebindings {
- insightful:bind {
- mods = {},
- triggers = btn.LEFT,
+ qbind:new {
+ triggers = qvars.btns.left,
press = function (c)
c:activate {
context = "mouse_click"
@@ -23,9 +23,9 @@ client.connect_signal("request::default_mousebindings", function()
group = "client",
desc = "raise client"
},
- insightful:bind {
- mods = vars.mods.M,
- triggers = btn.LEFT,
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = qvars.btns.left,
press = function (c)
c:activate {
context = "mouse_click",
@@ -35,9 +35,9 @@ client.connect_signal("request::default_mousebindings", function()
group = "client",
desc = "move client"
},
- insightful:bind {
- mods = vars.mods.M,
- triggers = btn.RIGHT,
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = qvars.btns.right,
press = function (c)
c:activate {
context = "mouse_click",
@@ -50,35 +50,82 @@ client.connect_signal("request::default_mousebindings", function()
}
end)
-local globalkeys = gears.table.join(
- insightful:bind {
- mods = vars.mods.MC,
+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"
},
- insightful:bind {
- mods = vars.mods.MC,
- triggers = "s",
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "F1",
press = function()
insightful:toggle()
end,
group = "awesome",
desc = "toggle insightful"
},
- insightful:bind {
- mods = vars.mods.MC,
+ qbind:new {
+ mods = qvars.mods.MC,
triggers = "a",
press = function()
- archaic:toggle()
+ if flashy._widget.visible then
+ flashy:hide()
+ else
+ flashy:show()
+ end
end,
group = "awesome",
- desc = "toggle notification center"
+ desc = "toggle flashy"
},
- insightful:bind {
- mods = vars.mods.M,
- triggers = " ",
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "space",
press = function()
fresnel:show()
end,
@@ -86,7 +133,7 @@ local globalkeys = gears.table.join(
desc = "toggle fresnel"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = "XF86AudioMute",
press = function()
@@ -95,7 +142,7 @@ local globalkeys = gears.table.join(
group = "audio",
desc = "mute"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = {
{ "XF86AudioRaiseVolume", true },
@@ -111,7 +158,7 @@ local globalkeys = gears.table.join(
group = "audio",
desc = "increase/decrease volume"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = {
{ "XF86AudioNext", true },
@@ -127,7 +174,7 @@ local globalkeys = gears.table.join(
group = "audio",
desc = "previous/next song"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = "XF86AudioPlay",
press = function()
@@ -137,7 +184,7 @@ local globalkeys = gears.table.join(
desc = "(un)pause song"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = {
{ "XF86MonBrightnessUp", true },
@@ -154,8 +201,8 @@ local globalkeys = gears.table.join(
desc = "increase/decrease brightness"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Return",
press = function()
awful.spawn(cfg.terminal)
@@ -164,94 +211,35 @@ local globalkeys = gears.table.join(
desc = "launch terminal"
},
- insightful:bind {
- mods = vars.mods.MC,
- triggers = "q",
- press = function()
- local c = client.focus
- if c then
- c:kill()
- end
- end,
- group = "client",
- desc = "close"
- },
- insightful:bind {
- mods = vars.mods.M,
- triggers = "m",
- press = function()
- local c = client.focus
- if c then
- c.maximized = not c.maximized
- end
- end,
- group = "client",
- desc = "(un)maximize"
- },
- insightful:bind {
- mods = vars.mods.M,
- triggers = "n",
- press = function()
- local c = client.focus
- if c then
- gears.timer.delayed_call(function()
- c.minimized = true
- end)
- end
- end,
- group = "client",
- desc = "minimize"
- },
- insightful:bind {
- mods = vars.mods.M,
- triggers = "f",
- press = function()
- local c = client.focus
- if c then
- c.fullscreen = not c.fullscreen
- end
- end,
- group = "client",
- desc = "toggle fullscreen"
- },
-
- insightful:bind {
+ qbind:new {
mods = {},
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 " .. path .. " && xclip -selection clipboard -t image/png " .. path)
- naughty.notification {
- app_name = "Maim",
- title = "Screenshot taken",
- message = "Saved at " .. path
- }
+ -- 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"
},
- insightful:bind {
- mods = vars.mods.S,
+ 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 .. [["]])
- -- naughty.notification {
- -- app_name = "Maim",r
- -- title = "Screenshot taken",
- -- message = "Saved at " .. path
- -- }
end,
group = "screenshot",
desc = "take region screenshot"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Print",
press = function()
if recording[1] then
@@ -277,8 +265,8 @@ local globalkeys = gears.table.join(
desc = "toggle recording"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "k",
press = function()
awful.spawn("xkblayout-state set +1")
@@ -286,8 +274,8 @@ local globalkeys = gears.table.join(
group = "keyboard",
desc = "next keyboard layout"
},
- insightful:bind {
- mods = vars.mods.MS,
+ qbind:new {
+ mods = qvars.mods.MS,
triggers = "k",
press = function()
awful.spawn("xkblayout-state set -1")
@@ -296,23 +284,18 @@ local globalkeys = gears.table.join(
desc = "previous keyboard layout"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Up",
press = awful.tag.viewprev,
group = "tag",
desc = "switch to previous"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Down",
press = awful.tag.viewnext,
group = "tag",
desc = "switch to next"
}
-)
-
--- gears.debug.dump(insightful:bind.hottriggerss)
-
-root.keys(globalkeys)
-
+}
diff --git a/.config/awesome/misc/rules.lua b/.config/awesome/misc/rules.lua
index 803d49a..b777ae8 100644
--- a/.config/awesome/misc/rules.lua
+++ b/.config/awesome/misc/rules.lua
@@ -1,7 +1,6 @@
local ruled = require "ruled"
local beautiful = require "beautiful"
local awful = require "awful"
-local vars = require "misc.vars"
ruled.client.connect_signal("request::rules", function()
ruled.client.append_rule({
@@ -15,9 +14,7 @@ ruled.client.connect_signal("request::rules", function()
screen = awful.screen.preferred,
placement = awful.placement.centered+awful.placement.no_offscreen,
floating = false,
- -- shape = vars.shape,
honor_padding = true
- -- tag = "1"
}
})
@@ -47,7 +44,7 @@ ruled.client.connect_signal("request::rules", function()
ruled.client.append_rule({
id = "browser_tag",
rule_any = {
- class = { "firefox" }
+ instance = { "Navigator" }
},
properties = {
screen = 1,
diff --git a/.config/awesome/misc/setup.lua b/.config/awesome/misc/setup.lua
deleted file mode 100644
index aeee19a..0000000
--- a/.config/awesome/misc/setup.lua
+++ /dev/null
@@ -1,65 +0,0 @@
-local naughty = require "naughty"
-local beautiful = require "beautiful"
--- local notif_overlay = require "ui.notifs"
-local wicked = require "ui.wicked"
-local awful = require "awful"
-local rubato = require "lib.rubato"
-local vars = require "misc.vars"
-
--- naughty.connect_signal("request::display", function(n)
--- notif_overlay:notify(n)
--- end)
-
-naughty.connect_signal("request::display", function(n)
- naughty.layout.box {
- notification = n,
- placement = function(d)
- return awful.placement.right(d, {
- margins = beautiful.useless_gap * 2
- })
- end
- }
-
- -- wicked:.notify(n)
-end)
-
-naughty.connect_signal("request::display_error", function(message, startup)
- naughty.notification {
- urgency = "critical",
- title = "Oops, an error happened"..(startup and " during startup!" or "!"),
- message = message
- }
-end)
-
--- Taken from https://www.reddit.com/r/awesomewm/comments/syjolb/comment/hy0xy35/
-
-awesome.connect_signal('exit', function(reason_restart)
- if not reason_restart then return end
-
- local file = io.open('/tmp/awesomewm-last-selected-tags', 'w+')
-
- for s in screen do
- file:write(s.selected_tag.index, '\n')
- end
-
- file:close()
-end)
-
-awesome.connect_signal('startup', function()
- local file = io.open('/tmp/awesomewm-last-selected-tags', 'r')
- if not file then return end
-
- local selected_tags = {}
-
- for line in file:lines() do
- table.insert(selected_tags, tonumber(line))
- end
-
- for s in screen do
- local i = selected_tags[s.index]
- local t = s.tags[i]
- t:view_only()
- end
-
- file:close()
-end)
diff --git a/.config/awesome/misc/signals.lua b/.config/awesome/misc/signals.lua
deleted file mode 100644
index a65ca43..0000000
--- a/.config/awesome/misc/signals.lua
+++ /dev/null
@@ -1,89 +0,0 @@
-local vars = require "misc.vars"
-local awful = require "awful"
-local rectangle = require "gears.shape".rectangle
-local bling = require "lib.bling"
-
-client.connect_signal("property::name", function(c)
- local out = io.popen("readlink /proc/" .. c.pid .. "/exe")
- local name = c.name
- if out ~= nil then
- name = out:read("*a"):sub(0, -2):match("[^\\/]+$") or name
- end
- c.name = string.lower(name)
-end)
-
-client.connect_signal("request::manage", function (c)
- c.shape = vars.shape
- if c.maximized then
- c.maximized = false
- c.maximized = true
- end
-end)
-
-local function handle_corners(c)
- if c.maximized then
- c.shape = rectangle
- c.border_width = 0
- else
- c.shape = vars.shape
- c.border_width = vars.border_width
- end
-end
-
-client.connect_signal("property::maximized", handle_corners)
-client.connect_signal("property::fullscreen", handle_corners)
-
-screen.connect_signal("request::desktop_decoration", function(s)
- awful.tag.add(
- "1",
- {
- screen = s,
- layout = awful.layout.suit.floating,
- selected = true
- }
- )
-
- awful.tag.add(
- "2",
- {
- screen = s,
- layout = awful.layout.suit.floating,
-
- }
- )
-
- awful.tag.add(
- "3",
- {
- screen = s,
- layout = awful.layout.suit.tile.left,
- master_width_factor = 0.7
- }
- )
-
- awful.tag.add(
- "4",
- {
- screen = s,
- layout = awful.layout.suit.tile.top,
- master_width_factor = 0.2
- }
- )
-
- awful.tag.add(
- "5",
- {
- screen = s,
- layout = awful.layout.suit.tile.right,
- master_width_factor = 0.7
- }
- )
-
- awful.tag.add(
- "6",
- {
- screen = s,
- layout = awful.layout.suit.floating,
- }
- )
-end)
diff --git a/.config/awesome/misc/vars.lua b/.config/awesome/misc/vars.lua
deleted file mode 100644
index 7a5f9c8..0000000
--- a/.config/awesome/misc/vars.lua
+++ /dev/null
@@ -1,81 +0,0 @@
-local gears = require "gears"
-local xresources = require "beautiful.xresources"
-local x_col = xresources.get_current_theme()
-local dpi = xresources.apply_dpi
-local wibox = require "wibox"
-
-local v = {}
-
-v.notif_timeout = 3
-
-v.anim_duration = 0.15
-v.anim_intro = v.anim_duration / 2
-
-function v.shape(cr,w,h)
- gears.shape.rounded_rect(cr,w,h,dpi(4))
-end
-
-v.border_width = dpi(1.5)
-
-v.padding = dpi(4)
-v.big_padding = dpi(8)
-
-v.text_font = "Fira Code Nerd Font Mono Medium"
-v.symbol_font = "Symbols Nerd Font:style=1000-em"
-v.font_size = 8
-v.font = v.text_font .. " " .. v.font_size
-
-local char_width, char_height = wibox.widget {
- widget = wibox.widget.textbox,
- text = "a"
-}:get_preferred_size_at_dpi(screen[1].dpi)
-
-v.char_height = char_height
-v.char_width = char_width
-
-v.bar_size = dpi(16)
-
-v.button_size = dpi(12)
-
-v.colors = {
- fg = x_col.foreground,
- bg = x_col.background,
-
- black = x_col.color0,
- red = x_col.color1,
- green = x_col.color2,
- yellow = x_col.color3,
- blue = x_col.color4,
- pink = x_col.color5,
- cyan = x_col.color6,
- white = x_col.color7,
-
- bright = {
- black = x_col.color8,
- red = x_col.color9,
- green = x_col.color10,
- yellow = x_col.color11,
- blue = x_col.color12,
- pink = x_col.color13,
- cyan = x_col.color14,
- white = x_col.color15,
- },
-
- dim = {
- fg = "#8893a5",
- bg = "#20262e"
- }
-}
-
--- taken from https://github.com/bew/dotfiles/blob/ab9bb1935783f7a31ef777b1d7e26d53f35df864/gui/wezterm/cfg_utils.lua
-v.mods = setmetatable({ _SHORT_MAP = { C = "Control", S = "Shift", A = "Mod1", M = "Mod4" } }, {
- __index = function(self, key)
- local resolved_mods = {}
- for i = 1, #key do
- resolved_mods[i] = self._SHORT_MAP[key:sub(i, i)]
- end
- return resolved_mods
- end
-})
-
-return v