move clients to screen
This commit is contained in:
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) )
|
||||
|
||||
74
rc.lua
74
rc.lua
@@ -22,8 +22,8 @@ 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
|
||||
@@ -131,9 +131,14 @@ myawesomemenu = {
|
||||
{ "shutdown", function() awful.spawn.with_shell("systemctl poweroff") end}
|
||||
}
|
||||
|
||||
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon }
|
||||
local menu_terminal = { "open terminal", terminal }
|
||||
|
||||
mymainmenu = awful.menu({
|
||||
items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
menu_awesome,
|
||||
{ "debian", debian.menu.Debian_menu.Debian },
|
||||
{ "terminal", terminal }
|
||||
menu_terminal
|
||||
}
|
||||
})
|
||||
|
||||
@@ -217,7 +222,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()
|
||||
@@ -250,7 +255,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
|
||||
@@ -305,9 +310,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"}),
|
||||
@@ -332,13 +337,7 @@ globalkeys = awful.util.table.join(
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||
{description = "quit awesome", group = "awesome"}),
|
||||
|
||||
-- sb
|
||||
awful.key({ modkey, "Shift" }, "l", function () awful.spawn("i3lock -c 000000") 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, }, "l", function () awful.tag.incmwfact( 0.05) end,
|
||||
@@ -346,6 +345,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,
|
||||
@@ -358,17 +358,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,
|
||||
@@ -407,6 +398,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
|
||||
@@ -414,6 +406,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
|
||||
@@ -426,6 +430,24 @@ 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
|
||||
@@ -439,6 +461,7 @@ 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
|
||||
@@ -522,6 +545,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