Add timekpr

This commit is contained in:
Przemek Grondek 2023-11-07 18:08:58 +01:00
parent 125fd4768e
commit c3aec9f626
3 changed files with 86 additions and 1 deletions

View File

@ -8,4 +8,4 @@
- import_tasks: dotfiles.yml
- import_tasks: signal.yml
#- import_tasks: timekpr.yml
- import_tasks: timekpr.yml

View File

@ -0,0 +1,34 @@
- become: yes
block:
- name: add ppa [Ubuntu]
when: ansible_distribution == "Ubuntu"
apt_repository:
repo: ppa:mjasnik/ppa
- name: install timekpr [Ubuntu]
when: ansible_distribution == "Ubuntu"
apt:
update_cache: yes
state: latest
pkg:
- timekpr-next
- name: install timekpr [Arch]
shell:
cmd:
yay -S --needed --noconfirm timekpr-next
when: ansible_distribution == "Archlinux"
- name: configure
template:
src: var/lib/timekpr/config/timekpr.USER.conf.j2
dest: /var/lib/timekpr/config/timekpr.{{ansible_user_id}}.conf
vars:
user: "{{ ansible_user_id }}"
- name: "Enable service"
become: yes
ansible.builtin.systemd:
name: timekpr
state: started
enabled: yes

View File

@ -0,0 +1,51 @@
[DOCUMENTATION]
#### this is the user configuration file for timekpr-next
#### if this file cannot be read properly, it will be overwritten with defaults
#### all numeric time values are specified in seconds
#### days and hours should be configured as per ISO 8601 (i.e. Monday is the first day of week (1-7) and hours are in 24h format (0-23))
[{{ user }}]
# this defines which hours are allowed (remove or add hours to limit access), configure limits for start/end minutes for hour in brackets,
# optionally enter ! in front of hour to mark it non-accountable, example: !22[00-15]
ALLOWED_HOURS_1 = 9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
ALLOWED_HOURS_2 = 9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
ALLOWED_HOURS_3 = 9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
ALLOWED_HOURS_4 = 9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
ALLOWED_HOURS_5 = 9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
ALLOWED_HOURS_6 = 0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
ALLOWED_HOURS_7 = 0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23
# this defines which days of the week a user can use computer (remove or add days to limit access)
ALLOWED_WEEKDAYS = 1;2;3;4;5;6;7
# this defines allowed time in seconds per week day a user can use the computer (number of values must match the number of values for option ALLOWED_WEEKDAYS)
LIMITS_PER_WEEKDAYS = 86400;86400;86400;86400;86400;86400;86400
# this defines allowed time per week in seconds (in addition to other limits)
LIMIT_PER_WEEK = 604800
# this defines allowed time per month in seconds (in addition to other limits)
LIMIT_PER_MONTH = 2678400
# this defines whether to account sessions which are inactive (locked screen, user switched away from desktop, etc.)
TRACK_INACTIVE = False
# this defines whether to show icon and notifications for user
HIDE_TRAY_ICON = False
# this defines user restriction / lockout mode: lock - lock screen, suspend - put computer to sleep, suspendwake - put computer to sleep and wake it up,
# terminate - terminate sessions, shutdown - shutdown the computer
LOCKOUT_TYPE = terminate
# this defines wakeup hour interval in format xn;yn where xn / yn are hours from 0 to 23, wakeup itself must be supported by BIOS / UEFI and enabled,
# this is effective only when lockout type is suspendwake
WAKEUP_HOUR_INTERVAL = 0;23
[{{ user }}.PLAYTIME]
# whether PlayTime is enabled for this user
PLAYTIME_ENABLED = False
# whether PlayTime is enabled to override existing time accounting, i.e. time ticks only when PlayTime processes / activities are running,
# in this case explicit PlayTime limits are ignored
PLAYTIME_LIMIT_OVERRIDE_ENABLED = False
# whether PlayTime activities are allowed during unaccounted time intervals
PLAYTIME_UNACCOUNTED_INTERVALS_ENABLED = True
# specify on which days PlayTime is enabled
PLAYTIME_ALLOWED_WEEKDAYS = 1;2;3;4;5;6;7
# how much PlayTime is allowed per allowed days (number of values must match the number of values for option PLAYTIME_ALLOWED_WEEKDAYS)
PLAYTIME_LIMITS_PER_WEEKDAYS = 0;0;0;0;0;0;0
# this defines which activities / processes are monitored, pattern: PLAYTIME_ACTIVITY_NNN = PROCESS_MASK[DESCRIPTION],
# where NNN is number left padded with 0 (keys must be unique and ordered), optionally it's possible to add user
# friendly description in [] brackets. Process mask supports regexp, except symbols [], please be careful entering it!
##PLAYTIME_ACTIVITIES## Do NOT remove or alter this line!