Skip to content

Instantly share code, notes, and snippets.

@Skehmatics
Created November 13, 2016 20:50
Show Gist options
  • Save Skehmatics/4c683abb2b612434aa304ecc09aad51d to your computer and use it in GitHub Desktop.
Save Skehmatics/4c683abb2b612434aa304ecc09aad51d to your computer and use it in GitHub Desktop.

Revisions

  1. Derek Schmidt created this gist Nov 13, 2016.
    10 changes: 10 additions & 0 deletions day-mode
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    # export DBUS_SESSION_BUS_ADDRESS environment variable because cron hates me
    PID=$(pgrep -u USER gnome-session-b)
    export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)

    /usr/bin/gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Plat'
    /usr/bin/gsettings set org.gnome.desktop.interface gtk-theme 'Flat-Plat'
    /usr/bin/gsettings set org.gnome.desktop.background picture-uri 'file://WALLPAPER-PATH'
    /usr/bin/gsettings --schemadir ~/.local/share/gnome-shell/extensions/[email protected] set org.zzrough.gs-extensions.drop-down-terminal background-color 'rgb(69,90,100)'
    23 changes: 23 additions & 0 deletions day-night-cycle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash
    # export DBUS_SESSION_BUS_ADDRESS environment variable because cron hates me
    PID=$(pgrep -o gnome-session -u "USER")
    export DBUS_SESSION_BUS_ADDRESS=$(sudo grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
    TIME="$(date '+%H%M')"
    echo "The current time is $TIME"

    CIVS="$(/usr/local/bin/find-twilight | cut -f1 -d\ )"
    CIVE="$(/usr/local/bin/find-twilight | cut -f2 -d\ )"
    echo "Daylight starts at $CIVS ends at $CIVE"
    if [ $TIME -ge $CIVS ] && [ $TIME -le $CIVE ] ; then
    echo "Switching to Day mode"
    RESP=exec /usr/local/bin/day-mode
    else
    echo "Switching to Night mode"
    RESP=exec /usr/local/bin/night-mode
    fi

    if [[ $RESP ]] ; then
    echo "Switch failure"
    else
    echo "Switch sucess"
    fi
    2 changes: 2 additions & 0 deletions find-twilight
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    #!/bin/bash
    echo $(/usr/local/bin/solunar -c CITY --syslocal | grep 'Sunrise\|Sunset' | grep -Eo '[0-9]' | tr -d '\n' | grep -Eo '[0-9]{4,4}')
    10 changes: 10 additions & 0 deletions night-mode
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    # export DBUS_SESSION_BUS_ADDRESS environment variable because cron hates me
    PID=$(pgrep -u USER gnome-session)
    export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)

    /usr/bin/gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Plat-Dark'
    /usr/bin/gsettings set org.gnome.desktop.interface gtk-theme 'Flat-Plat-Dark'
    /usr/bin/gsettings set org.gnome.desktop.background picture-uri 'file://WALLPAPER-PATH'
    /usr/bin/gsettings --schemadir ~/.local/share/gnome-shell/extensions/[email protected] set org.zzrough.gs-extensions.drop-down-terminal background-color 'rgb(33,33,33)'