نمایش آیکون ها در یک workspace

ساخت وبلاگ
دوستان در gnome flashback می خوام آیکون دسکتاپ در یک workspace  باشه اسکریپت پایتونی پیدا کردم که با wmctrl و فقط در unity کار می کنه لطفا راه حلی دارید راهنمایی کنید در گنوم این کار رو انجام بدم سپاس
#!/usr/bin/env python3
import subprocess
import os
import time
import shutil

home = os.environ["HOME"]
desktop_dir = desktop_dir = home+"/"+"Desktop"
data_dirstr = home+"/desktop_data/desktop_"

get = lambda cmd: subprocess.check_output(["/bin/bash", "-c", cmd]).decode("utf-8")

# get resolution
xr = get("xrandr").split()
plus = 2 if xr[xr.index("connected")+1] == "primary" else 1
res = [int(n) for n in xr[xr.index("connected")+plus].split("+")[0].split("x")]

def get_dt():
    # get the current viewport
    vp_data = subprocess.check_output(["wmctrl", "-d"]).decode("utf-8").split()
    dt = [int(n) for n in vp_data[3].split("x")]
    cols = int(dt[0]/res[0])
    curr_vpdata = [int(n) for n in vp_data[5].split(",")]
    curr_col = int(curr_vpdata[0]/res[0])+1; curr_row = int(curr_vpdata[1]/res[1])
    retu str(curr_col+curr_row*cols)

curr_dt1 = get_dt()

while True:
    time.sleep(1)
    curr_dt2 = get_dt()
    # alter the set of links when workspace changes
    if not curr_dt1 == curr_dt2:
        datafolder = data_dirstr+curr_dt2
        for f in os.listdir(desktop_dir):
            subject = desktop_dir+"/"+f
            # uncomment one of the two lines below
            if os.path.islink(subject):                                       # uncomment for only folders (links to) per workspace
            # if os.path.islink(subject) or subject.endswith(".desktop") :    # uncomment for folders and .desktop files per workspace
            #
                os.remove(subject)
        for f in os.listdir(datafolder):
            subject = datafolder+"/"+f; target = desktop_dir+"/"+f
            if os.path.islink(subject):
                os.symlink(os.readlink(subject), target)
            else:
                shutil.copy(subject,target)
    curr_dt1 = curr_dt2


  منبع: از اینجا

اوبونتو...
ما را در سایت اوبونتو دنبال می کنید

برچسب : نویسنده : استخدام کار ubuntu بازدید : 132 تاريخ : پنجشنبه 20 خرداد 1395 ساعت: 23:39