Xclock always on top with keyboard shortcut?

Locked
Message
Author
User avatar
mikeswifty
Posts: 26
Joined: Wed Jul 26, 2017 9:39 pm

Xclock always on top with keyboard shortcut?

#1 Post by mikeswifty »

I have added a keyboard shortcut to display the date and time but would like for the window to open as "Always on top" by default. Not sure how to do this. I've tried the following in the terminal: xclock -d -update 1 -fg cyan -bg black && wmctrl -r xclock -b add,above (and also tried using "toggle" in place of "add"). It opens up the clock but doesn't make it "Always on top". And when I try to put it in the keyboard menu under application settings it doesn't do anything (/usr/bin/xclock -d -update 1 -fg cyan -bg black && wmctrl -r xclock -b add,above), though leaving off the "&& wmctrl..." opens up the clock.

I can manually click the "Always on top" once the clock opens (and reposition the window to bottom center, which is where I want it, but w-a-a-y beyond my capabilities via command line), but there's an easier way, right? All I really want is a clock with display that's big enough to catch my eye so I'll know I've spent too much time sitting in front of the computer (or it's time to go do "xyz" and get on with my day, etc.") I can make a second horizontal panel to just display the time, sure, but that takes out a whole row from my screen instead of just a small box, so I think I prefer the xclock (or similar).

Thanks!

User avatar
mikeswifty
Posts: 26
Joined: Wed Jul 26, 2017 9:39 pm

Re: Xclock always on top with keyboard shortcut?

#2 Post by mikeswifty »

Since it doesn't stay on top, I had the idea to just hit my keyboard shortcut to call up the xclock again whenever I want to see it and use "Alt-F4" to close the window it's in when I'm done. But "Alt-F4" doesn't have any effect on the xclock window (it just closes out my web browser or spreadsheet or whatever else I'm working on) and if I keep using my shortcut key, I get multiple clocks open on the desktop (the latest one is in front, where I can see it, the rest are behind). :bawling:

User avatar
mikeswifty
Posts: 26
Joined: Wed Jul 26, 2017 9:39 pm

Re: Xclock always on top with keyboard shortcut?

#3 Post by mikeswifty »

So if I use my shortcut to bring up the xclock, I can enter "wmctrl -r xclock -b toggle,above" in the terminal and get the window to be "Always on Top" like I want it, but I can't figure out how to do it all as one line. Maybe I need a "sleep" command in between (like xclock -d -update 1 -fg cyan -bg black && sleep 1 && wmctrl -r xclock -b toggle,above), but that doesn't seem to work...

User avatar
mikeswifty
Posts: 26
Joined: Wed Jul 26, 2017 9:39 pm

Re: Xclock always on top with keyboard shortcut?

#4 Post by mikeswifty »

Got the placement to bottom, center, with this: -geometry -500+1000.

So now I've got: xclock -d -update 1 -fg cyan -bg black -geometry -500+1000

And it runs with a keyboard shortcut! Sheesh, maybe I can figure this out...
Last edited by mikeswifty on Sun Aug 06, 2017 12:47 pm, edited 1 time in total.

User avatar
mikeswifty
Posts: 26
Joined: Wed Jul 26, 2017 9:39 pm

Re: Xclock always on top with keyboard shortcut?

#5 Post by mikeswifty »

Can't figure out the xclock, but managed to come up with a solution that works nicely. I went ahead and added a second panel in DESKBAR MODE, centered it at the bottom of the screen and clicked to hide the panel intelligently. gave it two rows, increased the font size, and added the Orage panel clock twice. One shows the time, the other shows the day & date. When I want to see the time, I just hover the mouse over the bottom, center of the screen.

Here's what it looks like while web browsing:
Clock2.jpeg

And here's what it looks like from the desktop:
Clock1.jpeg

User avatar
r4pt7r
Posts: 1
Joined: Fri Feb 25, 2022 6:33 pm

Re: Xclock always on top with keyboard shortcut?

#6 Post by r4pt7r »

Got the original (generic) method working; I put the following in my ~/.profile :

xclock -norender -digital -brief -geometry 40x30+1690+2000 -fg orange -bg darkgreen -padding 0 &
sleep 1
wmctrl -a xclock
wmctrl -r xclock -b toggle,above

User avatar
Utopia
Administrator
Posts: 3245
Joined: Sun Apr 29, 2007 11:53 am

Re: Xclock always on top with keyboard shortcut?

#7 Post by Utopia »

Moderator comment:
This is a very old thread. Please, start your own instead. Thread locked.
Henry

Locked

Return to “XFCE Desktop Environment”