Awesome configs for Ben.

This commit is contained in:
Derek Taylor
2023-04-05 14:32:50 -05:00
parent 1966d656c1
commit 6252ad30c1
608 changed files with 9300 additions and 3600 deletions

View File

@@ -0,0 +1,9 @@
# Awesome4Laptop
Installation:
git clone https://github.com/msjche/Awesome4Laptop.git ~/.config/awesome
cd ~/.config/awesome && cp -r Awesome4Laptop/* .
rm -r Awesome4Laptop
![Alt text](screenshot.png?raw=true "Title")

View File

@@ -1,923 +0,0 @@
#+TITLE: Awesome WM Config
#+AUTHOR: Derek Taylor
#+PROPERTY: header-args :tangle rc.lua
#+auto_tangle: t
#+STARTUP: showeverything
* Table of Contents :toc:
- [[#about-this-config][About This Config]]
- [[#features-of-awesome][Features of Awesome]]
- [[#libraries][Libraries]]
- [[#error-handling][Error Handling]]
- [[#auto-start-windowless-processes][Auto start windowless processes]]
- [[#setting-our-theme][Setting our theme]]
- [[#variable-definitions][Variable definitions]]
- [[#tags-and-layouts][Tags and Layouts]]
- [[#menu][Menu]]
- [[#system-sounds][System Sounds]]
- [[#screen-and-wallpaper][Screen and wallpaper]]
- [[#mouse-bindings][Mouse bindings]]
- [[#keybindings][Keybindings]]
- [[#rules][Rules]]
- [[#signals][Signals]]
- [[#enable-sloppy-focus][Enable sloppy focus]]
- [[#autostart][Autostart]]
* About This Config
#+CAPTION: Awesome Scrot
#+ATTR_HTML: :alt Awesome Scrot :title Awesome Scrot :align left
[[https://gitlab.com/dwt1/dotfiles/-/raw/master/.screenshots/dotfiles09-thumb.png]]
This is the awesome window manager configuration of Derek Taylor (DistroTube)
- My YouTube: http://www.youtube.com/c/DistroTube
- My GitLab: http://www.gitlab.com/dwt1/
My awesome window manager configuration. Keep in mind, that my configs are purposely bloated with examples of what you can do with awesome. It is written more as a study guide rather than a config that you should download and use. Take what works for you; leave the rest!
* Features of Awesome
- Simple enough for beginner's but flexible enough for the power user.
- Extremely customizable, maybe more so than any other window manager.
- Configured in Lua.
- A documented API to configure and define the behavior of your window manager.
* Libraries
These are Lua modules that we must import so that we can use their functions later in the config.
#+BEGIN_SRC lua
local awesome, client, mouse, screen, tag = awesome, client, mouse, screen, tag
local ipairs, string, os, table, tostring, tonumber, type = ipairs, string, os, table, tostring, tonumber, type
-- Standard awesome library
local gears = require("gears") --Utilities such as color parsing and objects
local awful = require("awful") --Everything related to window managment
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
naughty.config.defaults['icon_size'] = 100
local lain = require("lain")
local freedesktop = require("freedesktop")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
local hotkeys_popup = require("awful.hotkeys_popup").widget
require("awful.hotkeys_popup.keys")
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
#+END_SRC
* 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)
#+BEGIN_SRC lua
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err) })
in_error = false
end)
end
#+END_SRC
* Auto start windowless processes
#+BEGIN_SRC lua
local function run_once(cmd_arr)
for _, cmd in ipairs(cmd_arr) do
awful.spawn.with_shell(string.format("pgrep -u $USER -fx '%s' > /dev/null || (%s)", cmd, cmd))
end
end
run_once({ "unclutter -root" }) -- entries must be comma-separated
#+END_SRC
* Setting our theme
We can have multiple themes available to us and set the one we want to use with chosen_theme.
#+BEGIN_SRC lua
local themes = {
"powerarrow", -- 1
}
-- choose your theme here
local chosen_theme = themes[1]
local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme)
beautiful.init(theme_path)
#+END_SRC
* Variable definitions
It's nice to assign values to stuff that you will use more than once
in the config. Setting values for things like font, terminal and editor
means you only have to change the value here to make changes globally.
#+BEGIN_SRC lua
local modkey = "Mod4"
local altkey = "Mod1"
local ctrlkey = "Control"
local terminal = "alacritty"
local browser = "qutebrowser"
local editor = os.getenv("EDITOR") or "vim"
local emacs = "emacsclient -c -a 'emacs' "
local colorscheme = "DoomOne"
local mediaplayer = "mpv"
local soundplayer = "ffplay -nodisp -autoexit " -- The program that will play system sounds
#+END_SRC
* Tags and Layouts
Tags are essentially our workspaces. There are a ton of layouts available in awesome. I have most of them commented out, but if you want to try them out, then simply uncomment them.
#+BEGIN_SRC lua
-- awesome variables
awful.util.terminal = terminal
--awful.util.tagnames = { " ", " ", " ", " ", " ", " ", " ", " ", " ", " " }
awful.util.tagnames = { " DEV ", " WWW ", " SYS ", " DOC ", " VBOX ", " CHAT ", " MUS ", " VID ", " GFX " }
awful.layout.suit.tile.left.mirror = true
awful.layout.layouts = {
awful.layout.suit.tile,
awful.layout.suit.floating,
--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,
--lain.layout.cascade,
--lain.layout.cascade.tile,
--lain.layout.centerwork,
--lain.layout.centerwork.horizontal,
--lain.layout.termfair,
--lain.layout.termfair.center,
}
awful.util.taglist_buttons = my_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.util.tasklist_buttons = my_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 ()
local instance = nil
return function ()
if instance and instance.wibox.visible then
instance:hide()
instance = nil
else
instance = awful.menu.clients({theme = {width = 250}})
end
end
end),
awful.button({ }, 4, function () awful.client.focus.byidx(1) end),
awful.button({ }, 5, function () awful.client.focus.byidx(-1) end)
)
lain.layout.termfair.nmaster = 3
lain.layout.termfair.ncol = 1
lain.layout.termfair.center.nmaster = 3
lain.layout.termfair.center.ncol = 1
lain.layout.cascade.tile.offset_x = 2
lain.layout.cascade.tile.offset_y = 32
lain.layout.cascade.tile.extra_padding = 5
lain.layout.cascade.tile.nmaster = 5
lain.layout.cascade.tile.ncol = 2
beautiful.init(string.format(gears.filesystem.get_configuration_dir() .. "/themes/%s/theme.lua", chosen_theme))
#+END_SRC
* Menu
Awesome has a menu system if you want to use it.
#+BEGIN_SRC lua
local myawesomemenu = {
{ "hotkeys", function() return false, hotkeys_popup.show_help end },
{ "manual", terminal .. " -e 'man awesome'" },
{ "edit config", "emacsclient -c -a emacs ~/.config/awesome/rc.lua" },
{ "arandr", "arandr" },
{ "restart", awesome.restart },
}
awful.util.mymainmenu = freedesktop.menu.build({
icon_size = beautiful.menu_height or 16,
before = {
{ "Awesome", myawesomemenu, beautiful.awesome_icon },
--{ "Atom", "atom" },
-- other triads can be put here
},
after = {
{ "Terminal", terminal },
{ "Log out", function() awesome.quit() end },
{ "Sleep", "systemctl suspend" },
{ "Restart", "systemctl reboot" },
{ "Exit", "systemctl poweroff" },
-- other triads can be put here
}
})
--menubar.utils.terminal = terminal -- Set the Menubar terminal for applications that require it
#+END_SRC
* System Sounds
Available sounds that are part of the default =dtos-sounds= package include:
+ menu-01.mp3
+ menu-02.mp3
+ menu-03.mp3
+ shutdown-01.mp3
+ shutdown-02.mp3
+ shutdown-03.mp3
+ startup-01.mp3
+ startup-02.mp3
+ startup-03.mp3
#+begin_src lua
local soundDir = "/opt/dtos-sounds/" -- The directory that has the sound files
local startupSound = soundDir .. "startup-01.mp3"
local shutdownSound = soundDir .. "shutdown-01.mp3"
local dmenuSound = soundDir .. "menu-01.mp3"
#+end_src
* Screen and wallpaper
You can set wallpaper with awesome. This is optional, of course. Otherwise, just set wallpaper with your preferred wallpaper utility (such as nitrogen or feh).
#+BEGIN_SRC lua
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", function(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
gears.wallpaper.maximized(wallpaper, s, true)
end
end)
-- Create a wibox for each screen and add it
awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end)
#+END_SRC
* Mouse bindings
Defining what our mouse clicks do.
#+BEGIN_SRC lua
root.buttons(my_table.join(
awful.button({ }, 3, function () awful.util.mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
#+END_SRC
* Keybindings
| Keybinding | Action |
|-------------------------+--------------------------------------------------------------------------|
| MODKEY + RETURN | opens terminal (alacritty is the terminal but can be easily changed) |
| MODKEY + SHIFT + RETURN | opens run launcher (dmenu is the run launcher but can be easily changed) |
| MODKEY + SHIFT + c | closes window with focus |
| MODKEY + SHIFT + r | restarts awesome |
| MODKEY + SHIFT + q | quits awesome |
| MODKEY + 1-9 | switch focus to workspace (1-9) |
| MODKEY + SHIFT + 1-9 | send focused window to workspace (1-9) |
| MODKEY + j,k | switches focus between windows in the stack, |
| MODKEY + SHIFT + j,k | rotates the windows in the stack |
| MODKEY + SHIFT + h,l | Decrease/increase master width factor |
| ALT + h,j,k,l | switches focus between windows across all monitors |
| MODKEY + period | switch focus to next monitor |
| MODKEY + comma | switch focus to prev monitor |
#+BEGIN_SRC lua
globalkeys = my_table.join(
-- {{{ Personal keybindings
-- Awesome keybindings
awful.key({ modkey, }, "Return", function () awful.spawn( terminal ) end,
{description = "Launch terminal", group = "awesome"}),
awful.key({ modkey, }, "b", function () awful.spawn( "qutebrowser" ) end,
{description = "Launch qutebrowser", group = "awesome"}),
awful.key({ modkey, "Shift" }, "r", awesome.restart,
{description = "Reload awesome", group = "awesome"}),
awful.key({ modkey, "Shift" }, "q", function () awful.spawn.with_shell("dm-logout") end,
{description = "Quit awesome", group = "awesome"}),
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description = "Show help", group="awesome"}),
awful.key({ modkey, "Shift" }, "w", function () awful.util.mymainmenu:show() end,
{description = "Show main menu", group = "awesome"}),
awful.key({ modkey, "Shift" }, "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 = "Show/hide wibox (bar)", group = "awesome"}),
-- Run launcher
awful.key({ modkey, "Shift" }, "Return", function () awful.util.spawn("dm-run") end,
{description = "Run launcher", group = "hotkeys"}),
-- Dmscripts (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 == "h" then awful.spawn.with_shell("dm-hub")
elseif key == "a" then awful.spawn.with_shell("dm-sounds")
elseif key == "b" then awful.spawn.with_shell("dm-setbg")
elseif key == "c" then awful.spawn.with_shell("dtos-colorscheme")
elseif key == "e" then awful.spawn.with_shell("dm-confedit")
elseif key == "i" then awful.spawn.with_shell("dm-maim")
elseif key == "k" then awful.spawn.with_shell("dm-kill")
elseif key == "m" then awful.spawn.with_shell("dm-man")
elseif key == "n" then awful.spawn.with_shell("dm-note")
elseif key == "o" then awful.spawn.with_shell("dm-bookman")
elseif key == "p" then awful.spawn.with_shell("passmenu -p \"Pass: \"")
elseif key == "q" then awful.spawn.with_shell("dm-logout")
elseif key == "r" then awful.spawn.with_shell("dm-radio")
elseif key == "s" then awful.spawn.with_shell("dm-websearch")
elseif key == "t" then awful.spawn.with_shell("dm-translate")
end
awful.keygrabber.stop(grabber)
end
)
end,
{description = "followed by KEY", group = "Dmscripts"}
),
-- Emacs (Super + e followed by KEY)
awful.key( {modkey}, "e", function()
local grabber
grabber =
awful.keygrabber.run(
function(_, key, event)
if event == "release" then return end
if key == "e" then awful.spawn.with_shell(emacs .. "--eval '(dashboard-refresh-buffer)'")
elseif key == "a" then awful.spawn.with_shell(emacs .. "--eval '(emms)' --eval '(emms-play-directory-tree \"~/Music/\")'")
elseif key == "b" then awful.spawn.with_shell(emacs .. "--eval '(ibuffer)'")
elseif key == "d" then awful.spawn.with_shell(emacs .. "--eval '(dired nil)'")
elseif key == "i" then awful.spawn.with_shell(emacs .. "--eval '(erc)'")
elseif key == "n" then awful.spawn.with_shell(emacs .. "--eval '(elfeed)'")
elseif key == "s" then awful.spawn.with_shell(emacs .. "--eval '(eshell)'")
elseif key == "v" then awful.spawn.with_shell(emacs .. "--eval '(+vterm/here nil)'")
elseif key == "w" then awful.spawn.with_shell(emacs .. "--eval '(doom/window-maximize-buffer(eww \"distro.tube\"))'")
end
awful.keygrabber.stop(grabber)
end
)
end,
{description = "followed by KEY", group = "Emacs"}
),
-- Tag browsing with modkey
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({ altkey, }, "Escape", awful.tag.history.restore,
{description = "go back", group = "tag"}),
-- Tag browsing ALT+TAB (ALT+SHIFT+TAB)
awful.key({ altkey, }, "Tab", awful.tag.viewnext,
{description = "view next", group = "tag"}),
awful.key({ altkey, "Shift" }, "Tab", awful.tag.viewprev,
{description = "view previous", group = "tag"}),
-- Non-empty tag browsing CTRL+TAB (CTRL+SHIFT+TAB)
awful.key({ ctrlkey }, "Tab", function () lain.util.tag_view_nonempty(-1) end,
{description = "view previous nonempty", group = "tag"}),
awful.key({ ctrlkey, "Shift" }, "Tab", function () lain.util.tag_view_nonempty(1) end,
{description = "view previous nonempty", group = "tag"}),
-- Default client focus
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"}),
-- By direction client focus
awful.key({ altkey }, "j", function() awful.client.focus.global_bydirection("down")
if client.focus then client.focus:raise() end end,
{description = "Focus down", group = "client"}),
awful.key({ altkey }, "k", function() awful.client.focus.global_bydirection("up")
if client.focus then client.focus:raise() end end,
{description = "Focus up", group = "client"}),
awful.key({ altkey }, "h", function() awful.client.focus.global_bydirection("left")
if client.focus then client.focus:raise() end end,
{description = "Focus left", group = "client"}),
awful.key({ altkey }, "l", function() awful.client.focus.global_bydirection("right")
if client.focus then client.focus:raise() end end,
{description = "Focus right", group = "client"}),
-- By direction client focus with arrows
awful.key({ ctrlkey, modkey }, "Down", function() awful.client.focus.global_bydirection("down")
if client.focus then client.focus:raise() end end,
{description = "Focus down", group = "client"}),
awful.key({ ctrlkey, modkey }, "Up", function() awful.client.focus.global_bydirection("up")
if client.focus then client.focus:raise() end end,
{description = "Focus up", group = "client"}),
awful.key({ ctrlkey, modkey }, "Left", function() awful.client.focus.global_bydirection("left")
if client.focus then client.focus:raise() end end,
{description = "Focus left", group = "client"}),
awful.key({ ctrlkey, modkey }, "Right", function() awful.client.focus.global_bydirection("right")
if client.focus then client.focus:raise() end end,
{description = "Focus right", group = "client"}),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end,
{description = "swap with next client by index", group = "client"}),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
{description = "swap with previous client by index", group = "client"}),
awful.key({ modkey }, ".", function () awful.screen.focus_relative(1) end,
{description = "focus the next screen", group = "screen"}),
awful.key({ modkey }, ",", function () awful.screen.focus_relative(-1) end,
{description = "focus the previous screen", group = "screen"}),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
{description = "jump to urgent client", group = "client"}),
awful.key({ ctrlkey, }, "Tab", function () awful.client.focus.history.previous()
if client.focus then client.focus:raise() end end,
{description = "go back", group = "client"}),
-- On the fly useless gaps change
awful.key({ altkey, ctrlkey }, "j", function () lain.util.useless_gaps_resize(1) end,
{description = "increment useless gaps", group = "tag"}),
awful.key({ altkey, ctrlkey }, "k", function () lain.util.useless_gaps_resize(-1) end,
{description = "decrement useless gaps", group = "tag"}),
-- Dynamic tagging
awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end,
{description = "add new tag", group = "tag"}),
awful.key({ modkey, ctrlkey }, "r", function () lain.util.rename_tag() end,
{description = "rename tag", group = "tag"}),
awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end,
{description = "move tag to the left", group = "tag"}),
awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end,
{description = "move tag to the right", group = "tag"}),
awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end,
{description = "delete tag", group = "tag"}),
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, "Shift" }, "Up", function () awful.tag.incnmaster( 1, nil, true) end,
{description = "increase the number of master clients", group = "layout"}),
awful.key({ modkey, "Shift" }, "Down", function () awful.tag.incnmaster(-1, nil, true) end,
{description = "decrease the number of master clients", group = "layout"}),
awful.key({ modkey, ctrlkey }, "h", function () awful.tag.incncol( 1, nil, true) end,
{description = "increase the number of columns", group = "layout"}),
awful.key({ modkey, ctrlkey }, "l", function () awful.tag.incncol(-1, nil, true) end,
{description = "decrease the number of columns", group = "layout"}),
awful.key({ modkey, }, "Tab", function () awful.layout.inc( 1) end,
{description = "select next", group = "layout"}),
awful.key({ modkey, "Shift" }, "Tab", function () awful.layout.inc(-1) end,
{description = "select previous", group = "layout"}),
awful.key({ modkey, ctrlkey }, "n",
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
client.focus = c
c:raise()
end
end,
{description = "restore minimized", group = "client"}),
-- Dropdown application
awful.key({ modkey, }, "F12", function () awful.screen.focused().quake:toggle() end,
{description = "dropdown application", group = "super"}),
-- Widgets popups
awful.key({ altkey, }, "c", function () lain.widget.cal.show(7) end,
{description = "show calendar", group = "widgets"}),
awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end,
{description = "show filesystem", group = "widgets"}),
awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end,
{description = "show weather", group = "widgets"}),
-- Brightness
awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end,
{description = "+10%", group = "hotkeys"}),
awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end,
{description = "-10%", group = "hotkeys"}),
-- ALSA volume control
--awful.key({ ctrlkey }, "Up",
awful.key({ }, "XF86AudioRaiseVolume",
function ()
os.execute(string.format("amixer -q set %s 1%%+", beautiful.volume.channel))
beautiful.volume.update()
end),
--awful.key({ ctrlkey }, "Down",
awful.key({ }, "XF86AudioLowerVolume",
function ()
os.execute(string.format("amixer -q set %s 1%%-", beautiful.volume.channel))
beautiful.volume.update()
end),
awful.key({ }, "XF86AudioMute",
function ()
os.execute(string.format("amixer -q set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel))
beautiful.volume.update()
end),
awful.key({ ctrlkey, "Shift" }, "m",
function ()
os.execute(string.format("amixer -q set %s 100%%", beautiful.volume.channel))
beautiful.volume.update()
end),
awful.key({ ctrlkey, "Shift" }, "0",
function ()
os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel))
beautiful.volume.update()
end),
-- Copy primary to clipboard (terminals to gtk)
awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end,
{description = "copy terminal to gtk", group = "hotkeys"}),
-- Copy clipboard to primary (gtk to terminals)
awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end,
{description = "copy gtk to terminal", group = "hotkeys"}),
awful.key({ altkey, "Shift" }, "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"})
--]]
)
clientkeys = my_table.join(
awful.key({ altkey, "Shift" }, "m", lain.util.magnify_client,
{description = "magnify client", group = "client"}),
awful.key({ modkey, }, "space",
function (c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{description = "toggle fullscreen", group = "client"}),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
{description = "close", group = "hotkeys"}),
awful.key({ modkey, }, "t", awful.client.floating.toggle,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, ctrlkey }, "Return", function (c) c:swap(awful.client.getmaster()) end,
{description = "move to master", group = "client"}),
awful.key({ modkey, "Shift" }, "t", function (c) c.ontop = not c.ontop end,
{description = "toggle keep on top", group = "client"}),
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
{description = "move to screen", 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 = "maximize", group = "client"})
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
-- Hack to only show tags 1 and 9 in the shortcut window (mod+s)
local descr_view, descr_toggle, descr_move, descr_toggle_focus
if i == 1 or i == 9 then
descr_view = {description = "view tag #", group = "tag"}
descr_toggle = {description = "toggle tag #", group = "tag"}
descr_move = {description = "move focused client to tag #", group = "tag"}
descr_toggle_focus = {description = "toggle focused client on tag #", group = "tag"}
end
globalkeys = my_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,
descr_view),
-- Toggle tag display.
awful.key({ modkey, ctrlkey }, "#" .. i + 9,
function ()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
descr_toggle),
-- 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,
descr_move),
-- Toggle tag on focused client.
awful.key({ modkey, ctrlkey, "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,
descr_toggle_focus)
)
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)
#+END_SRC
* Rules
#+BEGIN_SRC lua
-- 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,
size_hints_honor = false
}
},
-- Titlebars
{ rule_any = { type = { "dialog", "normal" } },
properties = { titlebars_enabled = false } },
-- Set applications to always map on the tag 1 on screen 1.
-- find class or role via xprop command
--{ rule = { class = browser1 },
--properties = { screen = 1, tag = awful.util.tagnames[1] } },
--{ rule = { class = editorgui },
--properties = { screen = 1, tag = awful.util.tagnames[2] } },
--{ rule = { class = "Geany" },
--properties = { screen = 1, tag = awful.util.tagnames[2] } },
-- Set applications to always map on the tag 3 on screen 1.
--{ rule = { class = "Inkscape" },
--properties = { screen = 1, tag = awful.util.tagnames[3] } },
-- Set applications to always map on the tag 4 on screen 1.
--{ rule = { class = "Gimp" },
--properties = { screen = 1, tag = awful.util.tagnames[4] } },
-- Set applications to be maximized at startup.
-- find class or role via xprop command
{ rule = { class = "Gimp*", role = "gimp-image-window" },
properties = { maximized = true } },
{ rule = { class = "inkscape" },
properties = { maximized = true } },
{ rule = { class = mediaplayer },
properties = { maximized = true } },
{ rule = { class = "Vlc" },
properties = { maximized = true } },
{ rule = { class = "VirtualBox Manager" },
properties = { maximized = true } },
{ rule = { class = "VirtualBox Machine" },
properties = { maximized = true } },
{ rule = { class = "Xfce4-settings-manager" },
properties = { floating = false } },
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
},
class = {
"Arandr",
"Blueberry",
"Galculator",
"Gnome-font-viewer",
"Gpick",
"Imagewriter",
"Font-manager",
"Kruler",
"MessageWin", -- kalarm.
"Oblogout",
"Peek",
"Skype",
"System-config-printer.py",
"Sxiv",
"Unetbootin.elf",
"Wpa_gui",
"pinentry",
"veromix",
"xtightvncviewer"},
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
"Preferences",
"setup",
}
}, properties = { floating = true }},
}
#+END_SRC
* Signals
#+BEGIN_SRC lua
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
if awesome.startup and
not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
end)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- Custom
if beautiful.titlebar_fun then
beautiful.titlebar_fun(c)
return
end
-- Default
-- buttons for the titlebar
local buttons = my_table.join(
awful.button({ }, 1, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.resize(c)
end)
)
awful.titlebar(c, {size = 21}) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
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),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
#+END_SRC
* Enable sloppy focus
Enable sloppy focus, so that focus follows mouse.
#+BEGIN_SRC lua
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = true})
end)
-- No border for maximized clients
function border_adjust(c)
if c.maximized then -- no borders if only 1 client visible
c.border_width = 0
elseif #awful.screen.focused().clients > 1 then
c.border_width = beautiful.border_width
c.border_color = beautiful.border_focus
end
end
client.connect_signal("focus", border_adjust)
client.connect_signal("property::maximized", border_adjust)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
#+END_SRC
* Autostart
#+BEGIN_SRC lua
awful.spawn.with_shell(soundplayer .. startupSound)
awful.spawn.with_shell("lxsession")
awful.spawn.with_shell("picom")
awful.spawn.with_shell("nm-applet")
awful.spawn.with_shell("volumeicon")
awful.spawn.with_shell("killall conky")
awful.spawn.with_shell("sleep 3 && conky -c $HOME/.config/conky/awesome/" .. colorscheme .. "-01.conkyrc")
awful.spawn.with_shell("/usr/bin/emacs --daemon")
#+END_SRC
Select only =ONE= of the following four ways to set the wallpaper.
#+BEGIN_SRC lua
awful.spawn.with_shell("xargs xwallpaper --stretch < ~/.cache/wall")
--awful.spawn.with_shell("~/.fehbg") -- set last saved feh wallpaper
--awful.spawn.with_shell("feh --randomize --bg-fill /usr/share/backgrounds/dtos-backgrounds/*") -- feh sets random wallpaper
--awful.spawn.with_shell("nitrogen --restore") -- if you prefer nitrogen to feh/xwallpaper
#+END_SRC

21
.config/awesome/autostart.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
function run {
if ! pgrep $1 ;
then
$@&
fi
}
#run "megasync"
run "xscreensaver -no-splash"
#run "/usr/bin/dropbox"
#run "insync start"
run "picom"
#run "/usr/bin/redshift"
run "mpd"
run "nm-applet"
# sleep 3
# run "$HOME/Scripts/Theming/1440.sh"

View File

@@ -0,0 +1,131 @@
-----------------------------------------------------------------------------
-- conkyrc_seamod
-- Date : 04/23/2016
-- Author : SeaJey and Maxiwell
-- Conky : >= 1.10
-- License : Distributed under the terms of GNU GPL version 2 or later
-----------------------------------------------------------------------------
conky.config = {
background = true,
update_interval = 1,
time_in_seconds = true,
cpu_avg_samples = 2,
net_avg_samples = 2,
temperature_unit = 'farenheight',
double_buffer = true,
no_buffers = true,
text_buffer_size = 2048,
gap_x = 0,
gap_y = 150,
minimum_width = 100, minimum_height = 900,
maximum_width = 115,
own_window = true,
own_window_type = 'desktop',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_class = 'conky-semi',
own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
border_inner_margin = 0,
border_outer_margin = 0,
alignment = 'top_left',
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
override_utf8_locale = true,
use_xft = true,
font = 'caviar dreams:size=11',
xftalpha = 0.5,
uppercase = false,
-- Defining colors
default_color = '#FFFFFF',
-- Shades of Gray
color1 = '#DDDDDD',
color2 = '#AAAAAA',
color3 = '#888888',
-- Gentoo Purple
color4 = '#7A5ADA',
-- Green
color5 = '#8FEB8F',
-- Red
color6 = '#F45F45',
-- Loading lua script for drawning rings
lua_load = '~/.config/awesome/conky/seamod_rings.lua',
lua_draw_hook_pre = 'main',
};
--${offset 15}${font Droid Sans:size=11:style=normal}${color1}${pre_exec lsb_release -d | cut -f 2} - $sysname $kernel
conky.text = [[
${font Droid Sans:size=8:style=normal}${color1}$kernel
${font Droid Sans:size=8:style=normal}${color1}Temp ${color3}$alignr${exec 10 sensors | grep Core\ 3 | awk '{print $3}'}
${font Droid Sans:size=9:style=normal}${color1}NVidia Optimus: ${color3}$alignr${execi 10 cat /proc/acpi/bbswitch | awk '{print $2}'}
${font Droid Sans:size=9:style=normal}${color1}Uptime: $alignr${color3}${color3}$uptime
#${voffset 40}
#${offset 65}${font Droid Sans:size=16:style=bold}${color5}BAT
#
#${voffset -35}
${font Droid Sans:size=8:style=normal}${color1}Status ${color3}$alignr${battery BAT1}
${font Droid Sans:size=8:style=normal}${color1}Time Left ${font Droid Sans:size=8:bold:style=normal}${color4}$alignr${format_time $battery_time "\hh\mm"}${battery_time BAT1}
# Showing CPU Graph
${voffset 40}
${offset 65}${font Droid Sans:size=19:style=bold}${color5}CPU
${voffset 10}
${cpugraph cpu1 20,118 666666 666666}
${voffset -40}
${font Droid Sans:size=9:style=normal}${color1}CPU Freq: ${font Droid Sans:size=9:bold:style=normal}${alignr}${color4}${freq} ${color2}MHz
# Showing TOP 5 CPU-consumers
${font Droid Sans:bold:size=8:style=normal}${color4}${top name 1}${alignr}${top cpu 1}%
${font Droid Sans:size=8:style=normal}${color1}${top name 2}${alignr}${top cpu 2}%
${font Droid Sans:size=8:style=normal}${color2}${top name 3}${alignr}${top cpu 3}%
${font Droid Sans:size=8:style=normal}${color3}${top name 4}${alignr}${top cpu 4}%
${font Droid Sans:size=8:style=normal}${color3}${top name 5}${alignr}${top cpu 5}%
#Showing memory part with TOP 5
${voffset 30}
${offset 65}${font Droid Sans:size=14:style=bold}${color5}MEM
${voffset 1}
${font Droid Sans:bold:size=8:style=normal}${color4}${top_mem name 1}${alignr}${top_mem mem_res 1}
${font Droid Sans:size=8:style=normal}${color1}${top_mem name 2}${alignr}${top_mem mem_res 2}
${font Droid Sans:size=8:style=normal}${color2}${top_mem name 3}${alignr}${top_mem mem_res 3}
${font Droid Sans:size=8:style=normal}${color3}${top_mem name 4}${alignr}${top_mem mem_res 4}
${font Droid Sans:size=8:style=normal}${color3}${top_mem name 4}${alignr}${top_mem mem_res 5}
# Showing disk partitions: boot, root, home
${voffset 47}
${offset 70}${font Droid Sans:size=12:style=bold}${color5}DISKS
${voffset 20}
${diskiograph 20,118 666666 666666}${voffset -30}
${voffset 10}
${font Droid Sans:size=8:}${color1}Boot Free: ${alignr}$color3${font Droid Sans:size=8:style=normal}${fs_free /boot}
${font Droid Sans:size=8:}${color1}Root Free: ${alignr}$color3${font Droid Sans:size=8:style=normal}${fs_free /}
${font Droid Sans:size=8:}${color1}Home Free: ${alignr}$color3${font Droid Sans:size=8:style=normal}${fs_free /home}
# Network
${voffset 49}
${offset 70}${font Droid Sans:size=14:style=bold}${color5}WiFi
${voffset 10}
${font Droid Sans:size=10:style=bold}${color1}${color2}VPN: ${font Droid Sans:size=10:style=bold}${color5}${if_up tun0}UP${else}${color6}Down$endif$font$color
${font Droid Sans:size=8:style=bold}${color1}Lan IP: ${alignr}$color3${addr wlp6s0}
${font Droid Sans:size=8:style=bold}${color1}Ext IP: ${alignr}${color3}NOPE#${alignr}$color3${execi 600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1}
#${font Droid Sans:size=8:style=bold}${alignr}$color3${execi 600 wget -q -O /dev/stdout https://www.dnsleaktest.com/ | grep from | grep -o '<p>.*<img' | grep -o '>.*<' | grep -oEi '[a-zA-Z0-9 ,]+'}
${voffset 10}
${color1}${font Droid Sans:size=8:style=bold}Up: ${alignr}${font Droid Sans:size=8:style=normal}$color2${upspeed wlp6s0} / ${totalup wlp6s0}
${upspeedgraph wlp6s0 40,118 4B1B0C FF5C2B 1280KiB -l}
${color1}${font Droid Sans:size=8:style=bold}Down: ${alignr}${font Droid Sans:size=8:style=normal}$color2${downspeed wlp6s0} / ${totaldown wlp6s0}
${downspeedgraph wlp6s0 40,118 324D23 77B753 1280KiB -l}
]];

View File

@@ -0,0 +1,478 @@
--==============================================================================
-- seamod_rings.lua
--
-- Date : 05/02/2012
-- Author : SeaJey
-- Version : v0.1
-- License : Distributed under the terms of GNU GPL version 2 or later
--
-- This version is a modification of lunatico_rings.lua wich is modification of conky_orange.lua
--
-- conky_orange.lua: http://gnome-look.org/content/show.php?content=137503&forumpage=0
-- lunatico_rings.lua: http://gnome-look.org/content/show.php?content=142884
--==============================================================================
require 'cairo'
gauge = {
{
name='cpu', arg='cpu1', max_value=100,
x=60, y=175,
graph_radius=54,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu2', max_value=100,
x=60, y=175,
graph_radius=48,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu3', max_value=100,
x=60, y=175,
graph_radius=42,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu4', max_value=100,
x=60, y=175,
graph_radius=36,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu5', max_value=100,
x=60, y=175,
graph_radius=30,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu6', max_value=100,
x=60, y=175,
graph_radius=24,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu7', max_value=100,
x=60, y=175,
graph_radius=18,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='cpu', arg='cpu8', max_value=100,
x=60, y=175,
graph_radius=12,
graph_thickness=5,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='',
caption_weight=1, caption_size=9.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
--{
-- name='battery_percent', arg='BAT1', max_value=100,
-- x=60, y=133,
-- graph_radius=35,
-- graph_thickness=20,
-- graph_start_angle=180,
-- graph_unit_angle=2.7, graph_unit_thickness=2.7,
-- graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
-- graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
-- hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
-- txt_radius=13,
-- txt_weight=1, txt_size=10.0,
-- txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
-- graduation_radius=23,
-- graduation_thickness=0, graduation_mark_thickness=2,
-- graduation_unit_angle=27,
-- graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.5,
-- caption='',
-- caption_weight=1, caption_size=10.0,
-- caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
--},
{
name='memperc', arg='', max_value=100,
x=60, y=428,
graph_radius=35,
graph_thickness=20,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=18,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=23,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.5,
caption='',
caption_weight=1, caption_size=10.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='fs_used_perc', arg='/home', max_value=100,
x=60, y=620,
graph_radius=52,
graph_thickness=7,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=65,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=23,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='/home',
caption_weight=1, caption_size=12.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
},
{
name='fs_used_perc', arg='/', max_value=100,
x=60, y=620,
graph_radius=40,
graph_thickness=7,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=27,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=23,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='/',
caption_weight=1, caption_size=12.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
},
{
name='fs_used_perc', arg='/boot', max_value=100,
x=60, y=620,
graph_radius=28,
graph_thickness=7,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=1.0,
txt_radius=16,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=23,
graduation_thickness=0, graduation_mark_thickness=2,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='/boot',
caption_weight=1, caption_size=12.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
},
{
name='downspeedf', arg='wlp6s0', max_value=100,
x=60, y=835,
graph_radius=42,
graph_thickness=7,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=0,
txt_radius=60,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='Down',
caption_weight=1, caption_size=12.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
},
{
name='upspeedf', arg='wlp6s0', max_value=100,
x=60, y=835,
graph_radius=30,
graph_thickness=7,
graph_start_angle=180,
graph_unit_angle=2.7, graph_unit_thickness=2.7,
graph_bg_colour=0xffffff, graph_bg_alpha=0.1,
graph_fg_colour=0xFFFFFF, graph_fg_alpha=0.3,
hand_fg_colour=0x7A5ADA, hand_fg_alpha=0,
txt_radius=20,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0x7A5ADA, txt_fg_alpha=1.0,
graduation_radius=28,
graduation_thickness=0, graduation_mark_thickness=1,
graduation_unit_angle=27,
graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.3,
caption='Up',
caption_weight=1, caption_size=12.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.5,
},
}
-- converts color in hexa to decimal
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-- convert degree to rad and rotate (0 degree is top/north)
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-- displays gauges
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = value % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
if txt_radius > 0 then
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
end
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 5)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-- loads data and displays gauges
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- MAIN
function conky_main()
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
go_gauge_rings(display)
end
cairo_surface_destroy(cs)
cairo_destroy(display)
end

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,52 @@
Awesome-Freedesktop
===================
-------------------------------------------------------------------
Freedesktop.org menu and desktop icons support for Awesome WM 4.x
-------------------------------------------------------------------
:Original author: Antonio Terceiro
:Maintainer: Luke Bonham
:Version: git
:License: GNU-GPL2_
:Source: https://github.com/copycat-killer/awesome-freedesktop
Description
-----------
This is a port of awesome-freedesktop_ to Awesome_ 4.x.
See branches_ for previous versions.
Since the introduction of Menubar_ as core library for providing Freedesktop.org menu functionalities in Awesome,
we can now avoid all the dirty work by just exploiting ``menubar.utils`` functions.
At the initial status of this port, the menu is pretty much complete, while the desktop icons are very basic,
so the long term objective will be to complete functionalities on this part too.
More specifically, the todo list is:
- A better way to handle desktop icons path
- Ability to drag and line up icons
- Event-based signals, in particular:
- Updating trash icon according to its status
- Dynamic update (no need to restart Awesome to see changes on desktop)
Screenshot
----------
.. image:: screenshot.png
:align: center
:alt: Showcase of Freedesktop support in Awesome, using Adwaita icons
Installation and usage
----------------------
Read the wiki_.
.. _GNU-GPL2: http://www.gnu.org/licenses/gpl-2.0.html
.. _awesome-freedesktop: https://github.com/terceiro/awesome-freedesktop
.. _Awesome: https://github.com/awesomeWM/awesome
.. _branches: https://github.com/copycat-killer/awesome-freedesktop/branches
.. _Menubar: https://github.com/awesomeWM/awesome/tree/master/lib/menubar
.. _wiki: https://github.com/copycat-killer/awesome-freedesktop/wiki

View File

@@ -1,12 +1,12 @@
package = "awesome-freedesktop"
version = "scm-1"
version = "git"
source = {
url = "https://github.com/lcpz/awesome-freedesktop",
tag = "scm-1`"
url = "https://github.com/copycat-killer/awesome-freedesktop",
tag = "git"
}
description = {
summary = "Freedesktop.org menu and desktop icons support for Awesome WM",
homepage = "https://github.com/lcpz/awesome-freedesktop",
homepage = "https://github.com/copycat-killer/awesome-freedesktop",
license = "GPL v2"
}
dependencies = {

27
.config/awesome/freedesktop/desktop.lua Executable file → Normal file
View File

@@ -1,14 +1,15 @@
--[[
Awesome-Freedesktop
Freedesktop.org compliant desktop entries and menu
Desktop section
Licensed under GNU General Public License v2
* (c) 2016, Luke Bonham
* (c) 2009-2015, Antonio Terceiro
Awesome-Freedesktop
Freedesktop.org compliant desktop entries and menu
Desktop section
Licensed under GNU General Public License v2
* (c) 2016, Luke Bonham
* (c) 2009-2015, Antonio Terceiro
--]]
local awful = require("awful")
@@ -16,12 +17,12 @@ local theme = require("beautiful")
local utils = require("menubar.utils")
local wibox = require("wibox")
local capi = capi
local capi = { screen = screen }
local io = io
local ipairs = ipairs
local mouse = mouse
local os = os
local string = string
local string = { format = string.format }
local table = table
-- Desktop icons
@@ -140,7 +141,7 @@ end
function desktop.add_base_icons(args)
for _,base in ipairs(args.baseicons) do
desktop.add_single_icon(args, base.label, utils.lookup_icon(base.icon), function()
awful.spawn(string.format("%s '%s'", args.open_with, base.onclick))
awful.spawn(string.format("%s '%s'", args.open_width, base.onclick))
end)
end
end

17
.config/awesome/freedesktop/init.lua Executable file → Normal file
View File

@@ -1,12 +1,13 @@
--[[
Awesome-Freedesktop
Freedesktop.org compliant desktop entries and menu
Licensed under GNU General Public License v2
* (c) 2016, Luke Bonham
* (c) 2009-2015, Antonio Terceiro
Awesome-Freedesktop
Freedesktop.org compliant desktop entries and menu
Licensed under GNU General Public License v2
* (c) 2016, Luke Bonham
* (c) 2009-2015, Antonio Terceiro
--]]
return {

48
.config/awesome/freedesktop/menu.lua Executable file → Normal file
View File

@@ -1,23 +1,30 @@
--[[
Awesome-Freedesktop
Freedesktop.org compliant desktop entries and menu
Menu section
Licensed under GNU General Public License v2
* (c) 2016, Luke Bonham
* (c) 2014, Harvey Mittens
Awesome-Freedesktop
Freedesktop.org compliant desktop entries and menu
Menu section
Licensed under GNU General Public License v2
* (c) 2016, Luke Bonham
* (c) 2014, Harvey Mittens
--]]
local awful_menu = require("awful.menu")
local menu_gen = require("menubar.menu_gen")
local menu_utils = require("menubar.utils")
local icon_theme = require("menubar.icon_theme")
local gls = require("gears.filesystem")
local pairs, string, table, os = pairs, string, table, os
local os = { execute = os.execute,
getenv = os.getenv }
local pairs = pairs
local string = { byte = string.byte,
format = string.format }
local table = { insert = table.insert,
remove = table.remove,
sort = table.sort }
-- Add support for NixOS systems too
table.insert(menu_gen.all_menu_dirs, string.format("%s/.nix-profile/share/applications", os.getenv("HOME")))
@@ -25,7 +32,7 @@ table.insert(menu_gen.all_menu_dirs, string.format("%s/.nix-profile/share/applic
-- Remove non existent paths in order to avoid issues
local existent_paths = {}
for k,v in pairs(menu_gen.all_menu_dirs) do
if gls.is_dir(v) then
if os.execute(string.format("ls %s &> /dev/null", v)) then
table.insert(existent_paths, v)
end
end
@@ -42,8 +49,8 @@ local menu = {}
-- @param tab a given table
-- @param val the element to search for
-- @return true if the given string is found within the search table; otherwise, false if not
function menu.has_value (tab, val)
for index, value in pairs(tab) do
local function has_value (tab, val)
for index, value in ipairs(tab) do
if val:find(value) then
return true
end
@@ -59,7 +66,6 @@ function menu.build(args)
local before = args.before or {}
local after = args.after or {}
local skip_items = args.skip_items or {}
local sub_menu = args.sub_menu or false
local result = {}
local _menu = awful_menu({ items = before })
@@ -74,7 +80,7 @@ function menu.build(args)
for k, v in pairs(entries) do
for _, cat in pairs(result) do
if cat[1] == v.category then
if not menu.has_value(skip_items, v.name) then
if not has_value(skip_items, v.name) then
table.insert(cat[2], { v.name, v.cmdline, v.icon })
end
break
@@ -99,11 +105,6 @@ function menu.build(args)
-- Sort categories alphabetically also
table.sort(result, function(a, b) return string.byte(a[1]) < string.byte(b[1]) end)
-- Add menu item to hold the generated menu
if sub_menu then
result = {{sub_menu, result}}
end
-- Add items to menu
for _, v in pairs(result) do _menu:add(v) end
for _, v in pairs(after) do _menu:add(v) end
@@ -116,9 +117,6 @@ function menu.build(args)
end
end
-- Hold the menu in the module
menu.menu = _menu
return _menu
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -0,0 +1,21 @@
# If you have a question
Take the following steps:
1. [Google it](https://encrypted.google.com)
2. Search [Awesome doc](https://awesomewm.org/doc)
3. Ask [community](https://awesomewm.org/community)
and, if you still don't have an answer, you can ask here.
**Please be warned:** if your question is __unrelated__ to this repository, a reply is only an act of kindness.
# If you have an issue
**Please read the [wiki](https://github.com/copycat-killer/lain/wiki) and search the [Issues section](https://github.com/copycat-killer/lain/issues) first.**
If you can't find a solution there, then go ahead and provide:
* output of `awesome -v` and `lua -v`
* expected behavior and actual behavior
* steps to reproduce the problem

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,39 @@
Lain
====
-------------------------------------------------
Layouts, widgets and utilities for Awesome WM 4.x
-------------------------------------------------
:Author: Luke Bonham <dada [at] archlinux [dot] info>
:Version: git
:License: GNU-GPL2_
:Source: https://github.com/copycat-killer/lain
Description
-----------
Successor of awesome-vain_, this module provides alternative layouts, asynchronous widgets and utility functions for Awesome_ WM. Read the wiki_ for all the info.
Contributions
-------------
Constructive criticism and suggestions are welcome.
If you want to create a pull request, make sure that:
- Your code fits with the general style of the module. In particular, you should use the same indentation pattern that the code uses, and also avoid adding space at the ends of lines.
- Your code its easy to understand, maintainable, and modularized. You should also avoid code duplication wherever possible by adding functions to or using lain.helpers_. If something is unclear, or you can't write it in such a way that it will be clear, explain it with a comment.
- You test your changes before submitting to make sure that you code works and does not break other parts of the module.
- You eventually update ``wiki`` submodule with a thorough section.
Contributed widgets have to be put in ``widget/contrib``.
.. _GNU-GPL2: http://www.gnu.org/licenses/gpl-2.0.html
.. _awesome-vain: https://github.com/vain/awesome-vain
.. _Awesome: https://github.com/awesomeWM/awesome
.. _wiki: https://github.com/copycat-killer/lain/wiki
.. _lain.helpers: https://github.com/copycat-killer/lain/blob/master/helpers.lua

122
.config/awesome/lain/helpers.lua Executable file → Normal file
View File

@@ -1,16 +1,15 @@
--[[
Licensed under GNU General Public License v2
* (c) 2013, Luca CPZ
* (c) 2013, Luke Bonham
--]]
local spawn = require("awful.spawn")
local easy_async = require("awful.spawn").easy_async
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 }
@@ -33,49 +32,53 @@ 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
-- see if the file exists and is readable
function helpers.file_exists(file)
local f = io.open(file)
if f then
local s = f:read()
f:close()
f = s
end
return f ~= 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
-- get all lines from a file, returns an empty
-- list/table if the file does not exist
function helpers.lines_from(file)
if not helpers.file_exists(file) then return {} end
local lines = {}
for line in io.lines(file) 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
-- match all lines from a file, returns an empty
-- list/table if the file or match does not exist
function helpers.lines_match(regexp, file)
local lines = {}
for index,line in pairs(helpers.lines_from(file)) do
if string.match(line, regexp) then
lines[index] = 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
-- get first line of a file, return nil if
-- the file does not exist
function helpers.first_line(file)
return helpers.lines_from(file)[1]
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
-- get first non empty line from a file,
-- returns nil otherwise
function helpers.first_nonempty_line(file)
for k,v in pairs(helpers.lines_from(file)) do
if #v then return v end
end
return nil
end
-- }}}
@@ -107,29 +110,12 @@ end
-- @param callback function to execute on cmd output
-- @return cmd PID
function helpers.async(cmd, callback)
return spawn.easy_async(cmd,
return easy_async(cmd,
function (stdout, stderr, reason, exit_code)
callback(stdout, exit_code)
callback(stdout)
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
@@ -176,28 +162,6 @@ function helpers.spairs(t)
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

0
.config/awesome/lain/icons/cal/white/1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 714 B

0
.config/awesome/lain/icons/cal/white/10.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
.config/awesome/lain/icons/cal/white/11.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
.config/awesome/lain/icons/cal/white/12.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
.config/awesome/lain/icons/cal/white/13.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
.config/awesome/lain/icons/cal/white/14.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

0
.config/awesome/lain/icons/cal/white/15.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
.config/awesome/lain/icons/cal/white/16.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
.config/awesome/lain/icons/cal/white/17.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
.config/awesome/lain/icons/cal/white/18.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
.config/awesome/lain/icons/cal/white/19.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
.config/awesome/lain/icons/cal/white/2.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
.config/awesome/lain/icons/cal/white/20.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

0
.config/awesome/lain/icons/cal/white/21.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
.config/awesome/lain/icons/cal/white/22.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

0
.config/awesome/lain/icons/cal/white/23.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

0
.config/awesome/lain/icons/cal/white/24.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
.config/awesome/lain/icons/cal/white/25.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
.config/awesome/lain/icons/cal/white/26.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
.config/awesome/lain/icons/cal/white/27.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
.config/awesome/lain/icons/cal/white/28.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

0
.config/awesome/lain/icons/cal/white/29.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
.config/awesome/lain/icons/cal/white/3.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
.config/awesome/lain/icons/cal/white/30.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

0
.config/awesome/lain/icons/cal/white/31.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
.config/awesome/lain/icons/cal/white/4.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1000 B

After

Width:  |  Height:  |  Size: 1000 B

0
.config/awesome/lain/icons/cal/white/5.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
.config/awesome/lain/icons/cal/white/6.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
.config/awesome/lain/icons/cal/white/7.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
.config/awesome/lain/icons/cal/white/8.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

0
.config/awesome/lain/icons/cal/white/9.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
.config/awesome/lain/icons/layout/default/cascade.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

0
.config/awesome/lain/icons/layout/default/cascadew.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

View File

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

View File

Before

Width:  |  Height:  |  Size: 169 B

After

Width:  |  Height:  |  Size: 169 B

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

View File

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 200 B

View File

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

0
.config/awesome/lain/icons/layout/default/termfair.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

View File

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

0
.config/awesome/lain/icons/layout/zenburn/cascade.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

View File

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 227 B

View File

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 361 B

View File

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 185 B

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

0
.config/awesome/lain/icons/layout/zenburn/termfair.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 237 B

0
.config/awesome/lain/icons/mail.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 526 B

After

Width:  |  Height:  |  Size: 526 B

0
.config/awesome/lain/icons/no_net.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
.config/awesome/lain/icons/openweathermap/01d.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

0
.config/awesome/lain/icons/openweathermap/01n.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Some files were not shown because too many files have changed in this diff Show More