-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from zxcv32/fix/kde
feat!: update for KDE
- Loading branch information
Showing
8 changed files
with
114 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Create executable and system pacakge | ||
# Create executable and system package | ||
SHELL = bash | ||
|
||
# Create executable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Package: openrwc | ||
Version: 0.0.2 | ||
Version: 0.0.3 | ||
Architecture: amd64 | ||
Essential: no | ||
Priority: optional | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2022 OpenRWC. | ||
* | ||
* Licensed under GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 | ||
* Everyone is permitted to copy and distribute verbatim copies | ||
* of this license document, but changing it is not allowed. | ||
* | ||
* @author Ashwani Sharma (https://github.com/zxcV32) | ||
*/ | ||
|
||
package internal | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
"os" | ||
"os/exec" | ||
) | ||
|
||
// KdeChange Set wallpaper on monitor(s) | ||
func KdeChange(path string, wallpaper string) error { | ||
// https://www.reddit.com/r/kde/comments/65pmhj/change_wallpaper_from_terminal/ | ||
script := `#!/usr/bin/env sh | ||
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "var allDesktops = desktops(); | ||
for (i=0;i<allDesktops.length;i++) {{ | ||
d = allDesktops[i]; | ||
d.wallpaperPlugin = \"org.kde.image\"; | ||
d.currentConfigGroup = Array(\"Wallpaper\", | ||
\"org.kde.image\", | ||
\"General\"); | ||
d.writeConfig(\"Image\", \"$1\") | ||
}} | ||
" | ||
` | ||
file := "kde.sh" | ||
if _, err := os.Stat(path + "/" + file); os.IsNotExist(err) { | ||
os.MkdirAll(path, 0700) | ||
f, openError := os.Create(path + "/" + file) | ||
if openError != nil { | ||
log.Fatal(openError) | ||
} | ||
defer f.Close() | ||
_, writeError := f.WriteString(script) | ||
|
||
if writeError != nil { | ||
log.Fatal(writeError) | ||
} | ||
err = os.Chmod(path+"/"+file, 0775) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Infof("Shell script %s created at %s", file, path) | ||
} | ||
_, err := exec.Command(path+"/"+file, wallpaper).Output() | ||
if nil != err { | ||
return err | ||
} | ||
log.Infof("KDE wallpaper applied to all monitors") | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters