From 45073b5b3b5cbafa97b6fa09f4cd9a4669097f79 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Mon, 6 Jul 2020 00:40:23 +0200 Subject: [PATCH] added more layouts, a weather widget and the most cool thing: a quake like terminal --- .config/awesome/lain/widget/weather.lua | 2 +- .config/awesome/lib/functions.lua | 12 +++ .config/awesome/rc.lua | 96 +++++++++++++----- .../themes/hanez/layouts/centerwork.png | Bin 0 -> 643 bytes .../themes/hanez/layouts/centerworkh.png | Bin 0 -> 631 bytes .config/awesome/themes/hanez/theme.lua | 34 ++++--- 6 files changed, 103 insertions(+), 41 deletions(-) create mode 100644 .config/awesome/themes/hanez/layouts/centerwork.png create mode 100644 .config/awesome/themes/hanez/layouts/centerworkh.png diff --git a/.config/awesome/lain/widget/weather.lua b/.config/awesome/lain/widget/weather.lua index 9c1e797f..27fd1dcb 100644 --- a/.config/awesome/lain/widget/weather.lua +++ b/.config/awesome/lain/widget/weather.lua @@ -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) diff --git a/.config/awesome/lib/functions.lua b/.config/awesome/lib/functions.lua index 9eaa69c0..ec84544b 100644 --- a/.config/awesome/lib/functions.lua +++ b/.config/awesome/lib/functions.lua @@ -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 diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index cc517e3f..1f91887f 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -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("%s: %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, diff --git a/.config/awesome/themes/hanez/layouts/centerwork.png b/.config/awesome/themes/hanez/layouts/centerwork.png new file mode 100644 index 0000000000000000000000000000000000000000..ed29d8a508157f2322856fbddafdb815eed7d6e9 GIT binary patch literal 643 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=hEVFt%hmI|q0=J1Z0v<)>xlq%tsQ zOst(~>v7mY=4gDhx2u*?nLr^&&|IAkufi)@A`6{Xh(?tf?EJz#%S1&}udgZl;KBZ* ztD3tvuj5K)s>=loyGs;PTUGR$|dIbCvC>7GJgew5Yo z+D9DPo?IU-Kkjf8SE+ll>&++W=Zg;4&66}VdRh61V`IRZgq_WiCj&Z{cP{Q)6}Zp- z^`=9W-J7FUZoFpullyRGZtBd}ChZfCC{0svYUq(Vwc>zNPgt*raON%liXZJV`#tn# z#-th)=`7$9o%ERffAjsjvszbrnrqHsXwu*I*O05FtTFBGw*CFNyDOPk<~3@seY@VQ zVW$73*SWe?EMIb&#jof3-ecA)Z#bwPYoy}Nb>WLR*MZ-XwZVK6J6Nl(-MJU_+oG1i z=t}4-HVX@uV_j4BzWey@-MM@JY%jlh&)z3jwCUE*uakh$!j|Oi?!xdN1Q+aGJ{c&& zS>O>_%)r2R1cVuYEU- literal 0 HcmV?d00001 diff --git a/.config/awesome/themes/hanez/layouts/centerworkh.png b/.config/awesome/themes/hanez/layouts/centerworkh.png new file mode 100644 index 0000000000000000000000000000000000000000..99b66f3994a4db7633d72abf7483757f5526912a GIT binary patch literal 631 zcmV--0*L*IP)EX>4Tx04R}tkv&MmKpe$iTT4YMB6bjQ2vVIah)QwPDionYs1;guFuC*#nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|}?mh0_0scmXsb<#%plX(p zP9}tGZdC}qB7`9NF@m_nOnpuiQ}7&L_we!cF2=LG&;2=imAuISpFljzbi*RvAdYWZ zI_G`j2rEen@j3ChK^G)`iKB|DQNBOx zvch?bvs$UK);;+P!+C9Gnd>x%k;EdFAVPqQ8p^1^LX1|86ccIMPk8u;9KT2|nOtQs zax9<<6_Voz|AXJ%nuV!JHz}L|f-koHF$#osfo9#dzmILZc>)BUfh(=;uQq_0Ptxmc zEqVm>Z37qAZB5<-E_Z;zCtWfmM+(sN7Ye}p8GTa@7`O#`*4*A&`#607GSpS-1~@nb z#)_1^?(y#K&ffk#)9UXBjvjKd+WGa800006VoOIv0RI600RN!9r;`8x010qNS#tmY z4#WTe4#WYKD-Ig~000McNliru