Added README and awesome directory

This commit is contained in:
Egor 2024-08-20 16:20:26 +03:00
parent 01a4fad6d7
commit 4f9c2d21c9
32 changed files with 821 additions and 0 deletions

16
README.md Normal file
View file

@ -0,0 +1,16 @@
# My .config folder
## Dependencies:
- WM: [awesome](https://github.com/awesomeWM/awesome) (previously [hyprland](https://github.com/hyprwm/Hyprland))
- Compositor: [picom](https://github.com/yshui/picom)
- Terminal: [kitty](https://github.com/kovidgoyal/kitty)
- Fonts:
- Default: [Rubik](https://github.com/googlefonts/Rubik)
- Terminal: [CaskaydiaCove Nerd Font](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/CascadiaCode)
- Editor: [neovim](https://github.com/neovim/neovim)
- File Explorer: [nemo](https://github.com/linuxmint/nemo)
- Launcher: [rofi](https://github.com/davatorium/rofi)
- Icons: [Papirus](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
- Cursors: [Babita](https://github.com/ful1e5/Bibata_Cursor)
- Theme: [Catpuccin Mocha](https://github.com/catppuccin/catppuccin)

15
awesome/autorun.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
run() {
if ! pgrep -f "$1" ;
then
"$@"&
fi
}
run "xautolock -detectsleep -time 1 -locker '~/.local/bin/lock.sh'"
run "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
run "nm-applet"
run "picom"
run "openrgb --startminimized -p traaaaa"

View file

@ -0,0 +1,5 @@
-- Returns all client mouse and keybinds.
return {
keys = require(... .. '.keys'),
mouse = require(... .. '.mouse')
}

View file

@ -0,0 +1,49 @@
local awful = require('awful')
local mod = require('binds.mod')
local modkey = mod.modkey
--- Client keybindings.
client.connect_signal('request::default_keybindings', function()
awful.keyboard.append_client_keybindings({
-- Client state management.
awful.key({ modkey, }, 'f',
function(c)
c.fullscreen = not c.fullscreen
c:raise()
end, { description = 'toggle fullscreen', group = 'client' }),
awful.key({ modkey, mod.shift }, 'c', function(c) c:kill() end,
{ description = 'close', group = 'client' }),
awful.key({ modkey, mod.ctrl }, 'space', awful.client.floating.toggle,
{ description = 'toggle floating', group = 'client' }),
awful.key({ modkey, }, 'n',
function(c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end, { description = 'minimize', group = 'client' }),
awful.key({ modkey, }, 'm',
function(c)
c.maximized = not c.maximized
c:raise()
end, { description = '(un)maximize', group = 'client' }),
awful.key({ modkey, mod.ctrl }, 'm',
function(c)
c.maximized_vertical = not c.maximized_vertical
c:raise()
end, { description = '(un)maximize vertically', group = 'client' }),
awful.key({ modkey, mod.shift }, 'm',
function(c)
c.maximized_horizontal = not c.maximized_horizontal
c:raise()
end, { description = '(un)maximize horizontally', group = 'client' }),
-- Client position in tiling management.
awful.key({ modkey, mod.ctrl }, 'Return', function(c) c:swap(awful.client.getmaster()) end,
{ description = 'move to master', group = 'client' }),
awful.key({ modkey, }, 'o', function(c) c:move_to_screen() end,
{ description = 'move to screen', group = 'client' }),
awful.key({ modkey, }, 't', function(c) c.ontop = not c.ontop end,
{ description = 'toggle keep on top', group = 'client' })
})
end)

View file

@ -0,0 +1,19 @@
local awful = require('awful')
local mod = require('binds.mod')
local modkey = mod.modkey
--- Client mouse bindings.
client.connect_signal('request::default_mousebindings', function()
awful.mouse.append_client_mousebindings({
awful.button(nil, 1, function(c)
c:activate({ context = 'mouse_click' })
end),
awful.button({ modkey }, 1, function(c)
c:activate({ context = 'mouse_click', action = 'mouse_move' })
end),
awful.button({ modkey }, 3, function(c)
c:activate({ context = 'mouse_click', action = 'mouse_resize' })
end)
})
end)

View file

@ -0,0 +1,5 @@
-- Returns all global WM mouse and keybinds.
return {
keys = require(... .. '.keys'),
mouse = require(... .. '.mouse')
}

View file

@ -0,0 +1,166 @@
local awful = require('awful')
local mod = require('binds.mod')
local modkey = mod.modkey
local apps = require('config.apps')
local widgets = require('ui')
--- Global key bindings
awful.keyboard.append_global_keybindings({
-- General Awesome keys.
awful.key({ modkey, }, 's', require('awful.hotkeys_popup').show_help,
{ description = 'show help', group = 'awesome' }),
awful.key({ mod.shift }, 'Alt_L', function () awful.widget.keyboardlayout().next_layout() end,
{ description = 'switch keyboard layout', group = 'awesome' }),
awful.key({ mod.alt }, 'Shift_L', function () awful.widget.keyboardlayout().next_layout() end,
{ description = 'switch keyboard layout', group = 'awesome' }),
awful.key({}, 'Print', function () awful.spawn.with_shell('maim -s | xclip -selection clipboard -t image/png') end,
{ description = 'take a screenshot of selected area and copy to clipboard', group = 'awesome' }),
-- Media controls
--awful.key({}, 'XF86AudioRaiseVolume', function () volume_widget:inc(5) end,
-- { description = 'Raise volume', group = 'media' }),
--awful.key({}, 'XF86AudioLowerVolume', function () volume_widget:dec(5) end,
-- { description = 'Lower volume', group = 'media' }),
awful.key({}, 'XF86AudioPlay', function () awful.spawn('playerctl play-pause') end,
{ description = 'Play/Pause media', group = 'media' }),
awful.key({}, 'XF86AudioPause', function () awful.spawn('playerctl play-pause') end,
{ description = 'Play/Pause media', group = 'media' }),
awful.key({}, 'XF86AudioNext', function () awful.spawn('playerctl next') end,
{ description = 'Next track', group = 'media' }),
awful.key({}, 'XF86AudioPrev', function () awful.spawn('playerctl previous') end,
{ description = 'Previous track', group = 'media' }),
awful.key({ modkey, }, 'w', function() widgets.menu.main:show() end,
{ description = 'show main menu', group = 'awesome' }),
awful.key({ modkey, mod.ctrl }, 'r', awesome.restart,
{ description = 'reload awesome', group = 'awesome' }),
awful.key({ modkey, mod.shift }, 'q', awesome.quit,
{ description = 'quit awesome', group = 'awesome' }),
awful.key({ modkey, mod.shift }, 'p', function () awful.spawn.with_shell('~/.local/bin/lock.sh') end,
{ description = 'lock screen', group = 'awesome' }),
awful.key({ modkey }, 'x', function() awful.prompt.run({
prompt = 'Run Lua code: ',
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. '/history_eval' })
end, { description = 'lua execute prompt', group = 'awesome' }),
awful.key({ modkey, }, 'Return', function() awful.spawn(apps.terminal) end,
{ description = 'open a terminal', group = 'launcher' }),
awful.key({ modkey }, 'r', function() awful.spawn('rofi -show drun') end,
{ description = 'run prompt', group = 'launcher' }),
awful.key({ modkey }, 'p', function() require('menubar').show() end,
{ description = 'show the menubar', group = 'launcher' }),
-- Tags related keybindings.
awful.key({ modkey, }, 'Left', awful.tag.viewprev,
{ description = 'view previous', group = 'tag' }),
awful.key({ modkey, }, 'Right', awful.tag.viewnext,
{ description = 'view next', group = 'tag' }),
awful.key({ modkey, }, 'Escape', awful.tag.history.restore,
{ description = 'go back', group = 'tag' }),
-- Focus related keybindings.
awful.key({ modkey, }, 'j', function() awful.client.focus.byidx( 1) end,
{ description = 'focus next by index', group = 'client' }),
awful.key({ modkey, }, 'k', function() awful.client.focus.byidx(-1) end,
{ description = 'focus previous by index', group = 'client'}),
awful.key({ modkey, }, 'Tab', function()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end, { description = 'go back', group = 'client' }),
awful.key({ modkey, mod.ctrl }, 'j', function() awful.screen.focus_relative( 1) end,
{ description = 'focus the next screen', group = 'screen' }),
awful.key({ modkey, mod.ctrl }, 'k', function() awful.screen.focus_relative(-1) end,
{ description = 'focus the previous screen', group = 'screen' }),
awful.key({ modkey, mod.ctrl }, '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' }),
-- Layout related keybindings.
awful.key({ modkey, mod.shift }, 'j', function() awful.client.swap.byidx( 1) end,
{ description = 'swap with next client by index', group = 'client' }),
awful.key({ modkey, mod.shift }, 'k', function() awful.client.swap.byidx(-1) end,
{ description = 'swap with previous client by index', group = 'client' }),
awful.key({ modkey, }, 'u', awful.client.urgent.jumpto,
{ description = 'jump to urgent client', group = 'client' }),
awful.key({ modkey, }, 'l', function() awful.tag.incmwfact( 0.05) end,
{ description = 'increase master width factor', group = 'layout' }),
awful.key({ modkey, }, 'h', function() awful.tag.incmwfact(-0.05) end,
{ description = 'decrease master width factor', group = 'layout' }),
awful.key({ modkey, mod.shift }, 'h', function() awful.tag.incnmaster( 1, nil, true) end,
{ description = 'increase the number of master clients', group = 'layout' }),
awful.key({ modkey, mod.shift }, 'l', function() awful.tag.incnmaster(-1, nil, true) end,
{ description = 'decrease the number of master clients', group = 'layout' }),
awful.key({ modkey, mod.ctrl }, 'h', function() awful.tag.incncol( 1, nil, true) end,
{ description = 'increase the number of columns', group = 'layout' }),
awful.key({ modkey, mod.ctrl }, 'l', function() awful.tag.incncol(-1, nil, true) end,
{ description = 'decrease the number of columns', group = 'layout' }),
awful.key({ modkey, }, 'space', function() awful.layout.inc( 1) end,
{ description = 'select next', group = 'layout' }),
awful.key({ modkey, mod.shift }, 'space', function() awful.layout.inc(-1) end,
{ description = 'select previous', group = 'layout' }),
awful.key({
modifiers = { modkey },
keygroup = 'numrow',
description = 'only view tag',
group = 'tag',
on_press = function(index)
local tag = awful.screen.focused().tags[index]
if tag then tag:view_only() end
end
}),
awful.key({
modifiers = { modkey, mod.ctrl },
keygroup = 'numrow',
description = 'toggle tag',
group = 'tag',
on_press = function(index)
local tag = awful.screen.focused().tags[index]
if tag then awful.tag.viewtoggle(tag) end
end
}),
awful.key({
modifiers = { modkey, mod.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
}),
awful.key({
modifiers = { modkey, mod.ctrl, mod.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
}),
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
})
})

View file

@ -0,0 +1,10 @@
local awful = require('awful')
local widgets = require('ui')
--- Global mouse bindings
awful.mouse.append_global_mousebindings({
awful.button(nil, 3, function() widgets.menu.main:toggle() end),
awful.button(nil, 4, awful.tag.viewprev),
awful.button(nil, 5, awful.tag.viewnext)
})

5
awesome/binds/init.lua Normal file
View file

@ -0,0 +1,5 @@
-- Returns all mouse and keybinds for both clients and the WM.
return {
global = require(... .. '.global'),
client = require(... .. '.client')
}

9
awesome/binds/mod.lua Normal file
View file

@ -0,0 +1,9 @@
return {
alt = 'Mod1',
super = 'Mod4',
shift = 'Shift',
ctrl = 'Control',
-- Set Super as default modkey if none is present.
modkey = require('config.user').mod or 'Mod4'
}

10
awesome/config/apps.lua Normal file
View file

@ -0,0 +1,10 @@
-- This is used later as the default terminal and editor to run.
local apps = {}
apps.terminal = 'kitty'
apps.editor = os.getenv('EDITOR') or 'nvim'
apps.editor_cmd = apps.terminal .. ' -e ' .. apps.editor
-- Set the terminal for the menubar.
require('menubar').utils.terminal = apps.terminal
return apps

41
awesome/config/rules.lua Normal file
View file

@ -0,0 +1,41 @@
local awful = require('awful')
local ruled = require('ruled')
--- Rules.
-- 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 + awful.placement.centered
}
})
-- Add titlebars to normal clients and dialogs.config
ruled.client.append_rule({
id = 'titlebars',
rule_any = { type = { 'normal', 'dialog' } },
properties = { titlebars_enabled = false }
})
ruled.client.append_rule({
rule = { class = 'steam' },
properties = { screen = 1, tag = '3: Gaming' }
})
ruled.client.append_rule({
rule = { class = 'discord' },
properties = { screen = 2, tag = '2: Discord' }
})
ruled.client.append_rule({
rule = { class = 'nekoray' },
properties = { screen = 2, tag = '3: VPN' }
})
end)

38
awesome/config/user.lua Normal file
View file

@ -0,0 +1,38 @@
local awful = require('awful')
-- Specify user preferences for Awesome's behavior.
return {
-- 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.
mod = 'Mod4',
-- Table of layouts to cover with awful.layout.inc, ORDER MATTERS, the first layout
-- in the table is your DEFAULT LAYOUT.
layouts = {
awful.layout.suit.tile.left,
awful.layout.suit.floating,
-- awful.layout.suit.tile,
-- 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
},
screens = {
{
tags = { '1: Main', '2: Dev', '3: Gaming', '4', '5' },
layouts = { awful.layout.suit.floating, awful.layout.suit.tile.left, awful.layout.suit.floating, awful.layout.suit.tile.left }
},
{
tags = { '1: Web', '2: Discord', '3: VPN', '4', '5' },
layouts = { awful.layout.suit.tile.left, awful.layout.suit.tile.left, awful.layout.suit.tile.left, awful.layout.suit.tile.left }
}
}
}

44
awesome/module/README.md Normal file
View file

@ -0,0 +1,44 @@
# AwesomeWM Community Modules
This directory serves as a container for community modules, for easy access in code.
To add submodules like the popular [bling](https://github.com/blingcorp/bling) or
[rubato](https://github.com/andorlando/rubato), either clone their repos into this
directory or add them as submodules of this repository.
An example file structure would be:
```
~/.config/awesome/
...
- module
- bling
...
init.lua
- rubato
...
init.lua
- some_mod
...
init.lua
...
...
```
Which would allow you to use these modules anywhere inside the config directory by
simply referencing them as:
```
local bling = require('module.bling')
local some_mod = require('module.some_mod')
```
## Common Community Modules
- [blingcorp/bling](https://github.com/blingcorp/bling), a collaborative community library
providing several goods like new layouts, widgets, signals and functionality like
scratchpads and tabbing.
- [andOrlando/rubato](https://github.com/andorlando/rubato), an animation library that's
easy to use. Do mind the fact that AWM runs on a **single CPU thread** and animations can
stress it pretty hard, so don't abuse them.
- [Aire-One/awesome-battery_widget](https://github.com/aire-one/awesome-battery_widget),
a simple and quick library providing battery information for laptops.
And many more.

69
awesome/rc.lua Normal file
View file

@ -0,0 +1,69 @@
-- awesome_mode: api-level=4:screen=on
-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, 'luarocks.loader')
--- Error handling.
-- Notification library.
local naughty = require('naughty')
-- 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)
-- Allow Awesome to automatically focus a client upon changing tags or loading.
require('awful.autofocus')
-- Enable hotkeys help widget for VIM and other apps when client with a matching
-- name is opened:
require('awful.hotkeys_popup.keys')
-- Load the theme. In other words, defines the variables within the `beautiful`
-- table.
require('theme')
-- Treat all signals. Bear in mind this implies creating all tags, attaching
-- their layouts, setting client behavior and loading UI.
require('signal')
-- Set all keybinds.
require('binds')
-- Load all client rules.
require('config.rules')
local awful = require('awful')
-- Autorun background daemons
awful.spawn.with_shell('~/.config/awesome/autorun.sh')
-- Autorun windowed apps
local autorunApps = {
{
app = "nekoray",
rules = { screen = 2, tag = "3: VPN" },
matcher = nil,
unique_id = nil
},
{
app = "firefox",
rules = { screen = 2, tag = "1: Web" },
matcher = nil,
unique_id = nil
},
{
app = "discord",
rules = { screen = 2, tag = "2: Discord" },
matcher = nil,
unique_id = nil
}
}
for i = 1, #autorunApps do
awful.spawn.once(autorunApps[i].app, autorunApps[i].rules, autorunApps[i].matcher, autorunApps[i].unique_id)
end

13
awesome/signal/client.lua Normal file
View file

@ -0,0 +1,13 @@
-- Add a titlebar if titlebars_enabled is set to true for the client in `config/rules.lua`.
client.connect_signal('request::titlebars', function(c)
-- While this isn't actually in the example configuration, it's the most sane thing to do.
-- If a client expressly says not to draw titlebars on it, just don't.
if c.requests_no_titlebars then return end
require('ui.titlebar').normal(c)
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal('mouse::enter', function(c)
c:activate({ context = 'mouse_enter', raise = false })
end)

9
awesome/signal/init.lua Normal file
View file

@ -0,0 +1,9 @@
-- Allows all signals to be connected and/or emitted.
return {
client = require(... .. '.client'),
-- NOTE: The `tag` file must be loaded before the `screen` one so that
-- the correct layouts defined in `config.user` are appended to the tags
-- upon creation.
tag = require(... .. '.tag'),
screen = require(... .. '.screen')
}

41
awesome/signal/screen.lua Normal file
View file

@ -0,0 +1,41 @@
local awful = require('awful')
local beautiful = require('beautiful')
local wibox = require('wibox')
local widgets = require('ui')
--- Attach tags and widgets to all screens.
screen.connect_signal('request::desktop_decoration', function(s)
-- Create all tags and attach the layouts to each of them.
local settings = require('config.user').screens[s.index]
awful.tag(settings.tags, s, settings.layouts)
-- Attach a wibar to each screen.
widgets.wibar(s)
end)
--- Wallpaper.
-- NOTE: `awful.wallpaper` is ideal for creating a wallpaper IF YOU
-- BENEFIT FROM IT BEING A WIDGET and not just the root window
-- background. IF YOU JUST WISH TO SET THE ROOT WINDOW BACKGROUND, you
-- may want to use the deprecated `gears.wallpaper` instead. This is
-- the most common case of just wanting to set an image as wallpaper.
screen.connect_signal('request::wallpaper', function(s)
awful.wallpaper({
screen = s,
widget = {
widget = wibox.container.tile,
valign = 'center',
halign = 'center',
tiled = false,
{
widget = wibox.widget.imagebox,
image = beautiful.wallpaper,
upscale = true,
downscale = true
}
}
})
end)
-- An example of what's mentioned above. For more information, see:
-- https://awesomewm.org/apidoc/utility_libraries/gears.wallpaper.html
-- gears.wallpaper.maximized(beautiful.wallpaper)

5
awesome/signal/tag.lua Normal file
View file

@ -0,0 +1,5 @@
--- Tag layouts.
-- Appends all layouts defined in `config/user.lua` to all tags.
tag.connect_signal('request::default_layouts', function()
require('awful').layout.append_default_layouts(require('config.user').layouts)
end)

17
awesome/theme/init.lua Normal file
View file

@ -0,0 +1,17 @@
-- Theme handling library
local beautiful = require('beautiful')
-- Standard awesome library
local gears = require('gears')
local xresources = require('beautiful.xresources')
local dpi = xresources.apply_dpi
local theme = dofile(gears.filesystem.get_themes_dir() .. 'xresources/theme.lua')
theme.wallpaper = '/home/egor/Pictures/wallpapers/wallhaven-8586my.png'
theme.font = 'Rubik Medium 10'
theme.icons = '/usr/share/icons/Papirus-Dark'
theme.useless_gap = dpi(6)
-- Themes define colors, icons, font and wallpapers.
beautiful.init(theme)

7
awesome/ui/init.lua Normal file
View file

@ -0,0 +1,7 @@
-- Returns all widgets, with assigned names, in a table.
return {
menu = require(... .. '.menu'),
notification = require(... .. '.notification'),
titlebar = require(... .. '.titlebar'),
wibar = require(... .. '.wibar')
}

31
awesome/ui/menu/init.lua Normal file
View file

@ -0,0 +1,31 @@
local awful = require('awful')
local beautiful = require('beautiful')
--- Menu
local menu = {}
local apps = require('config.apps')
local hkey_popup = require('awful.hotkeys_popup')
-- Create a main menu.
menu.awesome = {
{ 'hotkeys', function() hkey_popup.show_help(nil, awful.screen.focused()) end },
{ 'manual', apps.terminal .. ' -e man awesome' },
-- Not part of the original config but extremely useful, especially as the example
-- config is meant to serve as an example to build your own environment upon.
{
'docs',
(os.getenv('BROWSER') or 'firefox') .. ' https://awesomewm.org/apidoc'
},
{ 'edit config', apps.editor_cmd .. ' ' .. awesome.conffile },
{ 'restart', awesome.restart },
{ 'quit', function() awesome.quit() end }
}
menu.main = awful.menu({
items = {
{ 'awesome', menu.awesome, beautiful.awesome_icon },
{ 'open terminal', apps.terminal }
}
})
return menu

View file

@ -0,0 +1,5 @@
-- Allows for expanding into notifications for special cases, for example,
-- for music.
return {
normal = require(... .. '.normal')
}

View file

@ -0,0 +1,20 @@
local awful = require('awful')
local naughty = require('naughty')
local ruled = require('ruled')
--- Notifications
ruled.notification.connect_signal('request::rules', function()
-- All notifications will match this rule.
ruled.notification.append_rule({
rule = nil,
properties = {
screen = awful.screen.preferred,
implicit_timeout = 5
}
})
end)
-- Defines the default notification layout.
naughty.connect_signal('request::display', function(n)
naughty.layout.box({ notification = n })
end)

View file

@ -0,0 +1,5 @@
-- Returns titlebars for normal clients, this structure allows one to
-- easily define special titlebars for particular clients.
return {
normal = require(... .. '.normal')
}

View file

@ -0,0 +1,44 @@
local awful = require('awful')
local wibox = require('wibox')
--- The titlebar to be used on normal clients.
return function(c)
-- Buttons for the titlebar.
local buttons = {
awful.button(nil, 1, function()
c:activate({ context = 'titlebar', action = 'mouse_move' })
end),
awful.button(nil, 3, function()
c:activate({ context = 'titlebar', action = 'mouse_resize' })
end)
}
-- Draws the client titlebar at the default position (top) and size.
awful.titlebar(c).widget = wibox.widget({
layout = wibox.layout.align.horizontal,
-- Left
{
layout = wibox.layout.fixed.horizontal,
awful.titlebar.widget.iconwidget(c),
buttons = buttons
},
-- Middle
{
layout = wibox.layout.flex.horizontal,
{ -- Title
widget = awful.titlebar.widget.titlewidget(c),
halign = 'center'
},
buttons = buttons
},
-- Right
{
layout = wibox.layout.fixed.horizontal,
awful.titlebar.widget.floatingbutton(c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton(c),
awful.titlebar.widget.ontopbutton(c),
awful.titlebar.widget.closebutton(c)
}
})
end

34
awesome/ui/wibar/init.lua Normal file
View file

@ -0,0 +1,34 @@
local awful = require('awful')
local wibox = require('wibox')
local module = require(... .. '.module')
return function(s)
s.mypromptbox = awful.widget.prompt() -- Create a promptbox.
-- Create the wibox
s.mywibox = awful.wibar({
position = 'top',
screen = s,
widget = {
layout = wibox.layout.align.horizontal,
-- Left widgets.
{
layout = wibox.layout.fixed.horizontal,
--module.launcher(),
module.taglist(s),
s.mypromptbox
},
-- Middle widgets.
module.tasklist(s),
-- Right widgets.
{
layout = wibox.layout.fixed.horizontal,
awful.widget.keyboardlayout(), -- Keyboard map indicator and switcher.
wibox.widget.systray(),
wibox.widget.textclock(), -- Create a textclock widget.
module.layoutbox(s)
}
}
})
end

View file

@ -0,0 +1,8 @@
-- Return a table containing all bar modules, with a name attached
-- to each.
return {
--launcher = require(... .. '.launcher'),
taglist = require(... .. '.taglist'),
tasklist = require(... .. '.tasklist'),
layoutbox = require(... .. '.layoutbox')
}

View file

@ -0,0 +1,10 @@
local awful = require('awful')
local beautiful = require('beautiful')
-- Create a launcher widget. Opens the Awesome menu when clicked.
return function()
return awful.widget.launcher({
image = beautiful.awesome_icon,
menu = require('ui.menu').main
})
end

View file

@ -0,0 +1,15 @@
local awful = require('awful')
return function(s)
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
return awful.widget.layoutbox({
screen = s,
buttons = {
awful.button(nil, 1, function() awful.layout.inc( 1) end),
awful.button(nil, 3, function() awful.layout.inc(-1) end),
awful.button(nil, 4, function() awful.layout.inc(-1) end),
awful.button(nil, 5, function() awful.layout.inc( 1) end)
}
})
end

View file

@ -0,0 +1,34 @@
local awful = require('awful')
local mod = require('binds.mod')
local modkey = mod.modkey
return function(s)
-- Create a taglist widget
return awful.widget.taglist({
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = {
-- Left-clicking a tag changes to it.
awful.button(nil, 1, function(t) t:view_only() end),
-- Mod + Left-clicking a tag sends the currently focused client to it.
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
-- Right-clicking a tag makes its contents visible in the current one.
awful.button(nil, 3, awful.tag.viewtoggle),
-- Mod + Right-clicking a tag makes the currently focused client visible
-- in it.
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
-- Mousewheel scrolling cycles through tags.
awful.button(nil, 4, function(t) awful.tag.viewprev(t.screen) end),
awful.button(nil, 5, function(t) awful.tag.viewnext(t.screen) end)
}
})
end

View file

@ -0,0 +1,22 @@
local awful = require('awful')
return function(s)
-- Create a tasklist widget
return awful.widget.tasklist({
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = {
-- Left-clicking a client indicator minimizes it if it's unminimized, or unminimizes
-- it if it's minimized.
awful.button(nil, 1, function(c)
c:activate({ context = 'tasklist', action = 'toggle_minimization' })
end),
-- Right-clicking a client indicator shows the list of all open clients in all visible
-- tags.
awful.button(nil, 3, function() awful.menu.client_list({ theme = { width = 250 } }) end),
-- Mousewheel scrolling cycles through clients.
awful.button(nil, 4, function() awful.client.focus.byidx(-1) end),
awful.button(nil, 5, function() awful.client.focus.byidx( 1) end)
}
})
end