Python version commit n push.

This commit is contained in:
2019-05-05 04:02:35 -05:00
parent d03be33f35
commit 33e6a78650
32 changed files with 2808 additions and 0 deletions

39
python/src/debs/build.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
# Fixes ownershp
function main() {
sudo find . -type f -exec chmod 644 {} +
sudo find . -type d -exec chmod 755 {} +
# Set postrm permissions
for i in `find . -name postrm`; do
sudo chmod 755 "${i}"
done
# Set fxwinwrap permissions
for i in `find . -name fxwinwrap`; do
sudo chmod 755 "${i}"
done
# Set xwinwrap permissions
for i in `find . -name xwinwrap`; do
sudo chmod 755 "${i}"
done
sudo chmod 755 fxwinwrap*/opt/FXWinWrap/resources/bin/*
sudo chown -R root:root ./*/
builder;
}
#builds debs
function builder() {
for i in `ls`; do
if [[ -d "${i}" ]]; then
dpkg --build "${i}"
else
echo "Not a dir."
fi
done
}
main;

View File

@@ -0,0 +1,6 @@
#!/bin/bash
function main() {
sudo chown -R abaddon:abaddon .
}
main;

View File

@@ -0,0 +1,8 @@
Package: gwinwrap64
Version: 0.0-1
Section: python
Priority: optional
Architecture: amd64
Depends: ffmpegthumbnailer (>= 2.0.10-0.1), mplayer (>=2.0-728-g2c378c7-4), gifsicle (>=1.86-1), nitrogen (>=1.5.2-2)
Maintainer: Maxim Stewart <1itdominator@gmail.com>
Description: GWinWrap is a GUI to handle setting XWinWrap options.

View File

@@ -0,0 +1,20 @@
#!/bin/bash
#postrm (script executed after uninstalling the package)
#set -e
if [ -f /bin/xwinwrap ]; then
rm /bin/xwinwrap
fi
if [ -f /bin/gwinwrap ]; then
rm /bin/gwinwrap
fi
if [ -d /opt/GWinWrap ]; then
rm -rf /opt/GWinWrap
fi
if [ -x "`which xdg-desktop-menu 2>/dev/null`" ]; then
xdg-desktop-menu uninstall /usr/share/applications/GWinWrap.desktop
xdg-desktop-menu forceupdate --mode user
fi

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,196 @@
#!/usr/bin/env python
import os, cairo, sys, gi, re, threading, subprocess
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GObject as gobject
from gi.repository import Gtk, GdkPixbuf
from os import listdir
from os.path import isfile, join
from threading import Thread
from utils import SaveState
gdk.threads_init()
class GWinWrap:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file("resources/GWinWrap.glade")
# Get window and connect signals
self.window = self.builder.get_object("Main")
self.builder.connect_signals(self)
self.window.connect("delete-event", gtk.main_quit)
self.screen = self.window.get_screen()
self.visual = self.screen.get_rgba_visual()
if self.visual != None and self.screen.is_composited():
self.window.set_visual(self.visual)
self.window.set_app_paintable(True)
self.window.connect("draw", self.area_draw)
# Add filter to allow only folders to be selected
dialog = self.builder.get_object("selectedDirDialog")
filefilter = self.builder.get_object("Folders")
dialog.add_filter(filefilter)
# Get reference to remove and add it back...
self.gridLabel = self.builder.get_object("gridLabel")
self.stateSaver = SaveState()
self.xScreenVal = None
self.toSavePath = None # Global file path and type for saving to file
self.applyType = 1 # 1 is XWinWrap and 2 is Nitrogen
self.window.show()
def area_draw(self, widget, cr):
cr.set_source_rgba(0, 0, 0, 0.64)
cr.set_operator(cairo.OPERATOR_SOURCE)
cr.paint()
cr.set_operator(cairo.OPERATOR_OVER)
def setNewDir(self, widget, data=None):
dir = widget.get_filename()
Thread(target=self.newDir, args=(dir,)).start()
def newDir(self, dir):
self.clear()
imageGrid = self.builder.get_object("imageGrid")
path = dir
files = []
list = [f for f in listdir(path) if isfile(join(path, f))]
row = 0
col = 0
for file in list:
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm', '.png', '.jpg', '.jpeg', '.gif')):
files.append(file)
imageGrid.remove_column(0)
for file in files:
fullPathFile = path + "/" + file
eveBox = gtk.EventBox()
thumbnl = gtk.Image()
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')):
subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", "/tmp/image.png"])
thumbnl = self.createImage("/tmp/image.png")
eveBox.connect("button_press_event", self.runMplayerProcess, fullPathFile)
elif file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):
thumbnl = self.createImage(fullPathFile)
eveBox.connect("button_press_event", self.runImageViewerProcess, fullPathFile)
else:
print("Not a video or image file.")
return
gobject.idle_add(self.preGridSetup, (eveBox, thumbnl, ))
gobject.idle_add(self.addToGrid, (imageGrid, eveBox, col, row,))
col += 1
if col == 2:
col = 0
row += 1
def preGridSetup(self, args):
args[0].show()
args[1].show()
args[0].add(args[1])
def createImage(self, arg):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename = arg,
width = 310,
height = 310,
preserve_aspect_ratio = True)
return gtk.Image.new_from_pixbuf(pixbuf)
def addToGrid(self, args):
args[0].attach(args[1], args[2], args[3], 1, 1)
def runMplayerProcess(self, widget, eve, fullPathFile):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
subprocess.call(["mplayer", "-really-quiet", "-ao", "null", "-loop", "0", fullPathFile])
self.toSavePath = fullPathFile
self.applyType = 1 # Set to XWinWrap
def runImageViewerProcess(self, widget, eve, fullPathFile):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
subprocess.call(["xdg-open", fullPathFile])
self.toSavePath = fullPathFile
self.applyType = 2 # Set to Nitrogen
def toggleXscreenUsageField(self, widget, data=None):
useXscreenSaver = self.builder.get_object("useXScrnList")
if useXscreenSaver.get_active():
self.builder.get_object("xScreenSvrList").set_sensitive(True)
else:
self.builder.get_object("xScreenSvrList").set_sensitive(False)
def saveToFile(self, widget, data=None):
saveLoc = self.builder.get_object("saveLoc").get_active_text()
useXscreenSaver = self.builder.get_object("useXScrnList").get_active()
plyBckRes = self.builder.get_object("playbackResolution")
offset4Res = self.builder.get_object("posOffset")
resolution = plyBckRes.get_active_text() + offset4Res.get_active_text()
self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution,
saveLoc, useXscreenSaver, self.xScreenVal)
def applySttngs(self, widget, data=None):
os.system("killall xwinwrap &")
if self.applyType == 1:
os.system("bash -c '~/.animatedBGstarter.sh' &")
os.system("bash -c '~/.animatedBGstarter2.sh' &")
elif self.applyType == 2:
os.system("nitrogen --restore &")
else:
os.system("nitrogen --restore &")
def killXWinWrp(self, widget, data=None):
os.system("killall xwinwrap &")
def passXScreenVal(self, widget):
xSvrListStore = self.builder.get_object("XScreensaver List")
row = widget.get_cursor()
path = gtk.TreePath(row.path)
treeiter = xSvrListStore.get_iter(path[0])
self.xScreenVal = xSvrListStore.get_value(treeiter, 0)
def clearSelection(self, widget, data=None):
self.clear()
def clear(self):
imageGrid = self.builder.get_object("imageGrid")
while True:
if imageGrid.get_child_at(0,0)!= None:
imageGrid.remove_row(0)
else:
break
imageGrid.attach(self.gridLabel, 0, 0, 1, 1)
self.toSavePath = None
self.applyType = 1 # Default to XWinWrap
def closeProgram(self, widget, data=None):
sys.exit(0)
if __name__ == "__main__":
main = GWinWrap()
gtk.main()

