aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt19
-rw-r--r--wmstatus.c19
2 files changed, 31 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27dab0c..f1d4292 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,7 +33,7 @@ configure_file (${PROJECT_SOURCE_DIR}/config.h.in
include_directories (${PROJECT_BINARY_DIR})
# Build
-set (targets wmstatus paswitch siprandom big-brother)
+set (targets wmstatus paswitch siprandom)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
# These use Linux i2c APIs, but can be made to work on macOS
list (APPEND targets brightness input-switch)
@@ -47,7 +47,7 @@ elseif (APPLE)
add_definitions (-D_DARWIN_C_SOURCE)
endif ()
-foreach (name ${targets})
+foreach (name big-brother ${targets})
add_executable (${name} ${name}.c)
endforeach ()
@@ -93,7 +93,20 @@ if (WITH_GDM)
install (TARGETS gdm-switch-user DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
-list (REMOVE_ITEM targets big-brother)
+# These should be accessible by users, but need to touch system devices.
+# Use the setuid bit, for simplicity.
+foreach (target brightness input-switch)
+ if (${target} IN_LIST targets)
+ list (REMOVE_ITEM targets ${target})
+ install (TARGETS ${target} DESTINATION ${CMAKE_INSTALL_BINDIR}
+ PERMISSIONS
+ OWNER_WRITE OWNER_READ OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+ SETUID)
+ endif ()
+endforeach ()
+
install (TARGETS ${targets} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (PROGRAMS shellify DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
diff --git a/wmstatus.c b/wmstatus.c
index 57b1528..0885d97 100644
--- a/wmstatus.c
+++ b/wmstatus.c
@@ -2069,8 +2069,19 @@ on_noise_adjust (struct app_context *ctx, int arg)
if (!ctx->noise_end_time && (arg < 0 || !noise_start (ctx)))
return;
- // The granularity of noise playback is whole minutes
- ctx->noise_end_time += arg * 60;
+ time_t now = time (NULL);
+ int diff = difftime (ctx->noise_end_time, now);
+
+ // The granularity of noise playback setting is whole hours.
+ enum { SECOND = 1, MINUTE = 60, HOUR = 3600 };
+ if (arg > 0)
+ // Add a minute to enable stepping up from 0:59 to 2:00.
+ diff = (diff + arg * HOUR + MINUTE) / HOUR * HOUR;
+ else if (arg++ < 0)
+ // Remove a second to enable stepping down from 2:00 to 1:00.
+ diff = (diff + arg * HOUR - SECOND) / HOUR * HOUR;
+
+ ctx->noise_end_time = now + diff;
on_noise_timer (ctx);
}
@@ -2492,8 +2503,8 @@ g_keys[] =
{ 0, XF86XK_AudioMicMute, on_volume_mic_mute, 0 },
// Noise playback
- { ControlMask, XF86XK_AudioRaiseVolume, on_noise_adjust, 60 },
- { ControlMask, XF86XK_AudioLowerVolume, on_noise_adjust, -60 },
+ { ControlMask, XF86XK_AudioRaiseVolume, on_noise_adjust, 1 },
+ { ControlMask, XF86XK_AudioLowerVolume, on_noise_adjust, -1 },
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -