Merge remote-tracking branch 'origin/master' into nix

This commit is contained in:
Geoffrey Frogeye 2023-11-03 20:51:53 +01:00
commit ae9893fc08
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
9 changed files with 4 additions and 136 deletions

View file

@ -1,7 +1,10 @@
---
- name: I3-reload
ansible.builtin.command: i3-msg reload
listen: i3-reload
- name: Shell-reload
ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
listen: shell-reload
- name: Fzf-reload
ansible.builtin.command: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf
ansible.builtin.shell: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf
listen: fzf-reload

View file

@ -1,7 +0,0 @@
#!/usr/bin/env bash
while true
do
ashuffle
sleep 1
done

View file

@ -1,16 +0,0 @@
#!/bin/bash
# TODO Make a good service out of this
cd /opt/activitywatch # Put your ActivityWatch install folder here
killall aw-server
killall aw-watcher-afk
killall aw-watcher-window
./aw-server/aw-server &
./aw-watcher-afk/aw-watcher-afk &
./aw-watcher-window/aw-watcher-window & # you can add --exclude-title here to exclude window title tracking for this session only
notify-send "ActivityWatch started" # Optional, sends a notification when ActivityWatch is started

View file

@ -114,10 +114,8 @@ exec --no-startup-id unclutter -root # Hide mouse cursor after some time
#exec --no-startup-id dunst # Notifications (handled by systemd)
exec --no-startup-id keynav # Keyboard cursor controller
#exec --no-startup-id mpd # Music Player Daemon (handled by systemd)
# exec --no-startup-id ~/.config/i3/ashuffle # MPD Auto-refill
exec --no-startup-id autorandr --change --force # Screen configuration and everything that depends on it
{% if has_battery %}
exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification
{% endif %}
# exec --no-startup-id ~/.config/i3/aw_start # Activity tracker

View file

@ -1,2 +0,0 @@
#!/bin/sh
dmenu -fn 'DejaVu Sans Mono-10' -nb '#48483e' -nf '#f1ebeb' -sb '#8fc029' -sf '#272822' -i -l 8 -f "$@"

View file

@ -1,15 +0,0 @@
#!/bin/sh
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
cache=$cachedir/dmenu_run
else
cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
(
IFS=:
if stest -dqr -n "$cache" $PATH; then
stest -flx $PATH | sort -u | tee "$cache" | $HOME/.config/i3/dmenu_cmd -p 'Run' "$@"
else
$HOME/.config/i3/dmenu_cmd -p 'Run' "$@" < "$cache"
fi
) | ${SHELL:-"/bin/sh"} &

View file

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Send a key event to the current multimedia application or to MPD
# Currently since I did not found a way to test if a keystroke
# is grabbed by a windows or not, we test if MPD is playing
echo 8 "$1" "$2" "$(xdotool getactivewindow)" >> /tmp/dbg
if [ $# != 2 ]; then
echo "Usage: $0 KEY MPC_COMMAND"
exit 1
fi
if [ $(mpc status | wc -l) -ne 1 ]; then
# If mpd is running
mpc $2
else
# If mpd is not running
# echo "$1" "$2" "$(xdotool getactivewindow)" >> /tmp/dbg
xdotool key --window $(xdotool getactivewindow) $1
echo xdotool key --window $(xdotool getactivewindow) $1 >> /tmp/dbg
fi
exit 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 B

View file

@ -1,67 +0,0 @@
#!/usr/bin/env python3
"""
Logs what window is in focus
"""
import csv
import datetime
import os
import typing
import i3ipc
class ScreenTime:
FIELDS = ["date", "type", "class", "role", "instance", "title"]
def write(self, line: typing.Dict) -> None:
now = datetime.datetime.now()
line["date"] = now.timestamp()
print("WROTE", line)
with open(self.csv_path, "a") as typedfd:
writer = csv.DictWriter(typedfd, fieldnames=self.FIELDS)
writer.writerow(line)
def on_window_event(
self, _: i3ipc.connection.Connection, e: i3ipc.events.WindowEvent
) -> None:
focused = self.i3.get_tree().find_focused()
self.write(
{
"type": "window_" + e.change,
"class": focused.window_class,
"role": focused.window_role,
"title": focused.window_title,
"instance": focused.window_instance,
}
)
def on_mode_event(
self, _: i3ipc.connection.Connection, e: i3ipc.events.ModeEvent
) -> None:
self.write({"type": "mode", "title": e.change})
def __init__(self) -> None:
self.i3 = i3ipc.Connection()
self.i3.on(i3ipc.Event.WINDOW, self.on_window_event)
self.i3.on(i3ipc.Event.MODE, self.on_mode_event)
self.csv_path = os.path.join(
os.path.expanduser(os.getenv("XDG_CACHE_PATH", "~/.cache/")),
"screentime.csv",
)
if not os.path.isfile(self.csv_path):
with open(self.csv_path, "w") as typedfd:
writer = csv.DictWriter(typedfd, fieldnames=self.FIELDS)
writer.writeheader()
self.write({"type": "start"})
def main(self) -> None:
self.i3.main()
if __name__ == "__main__":
ST = ScreenTime()
ST.main()