Switched back to awesomewm
10
user/.bashrc
|
@ -196,10 +196,10 @@ alias \
|
|||
|
||||
# file management
|
||||
alias \
|
||||
fm="./.config/vifm/scripts/vifmrun" \
|
||||
file="./.config/vifm/scripts/vifmrun" \
|
||||
flm="./.config/vifm/scripts/vifmrun" \
|
||||
vifm="./.config/vifm/scripts/vifmrun" \
|
||||
fm="$HOME/.config/vifm/scripts/vifmrun" \
|
||||
file="$HOME/.config/vifm/scripts/vifmrun" \
|
||||
flm="$HOME/.config/vifm/scripts/vifmrun" \
|
||||
vifm="$HOME/.config/vifm/scripts/vifmrun" \
|
||||
rm="rm -vI" \
|
||||
mv="mv -iv" \
|
||||
cp="cp -iv" \
|
||||
|
@ -230,7 +230,7 @@ alias \
|
|||
alias \
|
||||
netstats="nmcli dev" \
|
||||
wfi="nmtui-connect" \
|
||||
wfi-scan="nmcli dev wifi list" \
|
||||
wfi-scan="nmcli dev wifi rescan && nmcli dev wifi list" \
|
||||
wfi-edit="nmtui-edit" \
|
||||
wfi-on="nmcli radio wifi on" \
|
||||
wfi-off="nmcli radio wifi off" \
|
||||
|
|
11
user/.config/awesome/core/apps.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
-- Apps
|
||||
local apps = {
|
||||
terminal = "alacritty",
|
||||
editor = "emacsclient -c -a 'emacs'",
|
||||
music = "alacritty -t cmus --class cmus,cmus -e cmus",
|
||||
chat = "alacritty -t gomuks --class gomuks,gomuks -e gomuks",
|
||||
game = "retroarch",
|
||||
file = "alacritty -t vifm --class vifm,vifm -e ./.config/vifm/scripts/vifmrun",
|
||||
browser = "brave",
|
||||
}
|
||||
return apps
|
4
user/.config/awesome/core/autostart.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
local awful = require("awful")
|
||||
awful.util.spawn_with_shell("$HOME/.fehbg &")
|
||||
awful.util.spawn_with_shell("lxpolkit &")
|
||||
awful.util.spawn_with_shell("unclutter --hide-on-touch &")
|
103
user/.config/awesome/core/bar/bar.lua
Normal file
|
@ -0,0 +1,103 @@
|
|||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
local awful = require("awful")
|
||||
local theme = require("theme.gruvbox.theme")
|
||||
|
||||
-- Keyboard layout widget
|
||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
||||
|
||||
-- Textclock widget
|
||||
mytextclock = wibox.widget.textclock()
|
||||
|
||||
screen.connect_signal("request::desktop_decoration", function(s)
|
||||
-- Tag names for each screen
|
||||
awful.tag({ "E",
|
||||
"F",
|
||||
"W",
|
||||
"C",
|
||||
"M",
|
||||
"V",
|
||||
"X",
|
||||
"D",
|
||||
"G"
|
||||
}, s, awful.layout.layouts[1])
|
||||
|
||||
-- Layoutbox widget
|
||||
s.mylayoutbox = awful.widget.layoutbox {
|
||||
screen = s,
|
||||
buttons = {
|
||||
awful.button({ }, 1, function () awful.layout.inc( 1) end),
|
||||
awful.button({ }, 3, function () awful.layout.inc(-1) end),
|
||||
awful.button({ }, 4, function () awful.layout.inc(-1) end),
|
||||
awful.button({ }, 5, function () awful.layout.inc( 1) end),
|
||||
}
|
||||
}
|
||||
|
||||
-- Custom widgets
|
||||
s.volume = awful.widget.watch(".config/awesome/core/bar/widgets/volume", 0.1)
|
||||
s.battery = awful.widget.watch(".config/awesome/core/bar/widgets/battery", 0.1)
|
||||
s.brightness = awful.widget.watch(".config/awesome/core/bar/widgets/brightness", 0.1)
|
||||
s.layout = awful.widget.watch(".config/awesome/core/bar/widgets/layout", 0.1)
|
||||
|
||||
-- Taglist widget
|
||||
s.mytaglist = awful.widget.taglist {
|
||||
screen = s,
|
||||
filter = awful.widget.taglist.filter.all,
|
||||
buttons = {
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
awful.button({ modkey }, 1, function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end),
|
||||
}
|
||||
}
|
||||
|
||||
-- Wibox
|
||||
s.mywibox = awful.wibar {
|
||||
position = "top",
|
||||
screen = s,
|
||||
widget = {
|
||||
layout = wibox.layout.stack,
|
||||
{
|
||||
layout = wibox.layout.align.horizontal,
|
||||
{ -- Left widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
s.mylayoutbox,
|
||||
s.mytaglist,
|
||||
},
|
||||
nil,
|
||||
{ -- Right widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_one),
|
||||
wibox.container.background(s.layout, theme.bar_bg_one),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_one),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_two),
|
||||
wibox.container.background(s.battery, theme.bar_bg_two),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_two),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_tre),
|
||||
wibox.container.background(s.volume, theme.bar_bg_tre),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_tre),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_for),
|
||||
wibox.container.background(s.brightness, theme.bar_bg_for),
|
||||
wibox.container.background(wibox.widget.textbox(" "), theme.bar_bg_for),
|
||||
},
|
||||
},
|
||||
{
|
||||
wibox.container.background(mytextclock, theme.bar_clock),
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
layout = wibox.container.place,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
end)
|
|
@ -2,27 +2,27 @@
|
|||
# Loop through all attached batteries and format the info
|
||||
currntpwr=$(powerprofilesctl get)
|
||||
if [ "${currntpwr}" = "performance" ]; then
|
||||
pwr="- 🔥 Performance"
|
||||
pwr="- performance"
|
||||
elif [ "${currntpwr}" = "balanced" ]; then
|
||||
pwr="- ⚖ Balanced"
|
||||
pwr="- balanced"
|
||||
elif [ "${currntpwr}" = "power-saver" ]; then
|
||||
pwr="- ⏱ Power Saver"
|
||||
pwr="- power-saver"
|
||||
fi
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
# If non-first battery, print a space separator.
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
# Sets up the status and capacity
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
"Full") status="⚡" ;;
|
||||
"Discharging") status="🔋" ;;
|
||||
"Charging") status="🔌" ;;
|
||||
"Not charging") status="🔋" ;;
|
||||
"Unknown") status="♻" ;;
|
||||
"Full") status=" " ;;
|
||||
"Discharging") status=" " ;;
|
||||
"Charging") status="" ;;
|
||||
"Not charging") status="" ;;
|
||||
"Unknown") status="ﴔ " ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
# Will make a warn variable if discharging and low
|
||||
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
|
||||
[ "$status" = "" ] && [ "$capacity" -le 25 ] && warn=" "
|
||||
# Prints the info
|
||||
printf "%s%s%d%%%s" "$status" "$warn " "$capacity " " $pwr"; unset warn
|
||||
done && printf "\\n"
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#!/bin/bash
|
||||
brt=$(xbacklight -get)
|
||||
if [ "$brt" = "100.000000" ]; then
|
||||
icon=🔆
|
||||
icon=""
|
||||
elif [ "$brt" \> "50%.*" ]; then
|
||||
icon=🔆
|
||||
icon=""
|
||||
elif [ "$brt" \< "49%.*" ]; then
|
||||
icon=🔅
|
||||
icon=""
|
||||
fi
|
||||
echo "$icon ${brt%.*}%"
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
layout=$(setxkbmap -query | grep -oP 'layout:\s*\K\w+');
|
||||
echo " ⌨ $layout ";
|
||||
echo " $layout";
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/bash
|
||||
# Prints the current volume or 🔇 if muted.
|
||||
[ $(pamixer --get-mute) = true ] && echo " 🔇 " && exit
|
||||
[ $(pamixer --get-mute) = true ] && echo "婢" && exit
|
||||
vol="$(pamixer --get-volume)"
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon="🔊"
|
||||
icon=""
|
||||
elif [ "$vol" -gt "30" ]; then
|
||||
icon="🔉"
|
||||
icon=""
|
||||
elif [ "$vol" -gt "0" ]; then
|
||||
icon="🔈"
|
||||
icon=""
|
||||
else
|
||||
echo " 🔇 " && exit
|
||||
echo " " && exit
|
||||
fi
|
||||
echo "$icon $vol%"
|
355
user/.config/awesome/core/bindings.lua
Normal file
|
@ -0,0 +1,355 @@
|
|||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
local wibox = require("wibox")
|
||||
local hotkeys_popup = require("awful.hotkeys_popup"); require("awful.hotkeys_popup.keys")
|
||||
local apps = require("core.apps")
|
||||
require("awful.autofocus")
|
||||
|
||||
-- Modkeys.
|
||||
altkey = "Mod1"
|
||||
modkey = "Mod4"
|
||||
conkey = "Control"
|
||||
|
||||
--[[ Quick keybindings ]]--
|
||||
awful.keyboard.append_global_keybindings({
|
||||
-- Show all the keybindings
|
||||
awful.key({ modkey }, "s", hotkeys_popup.show_help,
|
||||
{description="show help", group="quick"}),
|
||||
-- Reload awesome
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{description = "reload awesome", group = "quick"}),
|
||||
-- Show/Hide Wibox
|
||||
awful.key({ modkey }, "b", function ()
|
||||
for s in screen do
|
||||
s.mywibox.visible = not s.mywibox.visible
|
||||
if s.mybottomwibox then
|
||||
s.mybottomwibox.visible = not s.mybottomwibox.visible
|
||||
end
|
||||
end
|
||||
end,
|
||||
{description = "toggle wibox", group = "quick"}),
|
||||
awful.key({ modkey }, "Return", function () awful.spawn(apps.terminal) end,
|
||||
{description = "open a terminal", group = "launcher"}),
|
||||
})
|
||||
--[[ ]]--
|
||||
|
||||
--[[ Tags related keybindings ]]--
|
||||
awful.keyboard.append_global_keybindings({
|
||||
-- Switch to previous tag
|
||||
awful.key({ modkey }, "Left", awful.tag.viewprev,
|
||||
{description = "view previous", group = "tag"}),
|
||||
-- Switch to next tag
|
||||
awful.key({ modkey }, "Right", awful.tag.viewnext,
|
||||
{description = "view next", group = "tag"}),
|
||||
-- Switch back to the previous tag
|
||||
awful.key({ modkey }, "Escape", awful.tag.history.restore,
|
||||
{description = "go back", group = "tag"}),
|
||||
-- Switch tags by numbers 1-9
|
||||
awful.key {
|
||||
modifiers = { modkey },
|
||||
keygroup = "numrow",
|
||||
description = "only view tag",
|
||||
group = "tag",
|
||||
on_press = function (index)
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[index]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
end,
|
||||
},
|
||||
-- Toggle tags by numbers 1-9
|
||||
awful.key {
|
||||
modifiers = { modkey, "Control" },
|
||||
keygroup = "numrow",
|
||||
description = "toggle tag",
|
||||
group = "tag",
|
||||
on_press = function (index)
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[index]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
},
|
||||
-- Move focused client to tag by numbers 1-9
|
||||
awful.key {
|
||||
modifiers = { modkey, "Shift" },
|
||||
keygroup = "numrow",
|
||||
description = "move focused client to tag",
|
||||
group = "tag",
|
||||
on_press = function (index)
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[index]
|
||||
if tag then
|
||||
client.focus:move_to_tag(tag)
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
-- Toggle focused client on tag by numbers 1-9
|
||||
awful.key {
|
||||
modifiers = { modkey, "Control", "Shift" },
|
||||
keygroup = "numrow",
|
||||
description = "toggle focused client on tag",
|
||||
group = "tag",
|
||||
on_press = function (index)
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[index]
|
||||
if tag then
|
||||
client.focus:toggle_tag(tag)
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
--[[ ]]--
|
||||
|
||||
--[[ Focus related keybindings ]]--
|
||||
awful.keyboard.append_global_keybindings({
|
||||
-- Focus next client by index
|
||||
awful.key({ modkey }, "j",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
end,
|
||||
{description = "focus next by index", group = "focus"}),
|
||||
-- Focus previous client by index
|
||||
awful.key({ modkey }, "k",
|
||||
function ()
|
||||
awful.client.focus.byidx(-1)
|
||||
end,
|
||||
{description = "focus previous by index", group = "focus"}),
|
||||
-- Focus last focused client
|
||||
awful.key({ modkey }, "Tab",
|
||||
function ()
|
||||
awful.client.focus.history.previous()
|
||||
if client.focus then
|
||||
client.focus:raise()
|
||||
end
|
||||
end,
|
||||
{description = "go back", group = "focus"}),
|
||||
-- Focus next screen
|
||||
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative(1) end,
|
||||
{description = "focus the next screen", group = "focus"}),
|
||||
-- Focus previous screen
|
||||
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
|
||||
{description = "focus the previous screen", group = "focus"}),
|
||||
})
|
||||
--[[ ]]--
|
||||
|
||||
--[[ Layout related keybindings ]]--
|
||||
awful.keyboard.append_global_keybindings({
|
||||
-- Swap with next client by index
|
||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end,
|
||||
{description = "swap with next client by index", group = "layout"}),
|
||||
-- Swap with previous client by index
|
||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end,
|
||||
{description = "swap with previous client by index", group = "layout"}),
|
||||
-- Increase master width
|
||||
awful.key({ modkey }, "l", function () awful.tag.incmwfact( 0.05) end,
|
||||
{description = "increase master width factor", group = "layout"}),
|
||||
-- Decrease master width
|
||||
awful.key({ modkey }, "h", function () awful.tag.incmwfact(-0.05) end,
|
||||
{description = "decrease master width factor", group = "layout"}),
|
||||
-- Increase the number of master clients
|
||||
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
|
||||
{description = "increase the number of master clients", group = "layout"}),
|
||||
-- Decrease the number of master clients
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
|
||||
{description = "decrease the number of master clients", group = "layout"}),
|
||||
-- Increase the number of columns
|
||||
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
|
||||
{description = "increase the number of columns", group = "layout"}),
|
||||
-- Decrease the number of columns
|
||||
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
|
||||
{description = "decrease the number of columns", group = "layout"}),
|
||||
-- Switch to next layout
|
||||
awful.key({ modkey }, "space", function () awful.layout.inc( 1) end,
|
||||
{description = "select next", group = "layout"}),
|
||||
-- Switch to previous layout
|
||||
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
|
||||
{description = "select previous", group = "layout"}),
|
||||
-- Select layouts directly
|
||||
awful.key {
|
||||
modifiers = { modkey },
|
||||
keygroup = "numpad",
|
||||
description = "select layout directly",
|
||||
group = "layout",
|
||||
on_press = function (index)
|
||||
local t = awful.screen.focused().selected_tag
|
||||
if t then
|
||||
t.layout = t.layouts[index] or t.layout
|
||||
end
|
||||
end,
|
||||
}
|
||||
})
|
||||
--[[ ]]--
|
||||
|
||||
|
||||
--[[ Client related keybindings ]]--
|
||||
client.connect_signal("request::default_keybindings", function()
|
||||
-- Mouse bindings
|
||||
awful.mouse.append_client_mousebindings({
|
||||
-- Focus client with left click
|
||||
awful.button({ }, 1, function (c)
|
||||
c:activate { context = "mouse_click" }
|
||||
end),
|
||||
-- Move client by MODKEY + mouse left click
|
||||
awful.button({ modkey }, 1, function (c)
|
||||
c:activate { context = "mouse_click", action = "mouse_move" }
|
||||
end),
|
||||
-- Resize client by MODKEY + mouse right click
|
||||
awful.button({ modkey }, 3, function (c)
|
||||
c:activate { context = "mouse_click", action = "mouse_resize"}
|
||||
end),
|
||||
})
|
||||
-- Keyboard bindings
|
||||
awful.keyboard.append_client_keybindings({
|
||||
-- Set focused client to fullscreen
|
||||
awful.key({ modkey }, "f",
|
||||
function (c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{description = "toggle fullscreen", group = "client"}),
|
||||
-- Close focused client
|
||||
awful.key({ modkey }, "q", function (c) c:kill() end,
|
||||
{description = "close", group = "client"}),
|
||||
-- Toggle floating mode on focused client
|
||||
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle,
|
||||
{description = "toggle floating", group = "client"}),
|
||||
-- Move focused client to master
|
||||
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
|
||||
{description = "move to master", group = "client"}),
|
||||
-- Move focused client to the other screen
|
||||
awful.key({ modkey }, "o", function (c) c:move_to_screen() end,
|
||||
{description = "move to screen", group = "client"}),
|
||||
-- Toggle focused client to be on top
|
||||
awful.key({ modkey }, "t", function (c) c.ontop = not c.ontop end,
|
||||
{description = "toggle keep on top", group = "client"}),
|
||||
-- Minimize focused client
|
||||
awful.key({ modkey }, "n", function (c) c.minimized = true end,
|
||||
{description = "minimize", group = "client"}),
|
||||
-- (Un)Maximize focused client
|
||||
awful.key({ modkey }, "m",
|
||||
function (c)
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize", group = "client"}),
|
||||
-- (Un)Maximize vertically focused client
|
||||
awful.key({ modkey, "Control" }, "m",
|
||||
function (c)
|
||||
c.maximized_vertical = not c.maximized_vertical
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize vertically", group = "client"}),
|
||||
-- (Un)Maximize horizontally focused client
|
||||
awful.key({ modkey, "Shift" }, "m",
|
||||
function (c)
|
||||
c.maximized_horizontal = not c.maximized_horizontal
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "(un)maximize horizontally", group = "client"}),
|
||||
-- Unminimize clients
|
||||
awful.key({ modkey, "Control" }, "n",
|
||||
function ()
|
||||
local c = awful.client.restore()
|
||||
-- Focus restored client
|
||||
if c then
|
||||
c:activate { raise = true, context = "key.unminimize" }
|
||||
end
|
||||
end,
|
||||
{description = "restore minimized", group = "client"}),
|
||||
-- Jump to urgent client
|
||||
awful.key({ modkey }, "u", awful.client.urgent.jumpto,
|
||||
{description = "jump to urgent client", group = "client"}),
|
||||
})
|
||||
end)
|
||||
--[[ ]]--
|
||||
|
||||
--[[ Custom keybindings ]]
|
||||
awful.keyboard.append_global_keybindings({
|
||||
-- Volume
|
||||
awful.key({}, "XF86AudioRaiseVolume", function() awful.spawn("pamixer -i 5") end,
|
||||
{description = "increase volume", group = "quick"}),
|
||||
awful.key({}, "XF86AudioLowerVolume", function() awful.spawn("pamixer -d 5") end,
|
||||
{description = "decrease volume", group = "quick"}),
|
||||
awful.key({}, "XF86AudioMute", function() awful.spawn("pamixer -t") end,
|
||||
{description = "mute volume", group = "quick"}),
|
||||
awful.key({}, "XF86AudioMicMute", function() awful.spawn("pamixer --default-source -t") end,
|
||||
{description = "mute microphone", group = "quick"}),
|
||||
-- Brightness
|
||||
awful.key({}, "XF86MonBrightnessUp", function () awful.spawn("xbacklight -inc 10") end,
|
||||
{description = "increase brightness", group = "quick"}),
|
||||
awful.key({}, "XF86MonBrightnessDown", function () awful.spawn("xbacklight -dec 10") end,
|
||||
{description = "decrease brightness", group = "quick"}),
|
||||
-- Display configuration
|
||||
awful.key({}, "XF86Display", function () awful.spawn("arandr") end,
|
||||
{description = "decrease brightness", group = "quick"}),
|
||||
-- apps (Super + a followed by KEY)
|
||||
awful.key({ modkey }, "a", function()
|
||||
local grabber
|
||||
grabber =
|
||||
awful.keygrabber.run(
|
||||
function(_, key, event)
|
||||
if event == "release" then return end
|
||||
if key == "e" then awful.util.spawn(apps.editor)
|
||||
elseif key == "f" then awful.util.spawn(apps.file)
|
||||
elseif key == "w" then awful.util.spawn(apps.browser)
|
||||
elseif key == "c" then awful.util.spawn(apps.chat)
|
||||
elseif key == "m" then awful.util.spawn(apps.music)
|
||||
elseif key == "g" then awful.util.spawn(apps.game)
|
||||
end
|
||||
awful.keygrabber.stop(grabber)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{description = "followed by KEY (Look at the tag names)", group = "apps"}
|
||||
),
|
||||
-- Keyboard layouts (Super + x followed by KEY)
|
||||
awful.key({ modkey }, "x", function()
|
||||
local grabber
|
||||
grabber =
|
||||
awful.keygrabber.run(
|
||||
function(_, key, event)
|
||||
if event == "release" then return end
|
||||
if key == "e" then awful.util.spawn("setxkbmap es")
|
||||
elseif key == "u" then awful.util.spawn("setxkbmap us")
|
||||
end
|
||||
awful.keygrabber.stop(grabber)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{description = "followed by KEY", group = "keyboard"}
|
||||
),
|
||||
-- Dmenu scripts (Super + p followed by KEY)
|
||||
awful.key({ modkey }, "p", function()
|
||||
local grabber
|
||||
grabber =
|
||||
awful.keygrabber.run(
|
||||
function(_, key, event)
|
||||
if event == "release" then return end
|
||||
if key == "d" then awful.spawn.with_shell("dmenu_drun")
|
||||
elseif key == "r" then awful.spawn.with_shell("dmenu_run -b -l 10 -i")
|
||||
elseif key == "e" then awful.spawn.with_shell("dmenu_edit")
|
||||
elseif key == "q" then awful.spawn.with_shell("dmenu_power")
|
||||
elseif key == "i" then awful.spawn.with_shell("dmenu_wifi")
|
||||
elseif key == "b" then awful.spawn.with_shell("dmenu_blue")
|
||||
elseif key == "s" then awful.spawn.with_shell("dmenu_scrot")
|
||||
elseif key == "z" then awful.spawn.with_shell("dmenu_emoji")
|
||||
elseif key == "w" then awful.spawn.with_shell("dmenu_wall")
|
||||
end
|
||||
awful.keygrabber.stop(grabber)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{description = "followed by KEY", group = "dmenu scripts"}
|
||||
),
|
||||
})
|
||||
--[[ ]]
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
client.connect_signal("mouse::enter", function(c)
|
||||
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
||||
end)
|
13
user/.config/awesome/core/error_handling.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local naughty = require("naughty")
|
||||
|
||||
-- {{{ Error handling
|
||||
-- Check if awesome encountered an error during startup and fell back to
|
||||
-- another config (This code will only ever execute for the fallback config)
|
||||
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)
|
||||
-- }}}
|
86
user/.config/awesome/core/focus.lua
Normal file
|
@ -0,0 +1,86 @@
|
|||
--------------------------------------------------------------> dependencies ;
|
||||
|
||||
local gears = require('gears')
|
||||
|
||||
-----------------------------------------------------------------> locals -- ;
|
||||
|
||||
local stay_classes = {
|
||||
awesome
|
||||
-- taskbar
|
||||
}
|
||||
--+ class names defined here would insist micky stays where
|
||||
--> he is at.
|
||||
|
||||
-------------------------------------------------------------------> methods ;
|
||||
|
||||
local function set_contains(set, key)
|
||||
return set[key] ~= nil
|
||||
end
|
||||
|
||||
local micky = function ()
|
||||
gears.timer.weak_start_new(0.05, function()
|
||||
local c = client.focus
|
||||
local cgeometry = c:geometry()
|
||||
|
||||
mouse.coords({
|
||||
x = cgeometry.x + cgeometry.width / 2,
|
||||
y = cgeometry.y + cgeometry.height / 2
|
||||
})
|
||||
end)
|
||||
end
|
||||
--+ relocate mouse after slightly waiting for focus to
|
||||
--> complete. you can adjust the timer if you are on a slow
|
||||
--> cpu to give more time for the client to appear.
|
||||
|
||||
---------------------------------------------------------------------> signal ;
|
||||
|
||||
client.connect_signal("focus", function(c)
|
||||
local focused_client = c
|
||||
--+ client the focus is going towards
|
||||
|
||||
gears.timer.weak_start_new(0.15, function()
|
||||
local client_under_mouse = mouse.current_client
|
||||
local should_stay = set_contains(stay_classes, client_under_mouse.class)
|
||||
|
||||
if should_stay then return false end
|
||||
--+ exclusions
|
||||
|
||||
-- if compare_coords(focused_client) then return false end
|
||||
--+ avoid tabs
|
||||
|
||||
if not client_under_mouse then
|
||||
micky()
|
||||
return false
|
||||
end
|
||||
--+ nothing under the mouse, move directly
|
||||
|
||||
if focused_client:geometry().x ~= client_under_mouse:geometry().x
|
||||
or focused_client:geometry().y ~= client_under_mouse:geometry().y
|
||||
then
|
||||
micky()
|
||||
return false
|
||||
end
|
||||
--+ no need to relocate the mouse if already over
|
||||
--> the client.
|
||||
end)
|
||||
--+ mouse.current_client would point to the previous
|
||||
--> client without the callback.
|
||||
end)
|
||||
|
||||
|
||||
client.connect_signal("unmanage", function(c)
|
||||
local client_under_mouse = mouse.current_client
|
||||
|
||||
if not client_under_mouse then
|
||||
return false
|
||||
end
|
||||
|
||||
if client_under_mouse ~= c then
|
||||
micky()
|
||||
end
|
||||
--+ no need for the callback here.
|
||||
end)
|
||||
|
||||
---------------------------------------------------------------------> export ;
|
||||
|
||||
return micky
|
22
user/.config/awesome/core/layouts.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
-- {{{ Tag layout
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
tag.connect_signal("request::default_layouts", function()
|
||||
awful.layout.append_default_layouts({
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.left,
|
||||
awful.layout.suit.tile.bottom,
|
||||
awful.layout.suit.tile.top,
|
||||
-- awful.layout.suit.fair,
|
||||
-- awful.layout.suit.fair.horizontal,
|
||||
-- awful.layout.suit.spiral,
|
||||
-- awful.layout.suit.spiral.dwindle,
|
||||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
-- awful.layout.suit.magnifier,
|
||||
-- awful.layout.suit.corner.nw,
|
||||
awful.layout.suit.floating,
|
||||
})
|
||||
end)
|
||||
-- }}}
|
18
user/.config/awesome/core/notif.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local awful = require("awful")
|
||||
local ruled = require("ruled")
|
||||
local naughty = require("naughty")
|
||||
|
||||
ruled.notification.connect_signal('request::rules', function()
|
||||
-- Notifications timeout
|
||||
ruled.notification.append_rule {
|
||||
rule = { },
|
||||
properties = {
|
||||
screen = awful.screen.preferred,
|
||||
implicit_timeout = 5,
|
||||
}
|
||||
}
|
||||
end)
|
||||
naughty.connect_signal("request::display", function(n)
|
||||
naughty.layout.box { notification = n }
|
||||
end)
|
||||
naughty.config.defaults['icon_size'] = 80
|
137
user/.config/awesome/core/rules.lua
Normal file
|
@ -0,0 +1,137 @@
|
|||
local awful = require("awful")
|
||||
local ruled = require("ruled")
|
||||
|
||||
-- Rules to apply to new clients.
|
||||
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,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap+awful.placement.no_offscreen,
|
||||
callback = awful.client.setslave
|
||||
}
|
||||
}
|
||||
|
||||
-- Floating clients.
|
||||
ruled.client.append_rule {
|
||||
id = "floating",
|
||||
rule_any = {
|
||||
instance = { "copyq", "pinentry" },
|
||||
class = {
|
||||
"Galculator",
|
||||
"Blueman-manager",
|
||||
"Gpick",
|
||||
"Kruler",
|
||||
"Sxiv",
|
||||
"Tor Browser",
|
||||
"Wpa_gui",
|
||||
"veromix",
|
||||
"xtightvncviewer"
|
||||
},
|
||||
-- Note that the name property shown in xprop might be set slightly after creation of the client
|
||||
-- and the name shown there might not match defined rules here.
|
||||
name = {
|
||||
"Event Tester", -- xev.
|
||||
},
|
||||
role = {
|
||||
"AlarmWindow", -- Thunderbird's calendar.
|
||||
"ConfigManager", -- Thunderbird's about:config.
|
||||
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
|
||||
}
|
||||
},
|
||||
properties = { floating = true }
|
||||
}
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
-- E TAG
|
||||
ruled.client.append_rule {
|
||||
rule_any = { class = {
|
||||
"Emacs",
|
||||
"Godot",
|
||||
"Virt-manager"
|
||||
}
|
||||
},
|
||||
properties = { tag = "E" },
|
||||
}
|
||||
-- F TAG
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "vifm" },
|
||||
properties = { tag = "F" },
|
||||
}
|
||||
-- W TAG
|
||||
ruled.client.append_rule {
|
||||
rule_any = { class = {
|
||||
"Brave-browser",
|
||||
"librewolf",
|
||||
"qutebrowser"
|
||||
}
|
||||
},
|
||||
properties = { tag = "W" }
|
||||
}
|
||||
-- C TAG
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "gomuks" },
|
||||
properties = { tag = "C" }
|
||||
}
|
||||
-- M TAG
|
||||
ruled.client.append_rule {
|
||||
rule_any = { class = {
|
||||
"cmus",
|
||||
"Audacity",
|
||||
"Ardour",
|
||||
"Carla2",
|
||||
"Carla2-Control"
|
||||
}
|
||||
},
|
||||
properties = { tag = "M" }
|
||||
}
|
||||
-- V TAG
|
||||
ruled.client.append_rule {
|
||||
rule_any = { class = {
|
||||
"kdenlive",
|
||||
"Blender",
|
||||
"Natron",
|
||||
"SimpleScreenRecorder",
|
||||
"Ghb",
|
||||
"obs",
|
||||
"mpv"
|
||||
}
|
||||
},
|
||||
properties = { tag = "V" }
|
||||
}
|
||||
-- X TAG
|
||||
ruled.client.append_rule {
|
||||
rule_any = { class = {
|
||||
"Qjackctl",
|
||||
"lsp-plugins",
|
||||
"qpwgraph",
|
||||
"Gimp-2.10",
|
||||
"krita",
|
||||
"Inkscape",
|
||||
"Xournalpp",
|
||||
"Bitwarden"
|
||||
}
|
||||
},
|
||||
properties = { tag = "X" }
|
||||
}
|
||||
-- D TAG
|
||||
ruled.client.append_rule {
|
||||
rule_any = { class = {
|
||||
"DesktopEditors",
|
||||
"Joplin"
|
||||
}
|
||||
},
|
||||
properties = { tag = "D" }
|
||||
}
|
||||
-- G TAG
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "retroarch" },
|
||||
properties = { tag = "G" }
|
||||
}
|
||||
--}}}
|
||||
-- }
|
||||
end)
|
|
@ -1,203 +0,0 @@
|
|||
--[[
|
||||
|
||||
Licensed under GNU General Public License v2
|
||||
* (c) 2013, Luca CPZ
|
||||
|
||||
--]]
|
||||
|
||||
local spawn = require("awful.spawn")
|
||||
local timer = require("gears.timer")
|
||||
local debug = require("debug")
|
||||
local io = { lines = io.lines,
|
||||
open = io.open }
|
||||
local pairs = pairs
|
||||
local rawget = rawget
|
||||
local table = { sort = table.sort }
|
||||
|
||||
-- Lain helper functions for internal use
|
||||
-- lain.helpers
|
||||
local helpers = {}
|
||||
|
||||
helpers.lain_dir = debug.getinfo(1, 'S').source:match[[^@(.*/).*$]]
|
||||
helpers.icons_dir = helpers.lain_dir .. 'icons/'
|
||||
helpers.scripts_dir = helpers.lain_dir .. 'scripts/'
|
||||
|
||||
-- {{{ Modules loader
|
||||
|
||||
function helpers.wrequire(table, key)
|
||||
local module = rawget(table, key)
|
||||
return module or require(table._NAME .. '.' .. key)
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ File operations
|
||||
|
||||
-- check if the file exists and is readable
|
||||
function helpers.file_exists(path)
|
||||
local file = io.open(path, "rb")
|
||||
if file then file:close() end
|
||||
return file ~= nil
|
||||
end
|
||||
|
||||
-- get a table with all lines from a file
|
||||
function helpers.lines_from(path)
|
||||
local lines = {}
|
||||
for line in io.lines(path) do
|
||||
lines[#lines + 1] = line
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
-- get a table with all lines from a file matching regexp
|
||||
function helpers.lines_match(regexp, path)
|
||||
local lines = {}
|
||||
for line in io.lines(path) do
|
||||
if string.match(line, regexp) then
|
||||
lines[#lines + 1] = line
|
||||
end
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
-- get first line of a file
|
||||
function helpers.first_line(path)
|
||||
local file, first = io.open(path, "rb"), nil
|
||||
if file then
|
||||
first = file:read("*l")
|
||||
file:close()
|
||||
end
|
||||
return first
|
||||
end
|
||||
|
||||
-- get first non empty line from a file
|
||||
function helpers.first_nonempty_line(path)
|
||||
for line in io.lines(path) do
|
||||
if #line then return line end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ Timer maker
|
||||
|
||||
helpers.timer_table = {}
|
||||
|
||||
function helpers.newtimer(name, timeout, fun, nostart, stoppable)
|
||||
if not name or #name == 0 then return end
|
||||
name = (stoppable and name) or timeout
|
||||
if not helpers.timer_table[name] then
|
||||
helpers.timer_table[name] = timer({ timeout = timeout })
|
||||
helpers.timer_table[name]:start()
|
||||
end
|
||||
helpers.timer_table[name]:connect_signal("timeout", fun)
|
||||
if not nostart then
|
||||
helpers.timer_table[name]:emit_signal("timeout")
|
||||
end
|
||||
return stoppable and helpers.timer_table[name]
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ Pipe operations
|
||||
|
||||
-- run a command and execute a function on its output (asynchronous pipe)
|
||||
-- @param cmd the input command
|
||||
-- @param callback function to execute on cmd output
|
||||
-- @return cmd PID
|
||||
function helpers.async(cmd, callback)
|
||||
return spawn.easy_async(cmd,
|
||||
function (stdout, stderr, reason, exit_code)
|
||||
callback(stdout, exit_code)
|
||||
end)
|
||||
end
|
||||
|
||||
-- like above, but call spawn.easy_async with a shell
|
||||
function helpers.async_with_shell(cmd, callback)
|
||||
return spawn.easy_async_with_shell(cmd,
|
||||
function (stdout, stderr, reason, exit_code)
|
||||
callback(stdout, exit_code)
|
||||
end)
|
||||
end
|
||||
|
||||
-- run a command and execute a function on its output line by line
|
||||
function helpers.line_callback(cmd, callback)
|
||||
return spawn.with_line_callback(cmd, {
|
||||
stdout = function (line)
|
||||
callback(line)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ A map utility
|
||||
|
||||
helpers.map_table = {}
|
||||
|
||||
function helpers.set_map(element, value)
|
||||
helpers.map_table[element] = value
|
||||
end
|
||||
|
||||
function helpers.get_map(element)
|
||||
return helpers.map_table[element]
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ Misc
|
||||
|
||||
-- check if an element exist on a table
|
||||
function helpers.element_in_table(element, tbl)
|
||||
for _, i in pairs(tbl) do
|
||||
if i == element then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- iterate over table of records sorted by keys
|
||||
function helpers.spairs(t)
|
||||
-- collect the keys
|
||||
local keys = {}
|
||||
for k in pairs(t) do keys[#keys+1] = k end
|
||||
|
||||
table.sort(keys)
|
||||
|
||||
-- return the iterator function
|
||||
local i = 0
|
||||
return function()
|
||||
i = i + 1
|
||||
if keys[i] then
|
||||
return keys[i], t[keys[i]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- create the partition of singletons of a given set
|
||||
-- example: the trivial partition set of {a, b, c}, is {{a}, {b}, {c}}
|
||||
function helpers.trivial_partition_set(set)
|
||||
local ss = {}
|
||||
for _,e in pairs(set) do
|
||||
ss[#ss+1] = {e}
|
||||
end
|
||||
return ss
|
||||
end
|
||||
|
||||
-- creates the powerset of a given set
|
||||
function helpers.powerset(s)
|
||||
if not s then return {} end
|
||||
local t = {{}}
|
||||
for i = 1, #s do
|
||||
for j = 1, #t do
|
||||
t[#t+1] = {s[i],unpack(t[j])}
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
return helpers
|
Before Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1,000 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 227 B |
Before Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 526 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 4.8 KiB |