Add a 'do not disturb' widget.

master
josiah 4 years ago
parent 9b42c1d297
commit a74c87530d

@ -0,0 +1,65 @@
-------------------------------------------------
-- DemoMode button for Awesome Window Manager
-- Turns off notifications and send a heartbeat to xscreensaver
-- @author Raphaël Fournier-S'niehotta
-- @copyright 2018 Raphaël Fournier-S'niehotta
-------------------------------------------------
local wibox = require("wibox")
local watch = require("awful.widget.watch")
local awful = require("awful")
local beautiful = require("beautiful")
local naughty = require("naughty")
local gears = require("gears")
local XSCREENSAVER_DEACTIVATE_COMMAND = "xscreensaver-command -deactivate"
local XSCREENSAVER_TIMER = 61
local iconpath = "/home/josiah/.config/awesome/demomode.png"
local demoMode_widget = wibox.widget {
wibox.widget {
image = beautiful.demomode_icon or iconpath,
resize = true,
widget = wibox.widget.imagebox
},
widget = wibox.container.background
}
watch(XSCREENSAVER_DEACTIVATE_COMMAND, XSCREENSAVER_TIMER, demoMode_widget)
function blockXscreensaver()
gears.timer {
timeout = XSCREENSAVER_TIMER,
autostart = true,
callback = function()
awful.util.spawn_with_shell(XSCREENSAVER_DEACTIVATE_COMMAND)
--naughty.notify{
--title= "Notification status",
--text = tostring(not naughty.is_suspended()),
--ignore_suspend = true,
--}
end,
single_shot = false,
}
end
demoMode_widget:buttons(awful.util.table.join(
awful.button({ }, 1, function ()
naughty.toggle()
if naughty.is_suspended() then
blockXscreensaver()
demoMode_widget.bg = beautiful.fg_urgent
else
demoMode_widget.bg = beautiful.bg_normal
end
--naughty.notify{
--title= "Notification status",
--text = tostring(not naughty.is_suspended()),
--ignore_suspend = true,
--}
end)
))
return demoMode_widget

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -30,15 +30,6 @@ theme.border_normal = "#000000"
theme.border_focus = "#535d6c"
theme.border_marked = "#91231c"
-- customize the battery widget
-- as of 2020-05-09 this is not working, fuckin. -jlj
theme.widget_main_color = "#74aeab"
theme.widget_red = "#e53935"
theme.widget_yellow = "#c0ca33"
theme.widget_green = "#43a047"
theme.widget_black = "#000000"
theme.widget_transparent = "#00000000"
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
@ -52,6 +43,14 @@ theme.widget_transparent = "#00000000"
-- Example:
--theme.taglist_bg_focus = "#ff0000"
-- battery customization
theme.widget_main_color = "#74aeab"
theme.widget_red = "#e53935"
theme.widget_yellow = "#c0ca33"
theme.widget_green = "#43a047"
theme.widget_black = "#000000"
theme.widget_transparent = "#00000000"
-- Generate taglist squares:
local taglist_square_size = dpi(4)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(

@ -24,6 +24,8 @@ local volume_widget = require("awesome-wm-widgets.volume-widget.volume")
-- battery import and customization
local battery_widget = require("awesome-wm-widgets.batteryarc-widget.batteryarc")
-- game mode import and customization
local game_widget = require("awesome-wm-widgets.demomode-widget.demomode")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
@ -52,8 +54,8 @@ end
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") -- this is the OG theme
-- beautiful.init(gears.filesystem.get_themes_dir() .. "jlj-theme.lua") -- this is my shitty test theme
-- beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") -- this is the OG theme
beautiful.init(gears.filesystem.get_configuration_dir() .. "jlj-theme.lua") -- this is my shitty test theme
-- This is used later as the default terminal and editor to run.
terminal = "konsole"
@ -218,6 +220,7 @@ awful.screen.connect_for_each_screen(function(s)
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
game_widget,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,

Loading…
Cancel
Save