From 06b92b37c441177a7d84213f746963f14cfcb90e Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 18 Jun 2022 21:20:20 -0500 Subject: Add pomodoro --- rc.lua | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/rc.lua b/rc.lua index 999d1f6..5e2ec1d 100644 --- a/rc.lua +++ b/rc.lua @@ -20,6 +20,7 @@ local hotkeys_popup = require("awful.hotkeys_popup").widget -- Lain local lain = require("lain") +local awmodoro = require("awmodoro") local io = require("io") @@ -141,6 +142,32 @@ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesom mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) +pomowibox = awful.wibox({ position = "top", screen = 1, height=4}) +pomowibox.visible = false +local pomodoro = awmodoro.new({ + minutes = 25, + do_notify = false, + active_bg_color = '#313131', + paused_bg_color = '#7746D7', + fg_color = {type = "linear", from = {0,0}, to = {pomowibox.width, 0}, stops = {{0, "#AECF96"},{0.5, "#88A175"},{1, "#FF5656"}}}, + width = pomowibox.width, + height = pomowibox.height, + + begin_callback = function() + for s = 1, screen.count() do + mywibox[s].visible = false + end + pomowibox.visible = true + end, + + finish_callback = function() + for s = 1, screen.count() do + mywibox[s].visible = true + end + pomowibox.visible = false + end}) +pomowibox:set_widget(pomodoro) + -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} @@ -252,6 +279,7 @@ spr = wibox.widget.textbox(' ⌁ ') myemailwidget = wibox.widget.textbox() mybatwidget = wibox.widget.textbox ('') +mysysctlwidget = wibox.widget.textbox ('') mynetworkwidget = wibox.widget.textbox ('') notify_bat = true @@ -334,6 +362,30 @@ function act() end end) + textStat = " / " + --{{ systemctl status + awful.spawn.easy_async("bash -c \"ps aux | grep [w]pa_supplicant\"", function(out, a, reason, exit_code) + textStat = "" + if exit_code == 0 then + textStat = textStat .. "📡 | " + end + mysysctlwidget:set_text ( textStat ) + end + ) + awful.spawn.easy_async("systemctl status bluetooth", function(out, _, reason, exit_code) + if exit_code == 0 then + textStat = textStat .. "💎 | " + end + mysysctlwidget:set_text ( textStat ) + end + ) + awful.spawn.easy_async("systemctl status sshd", function(out, _, reason, exit_code) + if exit_code == 0 then + textStat = textStat .. "🐚 | " + end + mysysctlwidget:set_text ( textStat ) + end + ) --{{ Network awful.spawn.easy_async("bash -c \"ip r | grep default | head -n 1 | sed s/.*dev/sed/ | cut -d' ' -f 2\"", function(interface_default, stderr, reason, exit_code) @@ -526,6 +578,7 @@ for s = 1, screen.count() do if s == 1 then right_layout:add(wibox.widget.systray()) end right_layout:add(spr) right_layout:add(mpdwidget) + right_layout:add(mysysctlwidget) right_layout:add(mynetworkwidget) right_layout:add(spr) right_layout:add(cpuwidget.widget) @@ -640,6 +693,8 @@ layoutKkb = 1 -- {{{ Key bindings globalkeys = awful.util.table.join( + + awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {description="Show help", group="awesome"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore --[[, {description = "go back", group = "tag"} --]]), @@ -699,7 +754,7 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio awful.key({ modkey, "Mod1"}, "f", function () awful.util.spawn("firefox") end, {description = "Firefox", group = "awesome"}), -- awful.key({ modkey, }, "b", function () awful.util.spawn("vimb -c /usr/share/vimb/.vimbrc") end), - awful.key({ modkey, "Mod1"}, "r", function () awful.util.spawn_with_shell("xterm -ti vt340 -e 'ranger'") end, + awful.key({ modkey, "Mod1"}, "r", function () awful.util.spawn_with_shell("kitty -e 'ranger'") end, {description = "Ranger", group = "awesome"}), awful.key({ modkey, "Control"}, "r", function () awful.util.spawn("pcmanfm") end), awful.key({ modkey, }, "s", function () @@ -832,6 +887,12 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio history_path = awful.util.get_cache_dir() .. "/history_eval" } end,{description = "Run Lua code", group = "awesome"}), + awful.key({ modkey, "Shift" }, "!", + function () + awful.util.spawn("xset s off") + awful.util.spawn("xset s 0 0 0") + awful.util.spawn("xset -dpms") + end,{description = "🔐 lock screen", group = "awesome"}), awful.key({ modkey }, "!", function () awful.util.spawn("loginctl lock-session") @@ -1069,8 +1130,10 @@ for i = 1, 9 do client.focus:toggle_tag(tag) end end - end --[[, {description = "toggle focused client on tag #" .. i, group = "tag"}--]]) - ) + end --[[, {description = "toggle focused client on tag #" .. i, group = "tag"}--]]), + awful.key({ modkey, "Mod1"}, "p", function () pomodoro:toggle() end), + awful.key({ modkey, "Shift" }, "p", function () pomodoro:finish() end) + ) end -- cgit v1.2.3