View File

@@ -0,0 +1,699 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkFileFilter" id="Folders">
<mime-types>
<mime-type>inode/directory</mime-type>
</mime-types>
</object>
<object class="GtkListStore" id="XScreensaver List">
<columns>
<!-- column-name XScreensavers -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">electricsheep</col>
</row>
<row>
<col id="0" translatable="yes">atlantis</col>
</row>
<row>
<col id="0" translatable="yes">atunnel</col>
</row>
<row>
<col id="0" translatable="yes">blinkbox</col>
</row>
<row>
<col id="0" translatable="yes">blocktube</col>
</row>
<row>
<col id="0" translatable="yes">bouncingcow</col>
</row>
<row>
<col id="0" translatable="yes">boxfit</col>
</row>
<row>
<col id="0" translatable="yes">bsod</col>
</row>
<row>
<col id="0" translatable="yes">bubble3d</col>
</row>
<row>
<col id="0" translatable="yes">bumps</col>
</row>
<row>
<col id="0" translatable="yes">cage</col>
</row>
<row>
<col id="0" translatable="yes">carousel</col>
</row>
<row>
<col id="0" translatable="yes">cube21</col>
</row>
<row>
<col id="0" translatable="yes">cubenetic</col>
</row>
<row>
<col id="0" translatable="yes">cubicgrid</col>
</row>
<row>
<col id="0" translatable="yes">cwaves</col>
</row>
<row>
<col id="0" translatable="yes">dangerball</col>
</row>
<row>
<col id="0" translatable="yes">fiberlamp</col>
</row>
<row>
<col id="0" translatable="yes">fireworkx</col>
</row>
<row>
<col id="0" translatable="yes">flipflop</col>
</row>
<row>
<col id="0" translatable="yes">fliptext</col>
</row>
<row>
<col id="0" translatable="yes">flow</col>
</row>
<row>
<col id="0" translatable="yes">flurry</col>
</row>
<row>
<col id="0" translatable="yes">flyingtoasters</col>
</row>
<row>
<col id="0" translatable="yes">gflux</col>
</row>
<row>
<col id="0" translatable="yes">glcells</col>
</row>
<row>
<col id="0" translatable="yes">gleidescope</col>
</row>
<row>
<col id="0" translatable="yes">glknots</col>
</row>
<row>
<col id="0" translatable="yes">glmatrix</col>
</row>
<row>
<col id="0" translatable="yes">glschool</col>
</row>
<row>
<col id="0" translatable="yes">glslideshow</col>
</row>
<row>
<col id="0" translatable="yes">glsnake</col>
</row>
<row>
<col id="0" translatable="yes">hypertorus</col>
</row>
<row>
<col id="0" translatable="yes">hypnowheel</col>
</row>
<row>
<col id="0" translatable="yes">interaggregate</col>
</row>
<row>
<col id="0" translatable="yes">intermomentary</col>
</row>
<row>
<col id="0" translatable="yes">jigglypuff</col>
</row>
<row>
<col id="0" translatable="yes">jigsaw</col>
</row>
<row>
<col id="0" translatable="yes">julia</col>
</row>
<row>
<col id="0" translatable="yes">lament</col>
</row>
<row>
<col id="0" translatable="yes">lockward</col>
</row>
<row>
<col id="0" translatable="yes">metaballs</col>
</row>
<row>
<col id="0" translatable="yes">moebiusgears</col>
</row>
<row>
<col id="0" translatable="yes">molecule</col>
</row>
<row>
<col id="0" translatable="yes">morph3d</col>
</row>
<row>
<col id="0" translatable="yes">noof</col>
</row>
<row>
<col id="0" translatable="yes">phosphor</col>
</row>
<row>
<col id="0" translatable="yes">photopile</col>
</row>
<row>
<col id="0" translatable="yes">pinion</col>
</row>
<row>
<col id="0" translatable="yes">popsquares</col>
</row>
<row>
<col id="0" translatable="yes">ripples</col>
</row>
<row>
<col id="0" translatable="yes">skytentacles</col>
</row>
<row>
<col id="0" translatable="yes">slidescreen</col>
</row>
<row>
<col id="0" translatable="yes">stonerview</col>
</row>
<row>
<col id="0" translatable="yes">strange</col>
</row>
<row>
<col id="0" translatable="yes">substrate</col>
</row>
<row>
<col id="0" translatable="yes">tangram</col>
</row>
<row>
<col id="0" translatable="yes">whirlwindwarp</col>
</row>
<row>
<col id="0" translatable="yes">wormhole</col>
</row>
<row>
<col id="0" translatable="yes">xflame</col>
</row>
<row>
<col id="0" translatable="yes">xrayswarm</col>
</row>
<row>
<col id="0" translatable="yes">companioncube</col>
</row>
<row>
<col id="0" translatable="yes">fuzzyflakes</col>
</row>
<row>
<col id="0" translatable="yes">galaxy</col>
</row>
<row>
<col id="0" translatable="yes">glplanet</col>
</row>
<row>
<col id="0" translatable="yes">penetrate</col>
</row>
</data>
</object>
<object class="GtkWindow" id="Main">
<property name="width_request">950</property>
<property name="height_request">600</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">GWinWrap</property>
<property name="window_position">center</property>
<property name="default_width">950</property>
<property name="default_height">600</property>
<property name="icon">GWinWrap.png</property>
<property name="gravity">center</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">15</property>
<property name="margin_top">15</property>
<property name="margin_bottom">15</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Note: Double click an image to view the video or image.</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="clearSelection" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="selectedDirDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="focus_on_click">False</property>
<property name="tooltip_text" translatable="yes">Chose Dream Scene / Image Directory</property>
<property name="action">select-folder</property>
<property name="create_folders">False</property>
<property name="filter">Folders</property>
<property name="preview_widget_active">False</property>
<property name="title" translatable="yes">Dream Scene / Image Dir</property>
<signal name="file-set" handler="setNewDir" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid" id="imageGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="row_spacing">10</property>
<property name="column_spacing">10</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="gridLabel">
<property name="width_request">640</property>
<property name="height_request">525</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Choose Image/Video Directory...</property>
<attributes>
<attribute name="font-desc" value="Times New Roman, 28"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">10</property>
<property name="margin_right">15</property>
<property name="margin_top">15</property>
<property name="margin_bottom">15</property>
<property name="hexpand">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="useXScrnList">
<property name="label" translatable="yes">Use XScreenSaver</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="margin_bottom">5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggleXscreenUsageField" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="xScreenSvrList">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="model">XScreensaver List</property>
<property name="headers_visible">False</property>
<signal name="cursor-changed" handler="passXScreenVal" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="listColumn">
<property name="title" translatable="yes">XScreensaves</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">Playback Resolutions</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">Position Offset</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkComboBoxText" id="playbackResolution">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">3</property>
<items>
<item translatable="yes">7680x4320</item>
<item translatable="yes">3840x2160</item>
<item translatable="yes">2048x1080</item>
<item translatable="yes">1920x1080</item>
<item translatable="yes">1440x720</item>
<item translatable="yes">1600x900</item>
<item translatable="yes">1280x720</item>
<item translatable="yes">800x600</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="posOffset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">18</property>
<items>
<item translatable="yes">Left</item>
<item translatable="yes">-7680+0</item>
<item translatable="yes">-3840+0</item>
<item translatable="yes">-2048+0</item>
<item translatable="yes">-1920+0</item>
<item translatable="yes">-1440+0</item>
<item translatable="yes">-1600+0</item>
<item translatable="yes">-1280+0</item>
<item translatable="yes">-800+0</item>
<item translatable="yes">Right</item>
<item translatable="yes">+7680+0</item>
<item translatable="yes">+3840+0</item>
<item translatable="yes">+2048+0</item>
<item translatable="yes">+1920+0</item>
<item translatable="yes">+1440+0</item>
<item translatable="yes">+1600+0</item>
<item translatable="yes">+1280+0</item>
<item translatable="yes">+800+0</item>
<item translatable="yes">+0+0</item>
<item translatable="yes">Top</item>
<item translatable="yes">+0+7680</item>
<item translatable="yes">+0+3840</item>
<item translatable="yes">+0+2048</item>
<item translatable="yes">+0+1920</item>
<item translatable="yes">+0+1440</item>
<item translatable="yes">+0+1600</item>
<item translatable="yes">0+1280</item>
<item translatable="yes">+0+800</item>
<item translatable="yes">Bottum</item>
<item translatable="yes">+0-7680</item>
<item translatable="yes">+0-3840</item>
<item translatable="yes">+0-2048</item>
<item translatable="yes">+0-1920</item>
<item translatable="yes">+0-1440</item>
<item translatable="yes">+0-1600</item>
<item translatable="yes">0-1280</item>
<item translatable="yes">+0-800</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">10</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Save Path</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="saveLoc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">0</property>
<items>
<item translatable="yes">.animatedBGstarter.sh</item>
<item translatable="yes">.animatedBGstarter2.sh</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Save Selection</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="saveToFile" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="applySttngs" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Kill XWinWrap</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="killXWinWrp" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="closeProgram" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">1</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Encoding=UTF-8
Name=GWinWrap
Comment=Glade gui with python controls for XWinWrap
Exec=/bin/gwinwrap
Icon=/opt/GWinWrap/resources/GWinWrap.png
Terminal=false
Type=Application
Categories=System;

