diff options
author | Mike Crute <mike@crute.us> | 2022-10-08 10:39:14 -0700 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2022-10-08 10:39:14 -0700 |
commit | 9b234edeb6d57c911a0ac767fb82e5bf6fd92783 (patch) | |
tree | 1d13db093fdb28fd8e381f820c8876c107c374bd | |
parent | 531201dd29c39581f6d9f31af7ad62a5b7c26539 (diff) | |
download | dotfiles-9b234edeb6d57c911a0ac767fb82e5bf6fd92783.tar.bz2 dotfiles-9b234edeb6d57c911a0ac767fb82e5bf6fd92783.tar.xz dotfiles-9b234edeb6d57c911a0ac767fb82e5bf6fd92783.zip |
Add clock widget
-rw-r--r-- | .config/awesome/large_clock.lua | 31 | ||||
-rw-r--r-- | .config/awesome/mcrute.lua | 16 | ||||
-rwxr-xr-x | bin/vclock | 9 |
3 files changed, 56 insertions, 0 deletions
diff --git a/.config/awesome/large_clock.lua b/.config/awesome/large_clock.lua new file mode 100644 index 0000000..564bfb1 --- /dev/null +++ b/.config/awesome/large_clock.lua | |||
@@ -0,0 +1,31 @@ | |||
1 | local gears = require("gears") | ||
2 | local awful = require("awful") | ||
3 | local textclock = require("wibox.widget.textclock") | ||
4 | |||
5 | local large_clock_widget = { mt = {} } | ||
6 | |||
7 | function large_clock_widget.mt:__call(...) | ||
8 | local clock = textclock("<span size=\"100pt\">%H:%M</span>", 60, nil) | ||
9 | |||
10 | local popup = awful.popup { | ||
11 | ontop = true, | ||
12 | visible = false, | ||
13 | border_width = 1, | ||
14 | widget = clock, | ||
15 | placement = function(p) | ||
16 | awful.placement.top_right(p, { margins = { top = 30 }, parent = awful.screen.focused() }) | ||
17 | end | ||
18 | } | ||
19 | |||
20 | function popup:toggle() | ||
21 | if self.visible then | ||
22 | self.visible = false | ||
23 | else | ||
24 | self.visible = true | ||
25 | end | ||
26 | end | ||
27 | |||
28 | return popup | ||
29 | end | ||
30 | |||
31 | return setmetatable(large_clock_widget, large_clock_widget.mt) | ||
diff --git a/.config/awesome/mcrute.lua b/.config/awesome/mcrute.lua index a9ec8b3..824912d 100644 --- a/.config/awesome/mcrute.lua +++ b/.config/awesome/mcrute.lua | |||
@@ -31,6 +31,7 @@ local capi = | |||
31 | -- rc.lua just a little easier to grep for. | 31 | -- rc.lua just a little easier to grep for. |
32 | local battery = require("battery") | 32 | local battery = require("battery") |
33 | local calendar = require("calendar") | 33 | local calendar = require("calendar") |
34 | local large_clock = require("large_clock") | ||
34 | local _cpu_widget = require("cpu-widget") | 35 | local _cpu_widget = require("cpu-widget") |
35 | 36 | ||
36 | local timezone = "America/Los_Angeles" | 37 | local timezone = "America/Los_Angeles" |
@@ -390,6 +391,18 @@ function add_window_rules() | |||
390 | awful.rules.rules = gears.table.join(awful.rules.rules, { | 391 | awful.rules.rules = gears.table.join(awful.rules.rules, { |
391 | { rule_any = { | 392 | { rule_any = { |
392 | class = { | 393 | class = { |
394 | "xclock", | ||
395 | "XClock"}, | ||
396 | }, | ||
397 | properties = { | ||
398 | floating = true, | ||
399 | ontop = true, | ||
400 | focusable = true, | ||
401 | skip_taskbar = true, | ||
402 | placement = awful.placement.centered} | ||
403 | }, | ||
404 | { rule_any = { | ||
405 | class = { | ||
393 | "pavucontrol", | 406 | "pavucontrol", |
394 | "Pavucontrol"}, | 407 | "Pavucontrol"}, |
395 | }, | 408 | }, |
@@ -586,6 +599,8 @@ end | |||
586 | function get_clock() | 599 | function get_clock() |
587 | local wi = wibox.widget.textclock(" %a %b %d, %H:%M ", 60, timezone) | 600 | local wi = wibox.widget.textclock(" %a %b %d, %H:%M ", 60, timezone) |
588 | 601 | ||
602 | local lc = large_clock() | ||
603 | |||
589 | local cw = calendar({ | 604 | local cw = calendar({ |
590 | placement = 'top_right', | 605 | placement = 'top_right', |
591 | start_sunday = true, | 606 | start_sunday = true, |
@@ -594,6 +609,7 @@ function get_clock() | |||
594 | }) | 609 | }) |
595 | wi:connect_signal("button::press", function(_, _, _, button) | 610 | wi:connect_signal("button::press", function(_, _, _, button) |
596 | if button == 1 then cw.toggle() end | 611 | if button == 1 then cw.toggle() end |
612 | if button == 3 then lc:toggle() end | ||
597 | end) | 613 | end) |
598 | 614 | ||
599 | return wi | 615 | return wi |
diff --git a/bin/vclock b/bin/vclock new file mode 100755 index 0000000..f53b090 --- /dev/null +++ b/bin/vclock | |||
@@ -0,0 +1,9 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | color="#AAA" | ||
4 | |||
5 | if [[ "$1" == "-s" ]]; then | ||
6 | xclock -digital -strftime "%H:%M:%S" -face ":size=100:antialias=true:autohint=true" -fg $color -bg black -update 1 | ||
7 | else | ||
8 | xclock -digital -strftime "%H:%M" -face ":size=100:antialias=true:autohint=true" -fg $color -bg black -update 1 | ||
9 | fi | ||