Skip to content
Snippets Groups Projects
Commit 2e30b6fb authored by David Bernet's avatar David Bernet
Browse files

Update rc.lua

parent 5993b1a8
No related branches found
No related tags found
No related merge requests found
......@@ -7,19 +7,26 @@ local gears = require("gears")
local gmath = require("gears.math")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
-- {{{ Error handling
--------------------------
-- -- 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)
if awesome.startup_errors then
......@@ -42,114 +49,115 @@ do
in_error = false
end)
end
-- }}}
-- {{{ Variable definitions
--------------------
------------
-- -- VARIABLE DEFINITIONS -- --
--------------------------------
-- Themes define colours, icons, font and wallpapers.
-- beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
beautiful.init(gears.filesystem.get_configuration_dir() .. 'themes/custom.lua')
-- This is used later as the default terminal and editor to run.
-- default terminal
terminal = "kitty"
-- default editor
editor = os.getenv("EDITOR") or "code"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
-- awful.layout.suit.floating,
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.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
}
-- }}}
-- {{{ Menu
-- Create a launcher widget and a main menu
----------------
-- -- MENU -- --
----------------
-- Benutzer
useractions = {
{ "Abmelden", function() awesome.quit() end },
{ "Neustarten", function() awful.spawn("systemctl reboot") end },
{ "Energie sparen", function() awful.spawn("systemctl suspend") end },
{ "Herunterfahren", function() awful.spawn("systemctl poweroff") end },
}
-- Window Manager
myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", function() awesome.quit() end },
}
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Hauptmenü
mymainmenu = awful.menu({
items = {
{ "Benutzer", useractions },
{ "Window Manager", myawesomemenu },
{ "Terminal", terminal }
}
})
-----------------
-- -- WIBAR -- --
-----------------
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
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.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
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.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end),
awful.button({ }, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
awful.button(
{ }, 1,
function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end
),
awful.button(
{ }, 3,
function (c) awful.menu.client_list({ theme = { width = 250 } }) end
),
awful.button( { }, 4, function () awful.client.focus.byidx(1) end ),
awful.button( { }, 5, function () awful.client.focus.byidx(-1) end)
)
----------------------------------
-- -- HINTERGRUNDBILD SETZEN -- --
----------------------------------
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
......@@ -165,23 +173,17 @@ end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
-------------------------------
-- -- MONITORE EINRICHTEN -- --
-------------------------------
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
-- Wallpaper einrichten
set_wallpaper(s)
-- Each screen has its own tag table.
-- Arbeitsflächen einstellen
awful.tag({ " Ⅰ ", " Ⅱ ", " Ⅲ ", " Ⅳ ", " Ⅴ " }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(gears.table.join(
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)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
......@@ -205,7 +207,6 @@ awful.screen.connect_for_each_screen(function(s)
widget = wibox.widget.textclock
}
s.my_clock:buttons(gears.table.join(
s.my_clock:buttons(),
awful.button({}, 1, nil, function()
......@@ -216,258 +217,277 @@ awful.screen.connect_for_each_screen(function(s)
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
{
-- Left widgets
layout = wibox.layout.fixed.horizontal,
-- mylauncher,
s.mytaglist,
s.mypromptbox,
s.mytaglist
},
s.mytasklist, -- Middle widget
{ -- Right widgets
-- Middle widget
s.mytasklist,
{
-- Right widgets
layout = wibox.layout.fixed.horizontal,
-- mykeyboardlayout,
wibox.widget.systray(),
spacer,
-- awful.widget.watch("date", 1),
-- Create a textclock widget
s.my_clock,
-- s.mylayoutbox,
},
}
end)
-- }}}
-- {{{ Mouse bindings
--------------------------
-- -- MOUSE BINDINGS -- --
--------------------------
root.buttons(gears.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
local function move_to_previous_tag()
local c = client.focus
if not c then return end
local t = c.screen.selected_tag
local tags = c.screen.tags
local idx = t.index
local newtag = tags[gmath.cycle(#tags, idx-1)]
c:move_to_tag(newtag)
awful.tag.viewprev()
end
local function move_to_next_tag()
local c = client.focus
if not c then return end
local t = c.screen.selected_tag
local tags = c.screen.tags
local idx = t.index
local newtag = tags[gmath.cycle(#tags, idx+1)]
c:move_to_tag(newtag)
awful.tag.viewnext()
end
-- {{{ Key bindings
-----------------------------
-- -- KEYBOARD BINDINGS -- --
-----------------------------
globalkeys = gears.table.join(
-- reload awesome
awful.key(
{ modkey, "Control" }, "r",
awesome.restart,
{description = "reload awesome", group = "awesome"}
),
awful.key({ modkey, }, "Left", awful.tag.viewprev,
{description = "Arbeitsfläche links", group = "Workspace"}),
awful.key({ modkey, }, "Right", awful.tag.viewnext,
{description = "Arbeitsfläche rechts", group = "Workspace"}),
-- run prompt
awful.key(
{ modkey }, "r",
function () awful.spawn("rofi -show drun") end,
{description = "run prompt", group = "Launcher"}
),
awful.key({ modkey, "Ctrl" }, "Left", function(c) move_to_previous_tag() end,
{description = "Fenster nach links", group = "Workspace"}),
awful.key({ modkey, "Ctrl" }, "Right", function(c) move_to_next_tag() end,
{description = "Fenster nach rechts", group = "Workspace"}),
---------------------
-- WINDOW CONTROLL --
---------------------
-- move view to left tag
awful.key(
{ modkey }, "Left",
awful.tag.viewprev,
{description = "Arbeitsfläche links", group = "Workspace"}
),
awful.key({ modkey, }, "Down",
function ()
awful.client.focus.byidx( 1)
end,
-- move view to right tag
awful.key(
{ modkey }, "Right",
awful.tag.viewnext,
{description = "Arbeitsfläche rechts", group = "Workspace"}
),
-- move focus down
awful.key(
{ modkey }, "Down",
function () awful.client.focus.byidx(1) end,
{description = "Fokus vorheriges Fenster", group = "Fenster"}
),
awful.key({ modkey, }, "Up",
function ()
awful.client.focus.byidx(-1)
end,
-- move focus up
awful.key(
{ modkey }, "Up",
function () awful.client.focus.byidx(-1) end,
{description = "Fokus nächstes Fenster", group = "Fenster"}
),
-- Layout manipulation
awful.key({ modkey, "Ctrl" }, "Down", function () awful.client.swap.byidx( 1) end,
{description = "Fenster nach unten schieben", group = "Fenster"}),
awful.key({ modkey, "Ctrl" }, "Up", function () awful.client.swap.byidx( -1) end,
{description = "Fenster nach oben schieben", group = "Fenster"}),
awful.key({ modkey }, "o", function () awful.screen.focus_relative( 1) end,
{description = "Fokus auf nächsten Monitor", group = "Monitor"}),
-- move window to left tag
awful.key(
{ modkey, "Ctrl" }, "Left",
function(c)
local c = client.focus
if not c then return end
local t = c.screen.selected_tag
local tags = c.screen.tags
local idx = t.index
local newtag = tags[gmath.cycle(#tags, idx-1)]
c:move_to_tag(newtag)
awful.tag.viewprev()
end,
{description = "Fenster nach links", group = "Workspace"}
),
-- move window to right tag
awful.key(
{ modkey, "Ctrl" }, "Right",
function(c)
local c = client.focus
if not c then return end
local t = c.screen.selected_tag
local tags = c.screen.tags
local idx = t.index
local newtag = tags[gmath.cycle(#tags, idx+1)]
c:move_to_tag(newtag)
awful.tag.viewnext()
end,
{description = "Fenster nach rechts", group = "Workspace"}
),
-- move window down
awful.key(
{ modkey, "Ctrl" }, "Down",
function () awful.client.swap.byidx(1) end,
{description = "Fenster nach unten schieben", group = "Fenster"}
),
-- move window up
awful.key(
{ modkey, "Ctrl" }, "Up",
function () awful.client.swap.byidx( -1) end,
{description = "Fenster nach oben schieben", group = "Fenster"}
),
-- Standard program
-- move window to next display
awful.key(
{ modkey, "Ctrl" }, "o",
function () awful.screen.focus_relative( 1) end,
{description = "Fokus auf nächsten Monitor", group = "Monitor"}
),
---------------------
-- PROGRAM STARTER --
---------------------
-- Terminal
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
{description = "Terminal", group = "Launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}),
-- Prompt
awful.key({ modkey }, "r", function () awful.spawn("rofi -show drun") end,
{description = "run prompt", group = "Launcher"}),
awful.key({ modkey }, "e", function () awful.spawn("firefox") end,
-- Explorer
awful.key({ modkey }, "e", function () awful.spawn("nemo") end,
{description = "Explorer", group = "Launcher"}),
-- Browser
awful.key({ modkey }, "w", function () awful.spawn("firefox") end,
{description = "Web browser", group = "Launcher"}),
-- Email
awful.key({ modkey }, "t", function () awful.spawn("thunderbird") end,
{description = "Email client", group = "Launcher"}),
awful.key({ modkey }, "d", function () awful.spawn("discord") end,
{description = "Discord", group = "Launcher"}),
awful.key({ modkey }, "s", function () awful.spawn("steam") end,
{description = "Steam", group = "Launcher"})
{description = "Email client", group = "Launcher"})
)
---------------------
-- CLIENT CONTROLL --
---------------------
clientkeys = gears.table.join(
awful.key({ modkey, }, "space",
-- toggle floating
awful.key(
{ modkey, "Control" }, "space",
awful.client.floating.toggle,
{description = "toggle floating", group = "client"}
),
-- toggle fullscreen
awful.key(
{ modkey }, "m",
function (c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{description = "toggle fullscreen", group = "Fenster"}),
{description = "toggle fullscreen", group = "Fenster"}
),
awful.key({ modkey }, "q", function (c) c:kill() end,
{description = "close", group = "Fenster"}),
-- close window
awful.key(
{ modkey }, "q",
function (c) c:kill() end,
{ description = "close", group = "Fenster" }
),
awful.key({ modkey, "Ctrl" }, "o", function (c) c:move_to_screen() end,
{description = "move to screen", group = "client"}),
-- move window to next screen
awful.key(
{ modkey }, "o",
function (c) c:move_to_screen() end,
{ description = "move to screen", group = "client" }
),
awful.key({ modkey, }, "m",
-- toggle maximize
awful.key(
{ modkey }, "space",
function (c)
c.maximized = not c.maximized
c:raise()
end ,
{description = "(un)maximize", group = "client"})
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
end,
{description = "view tag #"..i, group = "Workspaces"}),
-- Toggle tag display.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{description = "toggle tag #" .. i, group = "Workspaces"}),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{description = "move focused client to tag #"..i, group = "Workspaces"}),
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{description = "toggle focused client on tag #" .. i, group = "Workspaces"})
end,
{ description = "(un)maximize", group = "client"}
)
end
clientbuttons = gears.table.join(
awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
end),
awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c)
end)
)
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
clientbuttons = gears.table.join(
awful.button({ }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
end),
awful.button({ modkey }, 1, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c)
end)
)
-----------------
-- -- RULES -- --
-----------------
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
{ -- All clients will match this rule.
rule = { },
properties = {
border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"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.
{ -- Floating clients.
rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"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.
}
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"ConfigManager", -- Thunderbird's about:config.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { floating = true }},
properties = { floating = true }
},
}
-- }}}
-- {{{ Signals
-------------------
-- -- SIGNALS -- --
-------------------
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
......@@ -482,7 +502,6 @@ client.connect_signal("manage", function (c)
end
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false})
......@@ -490,8 +509,11 @@ end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
---------------------------
-- -- DYNAMIC BORDERS -- --
---------------------------
beautiful.fullscreen_hide_border = true
beautiful.maximized_hide_border = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment