Skip to content
This repository was archived by the owner on Aug 3, 2019. It is now read-only.

Commit

Permalink
Removed system tray icon, fixes #68, #70 and #77
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsabbagh committed Oct 29, 2017
1 parent cf634f5 commit 838a1d9
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 94 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The program requires the pydbus python module, install it first:

sudo pip install pydbus

The source code is available to download via: [https://github.com/green-project/green-recorder/archive/master.zip](https://github.com/green-project/green-recorder/archive/master.zip). You can simply download it and install the dependencies on your distribution (gir1.2-appindicator3, gawk, python-gobject, python-urllib3, x11-utils, ffmpeg, pydbus, pulseaudio, xdg-open (or xdg-utils), python-configparser, imagemagick). And then run:
The source code is available to download via: [https://github.com/green-project/green-recorder/archive/master.zip](https://github.com/green-project/green-recorder/archive/master.zip). You can simply download it and install the dependencies on your distribution (gawk, python-gobject, python-urllib3, x11-utils, ffmpeg, pydbus, pulseaudio, xdg-open (or xdg-utils), python-configparser, imagemagick). And then run:

sudo python setup.py install

Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
green-recorder (3.1) zesty; urgency=low

* Removed the system tray indicator, and added a stop button.
* Fixed #68, #70, #77.

-- M.Hanny Sabbagh <[email protected]> Sun, 29 Oct 2017 11:02:00 +0200

green-recorder (3.0.6) zesty; urgency=low

* Fixed #73.
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Build-Depends: debhelper (>= 9), python2.7, python-dev, python-configparser, pul

Package: green-recorder
Architecture: all
Depends: gir1.2-appindicator3-0.1, gawk, python-gobject, python-urllib3, x11-utils, python-pydbus, ffmpeg (>= 3.0)
Depends: gawk, python-gobject, python-urllib3, x11-utils, python-pydbus, ffmpeg (>= 3.0)
Description: Green Recorder
Record your desktop easily using a simple GUI. Built using Python, GTK+ 3 and ffmpeg. Very easy to use. Supports both Xorg and Wayland (GNOME) display servers.
140 changes: 54 additions & 86 deletions green-recorder
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
import gi

gi.require_version('Gtk','3.0')
gi.require_version('AppIndicator3', '0.1')

from gi.repository import Gtk, Gdk, GLib, AppIndicator3 as appindicator
from gi.repository import Gtk, Gdk, GLib
from pydbus import SessionBus
import subprocess, signal, threading, datetime, urllib, gettext, locale, os, ConfigParser

Expand Down Expand Up @@ -81,33 +80,6 @@ if "wayland" in DisplayServer:
GNOMEScreencast = bus.get('org.gnome.Shell.Screencast', '/org/gnome/Shell/Screencast')
else:
DisplayServer = "xorg"

def recorderindicator():
# Create the app indicator widget.
global indicator
try:
s = subprocess.check_output("ps -cat|grep mate-panel", shell=True)
except:
indicator = appindicator.Indicator.new("Green Recorder", '/usr/share/pixmaps/green-recorder.png', appindicator.IndicatorCategory.APPLICATION_STATUS)
pass
else:
indicator = appindicator.Indicator.new("Green Recorder", 'green-recorder', appindicator.IndicatorCategory.APPLICATION_STATUS)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
indicator.set_menu(indicator_menu())
# Make middle-click stops the recording process.
indicator.set_secondary_activate_target(stoprecordingbutton)
Gtk.main()

def indicator_menu():
# Here menu items are defined and built. Used global on stoprecordingbutton to pass it as a Gtk.Widget to the indicator to be able to stop recording using middle click on the icon directly.
menu = Gtk.Menu()
global stoprecordingbutton
stoprecordingbutton = Gtk.MenuItem('Stop Recording')
stoprecordingbutton.connect('activate', stoprecording)
menu.append(stoprecordingbutton)
menu.show_all()
return menu


def sendnotification(text, time):
notifications = bus.get('.Notifications')
Expand Down Expand Up @@ -173,7 +145,7 @@ def RecordXorg():
window.show()
sendnotification("There seems to be a problem in recording. Try running 'green-recorder' from the command line to see the issue.", 4)
else:
recorderindicator()
sendnotification("Recording has started!", 1)



Expand Down Expand Up @@ -207,9 +179,7 @@ def RecordGnome():
else:
GNOMEScreencast.ScreencastArea(WindowXAxis, WindowYAxis, WindowWidth, WindowHeight, RecorderAbsPathName, {'framerate': GLib.Variant('i', int(RecorderFrames)), 'draw-cursor': GLib.Variant('b', mousecheck.get_active()), 'pipeline': GLib.Variant('s', RecorderPipeline)})

t = threading.RLock()
with t:
recorderindicator()
sendnotification("Recording has started!", 1)

def checkbool(s):
return s.lower() in ("True", "true", "1")
Expand Down Expand Up @@ -241,10 +211,6 @@ def record():
dialog.destroy()
elif response == Gtk.ResponseType.CANCEL:
return

# Hide the window. Used flush() to avoid the interface waiting.
window.hide()
Gdk.flush()

# Get the given values from the input fields.
#global RecorderFullPathName
Expand All @@ -263,6 +229,7 @@ def record():
RecorderAbsPathName = RecorderFullPathName.replace("file://", "")

subprocess.call(["sleep", RecorderDelay])
stopbutton.set_sensitive(True)

if "xorg" in DisplayServer:
RecordXorg()
Expand All @@ -274,53 +241,6 @@ def record():
else:
sendnotification("Sorry Jim, looks like you are using something we don't support", 3)
window.show()

def stoprecording(self):
subprocess.call(["sleep", "1"]) # Wait ffmpeg.

indicator.set_status(appindicator.IndicatorStatus.PASSIVE)
Gtk.main_quit()
window.show()
playbutton.set_sensitive(True)
filenameentry.set_placeholder_text(_("File Name.."))

try:
global areaaxis, WindowXAxis, WindowYAxis, WindowWidth, WindowHeight
del areaaxis, WindowXAxis, WindowYAxis, WindowWidth, WindowHeight
except NameError:
pass

if "xorg" in DisplayServer:
subprocess.call(["sleep", "1"])
RecorderProcess.terminate()

elif "gnomewayland" in DisplayServer:
subprocess.call(["sleep", "1"])

global RecorderPipeline
del RecorderPipeline

try:
GNOMEScreencast.StopScreencast()
AudioProcess.terminate()
except:
pass # I know.

if videocheck.get_active() == True and audiocheck.get_active() == True:
m = subprocess.call(["ffmpeg", "-i", RecorderFullPathName, "-i", "/tmp/Green-recorder-tmp.mkv", "-c", "copy", "/tmp/Green-Recorder-Final." + formatchooser.get_active_id(), "-y"])
k = subprocess.Popen(["mv", "/tmp/Green-Recorder-Final." + formatchooser.get_active_id(), RecorderAbsPathName])
elif videocheck.get_active() == False and audiocheck.get_active() == True:
k = subprocess.Popen(["mv", "/tmp/Green-recorder-tmp.mkv", RecorderAbsPathName])

if formatchooser.get_active_id() == "gif":
sendnotification("Your GIF image is currently being processed, this may take a while according to your PC's resources.", 5)

subprocess.call(["mv", RecorderAbsPathName, RecorderAbsPathName+".tmp"])
subprocess.call(["convert", "-layers", "Optimize", RecorderAbsPathName+".tmp", RecorderAbsPathName])
subprocess.call(["rm", RecorderAbsPathName+".tmp"])

CommandToRun = commandentry.get_text()
subprocess.Popen([CommandToRun], shell=True)

def hide_on_delete(widget, event):
widget.hide()
Expand All @@ -342,7 +262,8 @@ commandentry = builder.get_object("entry2")
preffilename = builder.get_object("entry3")
formatchooser = builder.get_object("comboboxtext1")
audiosource = builder.get_object("audiosource")
recordbutton = builder.get_object("button1")
recordbutton = builder.get_object("recordbutton")
stopbutton = builder.get_object("stopbutton")
windowgrabbutton = builder.get_object("button4")
areagrabbutton = builder.get_object("button5")
videocheck = builder.get_object("checkbutton1")
Expand Down Expand Up @@ -399,7 +320,7 @@ mousecheck.set_label(_("Show Mouse"))
followmousecheck.set_label(_("Follow Mouse"))
aboutdialog.set_transient_for(window)
aboutdialog.set_program_name(_("Green Recorder"))
aboutdialog.set_version("3.0")
aboutdialog.set_version("3.1")
aboutdialog.set_copyright("© 2017 FOSS Project")
aboutdialog.set_wrap_license(True)
aboutdialog.set_license("Green Recorder is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nGreen Recorder is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nSee the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Green Recorder. If not, see <http://www.gnu.org/licenses/>.")
Expand Down Expand Up @@ -449,6 +370,7 @@ audiocheck.set_active(checkbool(config.get('Options', 'audiocheck')))
mousecheck.set_active(checkbool(config.get('Options', 'mousecheck')))
followmousecheck.set_active(checkbool(config.get('Options', 'followmousecheck')))

stopbutton.set_sensitive(False)
playbutton.set_sensitive(False)

# Audio input sources
Expand Down Expand Up @@ -512,6 +434,52 @@ class Handler:
areachooser.set_title(_("Area Chooser"))
areachooser.show()

def stoprecording(self, GtkButton):
subprocess.call(["sleep", "1"]) # Wait ffmpeg.

window.show()

playbutton.set_sensitive(True)
filenameentry.set_placeholder_text(_("File Name.."))

try:
global areaaxis, WindowXAxis, WindowYAxis, WindowWidth, WindowHeight
del areaaxis, WindowXAxis, WindowYAxis, WindowWidth, WindowHeight
except NameError:
pass

if "xorg" in DisplayServer:
subprocess.call(["sleep", "1"])
RecorderProcess.terminate()

elif "gnomewayland" in DisplayServer:
subprocess.call(["sleep", "1"])

global RecorderPipeline
del RecorderPipeline

try:
GNOMEScreencast.StopScreencast()
AudioProcess.terminate()
except:
pass # I know.

if videocheck.get_active() == True and audiocheck.get_active() == True:
m = subprocess.call(["ffmpeg", "-i", RecorderFullPathName, "-i", "/tmp/Green-recorder-tmp.mkv", "-c", "copy", "/tmp/Green-Recorder-Final." + formatchooser.get_active_id(), "-y"])
k = subprocess.Popen(["mv", "/tmp/Green-Recorder-Final." + formatchooser.get_active_id(), RecorderAbsPathName])
elif videocheck.get_active() == False and audiocheck.get_active() == True:
k = subprocess.Popen(["mv", "/tmp/Green-recorder-tmp.mkv", RecorderAbsPathName])

if formatchooser.get_active_id() == "gif":
sendnotification("Your GIF image is currently being processed, this may take a while according to your PC's resources.", 5)

subprocess.call(["mv", RecorderAbsPathName, RecorderAbsPathName+".tmp"])
subprocess.call(["convert", "-layers", "Optimize", RecorderAbsPathName+".tmp", RecorderAbsPathName])
subprocess.call(["rm", RecorderAbsPathName+".tmp"])

CommandToRun = commandentry.get_text()
subprocess.Popen([CommandToRun], shell=True)

def preferencesbuttonclicked(self, GtkButton):
preferenceswindow.show()

Expand Down
7 changes: 5 additions & 2 deletions green-recorder.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name: green-recorder
Summary: A simple yet functional desktop recorder for Linux systems. Supports both Xorg server and Wayland (GNOME).
URL: https://foss-project.com
Version: 3.0.6
Version: 3.1
Release: 1%{?dist}
Source: https://github.com/%{owner}/%{name}/archive/%{version}/%{version}.tar.gz
License: GPLv3
Expand All @@ -14,7 +14,6 @@ Requires: python2
Requires: python2-pydbus
Requires: ffmpeg
Requires: gawk
Requires: libappindicator-gtk3
Requires: python2-urllib3
Requires: python-configparser
Requires: pulseaudio
Expand All @@ -41,6 +40,10 @@ python setup.py install -O1 --root=$RPM_BUILD_ROOT
%{_datadir}/pixmaps/%{name}.png

%changelog
* Sun Oct 29 2017 M.Hanny Sabbagh <[email protected]> 3.1
- Removed system tray icon and added close button.
- Fixed #68, #70 and #77.

* Fri Oct 20 2017 M.Hanny Sabbagh <[email protected]> 3.0.6
- Fixed #73.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
data_files.extend(locales)

setup(name = "green-recorder",
version = "3.0.6",
version = "3.1",
description = "Record your desktop easily using a simple GUI",
author = "FOSS Project",
author_email = "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

name: green-recorder
version: '3.0.6'
version: '3.1'
summary: Simple screen recorder for Linux desktop. Supports Xorg & Wayland.
description: |
Simple and easy screen recorder for Linux desktop. Supports Xorg & Wayland.
Expand Down
21 changes: 19 additions & 2 deletions ui/ui.glade
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@
<property name="can_focus">False</property>
<property name="stock">gtk-media-record</property>
</object>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-media-stop</property>
</object>
<object class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="can_focus">False</property>
Expand Down Expand Up @@ -808,7 +813,7 @@
<property name="has_subtitle">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="button1">
<object class="GtkButton" id="recordbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
Expand All @@ -818,6 +823,18 @@
<signal name="clicked" handler="recordclicked" swapped="no"/>
</object>
</child>
<child>
<object class="GtkButton" id="stopbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image5</property>
<signal name="clicked" handler="stoprecording" swapped="no"/>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="playbutton">
<property name="visible">True</property>
Expand All @@ -833,7 +850,7 @@
</packing>
</child>
<child>
<object class="GtkButton" id="button3">
<object class="GtkButton" id="aboutbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
Expand Down

0 comments on commit 838a1d9

Please sign in to comment.