View File

@@ -0,0 +1,22 @@
FXWinWrap is copyright 2016, 2017 Maxim Stewart.
FXWinWrap is currently developed by ITDominator <1itdominator@gmail.com>.
License: GPLv2+
This program 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 2 of the License, or
(at your option) any later version.
This program 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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
See /usr/share/common-licenses/GPL-2, or
<http://www.gnu.org/copyleft/gpl.txt> for the terms of the latest version
of the GNU General Public License.

View File

@@ -0,0 +1,196 @@
#!/usr/bin/env python
import os, cairo, sys, gi, re, threading, subprocess
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GObject as gobject
from gi.repository import Gtk, GdkPixbuf
from os import listdir
from os.path import isfile, join
from threading import Thread
from utils import SaveState
gdk.threads_init()
class GWinWrap:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file("resources/GWinWrap.glade")
# Get window and connect signals
self.window = self.builder.get_object("Main")
self.builder.connect_signals(self)
self.window.connect("delete-event", gtk.main_quit)
self.screen = self.window.get_screen()
self.visual = self.screen.get_rgba_visual()
if self.visual != None and self.screen.is_composited():
self.window.set_visual(self.visual)
self.window.set_app_paintable(True)
self.window.connect("draw", self.area_draw)
# Add filter to allow only folders to be selected
dialog = self.builder.get_object("selectedDirDialog")
filefilter = self.builder.get_object("Folders")
dialog.add_filter(filefilter)
# Get reference to remove and add it back...
self.gridLabel = self.builder.get_object("gridLabel")
self.stateSaver = SaveState()
self.xScreenVal = None
self.toSavePath = None # Global file path and type for saving to file
self.applyType = 1 # 1 is XWinWrap and 2 is Nitrogen
self.window.show()
def area_draw(self, widget, cr):
cr.set_source_rgba(0, 0, 0, 0.64)
cr.set_operator(cairo.OPERATOR_SOURCE)
cr.paint()
cr.set_operator(cairo.OPERATOR_OVER)
def setNewDir(self, widget, data=None):
dir = widget.get_filename()
Thread(target=self.newDir, args=(dir,)).start()
def newDir(self, dir):
self.clear()
imageGrid = self.builder.get_object("imageGrid")
path = dir
files = []
list = [f for f in listdir(path) if isfile(join(path, f))]
row = 0
col = 0
for file in list:
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm', '.png', '.jpg', '.jpeg', '.gif')):
files.append(file)
imageGrid.remove_column(0)
for file in files:
fullPathFile = path + "/" + file
eveBox = gtk.EventBox()
thumbnl = gtk.Image()
if file.lower().endswith(('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')):
subprocess.call(["ffmpegthumbnailer", "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", "/tmp/image.png"])
thumbnl = self.createImage("/tmp/image.png")
eveBox.connect("button_press_event", self.runMplayerProcess, fullPathFile)
elif file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):
thumbnl = self.createImage(fullPathFile)
eveBox.connect("button_press_event", self.runImageViewerProcess, fullPathFile)
else:
print("Not a video or image file.")
return
gobject.idle_add(self.preGridSetup, (eveBox, thumbnl, ))
gobject.idle_add(self.addToGrid, (imageGrid, eveBox, col, row,))
col += 1
if col == 2:
col = 0
row += 1
def preGridSetup(self, args):
args[0].show()
args[1].show()
args[0].add(args[1])
def createImage(self, arg):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename = arg,
width = 310,
height = 310,
preserve_aspect_ratio = True)
return gtk.Image.new_from_pixbuf(pixbuf)
def addToGrid(self, args):
args[0].attach(args[1], args[2], args[3], 1, 1)
def runMplayerProcess(self, widget, eve, fullPathFile):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
subprocess.call(["mplayer", "-really-quiet", "-ao", "null", "-loop", "0", fullPathFile])
self.toSavePath = fullPathFile
self.applyType = 1 # Set to XWinWrap
def runImageViewerProcess(self, widget, eve, fullPathFile):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
subprocess.call(["xdg-open", fullPathFile])
self.toSavePath = fullPathFile
self.applyType = 2 # Set to Nitrogen
def toggleXscreenUsageField(self, widget, data=None):
useXscreenSaver = self.builder.get_object("useXScrnList")
if useXscreenSaver.get_active():
self.builder.get_object("xScreenSvrList").set_sensitive(True)
else:
self.builder.get_object("xScreenSvrList").set_sensitive(False)
def saveToFile(self, widget, data=None):
saveLoc = self.builder.get_object("saveLoc").get_active_text()
useXscreenSaver = self.builder.get_object("useXScrnList").get_active()
plyBckRes = self.builder.get_object("playbackResolution")
offset4Res = self.builder.get_object("posOffset")
resolution = plyBckRes.get_active_text() + offset4Res.get_active_text()
self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution,
saveLoc, useXscreenSaver, self.xScreenVal)
def applySttngs(self, widget, data=None):
os.system("killall xwinwrap &")
if self.applyType == 1:
os.system("bash -c '~/.animatedBGstarter.sh' &")
os.system("bash -c '~/.animatedBGstarter2.sh' &")
elif self.applyType == 2:
os.system("nitrogen --restore &")
else:
os.system("nitrogen --restore &")
def killXWinWrp(self, widget, data=None):
os.system("killall xwinwrap &")
def passXScreenVal(self, widget):
xSvrListStore = self.builder.get_object("XScreensaver List")
row = widget.get_cursor()
path = gtk.TreePath(row.path)
treeiter = xSvrListStore.get_iter(path[0])
self.xScreenVal = xSvrListStore.get_value(treeiter, 0)
def clearSelection(self, widget, data=None):
self.clear()
def clear(self):
imageGrid = self.builder.get_object("imageGrid")
while True:
if imageGrid.get_child_at(0,0)!= None:
imageGrid.remove_row(0)
else:
break
imageGrid.attach(self.gridLabel, 0, 0, 1, 1)
self.toSavePath = None
self.applyType = 1 # Default to XWinWrap
def closeProgram(self, widget, data=None):
sys.exit(0)
if __name__ == "__main__":
main = GWinWrap()
gtk.main()

