Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.mo
*~
*/.project
*/.settings/
4 changes: 3 additions & 1 deletion gnome-shell-timer-config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
Expand Down Expand Up @@ -26,6 +26,8 @@

"""

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gio, Gdk, GLib

import os.path
Expand Down
74 changes: 44 additions & 30 deletions make.sh
Original file line number Diff line number Diff line change
@@ -1,64 +1,78 @@
#!/bin/bash

install() {
sudo mkdir -p "/usr/share/gnome-shell/extensions"
sudo cp -R "timer@olebowle.gmx.com" "/usr/share/gnome-shell/extensions/"
sudo cp -R "kitchen_timer.ogg" "/usr/share/gnome-shell/extensions/timer@olebowle.gmx.com/"
$SUDO mkdir -p "$DEST"
$SUDO cp -R "timer@olebowle.gmx.com" "$DEST"
$SUDO cp -R "kitchen_timer.ogg" "$DEST/timer@olebowle.gmx.com/"

sudo mkdir -p "/usr/share/glib-2.0/schemas"
sudo cp "org.gnome.shell.extensions.timer.gschema.xml" "/usr/share/glib-2.0/schemas/"
sudo glib-compile-schemas "/usr/share/glib-2.0/schemas"
cat org.gnome.shell.extensions.timer.gschema.xml.init | sed "s|__DEST__|${DEST}|" > org.gnome.shell.extensions.timer.gschema.xml
$SUDO mkdir -p "$USR_SHARE/glib-2.0/schemas"
$SUDO cp "org.gnome.shell.extensions.timer.gschema.xml" "$USR_SHARE/glib-2.0/schemas/"
$SUDO glib-compile-schemas "$USR_SHARE/glib-2.0/schemas"
#dconf write KEY VALUE
#dconf write /org/gnome/shell/extensions/timer/sound-uri "'file:///home/steeve/.local/share/gnome-shell/extensions/timer@olebowle.gmx.com/kitchen_timer.ogg'"

sudo mkdir -p "/usr/share/icons/hicolor/scalable/apps"
sudo cp "utilities-timer-symbolic.svg" "/usr/share/icons/hicolor/scalable/apps/"
sudo cp "gnome-shell-timer-config.svg" "/usr/share/icons/hicolor/scalable/apps/"
sudo gtk-update-icon-cache -q -t -f "/usr/share/icons/hicolor"
$SUDO mkdir -p "$USR_SHARE/icons/hicolor/scalable/apps"
$SUDO cp "utilities-timer-symbolic.svg" "$USR_SHARE/icons/hicolor/scalable/apps/"
$SUDO cp "gnome-shell-timer-config.svg" "$USR_SHARE/icons/hicolor/scalable/apps/"
$SUDO gtk-update-icon-cache -q -t -f "$USR_SHARE/icons/hicolor"

sudo mkdir -p "/usr/bin"
sudo cp "gnome-shell-timer-config.py" "/usr/bin/gnome-shell-timer-config"
sudo mkdir -p "/usr/share/applications"
sudo cp "gnome-shell-timer-config.desktop" "/usr/share/applications/"
$SUDO mkdir -p "/usr/bin"
$SUDO cp "gnome-shell-timer-config.py" "$DEST/timer@olebowle.gmx.com/gnome-shell-timer-config"
$SUDO mkdir -p "$USR_SHARE/applications"
$SUDO cp "gnome-shell-timer-config.desktop" "$USR_SHARE/applications/"
dconf write /org/gnome/shell/extensions/timer/timer-config "'""$DEST/timer@olebowle.gmx.com/gnome-shell-timer-config""'"

for lang in `locale -a | grep -o '^[[:alpha:]]\+_[[:alpha:]]\+'`; do
if [ -d "po/$lang" ]; then
sudo mkdir -p "/usr/share/locale/$lang/LC_MESSAGES"
sudo msgfmt -cv -o "/usr/share/locale/$lang/LC_MESSAGES/gnome-shell-timer.mo" "po/$lang/gnome-shell-timer.po"
$SUDO mkdir -p "$USR_SHARE/locale/$lang/LC_MESSAGES"
$SUDO msgfmt -cv -o "$USR_SHARE/locale/$lang/LC_MESSAGES/gnome-shell-timer.mo" "po/$lang/gnome-shell-timer.po"
fi
done
echo "timer-extension successfully installed"
echo "Press Alt+F2 and type 'r' to refresh"
}

uninstall() {
sudo rm -R "/usr/share/gnome-shell/extensions/timer@olebowle.gmx.com"
sudo rm "/usr/share/glib-2.0/schemas/org.gnome.shell.extensions.timer.gschema.xml"
sudo glib-compile-schemas "/usr/share/glib-2.0/schemas"
$SUDO rm -R "$DEST/timer@olebowle.gmx.com"
$SUDO rm "$USR_SHARE/glib-2.0/schemas/org.gnome.shell.extensions.timer.gschema.xml"
$SUDO glib-compile-schemas "$USR_SHARE/glib-2.0/schemas"
dconf reset -f /org/gnome/shell/extensions/timer/

sudo rm "/usr/share/icons/hicolor/scalable/apps/utilities-timer-symbolic.svg"
sudo rm "/usr/share/icons/hicolor/scalable/apps/gnome-shell-timer-config.svg"
sudo gtk-update-icon-cache -q -t -f "/usr/share/icons/hicolor"
$SUDO rm "$USR_SHARE/icons/hicolor/scalable/apps/utilities-timer-symbolic.svg"
$SUDO rm "$USR_SHARE/icons/hicolor/scalable/apps/gnome-shell-timer-config.svg"
$SUDO gtk-update-icon-cache -q -t -f "$USR_SHARE/icons/hicolor"

sudo rm "/usr/bin/gnome-shell-timer-config"
sudo rm "/usr/share/applications/gnome-shell-timer-config.desktop"
$SUDO rm "$USR_SHARE/timer@olebowle.gmx.com/gnome-shell-timer-config"
$SUDO rm "$USR_SHARE/applications/gnome-shell-timer-config.desktop"

sudo find "/usr/share/locale/" -type f -name "gnome-shell-timer.mo" -exec rm {} \;
$SUDO find "$USR_SHARE/locale/" -type f -name "gnome-shell-timer.mo" -exec rm {} \;
echo "timer-extension successfully uninstalled"
echo "Press Alt+F2 and type 'r' to refresh"
}

if [ $# -ne "1" ] || [ $1 = "help" ]; then
if [ $# -lt 1 -o $# -gt 2 ] || [ $1 = "help" ]; then
echo "Usage:"
echo " $0 install - Install timer-extension"
echo " $0 uninstall - Uninstall timer-extension"
echo " $0 install [local] - Install timer-extension"
echo " $0 uninstall [local] - Uninstall timer-extension"
echo " $0 help - Show this help"
exit 0
fi

if [ $1 = "install" ]; then
SUDO="sudo"
if [ "$2" == "local" ]; then
USR_SHARE=~/.local/share
SUDO=""
else
USR_SHARE=/usr/share
fi

DEST="$USR_SHARE/gnome-shell/extensions"

if [ $1 == "install" ]; then
install
fi

if [ $1 = "uninstall" ]; then
if [ $1 == "uninstall" ]; then
uninstall
fi
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@
<summary>Loop sound until end of notification</summary>
<description>Loop sound until end of notification</description>
</key>
<key name="sound-uri" type="s">
<default>"file:///usr/share/gnome-shell/extensions/timer@olebowle.gmx.com/kitchen_timer.ogg"</default>
<summary>Notification sound</summary>
<description>Enter uri for notification sound</description>
</key>
<key name="sound-uri" type="s">
<default>"file://__DEST__/timer@olebowle.gmx.com/kitchen_timer.ogg"</default>
<summary>Notification sound</summary>
<description>Enter uri for notification sound</description>
</key>
<key name="timer-config" type="s">
<default>"__DEST__/timer@olebowle.gmx.com/gnome-shell-timer-config"</default>
<summary>Path to timer config script</summary>
<description>Enter path for timer config script</description>
</key>
</schema>
</schemalist>
Loading