From c0802e2cafd40b9f49631950449428a521ae7825 Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 22 Apr 2023 01:36:32 +0200 Subject: Add pomodoro timers --- rc.lua | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'rc.lua') diff --git a/rc.lua b/rc.lua index 7067706..1e9e012 100644 --- a/rc.lua +++ b/rc.lua @@ -143,7 +143,10 @@ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) pomowibox = awful.wibox({ position = "top", screen = 1, height=4}) +qPomowibox = awful.wibox({ position = "top", screen = 1, height=4}) pomowibox.visible = false +qPomowibox.visible = false + local pomodoro = awmodoro.new({ minutes = 25, do_notify = false, @@ -151,7 +154,7 @@ local pomodoro = awmodoro.new({ 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, + height = pomowibox.height, begin_callback = function() for s = 1, screen.count() do @@ -166,7 +169,31 @@ local pomodoro = awmodoro.new({ end pomowibox.visible = false end}) -pomowibox:set_widget(pomodoro) + pomowibox:set_widget(pomodoro) +local quickPomodoro = awmodoro.new({ + minutes = 1, + do_notify = false, + active_bg_color = '#313131', + paused_bg_color = '#7746D7', + fg_color = {type = "linear", from = {0,0}, to = {qPomowibox.width, 0}, stops = {{0, "#AECF96"},{0.5, "#88A175"},{1, "#FF5656"}}}, + width = qPomowibox.width, + height = qPomowibox.height, + + begin_callback = function() + for s = 1, screen.count() do + mywibox[s].visible = false + end + qPomowibox.visible = true + end, + + finish_callback = function() + for s = 1, screen.count() do + mywibox[s].visible = true + end + qPomowibox.visible = false + end}) + qPomowibox:set_widget(quickPomodoro) + -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it @@ -696,7 +723,7 @@ globalkeys = awful.util.table.join( -awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {description="Show help", group="awesome"}), +awful.key({ modkey, "Mod1" }, "h", hotkeys_popup.show_help, {description="Show help", group="awesome"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore --[[, {description = "go back", group = "tag"} --]]), @@ -763,11 +790,16 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio naughty.notify({ title = 'Scrot', text = 'New screenshot taken', timeout = 3 }) end, {description = "Screenshot", group = "awesome"}), + awful.key({ modkey, "Shift"}, "s", function () + awful.util.spawn("scrot -s") + naughty.notify({ title = 'Scrot', text = 'New screenshot taken', timeout = 3 }) + end, + {description = "Screenshot of selectionned area", group = "awesome"}), awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("scrot -u") naughty.notify({ title = 'Scrot', text = 'Screenshot of focused windows', timeout = 2 }) end, - {description = "Screenshot selection", group = "awesome"}), + {description = "Screenshot of focused windows", group = "awesome"}), awful.key({ modkey, }, "Left", @@ -959,9 +991,6 @@ awful.key({ modkey, "Mod1" }, "t", function (c) c.ontop = not c.ontop e awful.key({ modkey, }, "v", function (c) awful.util.spawn("xdotool click 2") end), - awful.key({ modkey, "Mod1" }, "h", function (c) - c:kill() - end), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, {description = "Set floating layout", group = "client"}), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), @@ -1156,8 +1185,9 @@ for i = 1, 9 do 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) + awful.key({ modkey, "Mod1"}, "p", function () if not pomowibox.visible then pomodoro:toggle() end end), + awful.key({ modkey, "Ctrl"}, "p", function () if not pomowibox.visible then quickPomodoro:toggle() end end), + awful.key({ modkey, "Shift" }, "p", function () pomodoro:finish(); quickPomodoro:finish() end) ) end -- cgit v1.2.3