View File

@@ -0,0 +1,699 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkFileFilter" id="Folders">
<mime-types>
<mime-type>inode/directory</mime-type>
</mime-types>
</object>
<object class="GtkListStore" id="XScreensaver List">
<columns>
<!-- column-name XScreensavers -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">electricsheep</col>
</row>
<row>
<col id="0" translatable="yes">atlantis</col>
</row>
<row>
<col id="0" translatable="yes">atunnel</col>
</row>
<row>
<col id="0" translatable="yes">blinkbox</col>
</row>
<row>
<col id="0" translatable="yes">blocktube</col>
</row>
<row>
<col id="0" translatable="yes">bouncingcow</col>
</row>
<row>
<col id="0" translatable="yes">boxfit</col>
</row>
<row>
<col id="0" translatable="yes">bsod</col>
</row>
<row>
<col id="0" translatable="yes">bubble3d</col>
</row>
<row>
<col id="0" translatable="yes">bumps</col>
</row>
<row>
<col id="0" translatable="yes">cage</col>
</row>
<row>
<col id="0" translatable="yes">carousel</col>
</row>
<row>
<col id="0" translatable="yes">cube21</col>
</row>
<row>
<col id="0" translatable="yes">cubenetic</col>
</row>
<row>
<col id="0" translatable="yes">cubicgrid</col>
</row>
<row>
<col id="0" translatable="yes">cwaves</col>
</row>
<row>
<col id="0" translatable="yes">dangerball</col>
</row>
<row>
<col id="0" translatable="yes">fiberlamp</col>
</row>
<row>
<col id="0" translatable="yes">fireworkx</col>
</row>
<row>
<col id="0" translatable="yes">flipflop</col>
</row>
<row>
<col id="0" translatable="yes">fliptext</col>
</row>
<row>
<col id="0" translatable="yes">flow</col>
</row>
<row>
<col id="0" translatable="yes">flurry</col>
</row>
<row>
<col id="0" translatable="yes">flyingtoasters</col>
</row>
<row>
<col id="0" translatable="yes">gflux</col>
</row>
<row>
<col id="0" translatable="yes">glcells</col>
</row>
<row>
<col id="0" translatable="yes">gleidescope</col>
</row>
<row>
<col id="0" translatable="yes">glknots</col>
</row>
<row>
<col id="0" translatable="yes">glmatrix</col>
</row>
<row>
<col id="0" translatable="yes">glschool</col>
</row>
<row>
<col id="0" translatable="yes">glslideshow</col>
</row>
<row>
<col id="0" translatable="yes">glsnake</col>
</row>
<row>
<col id="0" translatable="yes">hypertorus</col>
</row>
<row>
<col id="0" translatable="yes">hypnowheel</col>
</row>
<row>
<col id="0" translatable="yes">interaggregate</col>
</row>
<row>
<col id="0" translatable="yes">intermomentary</col>
</row>
<row>
<col id="0" translatable="yes">jigglypuff</col>
</row>
<row>
<col id="0" translatable="yes">jigsaw</col>
</row>
<row>
<col id="0" translatable="yes">julia</col>
</row>
<row>
<col id="0" translatable="yes">lament</col>
</row>
<row>
<col id="0" translatable="yes">lockward</col>
</row>
<row>
<col id="0" translatable="yes">metaballs</col>
</row>
<row>
<col id="0" translatable="yes">moebiusgears</col>
</row>
<row>
<col id="0" translatable="yes">molecule</col>
</row>
<row>
<col id="0" translatable="yes">morph3d</col>
</row>
<row>
<col id="0" translatable="yes">noof</col>
</row>
<row>
<col id="0" translatable="yes">phosphor</col>
</row>
<row>
<col id="0" translatable="yes">photopile</col>
</row>
<row>
<col id="0" translatable="yes">pinion</col>
</row>
<row>
<col id="0" translatable="yes">popsquares</col>
</row>
<row>
<col id="0" translatable="yes">ripples</col>
</row>
<row>
<col id="0" translatable="yes">skytentacles</col>
</row>
<row>
<col id="0" translatable="yes">slidescreen</col>
</row>
<row>
<col id="0" translatable="yes">stonerview</col>
</row>
<row>
<col id="0" translatable="yes">strange</col>
</row>
<row>
<col id="0" translatable="yes">substrate</col>
</row>
<row>
<col id="0" translatable="yes">tangram</col>
</row>
<row>
<col id="0" translatable="yes">whirlwindwarp</col>
</row>
<row>
<col id="0" translatable="yes">wormhole</col>
</row>
<row>
<col id="0" translatable="yes">xflame</col>
</row>
<row>
<col id="0" translatable="yes">xrayswarm</col>
</row>
<row>
<col id="0" translatable="yes">companioncube</col>
</row>
<row>
<col id="0" translatable="yes">fuzzyflakes</col>
</row>
<row>
<col id="0" translatable="yes">galaxy</col>
</row>
<row>
<col id="0" translatable="yes">glplanet</col>
</row>
<row>
<col id="0" translatable="yes">penetrate</col>
</row>
</data>
</object>
<object class="GtkWindow" id="Main">
<property name="width_request">950</property>
<property name="height_request">600</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">GWinWrap</property>
<property name="window_position">center</property>
<property name="default_width">950</property>
<property name="default_height">600</property>
<property name="icon">GWinWrap.png</property>
<property name="gravity">center</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">15</property>
<property name="margin_top">15</property>
<property name="margin_bottom">15</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Note: Double click an image to view the video or image.</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="clearSelection" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="selectedDirDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="focus_on_click">False</property>
<property name="tooltip_text" translatable="yes">Chose Dream Scene / Image Directory</property>
<property name="action">select-folder</property>
<property name="create_folders">False</property>
<property name="filter">Folders</property>
<property name="preview_widget_active">False</property>
<property name="title" translatable="yes">Dream Scene / Image Dir</property>
<signal name="file-set" handler="setNewDir" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid" id="imageGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="row_spacing">10</property>
<property name="column_spacing">10</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkLabel" id="gridLabel">
<property name="width_request">640</property>
<property name="height_request">525</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Choose Image/Video Directory...</property>
<attributes>
<attribute name="font-desc" value="Times New Roman, 28"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="width_request">300</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">10</property>
<property name="margin_right">15</property>
<property name="margin_top">15</property>
<property name="margin_bottom">15</property>
<property name="hexpand">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="useXScrnList">
<property name="label" translatable="yes">Use XScreenSaver</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">center</property>
<property name="margin_bottom">5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="toggleXscreenUsageField" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="xScreenSvrList">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="model">XScreensaver List</property>
<property name="headers_visible">False</property>
<signal name="cursor-changed" handler="passXScreenVal" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="listColumn">
<property name="title" translatable="yes">XScreensaves</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">Playback Resolutions</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">Position Offset</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkComboBoxText" id="playbackResolution">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">3</property>
<items>
<item translatable="yes">7680x4320</item>
<item translatable="yes">3840x2160</item>
<item translatable="yes">2048x1080</item>
<item translatable="yes">1920x1080</item>
<item translatable="yes">1440x720</item>
<item translatable="yes">1600x900</item>
<item translatable="yes">1280x720</item>
<item translatable="yes">800x600</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="posOffset">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">18</property>
<items>
<item translatable="yes">Left</item>
<item translatable="yes">-7680+0</item>
<item translatable="yes">-3840+0</item>
<item translatable="yes">-2048+0</item>
<item translatable="yes">-1920+0</item>
<item translatable="yes">-1440+0</item>
<item translatable="yes">-1600+0</item>
<item translatable="yes">-1280+0</item>
<item translatable="yes">-800+0</item>
<item translatable="yes">Right</item>
<item translatable="yes">+7680+0</item>
<item translatable="yes">+3840+0</item>
<item translatable="yes">+2048+0</item>
<item translatable="yes">+1920+0</item>
<item translatable="yes">+1440+0</item>
<item translatable="yes">+1600+0</item>
<item translatable="yes">+1280+0</item>
<item translatable="yes">+800+0</item>
<item translatable="yes">+0+0</item>
<item translatable="yes">Top</item>
<item translatable="yes">+0+7680</item>
<item translatable="yes">+0+3840</item>
<item translatable="yes">+0+2048</item>
<item translatable="yes">+0+1920</item>
<item translatable="yes">+0+1440</item>
<item translatable="yes">+0+1600</item>
<item translatable="yes">0+1280</item>
<item translatable="yes">+0+800</item>
<item translatable="yes">Bottum</item>
<item translatable="yes">+0-7680</item>
<item translatable="yes">+0-3840</item>
<item translatable="yes">+0-2048</item>
<item translatable="yes">+0-1920</item>
<item translatable="yes">+0-1440</item>
<item translatable="yes">+0-1600</item>
<item translatable="yes">0-1280</item>
<item translatable="yes">+0-800</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">10</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Save Path</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="saveLoc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">0</property>
<items>
<item translatable="yes">.animatedBGstarter.sh</item>
<item translatable="yes">.animatedBGstarter2.sh</item>
</items>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Save Selection</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="saveToFile" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="applySttngs" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Kill XWinWrap</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="killXWinWrp" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="clicked" handler="closeProgram" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">1</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env python
import os
class SaveState:
def __init__(self):
self.fileWriter = None
self.filePath = None
self.useXSvrn = None
self.xScreenVal = None
self.sveFileLoc = None
self.resolution = None
def saveToFile(self, filePath, resolution,
saveLoc, useXSvrn, xScreenVal):
self.filePath = filePath
self.useXSvrn = useXSvrn
self.xScreenVal = xScreenVal
self.resolution = resolution
userPth = os.path.expanduser('~')
# Saves to file with selected and needed settings
if filePath:
if filePath.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):
self.sveFileLoc = userPth + "/" + ".config/nitrogen/bg-saved.cfg"
else:
self.sveFileLoc = userPth + "/" + saveLoc
else:
self.filePath = ''
if self.sveFileLoc:
self.fileWriter = open(self.sveFileLoc, "w")
return self.startSave()
def startSave(self):
applyType = 1
output = None
# XSCREENSAVER
if self.useXSvrn:
output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- /usr/lib/xscreensaver/" + self.xScreenVal + " -window-id WID -root";
# GIF
elif self.filePath.lower().endswith(('.gif')):
output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- gifview -a -w WID " + self.filePath;
# Standard images using nitrogen
elif self.filePath.lower().endswith(('.png', 'jpg', '.jpeg')):
output = "[xin_0] \n file=" + self.filePath + "\nmode=0 \nbgcolor=#000000\n[xin_1] \nfile=" + self.filePath + "\nmode=0 \nbgcolor=#000000";
applyType = 2;
# VIDEO
else:
output = "xwinwrap -ov -g " + self.resolution + " -st -sp -b -nf -s -ni -- mplayer -wid WID -really-quiet -ao null -loop 0 " + self.filePath;
pass
if self.fileWriter:
self.fileWriter.write(output)
self.fileWriter.close()
return applyType;

