Added xscreensaver preview

This commit is contained in:
Maxim Stewart 2019-05-13 21:54:16 -05:00
parent 0f46303c7c
commit 8bfce547f2
7 changed files with 86 additions and 434 deletions

Binary file not shown.

View File

@ -8,7 +8,7 @@ gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk from gi.repository import Gdk as gdk
from gi.repository import GObject as gobject from gi.repository import GObject as gobject
from gi.repository import Gtk, GdkPixbuf from gi.repository import GdkPixbuf
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
@ -28,9 +28,8 @@ class GWinWrap:
self.window = self.builder.get_object("Main") self.window = self.builder.get_object("Main")
self.builder.connect_signals(self) self.builder.connect_signals(self)
self.window.connect("delete-event", gtk.main_quit) self.window.connect("delete-event", gtk.main_quit)
self.screen = self.window.get_screen()
self.screen = self.window.get_screen() self.visual = self.screen.get_rgba_visual()
self.visual = self.screen.get_rgba_visual()
if self.visual != None and self.screen.is_composited(): if self.visual != None and self.screen.is_composited():
self.window.set_visual(self.visual) self.window.set_visual(self.visual)
@ -61,7 +60,15 @@ class GWinWrap:
# foreground=\"#ffa800\" # foreground=\"#ffa800\"
# foreground=\"#88cc27\" # foreground=\"#88cc27\"
# foreground=\"#ff0000\" # foreground=\"#ff0000\"
# foreground=\"#ff0000\"
# Fill list xscreensaver
self.xscrPth = "/usr/lib/xscreensaver/"
xscreenList = self.builder.get_object("XScreensaver List")
list = [f for f in listdir(self.xscrPth) if isfile(join(self.xscrPth, f))]
list.sort()
for file in list:
xscreenList.append((file,))
self.window.show() self.window.show()
@ -205,6 +212,10 @@ class GWinWrap:
resolution = plyBckRes.get_active_text() + offset4Res.get_active_text() resolution = plyBckRes.get_active_text() + offset4Res.get_active_text()
self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution, self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution,
saveLoc, useXscreenSaver, self.xScreenVal) saveLoc, useXscreenSaver, self.xScreenVal)
if self.applyType == -1:
self.helpLabel.set_markup("<span foreground=\"#e0cc64\">Nothing saved...</span>")
return
self.helpLabel.set_markup(self.savedLabel) self.helpLabel.set_markup(self.savedLabel)
def applySttngs(self, widget, data=None): def applySttngs(self, widget, data=None):
@ -229,6 +240,11 @@ class GWinWrap:
treeiter = xSvrListStore.get_iter(path[0]) treeiter = xSvrListStore.get_iter(path[0])
self.xScreenVal = xSvrListStore.get_value(treeiter, 0) self.xScreenVal = xSvrListStore.get_value(treeiter, 0)
def previewXscreen(self, widget, eve):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
preview = self.xscrPth + "/" + self.xScreenVal + "&"
os.system(preview)
def clearSelection(self, widget, data=None): def clearSelection(self, widget, data=None):
self.clear() self.clear()
@ -242,10 +258,13 @@ class GWinWrap:
break break
imageGrid.attach(self.gridLabel, 0, 0, 1, 1) imageGrid.attach(self.gridLabel, 0, 0, 1, 1)
self.builder.get_object("xScreenSvrList").set_sensitive(False)
self.builder.get_object("useXScrnList").set_active(False)
self.helpLabel.set_markup(self.defaultLabel) self.helpLabel.set_markup(self.defaultLabel)
self.loadProgress.set_text("") self.loadProgress.set_text("")
self.loadProgress.set_fraction(0.0) self.loadProgress.set_fraction(0.0)
self.toSavePath = None self.toSavePath = None
self.xScreenVal = None
self.applyType = 1 # Default to XWinWrap self.applyType = 1 # Default to XWinWrap
def closeProgram(self, widget, data=None): def closeProgram(self, widget, data=None):

View File

@ -12,206 +12,6 @@
<!-- column-name XScreensavers --> <!-- column-name XScreensavers -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </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>
<object class="GtkImage" id="clearImage"> <object class="GtkImage" id="clearImage">
<property name="visible">True</property> <property name="visible">True</property>
@ -449,6 +249,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="model">XScreensaver List</property> <property name="model">XScreensaver List</property>
<property name="headers_visible">False</property> <property name="headers_visible">False</property>
<signal name="button-press-event" handler="previewXscreen" swapped="no"/>
<signal name="cursor-changed" handler="passXScreenVal" swapped="no"/> <signal name="cursor-changed" handler="passXScreenVal" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>

