letting script display time in top bar ubuntu 18.04 LTS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks
Edit: And here is the script if that is useful:
#!/usr/bin/python3
import datetime
d2 = {0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'}
def time_round_to_5_minutes():
minute = datetime.datetime.now().minute
second = datetime.datetime.now().second
if minute % 5 * 60 + second < 150:
minute = minute - minute % 5
else:
minute = minute + 5 - minute % 5
minute = minute % 60
return minute
def time_in_norwegian():
hour = (datetime.datetime.now().hour + 2) % 24
minute = time_round_to_5_minutes()
d2[0] = 'Midnatt'
next_hour = True
if minute % 30 <= 15:
if minute == 45:
string = 'Kvart på '
elif minute == 30:
string = 'Halv '
elif minute == 0:
next_hour = False
elif minute < 20:
string = d2[minute] + ' over '
next_hour = False
if minute == 15:
string = 'Kvart over '
else:
string = d2[minute - 30] + ' over halv '
else:
if minute < 30:
string = d2[30-minute] + ' på halv '
else:
string = d2[60-minute] + ' på '
if next_hour == True:
hour = (hour + 1) % 24
if hour < 12:
am_pm = ' om morgenen'
else:
am_pm = ' om kvelden'
hour = hour % 12
string += d2[hour].lower() + am_pm
return string
print(time_in_norwegian())
python gnome-shell time
add a comment |
I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks
Edit: And here is the script if that is useful:
#!/usr/bin/python3
import datetime
d2 = {0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'}
def time_round_to_5_minutes():
minute = datetime.datetime.now().minute
second = datetime.datetime.now().second
if minute % 5 * 60 + second < 150:
minute = minute - minute % 5
else:
minute = minute + 5 - minute % 5
minute = minute % 60
return minute
def time_in_norwegian():
hour = (datetime.datetime.now().hour + 2) % 24
minute = time_round_to_5_minutes()
d2[0] = 'Midnatt'
next_hour = True
if minute % 30 <= 15:
if minute == 45:
string = 'Kvart på '
elif minute == 30:
string = 'Halv '
elif minute == 0:
next_hour = False
elif minute < 20:
string = d2[minute] + ' over '
next_hour = False
if minute == 15:
string = 'Kvart over '
else:
string = d2[minute - 30] + ' over halv '
else:
if minute < 30:
string = d2[30-minute] + ' på halv '
else:
string = d2[60-minute] + ' på '
if next_hour == True:
hour = (hour + 1) % 24
if hour < 12:
am_pm = ' om morgenen'
else:
am_pm = ' om kvelden'
hour = hour % 12
string += d2[hour].lower() + am_pm
return string
print(time_in_norwegian())
python gnome-shell time
There are extensions allowing to change the appearance of the clock
– vanadium
Apr 3 at 7:58
add a comment |
I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks
Edit: And here is the script if that is useful:
#!/usr/bin/python3
import datetime
d2 = {0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'}
def time_round_to_5_minutes():
minute = datetime.datetime.now().minute
second = datetime.datetime.now().second
if minute % 5 * 60 + second < 150:
minute = minute - minute % 5
else:
minute = minute + 5 - minute % 5
minute = minute % 60
return minute
def time_in_norwegian():
hour = (datetime.datetime.now().hour + 2) % 24
minute = time_round_to_5_minutes()
d2[0] = 'Midnatt'
next_hour = True
if minute % 30 <= 15:
if minute == 45:
string = 'Kvart på '
elif minute == 30:
string = 'Halv '
elif minute == 0:
next_hour = False
elif minute < 20:
string = d2[minute] + ' over '
next_hour = False
if minute == 15:
string = 'Kvart over '
else:
string = d2[minute - 30] + ' over halv '
else:
if minute < 30:
string = d2[30-minute] + ' på halv '
else:
string = d2[60-minute] + ' på '
if next_hour == True:
hour = (hour + 1) % 24
if hour < 12:
am_pm = ' om morgenen'
else:
am_pm = ' om kvelden'
hour = hour % 12
string += d2[hour].lower() + am_pm
return string
print(time_in_norwegian())
python gnome-shell time
I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks
Edit: And here is the script if that is useful:
#!/usr/bin/python3
import datetime
d2 = {0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'}
def time_round_to_5_minutes():
minute = datetime.datetime.now().minute
second = datetime.datetime.now().second
if minute % 5 * 60 + second < 150:
minute = minute - minute % 5
else:
minute = minute + 5 - minute % 5
minute = minute % 60
return minute
def time_in_norwegian():
hour = (datetime.datetime.now().hour + 2) % 24
minute = time_round_to_5_minutes()
d2[0] = 'Midnatt'
next_hour = True
if minute % 30 <= 15:
if minute == 45:
string = 'Kvart på '
elif minute == 30:
string = 'Halv '
elif minute == 0:
next_hour = False
elif minute < 20:
string = d2[minute] + ' over '
next_hour = False
if minute == 15:
string = 'Kvart over '
else:
string = d2[minute - 30] + ' over halv '
else:
if minute < 30:
string = d2[30-minute] + ' på halv '
else:
string = d2[60-minute] + ' på '
if next_hour == True:
hour = (hour + 1) % 24
if hour < 12:
am_pm = ' om morgenen'
else:
am_pm = ' om kvelden'
hour = hour % 12
string += d2[hour].lower() + am_pm
return string
print(time_in_norwegian())
python gnome-shell time
python gnome-shell time
edited Apr 2 at 19:15
tor
asked Apr 2 at 19:00
tortor
11
11
There are extensions allowing to change the appearance of the clock
– vanadium
Apr 3 at 7:58
add a comment |
There are extensions allowing to change the appearance of the clock
– vanadium
Apr 3 at 7:58
There are extensions allowing to change the appearance of the clock
– vanadium
Apr 3 at 7:58
There are extensions allowing to change the appearance of the clock
– vanadium
Apr 3 at 7:58
add a comment |
1 Answer
1
active
oldest
votes
An easy way to display your custom output on the top bar in Gnome Shell is to use the high quality and well maintained Gnome Shell extension Argos. Then you will need to remove the existing clock. The extension Clock Override allows to customize the format, so in your case you may have it display a space.
Perhaps Clock Override allows you to set a format close to what you want. That would eliminate the need for a custom script.
The final option is to go into the Gnome Shell code yourself, and create your own extension. That will require a learning curve to learn to programmatically interact with an ever changing and poorly documented interface, but that is what the many Gnome Shell extension developers do. The many existing extensions can help to study how things can be done.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130713%2fletting-script-display-time-in-top-bar-ubuntu-18-04-lts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
An easy way to display your custom output on the top bar in Gnome Shell is to use the high quality and well maintained Gnome Shell extension Argos. Then you will need to remove the existing clock. The extension Clock Override allows to customize the format, so in your case you may have it display a space.
Perhaps Clock Override allows you to set a format close to what you want. That would eliminate the need for a custom script.
The final option is to go into the Gnome Shell code yourself, and create your own extension. That will require a learning curve to learn to programmatically interact with an ever changing and poorly documented interface, but that is what the many Gnome Shell extension developers do. The many existing extensions can help to study how things can be done.
add a comment |
An easy way to display your custom output on the top bar in Gnome Shell is to use the high quality and well maintained Gnome Shell extension Argos. Then you will need to remove the existing clock. The extension Clock Override allows to customize the format, so in your case you may have it display a space.
Perhaps Clock Override allows you to set a format close to what you want. That would eliminate the need for a custom script.
The final option is to go into the Gnome Shell code yourself, and create your own extension. That will require a learning curve to learn to programmatically interact with an ever changing and poorly documented interface, but that is what the many Gnome Shell extension developers do. The many existing extensions can help to study how things can be done.
add a comment |
An easy way to display your custom output on the top bar in Gnome Shell is to use the high quality and well maintained Gnome Shell extension Argos. Then you will need to remove the existing clock. The extension Clock Override allows to customize the format, so in your case you may have it display a space.
Perhaps Clock Override allows you to set a format close to what you want. That would eliminate the need for a custom script.
The final option is to go into the Gnome Shell code yourself, and create your own extension. That will require a learning curve to learn to programmatically interact with an ever changing and poorly documented interface, but that is what the many Gnome Shell extension developers do. The many existing extensions can help to study how things can be done.
An easy way to display your custom output on the top bar in Gnome Shell is to use the high quality and well maintained Gnome Shell extension Argos. Then you will need to remove the existing clock. The extension Clock Override allows to customize the format, so in your case you may have it display a space.
Perhaps Clock Override allows you to set a format close to what you want. That would eliminate the need for a custom script.
The final option is to go into the Gnome Shell code yourself, and create your own extension. That will require a learning curve to learn to programmatically interact with an ever changing and poorly documented interface, but that is what the many Gnome Shell extension developers do. The many existing extensions can help to study how things can be done.
answered Apr 3 at 8:09
vanadiumvanadium
8,01111533
8,01111533
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130713%2fletting-script-display-time-in-top-bar-ubuntu-18-04-lts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
There are extensions allowing to change the appearance of the clock
– vanadium
Apr 3 at 7:58