diff options
author | Amin Bandali <amin@aminb.org> | 2018-04-29 02:00:39 -0400 |
---|---|---|
committer | Amin Bandali <amin@aminb.org> | 2018-04-29 02:00:39 -0400 |
commit | 4f183f2aa83af08c6c36bd982e2726fb1ac25d4c (patch) | |
tree | 94bb76cd75482a57d878d97fce49ba65d3a18981 | |
parent | b43e02acedf252efd3618b564174efb83c4c6d4c (diff) | |
download | configs-4f183f2aa83af08c6c36bd982e2726fb1ac25d4c.tar.gz configs-4f183f2aa83af08c6c36bd982e2726fb1ac25d4c.tar.xz configs-4f183f2aa83af08c6c36bd982e2726fb1ac25d4c.zip |
[rc/wp] migrate my little wallpaper changer script to literate setup
Diffstat (limited to '')
-rw-r--r-- | rc.org | 112 | ||||
-rw-r--r-- | wp/.config/systemd/user/wp.service | 6 | ||||
-rw-r--r-- | wp/.config/systemd/user/wp.timer | 10 | ||||
-rwxr-xr-x | wp/.local/bin/wp | 15 | ||||
-rwxr-xr-x | wp/.local/bin/wp-auto | 48 |
5 files changed, 112 insertions, 79 deletions
@@ -3541,6 +3541,118 @@ fi xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T #+end_src +** wp + +My little wallpaper changer script. + +*** wp +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/wp :shebang "#!/bin/bash" +:END: + +#+begin_src bash :tangle no +export DISPLAY=:0 + +case "$1" in + "day") + feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg + ;; + "night") + feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg + ;; + *) + echo $"Usage: $0 {day|night}" + exit 1 +esac +#+end_src + +*** wp-auto +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/wp-auto :shebang "#!/bin/bash" +:END: + +#+begin_src bash :tangle no +SED=$(which sed) +ROFI=$(which rofi) + +export DISPLAY=:0 +HOUR=$(date +%H) + +if [ -z "${SED}" ] +then + echo "Did not find 'sed', script cannot continue." + exit 1 +fi +if [ -z "${ROFI}" ] +then + echo "Did not find rofi, there is no point to continue." + exit 1 +fi + +### +# Create if not exists, then removes #include of .theme file (if present) and add the selected theme to the end. +# Repeated calls should leave the config clean-ish +### +function set_theme() +{ + CDIR="${HOME}/.config/rofi/" + if [ ! -d "${CDIR}" ] + then + mkdir -p ${CDIR} + fi + if [ -f "${CDIR}/config" ] + then + ${SED} -i "/rofi\.theme: .*\.rasi$/d" "${CDIR}/config" + fi + echo "rofi.theme: ${1}" >> "${CDIR}/config" + +} + +if [ "$HOUR" -gt "19" ] || [ "$HOUR" -lt "7" ] + then + feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg + xrdb -merge $HOME/.Xresources.d/gruvbox-dark.xresources + set_theme "/usr/share/rofi/themes//gruvbox-dark.rasi" + else + feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg + xrdb -merge $HOME/.Xresources.d/gruvbox-light.xresources + set_theme "/usr/share/rofi/themes//gruvbox-light.rasi" +fi +#+end_src + +*** wp.service +:PROPERTIES: +:header-args+: :tangle ~/.config/systemd/user/wp.service +:END: + +#+begin_src conf :tangle no +[Unit] +Description=wallpaper service + +[Service] +Type=oneshot +ExecStart=/usr/bin/bash -c %h/.local/bin/wp-auto +#+end_src + +*** wp.timer +:PROPERTIES: +:header-args+: :tangle ~/.config/systemd/user/wp.timer +:END: + +#+begin_src conf :tangle no +[Unit] +[Unit] +Description=wallpaper timer + +[Timer] +OnCalendar=07,21:00 +Unit=wp.service +Persistent=true + +[Install] +WantedBy=timers.target +#+end_src + ** Fun :) *** eat-em diff --git a/wp/.config/systemd/user/wp.service b/wp/.config/systemd/user/wp.service deleted file mode 100644 index 4308f83..0000000 --- a/wp/.config/systemd/user/wp.service +++ /dev/null @@ -1,6 +0,0 @@ -[Unit] -Description=wallpaper service - -[Service] -Type=oneshot -ExecStart=/usr/bin/bash -c %h/.local/bin/wp-auto diff --git a/wp/.config/systemd/user/wp.timer b/wp/.config/systemd/user/wp.timer deleted file mode 100644 index 448ab84..0000000 --- a/wp/.config/systemd/user/wp.timer +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=wallpaper timer - -[Timer] -OnCalendar=07,21:00 -Unit=wp.service -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/wp/.local/bin/wp b/wp/.local/bin/wp deleted file mode 100755 index 9bfbd51..0000000 --- a/wp/.local/bin/wp +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/bash - -export DISPLAY=:0 - -case "$1" in - "day") - feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg - ;; - "night") - feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg - ;; - *) - echo $"Usage: $0 {day|night}" - exit 1 -esac diff --git a/wp/.local/bin/wp-auto b/wp/.local/bin/wp-auto deleted file mode 100755 index d5eeb12..0000000 --- a/wp/.local/bin/wp-auto +++ /dev/null @@ -1,48 +0,0 @@ -#! /bin/bash - -SED=$(which sed) -ROFI=$(which rofi) - -export DISPLAY=:0 -HOUR=$(date +%H) - -if [ -z "${SED}" ] -then - echo "Did not find 'sed', script cannot continue." - exit 1 -fi -if [ -z "${ROFI}" ] -then - echo "Did not find rofi, there is no point to continue." - exit 1 -fi - -### -# Create if not exists, then removes #include of .theme file (if present) and add the selected theme to the end. -# Repeated calls should leave the config clean-ish -### -function set_theme() -{ - CDIR="${HOME}/.config/rofi/" - if [ ! -d "${CDIR}" ] - then - mkdir -p ${CDIR} - fi - if [ -f "${CDIR}/config" ] - then - ${SED} -i "/rofi\.theme: .*\.rasi$/d" "${CDIR}/config" - fi - echo "rofi.theme: ${1}" >> "${CDIR}/config" - -} - -if [ "$HOUR" -gt "19" ] || [ "$HOUR" -lt "7" ] - then - feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg - xrdb -merge $HOME/.Xresources.d/gruvbox-dark.xresources - set_theme "/usr/share/rofi/themes//gruvbox-dark.rasi" - else - feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg - xrdb -merge $HOME/.Xresources.d/gruvbox-light.xresources - set_theme "/usr/share/rofi/themes//gruvbox-light.rasi" -fi |