Compare commits
5 Commits
e3df36ce8a
...
9fac13f8d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fac13f8d6 | ||
|
|
73abe8a931 | ||
|
|
335d208437 | ||
|
|
02e810eb20 | ||
|
|
75dde09a96 |
89
brightness/brightness.lua
Normal file
89
brightness/brightness.lua
Normal file
@@ -0,0 +1,89 @@
|
||||
-- Battery widget
|
||||
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local timer = gears.timer or timer
|
||||
local watch = awful.spawn and awful.spawn.with_line_callback
|
||||
|
||||
------------------------------------------
|
||||
-- Private utility functions
|
||||
------------------------------------------
|
||||
|
||||
------------------------------------------
|
||||
-- Battery widget interface
|
||||
------------------------------------------
|
||||
|
||||
local brightness_widget= {}
|
||||
|
||||
function brightness_widget:new(args)
|
||||
return setmetatable({}, {__index = self}):init(args)
|
||||
end
|
||||
|
||||
function brightness_widget:init(args)
|
||||
self.widget = wibox.widget.textbox()
|
||||
self.widget.set_align("right")
|
||||
self.tooltip = awful.tooltip({objects={self.widget}})
|
||||
|
||||
self.widget:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function() self:update() end),
|
||||
awful.button({ }, 3, function() self:update() end)
|
||||
))
|
||||
|
||||
self.timer = timer({ timeout = 1 })
|
||||
self.timer:connect_signal("timeout", function() self:update() end)
|
||||
self.timer:start()
|
||||
self:update()
|
||||
|
||||
awesome.connect_signal("exit", function()
|
||||
awesome.kill(self.listener, 9)
|
||||
end)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function run(cmd)
|
||||
--[[
|
||||
local f = io.popen(cmd,'r')
|
||||
local s = f:read('*a')
|
||||
f:close()
|
||||
return s
|
||||
]]--
|
||||
return ""
|
||||
end
|
||||
|
||||
function getDate(cmd)
|
||||
local clipboard = run(cmd)
|
||||
local match = string.match(clipboard,'^%d%d%d%d%d%d%d%d%d%d%d%d%d$')
|
||||
if ( match == nil ) then
|
||||
return nil
|
||||
else
|
||||
local ms = tonumber(match)
|
||||
local s = math.floor((ms+500)/1000)
|
||||
return os.date("%Y-%m-%d %H:%M:%S",s)
|
||||
end
|
||||
end
|
||||
|
||||
function brightness_widget:update()
|
||||
io.open1G
|
||||
local text = ""
|
||||
local tooltip = ""
|
||||
|
||||
local s = getDate("xsel -o")
|
||||
if ( s == nil ) then
|
||||
s = getDate("xsel -o -b")
|
||||
end
|
||||
if ( s == nil ) then
|
||||
else
|
||||
text = "["..s.."]"
|
||||
tooltip = s
|
||||
end
|
||||
|
||||
self.widget:set_markup(text)
|
||||
self.tooltip:set_text(tooltip)
|
||||
end
|
||||
|
||||
return setmetatable(brightness_widget, {
|
||||
__call = brightness_widget.new,
|
||||
})
|
||||
1
brightness/init.lua
Symbolic link
1
brightness/init.lua
Symbolic link
@@ -0,0 +1 @@
|
||||
brightness.lua
|
||||
15
brightness/test.lua
Normal file
15
brightness/test.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local base = "/sys/devices/pci0000:00/0000:00:02.0/drm/card1/card1-eDP-1/intel_backlight/"
|
||||
|
||||
function readnum(file)
|
||||
local f = io.open(base .. file,'r')
|
||||
local n = f:read("*number")
|
||||
f:close()
|
||||
return n
|
||||
end
|
||||
|
||||
local cur = readnum("brightness")
|
||||
local min = 0
|
||||
local max = readnum("max_brightness")
|
||||
|
||||
print( string.format("[%s,%s] %s", min, max, cur) )
|
||||
|
||||
133
rc.lua
133
rc.lua
@@ -16,13 +16,14 @@ local cyclefocus = require('cyclefocus')
|
||||
-- Load Debian menu entries
|
||||
require("debian.menu")
|
||||
|
||||
-- 🔌
|
||||
-- battery meter
|
||||
local battery_widget = require("battery-widget")
|
||||
local battery = battery_widget({adapter = "BAT0",widget_text="${color_on}🔋${color_off}", limits={{10,"red"},{20,"orange"},{100,"white"}} })
|
||||
|
||||
-- clipdate
|
||||
local clipdate_widget = require("clipdate")
|
||||
local clipdate = clipdate_widget()
|
||||
--local clipdate_widget = require("clipdate")
|
||||
--local clipdate = clipdate_widget()
|
||||
|
||||
-- {{{ Error handling
|
||||
-- Check if awesome encountered an error during startup and fell back to
|
||||
@@ -55,9 +56,7 @@ end
|
||||
beautiful.init(awful.util.getdir("config") .. "themes/default/theme.lua")
|
||||
|
||||
-- This is used later as the default terminal and editor to run.
|
||||
--terminal = "x-terminal-emulator"
|
||||
--terminal = "terminology"
|
||||
terminal = "lxterminal"
|
||||
terminal = "x-terminal-emulator"
|
||||
editor = os.getenv("EDITOR") or "editor"
|
||||
editor_cmd = terminal .. " -e " .. editor
|
||||
|
||||
@@ -122,18 +121,32 @@ end
|
||||
-- Create a launcher widget and a main menu
|
||||
myawesomemenu = {
|
||||
{ "hotkeys", function() return false, hotkeys_popup.show_help end},
|
||||
{ "kbscan", function() awful.spawn.with_shell("/home/sbyrne/bin/kbscan") end},
|
||||
{ "find",
|
||||
function()
|
||||
local t = function(c)
|
||||
return true
|
||||
end
|
||||
for c in awful.client.iterate(t) do
|
||||
c.minimized = false
|
||||
end
|
||||
end },
|
||||
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
||||
{ "restart wm", awesome.restart },
|
||||
{ "logout", function() awesome.quit() end},
|
||||
{ "reboot", function() awful.spawn.with_shell("systemctl restart") end},
|
||||
{ "reboot", function() awful.spawn.with_shell("systemctl reboot") end},
|
||||
{ "shutdown", function() awful.spawn.with_shell("systemctl poweroff") end}
|
||||
}
|
||||
|
||||
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
{ "debian", debian.menu.Debian_menu.Debian },
|
||||
local freedesktop = require("freedesktop")
|
||||
mymainmenu = freedesktop.menu.build({
|
||||
before = {
|
||||
{ "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
},
|
||||
after = {
|
||||
{ "terminal", terminal }
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
||||
menu = mymainmenu })
|
||||
@@ -215,7 +228,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
set_wallpaper(s)
|
||||
|
||||
-- Each screen has its own tag table.
|
||||
awful.tag({ "1", "2", "3", "4", "5" }, s, awful.layout.layouts[1])
|
||||
awful.tag({ "☢", "☣", "☮", "☯", "⚙", "☠" }, s, awful.layout.layouts[1])
|
||||
|
||||
-- Create a promptbox for each screen
|
||||
s.mypromptbox = awful.widget.prompt()
|
||||
@@ -224,9 +237,12 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
s.mylayoutbox = awful.widget.layoutbox(s)
|
||||
s.mylayoutbox:buttons(awful.util.table.join(
|
||||
awful.button({ }, 1, function () awful.layout.inc( 1) end),
|
||||
awful.button({ }, 2, function () awful.layout.inc( 1) end),
|
||||
awful.button({ }, 3, function () awful.layout.inc(-1) end),
|
||||
awful.button({ }, 4, function () awful.layout.inc( 1) end),
|
||||
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
|
||||
awful.button({ }, 5, function () awful.layout.inc(-1) end),
|
||||
awful.button({ }, 6, function () awful.layout.inc(-1) end)
|
||||
))
|
||||
-- Create a taglist widget
|
||||
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
|
||||
|
||||
@@ -248,7 +264,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
{ -- Right widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
--mykeyboardlayout,
|
||||
clipdate.widget,
|
||||
--clipdate.widget,
|
||||
wibox.widget.systray(),
|
||||
battery.widget,
|
||||
mytextclock --[[, XXX11
|
||||
@@ -303,9 +319,9 @@ globalkeys = awful.util.table.join(
|
||||
{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, }, "l", function () awful.screen.focus_relative( 1) end,
|
||||
{description = "focus the next screen", group = "screen"}),
|
||||
awful.key({ modkey, }, "h", function () awful.screen.focus_relative(-1) end,
|
||||
awful.key({ modkey, }, "h", function () awful.screen.focus_relative(1) end,
|
||||
{description = "focus the previous screen", group = "screen"}),
|
||||
awful.key({ modkey, }, "l", 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"}),
|
||||
@@ -325,18 +341,12 @@ globalkeys = awful.util.table.join(
|
||||
-- Standard program
|
||||
awful.key({ modkey, }, "x", function () awful.spawn(terminal) end,
|
||||
{description = "open a terminal", group = "launcher"}),
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{description = "reload awesome", group = "awesome"}),
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||
{description = "quit awesome", group = "awesome"}),
|
||||
--awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
-- {description = "reload awesome", group = "awesome"}),
|
||||
--awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||
-- {description = "quit awesome", group = "awesome"}),
|
||||
|
||||
-- sb
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.spawn("i3lock") end, {description="lock", group="lock"}),
|
||||
awful.key({ modkey, }, "y", function () awful.spawn("yubioath-gui") end, {description="yubioath-gui", group="app"}),
|
||||
awful.key({ modkey, }, "F2", function () awful.spawn.with_shell("xdotool sleep 0.25; xdotool key --clearmodifiers --delay 0 m e a s u r e s f o r j u s t i c e period o r g") end,
|
||||
{description = "@measuresforjustice.org", group = "launcher"}),
|
||||
awful.key({ modkey, }, "F3", function () awful.spawn.with_shell("xdotool sleep 0.25; xdotool key --clearmodifiers --delay 0 s t e p h e n period b y r n e at m e a s u r e s f o r j u s t i c e period o r g") end,
|
||||
{description = "@measuresforjustice.org", group = "launcher"}),
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.spawn("xscreensaver-command -activate") end, {description="lock", group="lock"}),
|
||||
|
||||
--[[
|
||||
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
|
||||
@@ -344,6 +354,7 @@ globalkeys = awful.util.table.join(
|
||||
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
|
||||
{description = "decrease master width factor", group = "layout"}),
|
||||
]]--
|
||||
--[[
|
||||
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
|
||||
{description = "increase the number of master clients", group = "layout"}),
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
|
||||
@@ -356,17 +367,8 @@ globalkeys = awful.util.table.join(
|
||||
{description = "select next", group = "layout"}),
|
||||
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
|
||||
{description = "select previous", group = "layout"}),
|
||||
]]--
|
||||
|
||||
awful.key({ modkey, "Control" }, "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"}),
|
||||
|
||||
-- Prompt
|
||||
awful.key({ modkey }, " ", function () awful.screen.focused().mypromptbox:run() end,
|
||||
@@ -405,6 +407,7 @@ clientkeys = awful.util.table.join(
|
||||
{description = "move to screen", group = "client"}),
|
||||
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
|
||||
{description = "toggle keep on top", group = "client"}),
|
||||
-- minimize
|
||||
awful.key({ modkey, }, "n",
|
||||
function (c)
|
||||
-- The client currently has the input focus, so it cannot be
|
||||
@@ -412,6 +415,18 @@ clientkeys = awful.util.table.join(
|
||||
c.minimized = true
|
||||
end ,
|
||||
{description = "minimize", group = "client"}),
|
||||
-- unminimize
|
||||
awful.key({ modkey, "Control" }, "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"}),
|
||||
-- toggle maximized
|
||||
awful.key({ modkey, }, "m",
|
||||
function (c)
|
||||
c.maximized = not c.maximized
|
||||
@@ -424,12 +439,30 @@ clientkeys = awful.util.table.join(
|
||||
c:raise()
|
||||
end
|
||||
)
|
||||
|
||||
------ move windows
|
||||
-- super+alt+j -> move window to right screen
|
||||
,awful.key({ modkey, "Mod1" }, "l",
|
||||
function (c)
|
||||
local old = c.screen
|
||||
c:move_to_screen()
|
||||
awful.screen.focus(old)
|
||||
end
|
||||
)
|
||||
,awful.key({ modkey, "Mod1" }, "h",
|
||||
function (c)
|
||||
local old = c.screen
|
||||
c:move_to_screen(c.screen.index-1)
|
||||
awful.screen.focus(old)
|
||||
end
|
||||
)
|
||||
-- super+alt+j -> move window to next space
|
||||
,awful.key({ modkey, "Mod1" }, "j",
|
||||
function (c)
|
||||
local curTag = c.first_tag
|
||||
print(curTag.index)
|
||||
local tagIdx = curTag.index + 1
|
||||
if tagIdx > 5 then
|
||||
if tagIdx > 6 then
|
||||
tagIdx = 1
|
||||
end
|
||||
local tag = curTag.screen.tags[tagIdx]
|
||||
@@ -437,13 +470,14 @@ clientkeys = awful.util.table.join(
|
||||
--awful.tag:viewnext( c.screen.index )
|
||||
end
|
||||
)
|
||||
-- super+alt+k -> move window to prev space
|
||||
,awful.key({ modkey, "Mod1" }, "k",
|
||||
function (c)
|
||||
local curTag = c.first_tag
|
||||
print(curTag.index)
|
||||
local tagIdx = curTag.index - 1
|
||||
if tagIdx < 1 then
|
||||
tagIdx = 5
|
||||
tagIdx = 6
|
||||
end
|
||||
local tag = curTag.screen.tags[tagIdx]
|
||||
client.focus:move_to_tag(tag)
|
||||
@@ -451,7 +485,25 @@ clientkeys = awful.util.table.join(
|
||||
end
|
||||
)
|
||||
|
||||
,awful.key({'Control','Mod1'}, "Tab", function (c) c:lower() end, {description="lower",group="client"})
|
||||
-- mx master lower thumb button
|
||||
,awful.key({'Control','Mod1'}, "Tab",
|
||||
function (c)
|
||||
local n = awful.client.next(1,c,true)
|
||||
|
||||
-- TODO walk through next down and check widow bounds against mouse position
|
||||
--if n == nil then
|
||||
--else
|
||||
--end
|
||||
|
||||
c:lower()
|
||||
-- mouse.coords {
|
||||
-- x = top.x,
|
||||
-- y = top.y
|
||||
-- }
|
||||
-- client.focus(top)
|
||||
|
||||
end,
|
||||
{description="lower",group="client"})
|
||||
|
||||
-- Alt-Tab: cycle through clients on the same screen.
|
||||
-- This must be a clientkeys mapping to have source_c available in the callback.
|
||||
@@ -468,7 +520,7 @@ clientkeys = awful.util.table.join(
|
||||
-- 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, 5 do
|
||||
for i = 1, 6 do
|
||||
globalkeys = awful.util.table.join(globalkeys,
|
||||
-- View tag only.
|
||||
awful.key({ modkey }, "#" .. i + 9,
|
||||
@@ -520,6 +572,7 @@ clientbuttons = awful.util.table.join(
|
||||
awful.button({ modkey }, 1, awful.mouse.client.move),
|
||||
awful.button({ modkey }, 2, awful.mouse.client.resize)
|
||||
,awful.button({ modkey, "Control" }, 1, awful.mouse.client.resize)
|
||||
,awful.button({ modkey, "Control", "Shift" }, 1, function ( c) c.minimized = true end )
|
||||
,awful.button({}, mouseThumbUp, function(c) awful.tag.viewprev(c.screen.index) end)
|
||||
,awful.button({}, mouseThumbDown, function(c) awful.tag.viewnext(c.screen.index) end)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user