added more layouts, a weather widget and the most cool thing: a quake like terminal

This commit is contained in:
Johannes Findeisen 2020-07-06 00:40:23 +02:00
commit 45073b5b3b
6 changed files with 103 additions and 41 deletions

View file

@ -137,7 +137,7 @@ local function factory(args)
end)
end
if showpopup == "on" then weather.attach(weather.widget) end
if showpopup == "on" then weather.attach(weather.widget) end
weather.timer = helpers.newtimer("weather-" .. city_id, timeout, weather.update, false, true)
weather.timer_forecast = helpers.newtimer("weather_forecast-" .. city_id, timeout, weather.forecast_update, false, true)

View file

@ -19,3 +19,15 @@ function tablelength(T)
return count
end
local function set_wallpaper(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, false)
--gears.wallpaper.centered(wallpaper, s, true)
end
end

View file

@ -6,6 +6,8 @@
local config = require("config")
require("lib.functions")
--local math, string, os = math, string, os
local gears = require("gears")
awful = require("awful")
awful.rules = require("awful.rules")
@ -16,6 +18,7 @@ local naughty = require("naughty")
local menubar = require("menubar")
local vicious = require("vicious")
local lain = require("lain")
--local vain = require("vain")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
@ -50,8 +53,8 @@ end
beautiful.init(os.getenv("HOME").."/.config/awesome/themes/hanez/theme.lua")
-- To override the wallpaper provided by the theme you can just add a file named
-- ~/images/background.png and then this file will be used as wallpaper. No need
-- to change the theme or this file for that... ;)
-- ~/.background.png and then this file will be used as wallpaper. No need
-- to change the theme or this file for that... Even symlinks are working ;)
name = os.getenv("HOME").."/.background.png"
if file_exists(name) then
beautiful.wallpaper = name
@ -62,7 +65,10 @@ terminal = '/usr/bin/uxterm -bg black -fg grey -sb -leftbar -si -bc -cr orange
editor = "/usr/bin/vim"
editor_cmd = terminal .. " -e " .. editor
modkey = "Mod4"
awful.util.terminal = terminal
local modkey = "Mod4"
local altkey = "Mod1"
-- Autostart some programs defined in config.lua; Start them only once... ;)
for i, program in ipairs(config.autostart) do
@ -72,21 +78,27 @@ end
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
--awful.layout.suit.fair.horizontal,
lain.layout.centerwork,
--lain.layout.centerwork.horizontal,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
--awful.layout.suit.tile.bottom,
--awful.layout.suit.tile.top,
--awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle,
--awful.layout.suit.magnifier,
awful.layout.suit.corner.nw,
awful.layout.suit.corner.ne,
--awful.layout.suit.corner.nw,
--awful.layout.suit.corner.ne,
awful.layout.suit.corner.sw,
awful.layout.suit.corner.se,
--awful.layout.suit.corner.se,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.floating,
--lain.layout.cascade,
--lain.layout.cascade.tile,
--lain.layout.termfair,
--lain.layout.termfair.center,
}
-- }}}
@ -124,6 +136,20 @@ vicious.register(netwidget, vicious.widgets.net,
local thermalwidget = wibox.widget.textbox()
vicious.register(thermalwidget, vicious.widgets.thermal, "$1°C ", 20, config.thermal_zone )
local myweather = lain.widget.weather({
city_id = config.cityid,
notification_preset = { font = beautiful.font },
notification_text_fun = function (wn)
local day = os.date("%a %d", wn["dt"])
local tmin = math.floor(wn["temp"]["min"])
local tmax = math.floor(wn["temp"]["max"])
local desc = wn["weather"][1]["description"]
return string.format("<b>%s</b>: %s, %d°C/%d°C ", day, desc, tmin, tmax)
end,
})
myweather.attach(myweather.icon)
local cpuwidget = awful.widget.graph()
cpuwidget:set_width(100)
cpuwidget:set_background_color("#222222")
@ -195,6 +221,13 @@ end
screen.connect_signal("property::geometry", set_wallpaper)
awful.screen.connect_for_each_screen(function(s)
-- Quake application
s.quake = lain.util.quake({ app = terminal })
s.quake.horiz = "center"
s.quake.width = 1024
s.quake.height = 768
-- Wallpaper
set_wallpaper(s)
@ -236,6 +269,7 @@ awful.screen.connect_for_each_screen(function(s)
cpuwidget,
batterywidget,
thermalwidget,
myweather.icon,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
@ -255,28 +289,33 @@ root.buttons(gears.table.join(
-- {{{ Key bindings
globalkeys = gears.table.join(
-- Dropdown application
awful.key({ modkey, }, "q", function () awful.screen.focused().quake:toggle() end,
{description = "dropdown application", group = "launcher"}),
-- Set backlight
awful.key({ modkey, "Mod1" }, "1", function() awful.util.spawn("/usr/bin/xbacklight -set 10") end,
awful.key({ modkey, }, "1", function() awful.util.spawn("/usr/bin/xbacklight -set 10") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "2", function() awful.util.spawn("/usr/bin/xbacklight -set 20") end,
awful.key({ modkey, }, "2", function() awful.util.spawn("/usr/bin/xbacklight -set 20") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "3", function() awful.util.spawn("/usr/bin/xbacklight -set 30") end,
awful.key({ modkey, }, "3", function() awful.util.spawn("/usr/bin/xbacklight -set 30") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "4", function() awful.util.spawn("/usr/bin/xbacklight -set 40") end,
awful.key({ modkey, }, "4", function() awful.util.spawn("/usr/bin/xbacklight -set 40") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "5", function() awful.util.spawn("/usr/bin/xbacklight -set 50") end,
awful.key({ modkey, }, "5", function() awful.util.spawn("/usr/bin/xbacklight -set 50") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "6", function() awful.util.spawn("/usr/bin/xbacklight -set 60") end,
awful.key({ modkey, }, "6", function() awful.util.spawn("/usr/bin/xbacklight -set 60") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "7", function() awful.util.spawn("/usr/bin/xbacklight -set 70") end,
awful.key({ modkey, }, "7", function() awful.util.spawn("/usr/bin/xbacklight -set 70") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "8", function() awful.util.spawn("/usr/bin/xbacklight -set 80") end,
awful.key({ modkey, }, "8", function() awful.util.spawn("/usr/bin/xbacklight -set 80") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "9", function() awful.util.spawn("/usr/bin/xbacklight -set 90") end,
awful.key({ modkey, }, "9", function() awful.util.spawn("/usr/bin/xbacklight -set 90") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "0", function() awful.util.spawn("/usr/bin/xbacklight -set 100") end,
awful.key({ modkey, }, "0", function() awful.util.spawn("/usr/bin/xbacklight -set 100") end,
{ description="set backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "o", function()
awful.key({ modkey, }, "o", function()
local handle = io.popen("/usr/bin/xbacklight -get")
local result = handle:read("*a")
handle:close()
@ -285,7 +324,7 @@ globalkeys = gears.table.join(
awful.util.spawn("/usr/bin/xbacklight -set "..newval)
end,
{ description="decrease backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "p", function()
awful.key({ modkey, }, "p", function()
local handle = io.popen("/usr/bin/xbacklight -get")
local result = handle:read("*a")
handle:close()
@ -294,10 +333,11 @@ globalkeys = gears.table.join(
awful.util.spawn("/usr/bin/xbacklight -set "..newval)
end,
{ description="increase backlight", group="awesome" }),
awful.key({ modkey, "Mod1" }, "y", function() awful.util.spawn("/usr/bin/killall xautolock") end,
awful.key({ modkey, altkey }, "y", function() awful.util.spawn("/usr/bin/killall xautolock") end,
{ description="kill xautolock", group="awesome" }),
awful.key({ modkey, "Mod1" }, "x", function() awful.util.spawn("/usr/bin/xautolock -locker slock -time 5") end,
awful.key({ modkey, altkey }, "x", function() awful.util.spawn("/usr/bin/xautolock -locker slock -time 5") end,
{ description="enable xautolock", group="awesome" }),
-- Some Application shortcuts
awful.key({ modkey }, "e", function() awful.util.spawn("/usr/bin/emulationstation") end,
{ description="start emulationstation", group="awesome" }),
@ -316,10 +356,18 @@ globalkeys = gears.table.join(
awful.key({ modkey }, "y", function() awful.util.spawn("/usr/bin/thunar") end,
{ description="start thunar", group="awesome"}),
awful.key({ modkey, }, "u", function() awful.util.spawn("/usr/bin/xdotool click 2") end),
--awful.key({ modkey, "Mod1" }, "space", function() awful.util.spawn("/usr/bin/xdotool click 2") end),
--awful.key({ modkey, altkey }, "space", function() awful.util.spawn("/usr/bin/xdotool click 2") end),
awful.key({ modkey, "Shift" }, "Return", function () awful.util.spawn("/usr/bin/slock") end,
{ description="lock screen", group="awesome"}),
-- Copy primary to clipboard (terminals to gtk)
awful.key({ modkey, altkey }, "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, altkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end,
{description = "copy gtk to terminal", group = "hotkeys"}),
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{ description="show help", group="awesome"}),
awful.key({ modkey, }, "Left", awful.tag.viewprev,

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

View file

@ -77,21 +77,23 @@ theme.titlebar_maximized_button_focus_inactive = os.getenv("HOME").."/.config/a
theme.titlebar_maximized_button_normal_active = os.getenv("HOME").."/.config/awesome/themes/hanez/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active = os.getenv("HOME").."/.config/awesome/themes/hanez/titlebar/maximized_focus_active.png"
theme.layout_fairh = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/fairh.png"
theme.layout_fairv = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/fairv.png"
theme.layout_floating = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/floating.png"
theme.layout_magnifier = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/magnifier.png"
theme.layout_max = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/max.png"
theme.layout_fullscreen = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/fullscreen.png"
theme.layout_tilebottom = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tilebottom.png"
theme.layout_tileleft = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tileleft.png"
theme.layout_tile = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tile.png"
theme.layout_tiletop = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tiletop.png"
theme.layout_spiral = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/spiral.png"
theme.layout_dwindle = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/dwindle.png"
theme.layout_cornernw = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornernw.png"
theme.layout_cornerne = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornerne.png"
theme.layout_cornersw = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornersw.png"
theme.layout_cornerse = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornerse.png"
theme.layout_fairh = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/fairh.png"
theme.layout_fairv = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/fairv.png"
theme.layout_floating = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/floating.png"
theme.layout_magnifier = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/magnifier.png"
theme.layout_max = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/max.png"
theme.layout_fullscreen = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/fullscreen.png"
theme.layout_tilebottom = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tilebottom.png"
theme.layout_tileleft = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tileleft.png"
theme.layout_tile = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tile.png"
theme.layout_tiletop = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/tiletop.png"
theme.layout_spiral = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/spiral.png"
theme.layout_dwindle = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/dwindle.png"
theme.layout_cornernw = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornernw.png"
theme.layout_cornerne = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornerne.png"
theme.layout_cornersw = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornersw.png"
theme.layout_cornerse = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/cornerse.png"
theme.layout_centerwork = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/centerwork.png"
theme.layout_centerworkh = os.getenv("HOME").."/.config/awesome/themes/hanez/layouts/centerworkh.png"
return theme