{"id":35074,"date":"2026-01-12T12:54:41","date_gmt":"2026-01-12T17:54:41","guid":{"rendered":"http:\/\/www.allyngibson.com\/?p=35074"},"modified":"2026-01-12T12:55:19","modified_gmt":"2026-01-12T17:55:19","slug":"occasionally-clever","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=35074","title":{"rendered":"Occasionally Clever"},"content":{"rendered":"<p>Occasionally, I have a good idea, and occasionally, I can make it work.<\/p>\n<p>Case in point.<\/p>\n<p>Sometimes <a href=\"http:\/\/www.allyngibson.com\/?p=34750\">I will use an old and obscure window manager for Linux called WMX<\/a>.  It&#8217;s minimalist and spartan.  No panels, no background, barely a menu.  It can launch a terminal and scroll through workspaces.  You can set up a menu on the scroll wheel\/middle button.  When I don&#8217;t want bells and whistles, like when I&#8217;m writing, this is what I use.<\/p>\n<p>Instead of calling WMX directly, I launch it from a script that launches the screensaver, sets an environment variable, and uses feh to set a wallpaper.  To set a wallpaper, the feh command has to call the file directly, so I have a line like:<\/p>\n<p><code>feh --bg-fill \/home\/allyn\/Pictures\/backgrounds\/historical\/baltimore-1872.jpg &<\/code><\/p>\n<p>I have WMX alongside the Cinnamon desktop environment.  It occurred to me, what if I could just have feh call the wallpaper that <a href=\"http:\/\/www.allyngibson.com\/?p=35046\">I have set in Cinnamon<\/a>?  That&#8217;s just stored in dconf.  <code>gsettings get org.cinnamon.desktop.background picture-uri<\/code> will extract the filename.  That command comes out in a format like this: <code>'file:\/\/\/home\/allyn\/Pictures\/backgrounds\/bbc-ulysses\/1600-blue-mouldy.jpg'<\/code>  feh would not work with that, so I had to take the single quotes off and, just in case, the file prefix and leading slashes, to get it down to this: <code>\/home\/allyn\/Pictures\/backgrounds\/bbc-ulysses\/1600-blue-mouldy.jpg<\/code>.<\/p>\n<p>It did not come together quickly, I had to consult the Googles which led me to several Stack Overflow pages, I experimented with grep and awk and pipes, but I was able to cobble together code that did what I wanted: extract the filename, truncate it down, pass it to feh.  This is what I have in my bash script that launches WMX.<\/p>\n<p><code># Wallpaper<br \/>\nbackground_uri=$(gsettings get org.cinnamon.desktop.background picture-uri)<br \/>\nwallpaper=${background_uri:8:-1}<br \/>\nfeh --bg-fill $wallpaper<br \/>\n<\/code><\/p>\n<p>The first line is just a comment.<\/p>\n<p>The second line uses gsettings to get the path to the wallpaper and assigns it to a variable.<\/p>\n<p>The third line chops the first 8 characters as well as the last off the variable and assigns that result to a new variable.<\/p>\n<p>The fourth and final line calls feh (which sets the background image or wallpaper) and passes it the new, truncated variable.<\/p>\n<p><i>Voila!<\/i><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"http:\/\/www.allyngibson.com\/wp-content\/uploads\/2026\/01\/Screenshot_20260112_122344.jpg\" alt=\"Linux Mint screenshot of WMX, with the wallpaper showing the interior of a Dublin pub, because it&#039;s never too early for a Guinness\" class=\"aligncenter size-full wp-image-35073\" \/><\/p>\n<p>I look at it, and it looks so simple, but I spent about two hours on it last night and another half hour this morning.  Bash scripting isn&#8217;t something I know.  I can write a script that chains a lot of commands together, but variables were new and unknown to me&#8230; and they&#8217;re <i>still<\/i> new and unknown! \ud83d\ude06<\/p>\n<p>So now, when\/if I change my Cinnamon wallpaper, the wallpaper will change automatically in WMX.  If I want to change that, I can just comment out the line that sets the wallpaper using my variable and call a specific file directly as above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Occasionally, I have a good idea, and occasionally, I can make it work. Case in point. Sometimes I will use an old and obscure window manager for Linux called WMX. It&#8217;s minimalist and spartan. No panels, no background, barely a menu. It can launch a terminal and scroll through workspaces. You can set up a<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=35074\">Continue reading <span class=\"screen-reader-text\">&#8220;Occasionally Clever&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[763],"tags":[5145,4860,5146,5304],"class_list":["post-35074","post","type-post","status-publish","format-standard","hentry","category-linux","tag-cinnamon","tag-linux-mint","tag-linux-mint-debian-edition","tag-wmx","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/35074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=35074"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/35074\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=35074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=35074"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=35074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}