View File

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

View File

@ -8,7 +8,7 @@ gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk from gi.repository import Gdk as gdk
from gi.repository import GObject as gobject from gi.repository import GObject as gobject
from gi.repository import Gtk, GdkPixbuf from gi.repository import GdkPixbuf
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
@ -28,9 +28,8 @@ class GWinWrap:
self.window = self.builder.get_object("Main") self.window = self.builder.get_object("Main")
self.builder.connect_signals(self) self.builder.connect_signals(self)
self.window.connect("delete-event", gtk.main_quit) self.window.connect("delete-event", gtk.main_quit)
self.screen = self.window.get_screen()
self.screen = self.window.get_screen() self.visual = self.screen.get_rgba_visual()
self.visual = self.screen.get_rgba_visual()
if self.visual != None and self.screen.is_composited(): if self.visual != None and self.screen.is_composited():
self.window.set_visual(self.visual) self.window.set_visual(self.visual)
@ -61,7 +60,15 @@ class GWinWrap:
# foreground=\"#ffa800\" # foreground=\"#ffa800\"
# foreground=\"#88cc27\" # foreground=\"#88cc27\"
# foreground=\"#ff0000\" # foreground=\"#ff0000\"
# foreground=\"#ff0000\"
# Fill list xscreensaver
self.xscrPth = "/usr/lib/xscreensaver/"
xscreenList = self.builder.get_object("XScreensaver List")
list = [f for f in listdir(self.xscrPth) if isfile(join(self.xscrPth, f))]
list.sort()
for file in list:
xscreenList.append((file,))
self.window.show() self.window.show()
@ -205,6 +212,10 @@ class GWinWrap:
resolution = plyBckRes.get_active_text() + offset4Res.get_active_text() resolution = plyBckRes.get_active_text() + offset4Res.get_active_text()
self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution, self.applyType = self.stateSaver.saveToFile(self.toSavePath, resolution,
saveLoc, useXscreenSaver, self.xScreenVal) saveLoc, useXscreenSaver, self.xScreenVal)
if self.applyType == -1:
self.helpLabel.set_markup("<span foreground=\"#e0cc64\">Nothing saved...</span>")
return
self.helpLabel.set_markup(self.savedLabel) self.helpLabel.set_markup(self.savedLabel)
def applySttngs(self, widget, data=None): def applySttngs(self, widget, data=None):
@ -229,6 +240,11 @@ class GWinWrap:
treeiter = xSvrListStore.get_iter(path[0]) treeiter = xSvrListStore.get_iter(path[0])
self.xScreenVal = xSvrListStore.get_value(treeiter, 0) self.xScreenVal = xSvrListStore.get_value(treeiter, 0)
def previewXscreen(self, widget, eve):
if eve.type == gdk.EventType.DOUBLE_BUTTON_PRESS:
preview = self.xscrPth + "/" + self.xScreenVal + "&"
os.system(preview)
def clearSelection(self, widget, data=None): def clearSelection(self, widget, data=None):
self.clear() self.clear()
@ -242,10 +258,13 @@ class GWinWrap:
break break
imageGrid.attach(self.gridLabel, 0, 0, 1, 1) imageGrid.attach(self.gridLabel, 0, 0, 1, 1)
self.builder.get_object("xScreenSvrList").set_sensitive(False)
self.builder.get_object("useXScrnList").set_active(False)
self.helpLabel.set_markup(self.defaultLabel) self.helpLabel.set_markup(self.defaultLabel)
self.loadProgress.set_text("") self.loadProgress.set_text("")
self.loadProgress.set_fraction(0.0) self.loadProgress.set_fraction(0.0)
self.toSavePath = None self.toSavePath = None
self.xScreenVal = None
self.applyType = 1 # Default to XWinWrap self.applyType = 1 # Default to XWinWrap
def closeProgram(self, widget, data=None): def closeProgram(self, widget, data=None):

View File

@ -12,206 +12,6 @@
<!-- column-name XScreensavers --> <!-- column-name XScreensavers -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </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>
<object class="GtkImage" id="clearImage"> <object class="GtkImage" id="clearImage">
<property name="visible">True</property> <property name="visible">True</property>
@ -449,6 +249,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="model">XScreensaver List</property> <property name="model">XScreensaver List</property>
<property name="headers_visible">False</property> <property name="headers_visible">False</property>
<signal name="button-press-event" handler="previewXscreen" swapped="no"/>
<signal name="cursor-changed" handler="passXScreenVal" swapped="no"/> <signal name="cursor-changed" handler="passXScreenVal" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>

View File

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