Binary file not shown.

View File

@@ -0,0 +1 @@
from utils.SaveState import SaveState

Binary file not shown.

View File

@@ -0,0 +1,20 @@
all: all64 all32
all64:
gcc -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -lX11 -lXext -lXrender xwinwrap.c -o xwinwrap
-mkdir x86_64
mv ./xwinwrap ./x86_64
all32:
gcc -m32 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -lX11 -lXext -lXrender xwinwrap.c -o xwinwrap
-mkdir i386
mv ./xwinwrap ./i386
install64:
cp x86_64/xwinwrap /usr/bin
install32:
cp i386/xwinwrap /usr/bin
clean:
-rm -rf x86_64/ i386/

View File

@@ -0,0 +1,459 @@
/*
* Copyright © 2005 Novell, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of
* Novell, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
* Novell, Inc. makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: David Reveman <davidr@novell.com>
*/
/*
* Modified by: Shantanu Goel
* Tech Blog: http://tech.shantanugoel.com
* Blog: http://blog.shantanugoel.com
* Home Page: http://tech.shantanugoel.com/projects/linux/shantz-xwinwrap
*
* Changelog:
* 15-Jan-09: 1. Fixed the bug where XFetchName returning a NULL for "name"
* resulted in a crash.
* 2. Provided an option to specify the desktop window name.
* 3. Added debug messages
*
* 24-Aug-08: 1. Fixed the geometry option (-g) so that it works
* 2. Added override option (-ov), for seamless integration with
* desktop like a background in non-fullscreen modes
* 3. Added shape option (-sh), to create non-rectangular windows.
* Currently supporting circlular and triangular windows
*/
/*
* Modified by: Maxim Stewart
* Tech Blog: https://www.itdominator.com/
*
* Changelog:
* 3-March-19: 1. Cleaned up code formatting.
* 2. Removed unused DEBUG_MSG reference.
* 3. Moved functions to a more reasonable order.
* 4. Compile dev library list 32 & 64 bit:
* # 32
* sudo apt install libxext-dev:i386 libxrender-dev:i386 libc6-dev-i386
*
* # 64
* sudo apt install libxext-dev libxrender-dev libc6-dev
*/
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xproto.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/Xrender.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#define WIDTH 512
#define HEIGHT 384
#define OPAQUE 0xffffffff
#define NAME "xwinwrap"
#define VERSION "0.3"
#define DESKTOP_WINDOW_NAME_MAX_SIZE 25
#define DEFAULT_DESKTOP_WINDOW_NAME "Desktop"
#define DEBUG_MSG(x) if(debug) { fprintf(stderr, x); }
typedef enum {
SHAPE_RECT = 0,
SHAPE_CIRCLE,
SHAPE_TRIG,
} win_shape;
static pid_t pid = 0;
static char **childArgv = 0;
static int nChildArgv = 0;
int debug = 0;
char desktop_window_name[DESKTOP_WINDOW_NAME_MAX_SIZE];
static int addArguments(char **argv, int n) {
char **newArgv;
int i;
newArgv = realloc (childArgv, sizeof (char *) * (nChildArgv + n));
if (!newArgv)
return 0;
for (i = 0; i < n; i++)
newArgv[nChildArgv + i] = argv[i];
childArgv = newArgv;
nChildArgv += n;
return n;
}
static void setWindowOpacity(Display *dpy, Window win, unsigned int opacity) {
CARD32 o;
o = opacity;
XChangeProperty (dpy, win, XInternAtom (dpy, "_NET_WM_WINDOW_OPACITY", 0),
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &o, 1);
}
static Visual * findArgbVisual(Display *dpy, int scr) {
XVisualInfo *xvi;
XVisualInfo template;
int nvi;
int i;
XRenderPictFormat *format;
Visual *visual;
template.screen = scr;
template.depth = 32;
template.class = TrueColor;
xvi = XGetVisualInfo (dpy,
VisualScreenMask |
VisualDepthMask |
VisualClassMask,
&template,
&nvi);
if (!xvi)
return 0;
visual = 0;
for (i = 0; i < nvi; i++) {
format = XRenderFindVisualFormat (dpy, xvi[i].visual);
if (format->type == PictTypeDirect && format->direct.alphaMask) {
visual = xvi[i].visual;
break;
}
}
XFree (xvi);
return visual;
}
static Window find_desktop_window(Display *display, int screen,
Window *root, Window *p_desktop) {
int i;
unsigned int n;
Window win = *root;
Window troot, parent, *children;
char *name;
int status;
int width = DisplayWidth(display, screen);
int height = DisplayHeight(display, screen);
XWindowAttributes attrs;
XQueryTree(display, *root, &troot, &parent, &children, &n);
for (i = 0; i < (int) n; i++) {
status = XFetchName(display, children[i], &name);
status |= XGetWindowAttributes(display, children[i], &attrs);
if ((status != 0) && (NULL != name)) {
if( (attrs.map_state != 0) && (attrs.width == width) &&
(attrs.height == height) && (!strcmp(name, desktop_window_name)) ) {
win = children[i];
XFree(children);
XFree(name);
*p_desktop = win;
return win;
}
if(name)
XFree(name);
}
}
DEBUG_MSG("Desktop Window Not found\n");
return 0;
}
static void usage (void) {
fprintf(stderr, "%s v%s- Modified by Shantanu Goel. Visit http://tech.shantanugoel.com for updates, queries and feature requests\n", NAME, VERSION);
fprintf (stderr, "\nUsage: %s [-g {w}x{h}+{x}+{y}] [-ni] [-argb] [-fs] [-s] [-st] [-sp] [-a] "
"[-b] [-nf] [-o OPACITY] [-sh SHAPE] [-ov]-- COMMAND ARG1...\n", NAME);
fprintf (stderr, "Options:\n \
-g - Specify Geometry (w=width, h=height, x=x-coord, y=y-coord. ex: -g 640x480+100+100)\n \
-ni - Ignore Input\n \
-d - Desktop Window Hack. Provide name of the \"Desktop\" window as parameter \
-argb - RGB\n \
-fs - Full Screen\n \
-s - Sticky\n \
-st - Skip Taskbar\n \
-sp - Skip Pager\n \
-a - Above\n \
-b - Below\n \
-nf - No Focus\n \
-o - Opacity value between 0 to 1 (ex: -o 0.20)\n \
-sh - Shape of window (choose between rectangle, circle or triangle. Default is rectangle)\n \
-ov - Set override_redirect flag (For seamless desktop background integration in non-fullscreenmode)\n \
-debug - Enable debug messages\n");
}
static void sigHandler (int sig) { kill(pid, sig); }
int main (int argc, char **argv) {
Display *dpy;
Window win;
Window root;
Window p_desktop = 0;
int screen;
XSizeHints xsh;
XWMHints xwmh;
char widArg[256];
char *widArgv[] = { widArg };
char *endArg = NULL;
int i;
int status = 0;
unsigned int opacity = OPAQUE;
int x = 0;
int y = 0;
unsigned int width = WIDTH;
unsigned int height = HEIGHT;
int argb = 0;
int fullscreen = 0;
int noInput = 0;
int noFocus = 0;
Atom state[256];
int nState = 0;
int override = 0;
win_shape shape = SHAPE_RECT;
Pixmap mask;
GC mask_gc;
XGCValues xgcv;
dpy = XOpenDisplay (NULL);
if (!dpy) {
fprintf (stderr, "%s: Error: couldn't open display\n", argv[0]);
return 1;
}
screen = DefaultScreen (dpy);
root = RootWindow (dpy, screen);
strcpy(desktop_window_name, DEFAULT_DESKTOP_WINDOW_NAME);
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-g") == 0) {
if (++i < argc)
XParseGeometry (argv[i], &x, &y, &width, &height);
} else if (strcmp(argv[i], "-ni") == 0) {
noInput = 1;
} else if (strcmp(argv[i], "-d") == 0) {
++i;
strcpy(desktop_window_name, argv[i]);
} else if (strcmp(argv[i], "-argb") == 0) {
argb = 1;
} else if (strcmp(argv[i], "-fs") == 0) {
state[nState++] = XInternAtom (dpy, "_NET_WM_STATE_FULLSCREEN", 0);
fullscreen = 1;
} else if (strcmp(argv[i], "-s") == 0) {
state[nState++] = XInternAtom (dpy, "_NET_WM_STATE_STICKY", 0);
} else if (strcmp(argv[i], "-st") == 0) {
state[nState++] = XInternAtom (dpy, "_NET_WM_STATE_SKIP_TASKBAR", 0);
} else if (strcmp(argv[i], "-sp") == 0) {
state[nState++] = XInternAtom (dpy, "_NET_WM_STATE_SKIP_PAGER", 0);
} else if (strcmp(argv[i], "-a") == 0) {
state[nState++] = XInternAtom (dpy, "_NET_WM_STATE_ABOVE", 0);
} else if (strcmp(argv[i], "-b") == 0) {
state[nState++] = XInternAtom (dpy, "_NET_WM_STATE_BELOW", 0);
} else if (strcmp(argv[i], "-nf") == 0) {
noFocus = 1;
} else if (strcmp(argv[i], "-o") == 0) {
if (++i < argc)
opacity = (unsigned int) (atof (argv[i]) * OPAQUE);
} else if (strcmp(argv[i], "-sh") == 0) {
if (++i < argc) {
if(strcasecmp(argv[i], "circle") == 0) {
shape = SHAPE_CIRCLE;
} else if(strcasecmp(argv[i], "triangle") == 0) {
shape = SHAPE_TRIG;
}
}
} else if (strcmp(argv[i], "-ov") == 0) {
override = 1;
} else if (strcmp(argv[i], "-debug") == 0) {
debug = 1;
} else if (strcmp(argv[i], "--") == 0) {
break;
} else {
usage ();
return 1;
}
}
for (i = i + 1; i < argc; i++) {
if (strcmp(argv[i], "WID") == 0)
addArguments (widArgv, 1);
else
addArguments (&argv[i], 1);
}
if (!nChildArgv) {
fprintf (stderr, "%s: Error: couldn't create command line\n", argv[0]);
usage ();
return 1;
}
addArguments (&endArg, 1);
if (fullscreen) {
xsh.flags = PSize | PPosition;
xsh.width = DisplayWidth (dpy, screen);
xsh.height = DisplayHeight (dpy, screen);
} else {
xsh.flags = PSize;
xsh.width = width;
xsh.height = height;
}
xwmh.flags = InputHint;
xwmh.input = !noFocus;
if (argb) {
XSetWindowAttributes attr;
Visual *visual;
visual = findArgbVisual (dpy, screen);
if (!visual) {
fprintf (stderr, "%s: Error: couldn't find argb visual\n", argv[0]);
return 1;
}
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap (dpy, root, visual, AllocNone);
win = XCreateWindow (dpy, root, 0, 0, xsh.width, xsh.height, 0, 32,
InputOutput, visual,
CWBackPixel | CWBorderPixel | CWColormap, &attr);
} else {
XSetWindowAttributes attr;
attr.override_redirect = override;
if( override && find_desktop_window(dpy, screen, &root, &p_desktop) ) {
win = XCreateWindow (dpy, p_desktop, x, y, xsh.width, xsh.height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect, &attr);
} else {
win = XCreateWindow (dpy, root, x, y, xsh.width, xsh.height, 0,
CopyFromParent, InputOutput, CopyFromParent,
CWOverrideRedirect, &attr);
}
}
XSetWMProperties (dpy, win, NULL, NULL, argv, argc, &xsh, &xwmh, NULL);
if (opacity != OPAQUE)
setWindowOpacity (dpy, win, opacity);
if (noInput) {
Region region;
region = XCreateRegion ();
if (region) {
XShapeCombineRegion (dpy, win, ShapeInput, 0, 0, region, ShapeSet);
XDestroyRegion (region);
}
}
if (nState)
XChangeProperty (dpy, win, XInternAtom (dpy, "_NET_WM_STATE", 0),
XA_ATOM, 32, PropModeReplace, (unsigned char *) state, nState);
if (shape) {
mask = XCreatePixmap(dpy, win, width, height, 1);
mask_gc = XCreateGC(dpy, mask, 0, &xgcv);
switch(shape) {
//Nothing special to be done if it's a rectangle
case SHAPE_CIRCLE:
/* fill mask */
XSetForeground(dpy, mask_gc, 0);
XFillRectangle(dpy, mask, mask_gc, 0, 0, width, height);
XSetForeground(dpy, mask_gc, 1);
XFillArc(dpy, mask, mask_gc, 0, 0, width, height, 0, 23040);
break;
case SHAPE_TRIG:
{
XPoint points[3] = { {0, height},
{width/2, 0},
{width, height} };
XSetForeground(dpy, mask_gc, 0);
XFillRectangle(dpy, mask, mask_gc, 0, 0, width, height);
XSetForeground(dpy, mask_gc, 1);
XFillPolygon(dpy, mask, mask_gc, points, 3, Complex, CoordModeOrigin);
}
break;
default:
break;
}
/* combine */
XShapeCombineMask(dpy, win, ShapeBounding, 0, 0, mask, ShapeSet);
}
XMapWindow (dpy, win);
if(p_desktop == 0)
XLowerWindow(dpy, win);
XSync (dpy, win);
sprintf (widArg, "0x%x", (int) win);
pid = fork ();
switch (pid) {
case -1:
perror ("fork");
return 1;
case 0:
execvp (childArgv[0], childArgv);
perror (childArgv[0]);
exit (2);
break;
default:
break;
}
signal (SIGTERM, sigHandler);
signal (SIGINT, sigHandler);
for (;;) {
if (waitpid (pid, &status, 0) != -1) {
if (WIFEXITED (status))
fprintf (stderr, "%s died, exit status %d\n", childArgv[0],
WEXITSTATUS (status));
break;
}
}
XDestroyWindow (dpy, win);
XCloseDisplay (dpy);
return 0;
}

View File

@@ -0,0 +1,6 @@
#!/bin/bash
function main() {
gcc -no-pie -s gwinwrap_exec_bin.cpp -o gwinwrap
}
main;

View File

@@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
using namespace std;
int main() {
chdir("/opt/GWinWrap/");
system("python GWinWrap.py");
return 0;
}