Skip to content

Functional GUI for systemd's "timedatectl" written in python & tk. Useful for standalone window managers on Linux.

Notifications You must be signed in to change notification settings

kj-sh604/dateTimeSetter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dateTimeSetter ⌚

Easily Adjust Date & Time in Standalone Window Managers

Image of dateTimeSetter

Rationale

I use a standalone Window Manager on Linux (no Desktop Environment) and I missed having a simple GUI to quickly change Timezones and toggle NTP in a settings panel, which is commonly found in Desktop Environments. To address this, I made dateTimeSetter, a simple "date & time setter" written in Python and Tk.

Features

  • Simple as possible, so that it just gets out of your way and you can proceed with your life.
  • Can manipulate the following through the interface:
    • Date
    • Time
    • Timezone
    • Local RTC setting
    • NTP
  • Automatically sets the Date, Time, and Timezone with a checkbox.
  • Makefile
    • I've also included a Makefile that utilizes cython3 to create a .c file from the .py code and then compile with gcc into a single binary.
    • I can't really vouch for the continued reliability of the Makefile nor can I promise a significant performance increase with it being compiled as C code, but it's there if you want to give it a go 😌.
    • You will need to have cython, gcc, and make installed on your system (on top of the dependencies listed below) to utilize the Makefile.

Dependencies

To use dateTimeSetter, you will need to install the following dependencies. Here are some instructions on how to install them on various Linux distributions:

Ubuntu / Debian

sudo apt update
sudo apt install python3-tk python3-pip
pip3 install pytz requests

Fedora

sudo dnf install python3-tkinter python3-pip
pip3 install pytz requests

Arch Linux

sudo pacman -S tk python-pip python-pytz python-requests

Usage

$ python3 ./dateTimeSetter.py

or simply…

$ ./dateTimeSetter.py

How I Like to Run it On My Machines

As seen on my dotfiles repo, I wrap the usage of dateTimeSetter in a script:

I have it named as dateTime on my system

#!/bin/sh

BIN_PATH=~/.local/share/python-dateTimeSetter/dateTime
SCRIPT_PATH=~/.local/share/python-dateTimeSetter/dateTime.py

if [ -f "$BIN_PATH" ]; then
    if command -v lxsudo > /dev/null 2>&1; then
        lxsudo $BIN_PATH
    elif command -v gksudo > /dev/null 2>&1; then
        gksudo $BIN_PATH
    elif command -v pkexec > /dev/null 2>&1; then
        pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" $BIN_PATH
    else
        echo "No suitable graphical authentication tool found. Running without root privileges."
        notify-send "No suitable graphical authentication tool found. Running without root privileges."
        $BIN_PATH
    fi
elif [ -f "$SCRIPT_PATH" ]; then
    if command -v lxsudo > /dev/null 2>&1; then
        lxsudo python3 $SCRIPT_PATH
    elif command -v gksudo > /dev/null 2>&1; then
        gksudo python3 $SCRIPT_PATH
    elif command -v pkexec > /dev/null 2>&1; then
        pkexec env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" python3 $SCRIPT_PATH
    else
        echo "No suitable graphical authentication tool found. Running without root privileges."
        notify-send "No suitable graphical authentication tool found. Running without root privileges."
        python3 $SCRIPT_PATH
    fi
else
    echo "dateTime/dateTime.py not found"
    notify-send "Error!" "dateTime/dateTime.py not found" --urgency critical
fi

Feel free to implement something similar.

 

I hope that some of you would find this useful 😌

Happy hacking everyone! 🧑‍💻🤙

About

Functional GUI for systemd's "timedatectl" written in python & tk. Useful for standalone window managers on Linux.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published